Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Dynamic Protocol State #5336

Merged
merged 575 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
575 commits
Select commit Hold shift + click to select a range
739cbdf
Merge pull request #4832 from onflow/alex/4649-todos-and-refactoring-…
durkmurder Oct 18, 2023
b2c97b5
Apply suggestions from PR review
durkmurder Oct 19, 2023
244af7b
Simplified bootstrap in cluster switchover test
durkmurder Oct 19, 2023
e765750
Merge branch 'yurii/4649-todos-and-refactoring-part-1' of https://git…
durkmurder Oct 19, 2023
ad075bc
Apply suggestions from PR review
durkmurder Oct 19, 2023
09fdfbe
model/flow/protocol_state.go:
Oct 20, 2023
d9ae36d
minor comment revision
Oct 20, 2023
15e3e33
Fixed tests
durkmurder Oct 20, 2023
0dd823a
Merge pull request #4854 from onflow/alex/4649-prev-epoch-refactoring…
durkmurder Oct 20, 2023
de3c468
Merge pull request #4726 from onflow/yurii/4649-todos-and-refactoring…
durkmurder Oct 23, 2023
d3aa8d4
Merge branch 'feature/dynamic-protocol-state' into yurii/4649-prev-ep…
durkmurder Oct 23, 2023
95dbf1e
Added test for BuildIdentityTable
durkmurder Oct 23, 2023
df2bfab
Changed order of arguments in BuildIdentityTable
durkmurder Oct 23, 2023
25624f2
Linted
durkmurder Oct 23, 2023
f92636d
Apply suggestions from code review
durkmurder Oct 23, 2023
0172dd1
Changed expected error types of ProcessEpochSetup and ProcessEpochCom…
durkmurder Oct 23, 2023
d51fcfa
Merge branch 'yurii/4649-prev-epoch-refactoring-attempt' of https://g…
durkmurder Oct 23, 2023
f6d519b
updated goDoc of method `BuildIdentityTable` to completely describe a…
Oct 23, 2023
d468da1
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Oct 23, 2023
49934ce
updated code-internal documentation to precisely explain the identity…
Oct 23, 2023
c638874
minor re-ordering of the logic and in-code documentation of function …
Oct 23, 2023
e210519
Merge pull request #4834 from onflow/yurii/4649-prev-epoch-refactorin…
durkmurder Oct 24, 2023
d454e5e
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Oct 24, 2023
444459f
Fixed broken tests
durkmurder Oct 24, 2023
084669f
Changed order of InvalidStateTransitionAttempted in updater
durkmurder Oct 24, 2023
7b5135a
Tidy
durkmurder Oct 24, 2023
a46d6d8
Linted and updated error handling
durkmurder Oct 24, 2023
d4d0f9a
Extracted epoch setup and commits events creation from finalize comma…
durkmurder Oct 25, 2023
dc1ecf6
Finished updating rootblock command to correctly generate first epoch…
durkmurder Oct 25, 2023
07167d0
Linted
durkmurder Oct 25, 2023
76b8fa0
Fixed compilation of integration tests
durkmurder Oct 25, 2023
3246926
godoc cleanup
durkmurder Oct 25, 2023
64c9a5c
Godoc and state updater error handling updates
durkmurder Oct 25, 2023
7553ed9
Added tests for ApplyServiceEvents
durkmurder Oct 26, 2023
13e9957
Merge branch 'yurii/5517-extend-payload' of https://github.com/onflow…
durkmurder Oct 26, 2023
aa1169c
Updated tests for protocol state mutator
durkmurder Oct 27, 2023
9e90ac0
Consolidated service events handling in protocol state updater. Updat…
durkmurder Oct 27, 2023
a957702
added minor todo comment for
Oct 28, 2023
e11d0c2
Updated mutator tests to cover all paths in ApplyServiceEvents
durkmurder Oct 30, 2023
7807b79
Changed how protocol state updater handles invalid service events
durkmurder Oct 30, 2023
80f4bdf
Updated dynamic protocol state main interfaces. Restructured interfac…
durkmurder Oct 31, 2023
8a733b3
Fixed tests for state/protocol/*
durkmurder Oct 31, 2023
74be7f8
Fixed other broken tests. Linted
durkmurder Oct 31, 2023
8f4e038
Updated tests and changed Build signature
durkmurder Oct 31, 2023
4672345
Linted
durkmurder Oct 31, 2023
e7d75cd
Updated godoc
durkmurder Oct 31, 2023
d998fbf
Apply suggestions from code review
durkmurder Nov 1, 2023
b3d92bc
Apply suggestions from code review
durkmurder Nov 1, 2023
164fa95
Renamed seals.go -> payload.go
durkmurder Nov 1, 2023
f92c4f8
Merge branch 'yurii/5517-extend-payload' of https://github.com/onflow…
durkmurder Nov 1, 2023
d18150e
Fixed problems after merge
durkmurder Nov 1, 2023
f19ef7a
Cleanup mutator tests
durkmurder Nov 1, 2023
f1965e1
Updated godocs
durkmurder Nov 1, 2023
bdde391
detailed documentation of `StateMutator.ApplyServiceEvents`
Nov 2, 2023
d0bc661
Apply suggestions from code review
durkmurder Nov 2, 2023
69842cd
Apply suggestions from PR review
durkmurder Nov 2, 2023
f57cb5e
Updated protocol state mutator to rely only on fork-based flag for ep…
durkmurder Nov 2, 2023
6645d1e
Apply suggestions from PR review
durkmurder Nov 2, 2023
7ad9e93
minor documentation tweaks
Nov 3, 2023
139d60a
Update state/protocol/protocol_state/mutator.go
durkmurder Nov 3, 2023
d641eed
Merge branch 'yurii/5517-extend-payload' of https://github.com/onflow…
durkmurder Nov 3, 2023
b54530a
Introduced a dedicated state machine for epoch fallback.
durkmurder Nov 3, 2023
054435d
Linted
durkmurder Nov 3, 2023
8a893d0
Updated how transition to epoch fallback state machine happens.
durkmurder Nov 3, 2023
2962cad
Simplified how service events are processed in stateMutator
durkmurder Nov 3, 2023
203f049
extending and polishing documentation of verification logic for Epoch…
Nov 5, 2023
17f69ed
fixed formatting problem of goDoc
Nov 5, 2023
6da91f5
fixed formatting problem of goDoc
Nov 5, 2023
2c863f3
compactified code
Nov 5, 2023
1e03f9f
minor extension of test description
Nov 5, 2023
46943f1
Apply suggestions from code review
durkmurder Nov 6, 2023
b3c71c5
Merge branch 'yurii/5517-extend-payload' of https://github.com/onflow…
durkmurder Nov 6, 2023
140589e
Fixed compilation in tests
durkmurder Nov 6, 2023
e6c9430
Linted
durkmurder Nov 6, 2023
a8e5520
Fixed more dynamic protocol state tests
durkmurder Nov 6, 2023
8cd1106
Updated dynamic protocol state tests. Changed interface of ProtocolSt…
durkmurder Nov 6, 2023
418e560
Updated godoc for epoch fallback state machine
durkmurder Nov 6, 2023
c97ee1b
Refactoring of tests. Updated godocs. Added partially tests for epoch…
durkmurder Nov 7, 2023
f302bc6
Linted
durkmurder Nov 7, 2023
7bbf6c0
Updated tests for epoch fallback state machine
durkmurder Nov 7, 2023
91b77e9
Renamed files
durkmurder Nov 7, 2023
ec5a858
Updated naming
durkmurder Nov 7, 2023
466a7f3
Removed unneeded error in factory method. Updated godoc
durkmurder Nov 7, 2023
98aec88
extended and polished docs for StateMutator
Nov 7, 2023
df1fd29
goDoc polishing of state machine
Nov 7, 2023
2e59e75
typo
Nov 7, 2023
79e079e
minor revision of test names for better readability. e.g. TestHappyPa…
Nov 8, 2023
f3589eb
Merge branch 'yurii/5517-extend-payload' of https://github.com/onflow…
durkmurder Nov 8, 2023
abac934
Renamed InvalidStateTransitionAttempted -> InvalidEpochTransitionAtte…
durkmurder Nov 8, 2023
a9d27b4
Merge branch 'master' of https://github.com/onflow/flow-go into yurii…
durkmurder Nov 10, 2023
11ba36f
Added EpochParticipationStatus enum
durkmurder Nov 10, 2023
3c22d22
Merge pull request #5007 from onflow/yurii/sync-master-to-dynamic-pro…
durkmurder Nov 10, 2023
6a3eb1c
comment formating
Nov 11, 2023
169f5d5
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Nov 13, 2023
cb08aa2
Updated modules for insecure and integration
durkmurder Nov 13, 2023
9fc2f66
Merge branch 'yurii/5517-extend-payload' of https://github.com/onflow…
durkmurder Nov 13, 2023
602358f
Apply suggestions from PR review
durkmurder Nov 13, 2023
cbf4149
Apply suggestions from PR review
durkmurder Nov 13, 2023
8264c2a
Introduced DeferredDBUpdated
durkmurder Nov 13, 2023
52bacec
Renamed ProtocolStateForBoostrapState -> ProtocolStateFromEpochServic…
durkmurder Nov 13, 2023
27d32d1
Linted
durkmurder Nov 13, 2023
38b3210
Updated docs and implementation for TestHappyPathWithDbChanges
durkmurder Nov 13, 2023
87f36aa
Removed duplicated tests
durkmurder Nov 14, 2023
761d74a
Added test cases for epoch setup validity
durkmurder Nov 14, 2023
4ba03bc
Updated tests for NewClusterList
durkmurder Nov 14, 2023
fad73b3
Added test for validating extending setup and commit events
durkmurder Nov 14, 2023
45c9081
Linted
durkmurder Nov 14, 2023
a389919
Update state/protocol/protocol_state/mutator_test.go
durkmurder Nov 14, 2023
e8c2594
Merge pull request #4868 from onflow/yurii/5517-extend-payload
durkmurder Nov 14, 2023
47be8dc
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Nov 14, 2023
8325685
Merge branch 'yurii/4649-epoch-fallback-statemachine-attempt-1' of ht…
durkmurder Nov 14, 2023
b190146
Basic replace of Weight and Ejected with EpochParticipationStatus
durkmurder Nov 15, 2023
0256e28
WIP removing dynamic weight
durkmurder Nov 15, 2023
8c90272
Apply suggestions from code review
durkmurder Nov 16, 2023
12b3933
Apply suggestions from code review
durkmurder Nov 16, 2023
d4f4866
Apply suggestions from PR review
durkmurder Nov 16, 2023
16dd2e3
Apply suggestions from PR review. Linted
durkmurder Nov 16, 2023
05921b0
Apply suggestions from PR review
durkmurder Nov 16, 2023
8804a2d
Apply suggestions from PR review
durkmurder Nov 16, 2023
0b81d6c
Merge branch 'yurii/4649-epoch-fallback-statemachine-attempt-1' of ht…
durkmurder Nov 16, 2023
3984803
Merge pull request #4931 from onflow/yurii/4649-epoch-fallback-statem…
durkmurder Nov 16, 2023
1608669
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Nov 16, 2023
373cd37
WIP: fixing flow module after removing dynamic weight
durkmurder Nov 16, 2023
abb5089
Fixed tests for flow module
durkmurder Nov 17, 2023
b0dc5d9
Updated BuildIdentityTable to accept participation status for adjacen…
durkmurder Nov 17, 2023
88833ae
Changed how entities are ejected using protocol state machine. More t…
durkmurder Nov 17, 2023
e0770d0
WIP: fixing tests after introducing Ejected flag for ActiveIdentities
durkmurder Nov 17, 2023
e4e1814
Fixed statemachine tests
durkmurder Nov 20, 2023
97095cf
Fixed tests for consensus module
durkmurder Nov 20, 2023
379ccc2
WIP: fixing broken tests for engine module
durkmurder Nov 20, 2023
60af9f1
Fixed broken engine tests
durkmurder Nov 20, 2023
b0f9138
Fixed network tests
durkmurder Nov 20, 2023
d134cf0
Fixed all broken unit tests
durkmurder Nov 20, 2023
a0417de
Linted
durkmurder Nov 20, 2023
34cfedc
Revisions to tests, godoc, comments
durkmurder Nov 20, 2023
ff1c330
Added a sanity check for BuildIdentityTable
durkmurder Nov 20, 2023
8e4aa2a
Updated godocs
durkmurder Nov 20, 2023
83c2363
Apply suggestions from code review
durkmurder Nov 21, 2023
2a9a880
Update model/flow/identity.go
durkmurder Nov 21, 2023
926b093
Update module/validation/common.go
durkmurder Nov 21, 2023
7391fc3
Linted
durkmurder Nov 22, 2023
f4d6db0
Apply suggestions from code review
durkmurder Nov 23, 2023
28df008
Update consensus/hotstuff/committees/cluster_committee.go
durkmurder Nov 23, 2023
4c6f354
Update consensus/hotstuff/committees/cluster_committee.go
durkmurder Nov 23, 2023
0629a3b
Added IsValidCurrentEpochParticipantOrJoining filter and used it
durkmurder Nov 23, 2023
43a2113
Tweaked leader selection for collection clusters
durkmurder Nov 23, 2023
6ebe25e
Linted and applied suggestions
durkmurder Nov 23, 2023
f83efb9
Extended test to cover leaving consensus node
durkmurder Nov 24, 2023
75a61cf
extended goDoc for cluster leader selection to clarify the handling o…
Nov 24, 2023
10aaae3
in `committees.Cluster`
Nov 24, 2023
5a62638
fixed goDoc in model/flow/filter/identity.go: renamed stake -> weight
Nov 24, 2023
65db00f
In accordance with the filter `filter.IsVotingConsensusCommitteeMembe…
Nov 24, 2023
a4fafdd
updated documentation of MessageHub
Nov 25, 2023
51695ad
minor goDoc fixes and revisions
Nov 25, 2023
a937580
extending documentation
Nov 25, 2023
0422a1a
removed outdated Dapper copyright notices
Nov 25, 2023
d81d9e2
state/protocol/protocol_state/protocol_statemachine_test.go
Nov 25, 2023
4d5eddc
Apply suggestions from code review
durkmurder Nov 27, 2023
f2721f9
Apply suggestions from code review
durkmurder Nov 27, 2023
c1cd71b
Apply suggestions from code review
durkmurder Nov 27, 2023
115ac70
Apply suggestions from code review
durkmurder Nov 27, 2023
fefd1e1
Apply suggestions from PR review
durkmurder Nov 27, 2023
5b309ff
Apply suggestions from PR review
durkmurder Nov 28, 2023
cdfffe9
Added extra tests to cover cases where participants are leaving, join…
durkmurder Nov 28, 2023
a7b22f6
Merge pull request #5039 from onflow/yurii/4649-remove-dynamic-weight
durkmurder Nov 28, 2023
cd22475
Added tests to cover a few cases when bootstraping after spork
durkmurder Nov 29, 2023
475574d
Added a cache for secondary index for querying protocol state by bloc…
durkmurder Nov 29, 2023
e22ad8b
Updated secondary cache to store ids instead of entries
durkmurder Dec 4, 2023
8bf27ca
Extended InstanceParams interface to return more data
durkmurder Dec 4, 2023
775ac28
Extracted cached values from State
durkmurder Dec 4, 2023
965fb69
Implemented caching of static values in InstanceParams
durkmurder Dec 4, 2023
c9eb3e8
Removed errors in InstanceParams
durkmurder Dec 4, 2023
4021eca
WIP refactoring interface and implementation
durkmurder Dec 4, 2023
4f616dd
wip
Dec 5, 2023
f955f8a
Refactored state bootstraping so it's more modular and doesn't depend…
durkmurder Dec 5, 2023
23113e0
Fixed compilation errors due to InstanceParams interface changes
durkmurder Dec 5, 2023
5ecddb5
Updated godoc
durkmurder Dec 6, 2023
73ae8ee
Updated godoc
durkmurder Dec 6, 2023
494d0da
renamed `MutableProtocolState` to `MutableProtocolMutatorFactory`
Dec 6, 2023
d7a3cf7
Updates to `storage.ProtocolState` storage layer abstraction:
Dec 7, 2023
41b8362
added documentation of cache population
Dec 7, 2023
d9fb53d
added comments on recommended cache size
Dec 7, 2023
815ba07
minor comments for test
Dec 7, 2023
6c81ef2
Merge pull request #5116 from onflow/alex/PR-5080_-_suggestions
durkmurder Dec 7, 2023
337c066
Applied PR suggestions regarding cache size
durkmurder Dec 7, 2023
c585750
Merge branch 'master' of https://github.com/onflow/flow-go into yurii…
durkmurder Dec 7, 2023
02e43f9
Linted
durkmurder Dec 7, 2023
9096c03
Fixed issue in integration tests
durkmurder Dec 7, 2023
da9c65a
Removed nil support for EqualTo
durkmurder Dec 8, 2023
7587d3a
Merge pull request #5117 from onflow/yurii/sync-master-to-dynamic-pro…
durkmurder Dec 8, 2023
f89f5eb
Merge branch 'feature/dynamic-protocol-state' into yurii/4649-todos-a…
durkmurder Dec 8, 2023
66b1bab
Updated mocks
durkmurder Dec 8, 2023
7fdc7fb
Merge pull request #5080 from onflow/yurii/4649-todos-and-refactoring…
durkmurder Dec 8, 2023
b831282
Apply suggestions from code review
durkmurder Dec 8, 2023
4099164
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Dec 8, 2023
0f06b68
extended and polished documentation of `EpochCommitSafetyThreshold()`…
Dec 9, 2023
2acd236
removed `transaction.WithTx` and consolidated APIs of service methods…
Dec 9, 2023
4bc3a93
Update state/protocol/badger/state.go
durkmurder Dec 11, 2023
3c2d158
Consolidated usage of transaction.WithTx in bootstrapping logic
durkmurder Dec 11, 2023
14b4689
Added TODO for leaving EFM
durkmurder Dec 11, 2023
7384d70
[Dynamic Protocol State] Remove `EpochStatus` (#5089)
jordanschalm Dec 11, 2023
8098495
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Dec 11, 2023
7db2243
Added logic which was deleted during auto-merge
durkmurder Dec 11, 2023
f70a51f
Update state/protocol/protocol_state/protocol_state.go
Dec 12, 2023
28793bf
removed some white spaces
Dec 12, 2023
9636507
Merge branch 'yurii/instance-params-refactoring' into alex/PR-5113_-_…
Dec 12, 2023
12c8fd2
polished and consolidated revisions after merge
Dec 12, 2023
4a1d387
renamed protocol state's internal `cachedFinal` and `cachedSealed` to…
Dec 12, 2023
0366719
minor updates and polishing of goDoc
Dec 12, 2023
a4e5fba
removed outdated error checks -- functions now don't return any error…
Dec 12, 2023
f257638
wip
Dec 12, 2023
b27d944
fixed outdated goDoc
Dec 12, 2023
a5cf9a8
Merge branch 'feature/dynamic-protocol-state' into alex/dynPrtclSt_mi…
Dec 12, 2023
92dfe41
fixed my own confusing renaming
Dec 12, 2023
3ec6282
removed outdated dapper copyright notice
Dec 12, 2023
50872a0
reverted to functors
Dec 12, 2023
412c815
Merge pull request #5132 from onflow/alex/PR-5113_-_suggestions
durkmurder Dec 12, 2023
e7b2f94
Apply suggestions from code review
durkmurder Dec 12, 2023
6cf2e9f
Linted
durkmurder Dec 12, 2023
1668c30
Merge pull request #5113 from onflow/yurii/instance-params-refactoring
durkmurder Dec 13, 2023
032073c
wip
Dec 14, 2023
21456a3
first draft of deferred database updated
Dec 15, 2023
abd8e86
wip on testing framework
Dec 15, 2023
e3caa30
added tests for `DeferredDbOps`
Dec 15, 2023
292b541
[Dynamic Protocol State] Refactor Epoch Commitment Deadline Enforceme…
jordanschalm Dec 15, 2023
dfd1553
first complete draft -- still requires testing
Dec 16, 2023
8d8a691
`badger.ParticipantState` and `badger.FollowerState` are passing tests
Dec 16, 2023
e263ae1
Merge branch 'feature/dynamic-protocol-state' into alex/dynPrtclSt_mi…
Dec 16, 2023
d4e7dd8
linted test
Dec 16, 2023
5291963
[Dynamic Protocol State] Refactor bootstrapping and update Benchnet2 …
jordanschalm Dec 18, 2023
1a139f4
Apply suggestions from code review
Dec 20, 2023
6149d2e
removed type aliases `DeferredDBUpdates` and `DeferredBadgerUpdates`
Dec 21, 2023
26220e2
changed `DeferredDbOps.Pending` to be _not_ exported and added getter…
Dec 21, 2023
57a52fa
Merge branch 'feature/dynamic-protocol-state' into alex/dynPrtclSt_mi…
Dec 21, 2023
2fd4fe8
Merge pull request #5114 from onflow/alex/dynPrtclSt_minor-polishing
Dec 21, 2023
b49265d
Merge branch 'master' of https://github.com/onflow/flow-go into yurii…
durkmurder Jan 2, 2024
4ab0406
Merge pull request #5190 from onflow/yurii/sync-master-to-dynamic-pro…
durkmurder Jan 9, 2024
2d13dd1
Merge branch 'master' into jordan/sync-dyn-proto-state--master
jordanschalm Jan 30, 2024
344e772
lint
jordanschalm Jan 30, 2024
11641e8
commenting out problematic mock generation line
jordanschalm Jan 30, 2024
6e1c6ac
update state commitments
jordanschalm Jan 30, 2024
8f1f2e1
remove empty mock package
jordanschalm Jan 30, 2024
1210e7f
more state commitments, remove MERGE comments
jordanschalm Jan 30, 2024
cdeac2f
Merge branch 'master' into jordan/sync-dyn-proto-state--master
jordanschalm Jan 30, 2024
dc382d2
Merge branch 'master' into jordan/sync-dyn-proto-state--master
jordanschalm Jan 30, 2024
02b604b
Merge branch 'master' into jordan/sync-dyn-proto-state--master
jordanschalm Jan 31, 2024
0851b2c
Update protobuf model version to v0.3.7
jordanschalm Jan 31, 2024
1c7ab31
make tidy
jordanschalm Jan 31, 2024
2513249
Merge branch 'master' into jordan/sync-dyn-proto-state--master
jordanschalm Feb 1, 2024
321a9e2
Merge branch 'master' into jordan/sync-dyn-proto-state--master
jordanschalm Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
/cmd/util/util
/cmd/bootstrap/bootstrap

# Test ouput of bootstrapping CLI
cmd/bootstrap/bootstrap-example

# Test binary, build with `go test -c`
*.test
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ generate-fvm-env-wrappers:
generate-mocks: install-mock-generators
mockery --name '(Connector|PingInfoProvider)' --dir=network/p2p --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork"
CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=storage/mocks/storage.go -package=mocks github.com/onflow/flow-go/storage Blocks,Headers,Payloads,Collections,Commits,Events,ServiceEvents,TransactionResults
CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=module/mocks/network.go -package=mocks github.com/onflow/flow-go/module Local,Requester
# MERGE: Line below commented out on HEAD, uncommented on master
#CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=module/mocks/network.go -package=mocks github.com/onflow/flow-go/module Local,Requester
CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=network/mocknetwork/mock_network.go -package=mocknetwork github.com/onflow/flow-go/network EngineRegistry
mockery --name='.*' --dir=integration/benchmark/mocksiface --case=underscore --output="integration/benchmark/mock" --outpkg="mock"
mockery --name=ExecutionDataStore --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock"
Expand All @@ -178,6 +179,7 @@ generate-mocks: install-mock-generators
mockery --name '.*' --dir=storage --case=underscore --output="./storage/mock" --outpkg="mock"
mockery --name '.*' --dir="state/protocol" --case=underscore --output="state/protocol/mock" --outpkg="mock"
mockery --name '.*' --dir="state/protocol/events" --case=underscore --output="./state/protocol/events/mock" --outpkg="mock"
mockery --name '.*' --dir="state/protocol/protocol_state" --case=underscore --output="state/protocol/protocol_state/mock" --outpkg="mock"
mockery --name '.*' --dir=engine/execution/computation/computer --case=underscore --output="./engine/execution/computation/computer/mock" --outpkg="mock"
mockery --name '.*' --dir=engine/execution/state --case=underscore --output="./engine/execution/state/mock" --outpkg="mock"
mockery --name '.*' --dir=engine/collection --case=underscore --output="./engine/collection/mock" --outpkg="mock"
Expand Down
6 changes: 3 additions & 3 deletions cmd/access/node_builder/access_node_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1240,8 +1240,8 @@ func (builder *FlowAccessNodeBuilder) InitIDProviders() {
builder.SyncEngineParticipantsProviderFactory = func() module.IdentifierProvider {
return id.NewIdentityFilterIdentifierProvider(
filter.And(
filter.HasRole(flow.RoleConsensus),
filter.Not(filter.HasNodeID(node.Me.NodeID())),
filter.HasRole[flow.Identity](flow.RoleConsensus),
filter.Not(filter.HasNodeID[flow.Identity](node.Me.NodeID())),
underlay.NotEjectedFilter,
),
builder.IdentityProvider,
Expand Down Expand Up @@ -1574,7 +1574,7 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) {
node.Me,
node.State,
channels.RequestCollections,
filter.HasRole(flow.RoleCollection),
filter.HasRole[flow.Identity](flow.RoleCollection),
func() flow.Entity { return &flow.Collection{} },
)
if err != nil {
Expand Down
64 changes: 54 additions & 10 deletions cmd/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,60 @@ Each input is a config file specified as a command line parameter:

#### Example
```bash
go run ./cmd/bootstrap finalize \
--root-chain main \
--root-height 0 \
--root-parent 0000000000000000000000000000000000000000000000000000000000000000 \
--root-commit 4b8d01975cf0cd23e046b1fae36518e542f92a6e35bedd627c43da30f4ae761a \
--config ./cmd/bootstrap/example_files/node-config.json \
--partner-dir ./cmd/bootstrap/example_files/partner-node-infos \
--partner-weights ./cmd/bootstrap/example_files/partner-weights.json \
--epoch-counter 1 \
-o ./bootstrap/root-infos
go run . genconfig \
--address-format "%s%d-example.onflow.org:3569" \
--access 2 \
--collection 4 \
--consensus 3 \
--execution 2 \
--verification 3 \
--weight 100 \
-o ./ \
--config ./bootstrap-example/node-config.json

```

```bash
go run . keygen \
--machine-account \
--config ./bootstrap-example/node-config.json \
-o ./bootstrap-example/keys

```

```bash
go run . rootblock \
--root-chain bench \
--root-height 0 \
--root-parent 0000000000000000000000000000000000000000000000000000000000000000 \
--epoch-counter 0 \
--epoch-length 30000 \
--epoch-staking-phase-length 20000 \
--epoch-dkg-phase-length 2000 \
--collection-clusters 1 \
--protocol-version=0 \
--epoch-commit-safety-threshold=1000 \
--config ./bootstrap-example/node-config.json \
-o ./bootstrap-example \
--partner-dir ./example_files/partner-node-infos \
--partner-weights ./example_files/partner-weights.json \
--internal-priv-dir ./bootstrap-example/keys
```

```bash
go run . finalize \
--config ./bootstrap-example/node-config.json \
--partner-dir ./example_files/partner-node-infos \
--partner-weights ./example_files/partner-weights.json \
--internal-priv-dir ./bootstrap-example/keys/private-root-information \
--dkg-data ./bootstrap-example/private-root-information/root-dkg-data.priv.json \
--root-block ./bootstrap-example/public-root-information/root-block.json \
--intermediary-bootstrapping-data ./bootstrap-example/public-root-information/intermediary-bootstrapping-data.json \
--root-block-votes-dir ./bootstrap-example/public-root-information/root-block-votes/ \
--root-commit 0000000000000000000000000000000000000000000000000000000000000000 \
--genesis-token-supply="1000000000.0" \
--service-account-public-key-json "{\"PublicKey\":\"R7MTEDdLclRLrj2MI1hcp4ucgRTpR15PCHAWLM5nks6Y3H7+PGkfZTP2di2jbITooWO4DD1yqaBSAVK8iQ6i0A==\",\"SignAlgo\":2,\"HashAlgo\":1,\"SeqNumber\":0,\"Weight\":1000}" \
-o ./bootstrap-example
```

#### Generated output files
Expand Down
66 changes: 63 additions & 3 deletions cmd/bootstrap/cmd/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,81 @@ import (
"time"

"github.com/onflow/flow-go/cmd/bootstrap/run"
"github.com/onflow/flow-go/model/dkg"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/signature"
"github.com/onflow/flow-go/state/protocol/inmem"
)

func constructRootBlock(rootChain string, rootParent string, rootHeight uint64, rootTimestamp string) *flow.Block {

// constructRootHeader constructs a header for the root block.
func constructRootHeader(rootChain string, rootParent string, rootHeight uint64, rootTimestamp string) *flow.Header {
chainID := parseChainID(rootChain)
parentID := parseParentID(rootParent)
height := rootHeight
timestamp := parseRootTimestamp(rootTimestamp)

block := run.GenerateRootBlock(chainID, parentID, height, timestamp)
return run.GenerateRootHeader(chainID, parentID, height, timestamp)
}

// constructRootBlock constructs a valid root block based on the given header, setup, and commit.
func constructRootBlock(rootHeader *flow.Header, setup *flow.EpochSetup, commit *flow.EpochCommit) *flow.Block {
block := &flow.Block{
Header: rootHeader,
Payload: nil,
}
block.SetPayload(flow.Payload{
Guarantees: nil,
Seals: nil,
Receipts: nil,
Results: nil,
ProtocolStateID: inmem.ProtocolStateFromEpochServiceEvents(setup, commit).ID(),
})
return block
}

// constructRootEpochEvents constructs the epoch setup and commit events for the first epoch after spork.
func constructRootEpochEvents(
firstView uint64,
participants flow.IdentityList,
assignments flow.AssignmentList,
clusterQCs []*flow.QuorumCertificate,
dkgData dkg.DKGData) (*flow.EpochSetup, *flow.EpochCommit) {
epochSetup := &flow.EpochSetup{
Counter: flagEpochCounter,
FirstView: firstView,
FinalView: firstView + flagNumViewsInEpoch - 1,
DKGPhase1FinalView: firstView + flagNumViewsInStakingAuction + flagNumViewsInDKGPhase - 1,
DKGPhase2FinalView: firstView + flagNumViewsInStakingAuction + flagNumViewsInDKGPhase*2 - 1,
DKGPhase3FinalView: firstView + flagNumViewsInStakingAuction + flagNumViewsInDKGPhase*3 - 1,
Participants: participants.Sort(flow.Canonical[flow.Identity]).ToSkeleton(),
Assignments: assignments,
RandomSource: GenerateRandomSeed(flow.EpochSetupRandomSourceLength),
}

qcsWithSignerIDs := make([]*flow.QuorumCertificateWithSignerIDs, 0, len(clusterQCs))
for i, clusterQC := range clusterQCs {
members := assignments[i]
signerIDs, err := signature.DecodeSignerIndicesToIdentifiers(members, clusterQC.SignerIndices)
if err != nil {
log.Fatal().Err(err).Msgf("could not decode signer IDs from clusterQC at index %v", i)
}
qcsWithSignerIDs = append(qcsWithSignerIDs, &flow.QuorumCertificateWithSignerIDs{
View: clusterQC.View,
BlockID: clusterQC.BlockID,
SignerIDs: signerIDs,
SigData: clusterQC.SigData,
})
}

epochCommit := &flow.EpochCommit{
Counter: flagEpochCounter,
ClusterQCs: flow.ClusterQCVoteDatasFromQCs(qcsWithSignerIDs),
DKGGroupKey: dkgData.PubGroupKey,
DKGParticipantKeys: dkgData.PubKeyShares,
}
return epochSetup, epochCommit
}

func parseChainID(chainID string) flow.ChainID {
switch chainID {
case "main":
Expand Down
8 changes: 4 additions & 4 deletions cmd/bootstrap/cmd/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
// of succeeding the assignment by re-running the function without increasing the internal nodes ratio.
func constructClusterAssignment(partnerNodes, internalNodes []model.NodeInfo) (flow.AssignmentList, flow.ClusterList, error) {

partners := model.ToIdentityList(partnerNodes).Filter(filter.HasRole(flow.RoleCollection))
internals := model.ToIdentityList(internalNodes).Filter(filter.HasRole(flow.RoleCollection))
partners := model.ToIdentityList(partnerNodes).Filter(filter.HasRole[flow.Identity](flow.RoleCollection))
internals := model.ToIdentityList(internalNodes).Filter(filter.HasRole[flow.Identity](flow.RoleCollection))
nClusters := int(flagCollectionClusters)
nCollectors := len(partners) + len(internals)

Expand Down Expand Up @@ -73,7 +73,7 @@ func constructClusterAssignment(partnerNodes, internalNodes []model.NodeInfo) (f
assignments := assignment.FromIdentifierLists(identifierLists)

collectors := append(partners, internals...)
clusters, err := factory.NewClusterList(assignments, collectors)
clusters, err := factory.NewClusterList(assignments, collectors.ToSkeleton())
if err != nil {
log.Fatal().Err(err).Msg("could not create cluster list")
}
Expand Down Expand Up @@ -109,7 +109,7 @@ func constructRootQCsForClusters(
// Filters a list of nodes to include only nodes that will sign the QC for the
// given cluster. The resulting list of nodes is only nodes that are in the
// given cluster AND are not partner nodes (ie. we have the private keys).
func filterClusterSigners(cluster flow.IdentityList, nodeInfos []model.NodeInfo) []model.NodeInfo {
func filterClusterSigners(cluster flow.IdentitySkeletonList, nodeInfos []model.NodeInfo) []model.NodeInfo {

var filtered []model.NodeInfo
for _, node := range nodeInfos {
Expand Down
8 changes: 4 additions & 4 deletions cmd/bootstrap/cmd/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
func ensureUniformNodeWeightsPerRole(allNodes flow.IdentityList) {
// ensure all nodes of the same role have equal weight
for _, role := range flow.Roles() {
withRole := allNodes.Filter(filter.HasRole(role))
withRole := allNodes.Filter(filter.HasRole[flow.Identity](role))
// each role has at least one node so it's safe to access withRole[0]
expectedWeight := withRole[0].Weight
expectedWeight := withRole[0].InitialWeight
for _, node := range withRole {
if node.Weight != expectedWeight {
if node.InitialWeight != expectedWeight {
log.Fatal().Msgf(
"will not bootstrap configuration with non-equal weights\n"+
"found nodes with role %s and weight1=%d, weight2=%d",
role, expectedWeight, node.Weight)
role, expectedWeight, node.InitialWeight)
}
}
}
Expand Down
Loading
Loading