Skip to content

Commit 5c2cf06

Browse files
authored
Merge pull request #6000 from Algo-devops-service/relstable3.24.0
2 parents 34171a9 + 5466548 commit 5c2cf06

File tree

198 files changed

+11259
-5481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+11259
-5481
lines changed

.github/workflows/codegen_verification.yml

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
jobs:
88
codegen_verification:
99
runs-on: ubuntu-20.04
10+
services:
11+
converter:
12+
image: swaggerapi/swagger-converter@sha256:dcfd1c2537f5f271cb4ec942d08aa59ca41b9a24078040061a772afca7e548ae # v1.0.4
13+
ports:
14+
- 8080:8080
1015
steps:
1116
- name: Check out code
1217
uses: actions/[email protected]
@@ -16,6 +21,8 @@ jobs:
1621
- name: Uninstall existing go installation
1722
run: sudo apt-get -y -q purge golang-go
1823
- name: Run codegen_verification.sh
24+
env:
25+
SWAGGER_CONVERTER_API: "http://localhost:8080"
1926
run: |
2027
export GOPATH="${GITHUB_WORKSPACE}/go"
2128
cd go-algorand

.github/workflows/reviewdog.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
- name: Make libsodium.a
1818
run: sudo mv /usr/bin/go /usr/bin/go.bak && make crypto/libs/linux/amd64/lib/libsodium.a && sudo mv /usr/bin/go.bak /usr/bin/go
1919
- name: reviewdog-golangci-lint
20-
uses: reviewdog/action-golangci-lint@v2.3.1
20+
uses: reviewdog/action-golangci-lint@v2.6.1
2121
with:
2222
go_version_file: go.mod
23-
golangci_lint_version: "v1.53.2"
23+
golangci_lint_version: "v1.58.0"
2424
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
2525
reporter: "github-pr-check"
2626
tool_name: "Lint Errors"
@@ -63,13 +63,13 @@ jobs:
6363
run: |
6464
cd cicdtmp/golangci-lint
6565
git clone https://github.com/golangci/golangci-lint.git .
66-
git checkout tags/v1.53.2
66+
git checkout tags/v1.58.0
6767
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
6868
./golangci-lint-cgo --version
6969
cd ../../
7070
- name: Install reviewdog
7171
run: |
72-
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.14.1/install.sh | sh -s
72+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.17.4/install.sh | sh -s
7373
reviewdog --version
7474
- name: Build custom linters
7575
run: |

.golangci.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ linters-settings:
3636
- (*github.com/spf13/pflag.FlagSet).MarkDeprecated
3737
- (*github.com/spf13/pflag.FlagSet).MarkShorthandDeprecated
3838
govet:
39-
check-shadowing: true
39+
# Enables these linters in addition to the default ones.
40+
enable:
41+
- shadow
4042
settings:
4143
shadow:
4244
# explanation of strict vs non-strict:
@@ -131,6 +133,10 @@ issues:
131133
linters:
132134
- staticcheck
133135
text: "SA4006: this value" # of X is never used
136+
- path: _test\.go
137+
linters:
138+
- revive
139+
text: "dot-imports: should not use dot imports"
134140
- linters:
135141
- staticcheck
136142
text: "SA1019: rand*"

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04 as builder
22

3-
ARG GO_VERSION="1.20.14"
3+
ARG GO_VERSION="1.21.10"
44

55
ARG CHANNEL
66
ARG URL
@@ -46,7 +46,7 @@ FROM debian:bookworm-20240311-slim as final
4646
ENV PATH="/node/bin:${PATH}" ALGOD_PORT="8080" KMD_PORT="7833" ALGORAND_DATA="/algod/data"
4747

4848
# curl is needed to lookup the fast catchup url
49-
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl gosu && \
49+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && \
5050
update-ca-certificates && \
5151
apt-get clean && \
5252
rm -rf /var/lib/apt/lists/* && \

agreement/abstractions.go

+26-12
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ type BlockValidator interface {
5454
// and can now be recorded in the ledger. This is an optimized version of
5555
// calling EnsureBlock() on the Ledger.
5656
type ValidatedBlock interface {
57-
// WithSeed creates a copy of this ValidatedBlock with its
58-
// cryptographically random seed set to the given value.
59-
//
60-
// Calls to Seed() or to Digest() on the copy's Block must
61-
// reflect the value of the new seed.
62-
WithSeed(committee.Seed) ValidatedBlock
63-
6457
// Block returns the underlying block that has been validated.
6558
Block() bookkeeping.Block
6659
}
@@ -72,21 +65,42 @@ var ErrAssembleBlockRoundStale = errors.New("requested round for AssembleBlock i
7265
// An BlockFactory produces an Block which is suitable for proposal for a given
7366
// Round.
7467
type BlockFactory interface {
75-
// AssembleBlock produces a new ValidatedBlock which is suitable for proposal
76-
// at a given Round.
68+
// AssembleBlock produces a new UnfinishedBlock for a given Round.
69+
// It must be finalized before proposed by agreement. It is provided
70+
// a list of participating addresses that may propose this block.
7771
//
78-
// AssembleBlock should produce a ValidatedBlock for which the corresponding
72+
// AssembleBlock should produce a block for which the corresponding
7973
// BlockValidator validates (i.e. for which BlockValidator.Validate
8074
// returns true). If an insufficient number of nodes can assemble valid
8175
// entries, the agreement protocol may lose liveness.
8276
//
8377
// AssembleBlock may return an error if the BlockFactory is unable to
84-
// produce a ValidatedBlock for the given round. If an insufficient number of
78+
// produce an UnfinishedBlock for the given round. If an insufficient number of
8579
// nodes on the network can assemble entries, the agreement protocol may
8680
// lose liveness.
87-
AssembleBlock(basics.Round) (ValidatedBlock, error)
81+
AssembleBlock(rnd basics.Round, partAddresses []basics.Address) (UnfinishedBlock, error)
82+
}
83+
84+
// An UnfinishedBlock represents a Block produced by a BlockFactory
85+
// and must be finalized before being proposed by agreement.
86+
type UnfinishedBlock interface {
87+
// FinishBlock creates a proposable block, having set the cryptographically
88+
// random seed and payout related fields.
89+
//
90+
// Calls to Seed() or to Digest() on the copy's Block must
91+
// reflect the value of the new seed.
92+
FinishBlock(seed committee.Seed, proposer basics.Address, eligible bool) Block
93+
94+
Round() basics.Round
8895
}
8996

97+
// Block (in agreement) represents an UnfinishedBlock produced by a
98+
// BlockFactory, that was later finalized by providing the seed and the
99+
// proposer, and can now be proposed by agreement.
100+
//
101+
//msgp:ignore Block
102+
type Block bookkeeping.Block
103+
90104
// A Ledger represents the sequence of Entries agreed upon by the protocol.
91105
// The Ledger consists of two parts: a LedgerReader and a LedgerWriter, which
92106
// provide read and write access to the ledger, respectively.

agreement/agreementtest/simulate_test.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,17 @@ func (b testValidatedBlock) Block() bookkeeping.Block {
7979
return b.Inside
8080
}
8181

82-
func (b testValidatedBlock) WithSeed(s committee.Seed) agreement.ValidatedBlock {
82+
func (b testValidatedBlock) Round() basics.Round {
83+
return b.Inside.Round()
84+
}
85+
86+
func (b testValidatedBlock) FinishBlock(s committee.Seed, proposer basics.Address, eligible bool) agreement.Block {
8387
b.Inside.BlockHeader.Seed = s
84-
return b
88+
b.Inside.BlockHeader.Proposer = proposer
89+
if !eligible {
90+
b.Inside.BlockHeader.ProposerPayout = basics.MicroAlgos{}
91+
}
92+
return agreement.Block(b.Inside)
8593
}
8694

8795
type testBlockValidator struct{}
@@ -94,7 +102,7 @@ type testBlockFactory struct {
94102
Owner int
95103
}
96104

97-
func (f testBlockFactory) AssembleBlock(r basics.Round) (agreement.ValidatedBlock, error) {
105+
func (f testBlockFactory) AssembleBlock(r basics.Round, addrs []basics.Address) (agreement.UnfinishedBlock, error) {
98106
return testValidatedBlock{Inside: bookkeeping.Block{BlockHeader: bookkeeping.BlockHeader{Round: r}}}, nil
99107
}
100108

agreement/common_test.go

+16-7
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,17 @@ func (b testValidatedBlock) Block() bookkeeping.Block {
165165
return b.Inside
166166
}
167167

168-
func (b testValidatedBlock) WithSeed(s committee.Seed) ValidatedBlock {
168+
func (b testValidatedBlock) Round() basics.Round {
169+
return b.Inside.Round()
170+
}
171+
172+
func (b testValidatedBlock) FinishBlock(s committee.Seed, proposer basics.Address, eligible bool) Block {
169173
b.Inside.BlockHeader.Seed = s
170-
return b
174+
b.Inside.BlockHeader.Proposer = proposer
175+
if !eligible {
176+
b.Inside.BlockHeader.ProposerPayout = basics.MicroAlgos{}
177+
}
178+
return Block(b.Inside)
171179
}
172180

173181
type testBlockValidator struct{}
@@ -180,7 +188,7 @@ type testBlockFactory struct {
180188
Owner int
181189
}
182190

183-
func (f testBlockFactory) AssembleBlock(r basics.Round) (ValidatedBlock, error) {
191+
func (f testBlockFactory) AssembleBlock(r basics.Round, _ []basics.Address) (UnfinishedBlock, error) {
184192
return testValidatedBlock{Inside: bookkeeping.Block{BlockHeader: bookkeeping.BlockHeader{Round: r}}}, nil
185193
}
186194

@@ -413,7 +421,7 @@ type testAccountData struct {
413421
}
414422

415423
func makeProposalsTesting(accs testAccountData, round basics.Round, period period, factory BlockFactory, ledger Ledger) (ps []proposal, vs []vote) {
416-
ve, err := factory.AssembleBlock(round)
424+
ve, err := factory.AssembleBlock(round, accs.addresses)
417425
if err != nil {
418426
logging.Base().Errorf("Could not generate a proposal for round %d: %v", round, err)
419427
return nil, nil
@@ -525,19 +533,20 @@ func (v *voteMakerHelper) MakeRandomProposalValue() *proposalValue {
525533

526534
func (v *voteMakerHelper) MakeRandomProposalPayload(t *testing.T, r round) (*proposal, *proposalValue) {
527535
f := testBlockFactory{Owner: 1}
528-
ve, err := f.AssembleBlock(r)
536+
ub, err := f.AssembleBlock(r, nil)
529537
require.NoError(t, err)
538+
pb := ub.FinishBlock(committee.Seed{}, basics.Address{}, false)
530539

531540
var payload unauthenticatedProposal
532-
payload.Block = ve.Block()
541+
payload.Block = bookkeeping.Block(pb)
533542
payload.SeedProof = randomVRFProof()
534543

535544
propVal := proposalValue{
536545
BlockDigest: payload.Digest(),
537546
EncodingDigest: crypto.HashObj(payload),
538547
}
539548

540-
return &proposal{unauthenticatedProposal: payload, ve: ve}, &propVal
549+
return &proposal{unauthenticatedProposal: payload}, &propVal
541550
}
542551

543552
// make a vote for a fixed proposal value

agreement/fuzzer/ledger_test.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,17 @@ func (b testValidatedBlock) Block() bookkeeping.Block {
9393
return b.Inside
9494
}
9595

96-
func (b testValidatedBlock) WithSeed(s committee.Seed) agreement.ValidatedBlock {
96+
func (b testValidatedBlock) Round() basics.Round {
97+
return b.Inside.Round()
98+
}
99+
100+
func (b testValidatedBlock) FinishBlock(s committee.Seed, proposer basics.Address, eligible bool) agreement.Block {
97101
b.Inside.BlockHeader.Seed = s
98-
return b
102+
b.Inside.BlockHeader.Proposer = proposer
103+
if !eligible {
104+
b.Inside.BlockHeader.ProposerPayout = basics.MicroAlgos{}
105+
}
106+
return agreement.Block(b.Inside)
99107
}
100108

101109
type testBlockValidator struct{}
@@ -108,7 +116,7 @@ type testBlockFactory struct {
108116
Owner int
109117
}
110118

111-
func (f testBlockFactory) AssembleBlock(r basics.Round) (agreement.ValidatedBlock, error) {
119+
func (f testBlockFactory) AssembleBlock(r basics.Round, _ []basics.Address) (agreement.UnfinishedBlock, error) {
112120
return testValidatedBlock{Inside: bookkeeping.Block{BlockHeader: bookkeeping.BlockHeader{Round: r}}}, nil
113121
}
114122

0 commit comments

Comments
 (0)