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

[Dynamic Protocol State] Protocol state storage #4559

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1889c47
Changed core identity type to be constructured from static and dynami…
durkmurder Jul 3, 2023
81ca0c8
Fixed usages of Identity
durkmurder Jul 3, 2023
c19603d
Updated usages of flow.Identity to use flow.IdentitySkeleton. Fixed t…
durkmurder Jul 4, 2023
0f333f3
Fixed compilation issues in tests
durkmurder Jul 4, 2023
cff04e2
Linted
durkmurder Jul 4, 2023
b301877
Fixed more tests
durkmurder Jul 4, 2023
a0599fb
Updated Replicas to return identity skeleton. Updated implementors an…
durkmurder Jul 4, 2023
8c6bfc2
Fixed compilation issues for cluster committee
durkmurder Jul 4, 2023
1cbbe9b
Updated mocks
durkmurder Jul 4, 2023
19d5ada
Updated hotstuff committee to return skeleton and full identites depe…
durkmurder Jul 5, 2023
6682f27
Fixed more tests
durkmurder Jul 5, 2023
7bfd22f
Merge branch 'master' of https://github.com/onflow/flow-go into yurii…
durkmurder Jul 7, 2023
47e9de5
LInted
durkmurder Jul 7, 2023
d436320
Added protocol state entry data structure and added much needed ID fu…
durkmurder Jul 7, 2023
81f77ce
Added interface for ProtocolState storage
durkmurder Jul 7, 2023
5299054
Added protocol state database operations
durkmurder Jul 7, 2023
d235fe9
Added protocol state storage implementation
durkmurder Jul 10, 2023
606a729
Updated implementation of protocol state to correctly return indexed …
durkmurder Jul 10, 2023
0114b3c
Added RichProtocolStateEntry for storing all needed data without rely…
durkmurder Jul 11, 2023
cb20acc
Updated protocol state DB to enrich protocol state entry with extra data
durkmurder Jul 11, 2023
b1d0702
Added godoc for badger.ProtocolState
durkmurder Jul 11, 2023
3840c65
More godoc updates
durkmurder Jul 11, 2023
21af768
Updated fixtures, added basic test for storage. Fixed issue with orde…
durkmurder Jul 13, 2023
ba61c28
Updated tests to fully cover building of RichProtocolStateEntry
durkmurder Jul 13, 2023
b66d0e1
Added extra test for badger operations. Linted
durkmurder Jul 13, 2023
617925a
Updated godoc
durkmurder Jul 13, 2023
0812b8c
Merge branch 'master' of https://github.com/onflow/flow-go into yurii…
durkmurder Jul 20, 2023
89dc4f1
Merge branch 'yurii/6232-static-identity-model' of https://github.com…
durkmurder Jul 20, 2023
f1bc703
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Jul 24, 2023
e59a306
Merge branch 'yurii/6232-static-identity-model' of https://github.com…
durkmurder Jul 24, 2023
895a5a4
Updated protocol state store only canonicaly sorted identiies
durkmurder Jul 31, 2023
1a1b0e4
Updated ProtocolStateEntry to store union of previous and current epo…
durkmurder Jul 31, 2023
fe8ce9f
Updated how epoch participants are constructured in storage layer. Ch…
durkmurder Aug 1, 2023
9b6f11c
Refactored creation of RichProtocolStateEntry. Made it more flexible.…
durkmurder Aug 7, 2023
ab7859a
Changed RichProtocolStateEntry to hold a pointer of embedded type
durkmurder Aug 7, 2023
3bec054
Linted
durkmurder Aug 7, 2023
a97c454
Updated how identities are created based on epoch state. Updated test…
durkmurder Aug 8, 2023
7556712
Apply suggestions from code review
Aug 22, 2023
1ef613a
minor goDoc updates
Aug 24, 2023
60be9c4
removed unnecessary whitespaces
Aug 24, 2023
1227374
Merge branch 'feature/dynamic-protocol-state' into yurii/5529-dynamic…
jordanschalm Aug 24, 2023
be31002
refined goDoc
Aug 24, 2023
9a80526
refined goDoc part 2
Aug 25, 2023
e69609a
extended goDoc for tests
Aug 25, 2023
2fea77a
added TODOs reflecting review comments
Aug 25, 2023
7a16b08
fixed merge artifacts.
Aug 25, 2023
279a464
refined and extended goDoc
Aug 25, 2023
3f89749
more goDoc extensions
Aug 25, 2023
bd54989
extended `badger.ProtocolState` interface documentation
Aug 25, 2023
170109a
remove unused fn WaitForServerStart
jordanschalm Aug 25, 2023
f91d5c8
Update model/flow/protocol_state.go
durkmurder Sep 7, 2023
ddaf7ed
Fixed sanity check
durkmurder Sep 7, 2023
628d61f
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Sep 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed more tests
  • Loading branch information
durkmurder committed Jul 4, 2023
commit b3018778ee498cf5701157691788a7a35a0ede93
4 changes: 2 additions & 2 deletions cmd/util/cmd/execution-state-extract/export_report.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"EpochCounter": 0,
"PreviousStateCommitment": "829fd1ec06c9a40e5ceba9cff537e30806332aba6065da21a11556136d171c98",
"CurrentStateCommitment": "829fd1ec06c9a40e5ceba9cff537e30806332aba6065da21a11556136d171c98",
"PreviousStateCommitment": "170cbb4dd9c2b90362d09e5c05641de30e1ac6aa938ed4ea866fa592fba16566",
"CurrentStateCommitment": "170cbb4dd9c2b90362d09e5c05641de30e1ac6aa938ed4ea866fa592fba16566",
"ReportSucceeded": true
}
13 changes: 12 additions & 1 deletion model/flow/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ type encodableIdentity struct {
NodeID Identifier
Address string `json:",omitempty"`
Role Role
InitialWeight uint64
Weight uint64
Ejected bool
StakingPubKey []byte
NetworkPubKey []byte
}
Expand All @@ -145,7 +147,14 @@ type decodableIdentity struct {
}

func encodableFromIdentity(iy Identity) (encodableIdentity, error) {
ie := encodableIdentity{iy.NodeID, iy.Address, iy.Role, iy.Weight, nil, nil}
ie := encodableIdentity{
NodeID: iy.NodeID,
Address: iy.Address,
Role: iy.Role,
InitialWeight: iy.InitialWeight,
Weight: iy.Weight,
Ejected: iy.Ejected,
}
if iy.StakingPubKey != nil {
ie.StakingPubKey = iy.StakingPubKey.Encode()
}
Expand Down Expand Up @@ -208,7 +217,9 @@ func identityFromEncodable(ie encodableIdentity, identity *Identity) error {
identity.NodeID = ie.NodeID
identity.Address = ie.Address
identity.Role = ie.Role
identity.InitialWeight = ie.InitialWeight
identity.Weight = ie.Weight
identity.Ejected = ie.Ejected
var err error
if ie.StakingPubKey != nil {
if identity.StakingPubKey, err = crypto.DecodePublicKey(crypto.BLSBLS12381, ie.StakingPubKey); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion model/flow/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func TestIdentityEncodingJSON(t *testing.T) {
enc, err := json.Marshal(identity)
require.NoError(t, err)
// emulate the old encoding by replacing the new field with old field name
enc = []byte(strings.Replace(string(enc), "Weight", "Stake", 1))
// NOTE: use replace in such way to avoid replacing InitialWeight field.
enc = []byte(strings.Replace(string(enc), "\"Weight", "\"Stake", 1))
var dec flow.Identity
err = json.Unmarshal(enc, &dec)
require.NoError(t, err)
Expand Down