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] Read-only interfaces of protocol state #4579

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
6eff830
Renamed state -> chain_state. Introduced prootocol_state.go
durkmurder Jul 17, 2023
9f4a0a7
Added interfaces for accessing protocol state
durkmurder Jul 17, 2023
fa4a17f
Extracted inmem DKG conversions into public function
durkmurder Jul 17, 2023
c43200b
Updated interfaces for protocol state
durkmurder Jul 17, 2023
d550c92
Added partial implementation of dynamic protocol state adapter and pr…
durkmurder Jul 17, 2023
bf5d3ed
Small renaming. Cleanup and tidy
durkmurder Jul 17, 2023
62c14b5
Implementing additional functionality for dynamic protocol state adapter
durkmurder Jul 17, 2023
6106dc1
Split dynamic protocol state adapter into initial and dynamic
durkmurder Jul 18, 2023
2062efb
Added tests and documentation for adapters
durkmurder Jul 18, 2023
8e270b5
Updated mocks
durkmurder Jul 18, 2023
ec2b92b
Added tests for protocol state reader
durkmurder Jul 18, 2023
6b997ea
Updated godoc
durkmurder Jul 18, 2023
b42124b
Updated protocol state adapters to return data in lazy way
durkmurder Jul 19, 2023
6b3fa6b
Cleanup of existing code
durkmurder Jul 19, 2023
2ee7d87
Extracted GlobalParams from Params. Injected GlobalParams into Protoc…
durkmurder Jul 19, 2023
3ca81bb
Added tests to make sure that global params are correctly injected in…
durkmurder Jul 19, 2023
fdbb3cd
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Jul 20, 2023
71da068
Updated godoc for protocol state
durkmurder Jul 20, 2023
7605d99
Updated protocol.GlobalParams to stop returning errors as values are …
durkmurder Jul 20, 2023
9152753
Linted
durkmurder Jul 24, 2023
a44ec8f
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Jul 24, 2023
c59c26a
Added interface for state updater
durkmurder Jul 25, 2023
dfcab24
Updated ProtocolStateEntry to support deep copy functionality
durkmurder Jul 25, 2023
6b47488
Implemented processing of epoch setup and commit events. Implemented …
durkmurder Jul 25, 2023
ef964a4
Added some tests for updater
durkmurder Jul 26, 2023
3192722
Added test for setting invalid state transition
durkmurder Jul 26, 2023
a216da5
Added tests for processing epoch commit
durkmurder Jul 27, 2023
5c4c332
More updates to updater tests
durkmurder Jul 27, 2023
cdcd456
Added test for processing epoch setup event
durkmurder Jul 31, 2023
61f53c1
Added implementation and small test for UpdateIdentity
durkmurder Jul 31, 2023
7f844e2
Added more test cases for protocol state updater
durkmurder Jul 31, 2023
c7471d8
Added test for updating identity before processing epoch setup
durkmurder Jul 31, 2023
8126acd
Work in progress on updater tests
durkmurder Jul 31, 2023
c9480b2
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Jul 31, 2023
8ba0775
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Jul 31, 2023
f6952be
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Jul 31, 2023
c8144c8
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Jul 31, 2023
e0f0f1b
Updated godoc
durkmurder Aug 1, 2023
b909d20
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Aug 1, 2023
5881242
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Aug 1, 2023
dacf332
Changed how epoch setup events are processed. Changed how participant…
durkmurder Aug 1, 2023
18696f6
Updated tests to handle different edge cases when processing epoch setup
durkmurder Aug 1, 2023
07e449e
Updated godocs for multiple structures. Code cleanup and small refact…
durkmurder Aug 1, 2023
6e3f587
Linted
durkmurder Aug 1, 2023
9290985
Added a function to StateUpdater to retrieve candidate block
durkmurder Aug 2, 2023
4edcb11
Updated protocol state to return epoch status
durkmurder Aug 3, 2023
cf509f9
Updated mocks
durkmurder Aug 3, 2023
4fd8696
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Aug 3, 2023
16aa94d
Made protocol state updater to return parent state. Implemented Epoch…
durkmurder Aug 3, 2023
4423875
Updated protocol state to return low-level entry for bootstraping pur…
durkmurder Aug 7, 2023
325b7c9
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Aug 7, 2023
5dc0d20
Refactored implementation and tests of inmemory adapters. Moved to in…
durkmurder Aug 7, 2023
3163e93
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Aug 7, 2023
79c45c1
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Aug 7, 2023
5e8982e
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Aug 7, 2023
c95a9b7
Fixed tests after merge
durkmurder Aug 7, 2023
0d19d0a
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Aug 7, 2023
0953256
Merge branch 'yurii/5513-read-only-identity-table' of https://github.…
durkmurder Aug 7, 2023
3a9a86e
Linted
durkmurder Aug 7, 2023
d982854
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' of htt…
durkmurder Aug 8, 2023
9570336
Merge branch 'yurii/6801-protocol-state-updater' of https://github.co…
durkmurder Aug 8, 2023
cfc1eec
Removed automatic transition to new epoch in state updater
durkmurder Aug 9, 2023
0be0711
Updated how epoch transition is performed for protocol state updater.…
durkmurder Aug 9, 2023
1fe92c7
Updated how state transition happens
durkmurder Aug 9, 2023
63cd2f4
Updated mocks. Updated InitialProtocolStateAdaptor to return rich entry
durkmurder Aug 11, 2023
a678791
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' into y…
jordanschalm Aug 24, 2023
21c621f
removed error checks, whose APIs we refactored and that don't return …
Sep 4, 2023
8b16dad
Apply Jodan's suggested goDoc revisions
Sep 4, 2023
0a1bf67
micro code consolidation
Sep 5, 2023
30f6d52
extended GoDoc of `IdentityList.Copy`
Sep 5, 2023
0fa6e01
doc: req for StateUpdate inputs to be validated
jordanschalm Sep 7, 2023
0d961bc
add todo
jordanschalm Sep 7, 2023
f72f260
Merge branch 'yurii/5529-dynamic-protocol-state-storage-layer' into y…
jordanschalm Sep 7, 2023
a0041b8
Merge branch 'feature/dynamic-protocol-state' of https://github.com/o…
durkmurder Sep 8, 2023
7d91701
Apply suggestions from code review
durkmurder Sep 8, 2023
792715e
Apply suggestions from code review
durkmurder Sep 8, 2023
d222fd0
Applied suggestions from PR review. Updated tests
durkmurder Sep 8, 2023
0ccdb11
Linted
durkmurder Sep 8, 2023
4d3e92f
Fixed test
durkmurder Sep 8, 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
Extracted inmem DKG conversions into public function
  • Loading branch information
durkmurder committed Jul 17, 2023
commit fa4a17fb824bcdcd382b2d348e28a3938ff55846
18 changes: 18 additions & 0 deletions state/protocol/inmem/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,24 @@ func DKGFromEncodable(enc EncodableDKG) (*DKG, error) {
return &DKG{enc}, nil
}

// EncodableDKGFromEvents returns an EncodableDKG constructed from epoch setup and commit events.
// No errors are expected during normal operations.
func EncodableDKGFromEvents(setup *flow.EpochSetup, commit *flow.EpochCommit) (EncodableDKG, error) {
// filter initial participants to valid DKG participants
participants := setup.Participants.Filter(filter.IsValidDKGParticipant)
lookup, err := flow.ToDKGParticipantLookup(participants, commit.DKGParticipantKeys)
if err != nil {
return EncodableDKG{}, fmt.Errorf("could not construct dkg lookup: %w", err)
}

return EncodableDKG{
GroupKey: encodable.RandomBeaconPubKey{
PublicKey: commit.DKGGroupKey,
},
Participants: lookup,
}, nil
}

// ClusterFromEncodable returns a Cluster backed by the given encodable representation.
func ClusterFromEncodable(enc EncodableCluster) (*Cluster, error) {
return &Cluster{enc}, nil
Expand Down
16 changes: 3 additions & 13 deletions state/protocol/inmem/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package inmem
import (
"fmt"

"github.com/onflow/flow-go/model/encodable"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/model/flow/factory"
"github.com/onflow/flow-go/model/flow/filter"
Expand Down Expand Up @@ -256,20 +255,11 @@ func (es *committedEpoch) ClusterByChainID(chainID flow.ChainID) (protocol.Clust
}

func (es *committedEpoch) DKG() (protocol.DKG, error) {
// filter initial participants to valid DKG participants
participants := es.setupEvent.Participants.Filter(filter.IsValidDKGParticipant)
lookup, err := flow.ToDKGParticipantLookup(participants, es.commitEvent.DKGParticipantKeys)
encodable, err := EncodableDKGFromEvents(es.setupEvent, es.commitEvent)
if err != nil {
return nil, fmt.Errorf("could not construct dkg lookup: %w", err)
return nil, fmt.Errorf("could not build encodable DKG from epoch events")
}

dkg, err := DKGFromEncodable(EncodableDKG{
GroupKey: encodable.RandomBeaconPubKey{
PublicKey: es.commitEvent.DKGGroupKey,
},
Participants: lookup,
})
return dkg, err
return DKGFromEncodable(encodable)
}

// startedEpoch represents an epoch (with counter N) that has started, but there is no _finalized_ transition
Expand Down