-
Notifications
You must be signed in to change notification settings - Fork 201
[DataAvailability] Implement fork-aware Execution Data Endpoints #7985
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
Merged
peterargue
merged 52 commits into
feature/optimistic-sync
from
andron/7656-fork-aware-execution-data-endpoints
Oct 30, 2025
Merged
Changes from 37 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
1ba2e3b
added missing components to state stream backend, added execution dat…
AndriiDiachuk 05acbf1
Update cmd/access/node_builder/access_node_builder.go
AndriiDiachuk cdbb793
Update cmd/observer/node_builder/observer_builder.go
AndriiDiachuk fab2478
Update cmd/observer/node_builder/observer_builder.go
AndriiDiachuk 20e6f6b
Update cmd/access/node_builder/access_node_builder.go
AndriiDiachuk 0d88fb7
Linted
AndriiDiachuk c411bb3
Added check if GetIncludeExecutorMetadata is true for GetExecutionDat…
AndriiDiachuk eacc8e2
Added check for errNot found
AndriiDiachuk 50cb0c0
Added BlockExecutionData to the Snapshot interface, changed implement…
AndriiDiachuk 1152695
Merged conflicts
AndriiDiachuk af2c148
Added new interface for execution data reading, fixed corresponding p…
AndriiDiachuk 5bb7569
Fixed executionData tests
AndriiDiachuk d4b4830
Fixed TestGetExecutionDataByBlockID in handler tests
AndriiDiachuk c4cd2ce
Added checks if events storage is not empty
AndriiDiachuk 9bafca1
Added check to see if CI will fail
AndriiDiachuk ad1c42c
Added check for builder.events
AndriiDiachuk 4ce817c
Moved events init above calling snapshot
AndriiDiachuk 96b8a84
Initing events ion separate module
AndriiDiachuk 3293f9c
Moved back events storage init
AndriiDiachuk 424380f
Removed check if Events are non empty
AndriiDiachuk 6dd50bc
Removed not nil checks foir new snapshot mock
AndriiDiachuk ee10ca1
Added again storage event init at the top of the build function
AndriiDiachuk 6b23d30
Added check for notNil for events
AndriiDiachuk beb8d0c
Removed not nol check as one of the tests expects events to be nil
AndriiDiachuk c1da4d2
Added error handilng to the test
AndriiDiachuk dbc1972
Linted
AndriiDiachuk d0dd55e
Removed commented code
AndriiDiachuk 6964e5e
Linted again
AndriiDiachuk 78a76e8
Fixed comments regarding to errors in the GetExecutionDataByBlockID
AndriiDiachuk 4bdd5df
Added additional checks in the tests
AndriiDiachuk 742c0ce
Extended checks for handler test< added godoc
AndriiDiachuk 1ee4ba4
Removed notNil check for ExecutionStateCache
AndriiDiachuk e730298
Removed other notNil check for executionStateCache
AndriiDiachuk 257f514
Moved init of executionResultInfoProvider to the top of the Build fun…
AndriiDiachuk 7ad32c5
Moved init of executionResultInfoProvider to the top of the Build fun…
AndriiDiachuk c8e7038
Added not nil checks for the execution result info provider
AndriiDiachuk 2dba2af
Created separate function for result info provider
AndriiDiachuk 616324c
Fixed mocked values, added error handling for missing error
AndriiDiachuk 8a293ef
Removed separate config for the optimistic_sync package
AndriiDiachuk dc1e1a8
Fixed init of NewSnapshotMock in observer builder
AndriiDiachuk 5adc47d
Added not nil check for events in NewSnapshotMock
AndriiDiachuk 44fca74
Changed check for builder events
AndriiDiachuk b14cd1c
Added check for the collections storage
AndriiDiachuk a44b079
added check for nil for transactions and executionDataStoreCache
AndriiDiachuk b86afba
Moved lightTransactionResults and transactionResultErrorMessages init…
AndriiDiachuk beff0ad
Fixed notNil function
AndriiDiachuk bf29402
Changed impl of notNil
AndriiDiachuk 7c4062a
Added function to check storages
AndriiDiachuk fc9ef3c
Added godoc, and refactored one test
AndriiDiachuk 386498a
Added more test cases, added godoc woth expected errors
AndriiDiachuk 47bbf72
Removed empty line
AndriiDiachuk 29cbe4d
Merged both builders
AndriiDiachuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -375,8 +375,10 @@ type FlowAccessNodeBuilder struct { | |
| unsecureGrpcServer *grpcserver.GrpcServer | ||
| stateStreamGrpcServer *grpcserver.GrpcServer | ||
|
|
||
| stateStreamBackend *statestreambackend.StateStreamBackend | ||
| nodeBackend *backend.Backend | ||
| stateStreamBackend *statestreambackend.StateStreamBackend | ||
| nodeBackend *backend.Backend | ||
| executionResultInfoProvider optimistic_sync.ExecutionResultInfoProvider | ||
| executionStateCache optimistic_sync.ExecutionStateCache | ||
|
|
||
| ExecNodeIdentitiesProvider *commonrpc.ExecutionNodeIdentitiesProvider | ||
| TxResultErrorMessagesCore *tx_error_messages.TxErrorMessagesCore | ||
|
|
@@ -650,6 +652,21 @@ func (builder *FlowAccessNodeBuilder) BuildExecutionSyncComponents() *FlowAccess | |
|
|
||
| return nil | ||
| }). | ||
| Module("execution state cache", func(node *cmd.NodeConfig) error { | ||
| // TODO: use real objects instead of mocks once they're implemented | ||
| snapshot := osyncsnapshot.NewSnapshotMock( | ||
AndriiDiachuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| builder.events, | ||
| builder.collections, | ||
| builder.transactions, | ||
| builder.lightTransactionResults, | ||
| builder.transactionResultErrorMessages, | ||
| nil, | ||
| executionDataStoreCache, | ||
| ) | ||
| builder.executionStateCache = execution_state.NewExecutionStateCacheMock(snapshot) | ||
|
|
||
| return nil | ||
| }). | ||
| Component("execution data service", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) { | ||
| opts := []network.BlobServiceOption{ | ||
| blob.WithBitswapOptions( | ||
|
|
@@ -1084,6 +1101,8 @@ func (builder *FlowAccessNodeBuilder) BuildExecutionSyncComponents() *FlowAccess | |
| builder.stateStreamConf.ClientSendBufferSize, | ||
| ), | ||
| executionDataTracker, | ||
| notNil(builder.executionResultInfoProvider), | ||
| builder.executionStateCache, | ||
AndriiDiachuk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("could not create state stream backend: %w", err) | ||
|
|
@@ -1714,10 +1733,50 @@ func (builder *FlowAccessNodeBuilder) enqueueRelayNetwork() { | |
| }) | ||
| } | ||
|
|
||
| // buildExecutionResultInfoProvider registers a module that wires the | ||
| // optimistic_sync.ExecutionResultInfoProvider on the builder. | ||
| func (builder *FlowAccessNodeBuilder) buildExecutionResultInfoProvider() *FlowAccessNodeBuilder { | ||
| builder.Module("execution result info provider", func(node *cmd.NodeConfig) error { | ||
| backendConfig := builder.rpcConf.BackendConfig | ||
|
|
||
| preferredENIdentifiers, err := flow.IdentifierListFromHex(backendConfig.PreferredExecutionNodeIDs) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to convert node id string to Flow Identifier for preferred EN map: %w", err) | ||
| } | ||
|
|
||
| fixedENIdentifiers, err := flow.IdentifierListFromHex(backendConfig.FixedExecutionNodeIDs) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to convert node id string to Flow Identifier for fixed EN map: %w", err) | ||
| } | ||
|
|
||
| execNodeSelector := execution_result.NewExecutionNodeSelector( | ||
| preferredENIdentifiers, | ||
| fixedENIdentifiers, | ||
| ) | ||
|
|
||
| builder.executionResultInfoProvider = execution_result.NewExecutionResultInfoProvider( | ||
| node.Logger, | ||
| node.State, | ||
| node.Storage.Receipts, | ||
| execNodeSelector, | ||
| optimistic_sync.DefaultCriteria, | ||
| ) | ||
|
|
||
| return nil | ||
| }) | ||
| return builder | ||
| } | ||
|
|
||
| func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | ||
| var processedFinalizedBlockHeight storage.ConsumerProgressInitializer | ||
| var processedTxErrorMessagesBlockHeight storage.ConsumerProgressInitializer | ||
|
|
||
| builder.Module("events storage", func(node *cmd.NodeConfig) error { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Events storage is the only one that can be initialized at this point. Other storages are initialized later or based on flags like |
||
| builder.events = store.NewEvents(node.Metrics.Cache, node.ProtocolDB) | ||
| return nil | ||
| }) | ||
| builder.buildExecutionResultInfoProvider() | ||
|
|
||
| if builder.executionDataSyncEnabled { | ||
| builder.BuildExecutionSyncComponents() | ||
| } | ||
|
|
@@ -1924,10 +1983,6 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | |
| builder.RegistersAsyncStore = execution.NewRegistersAsyncStore() | ||
| return nil | ||
| }). | ||
| Module("events storage", func(node *cmd.NodeConfig) error { | ||
| builder.events = store.NewEvents(node.Metrics.Cache, node.ProtocolDB) | ||
| return nil | ||
| }). | ||
| Module("reporter", func(node *cmd.NodeConfig) error { | ||
| builder.Reporter = index.NewReporter() | ||
| return nil | ||
|
|
@@ -2113,30 +2168,6 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | |
| notNil(builder.ExecNodeIdentitiesProvider), | ||
| ) | ||
|
|
||
| execNodeSelector := execution_result.NewExecutionNodeSelector( | ||
| preferredENIdentifiers, | ||
| fixedENIdentifiers, | ||
| ) | ||
|
|
||
| execResultInfoProvider := execution_result.NewExecutionResultInfoProvider( | ||
| node.Logger, | ||
| node.State, | ||
| node.Storage.Receipts, | ||
| execNodeSelector, | ||
| optimistic_sync.DefaultCriteria, | ||
| ) | ||
|
|
||
| // TODO: use real objects instead of mocks once they're implemented | ||
| snapshot := osyncsnapshot.NewSnapshotMock( | ||
| builder.events, | ||
| builder.collections, | ||
| builder.transactions, | ||
| builder.lightTransactionResults, | ||
| builder.transactionResultErrorMessages, | ||
| nil, | ||
| ) | ||
| execStateCache := execution_state.NewExecutionStateCacheMock(snapshot) | ||
|
|
||
| builder.nodeBackend, err = backend.New(backend.Params{ | ||
| State: node.State, | ||
| CollectionRPC: builder.CollectionRPC, // might be nil | ||
|
|
@@ -2177,8 +2208,8 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | |
| VersionControl: notNil(builder.VersionControl), | ||
| ExecNodeIdentitiesProvider: notNil(builder.ExecNodeIdentitiesProvider), | ||
| TxErrorMessageProvider: notNil(builder.txResultErrorMessageProvider), | ||
| ExecutionResultInfoProvider: execResultInfoProvider, | ||
| ExecutionStateCache: execStateCache, | ||
| ExecutionResultInfoProvider: notNil(builder.executionResultInfoProvider), | ||
| ExecutionStateCache: builder.executionStateCache, | ||
| OperatorCriteria: optimistic_sync.DefaultCriteria, | ||
| MaxScriptAndArgumentSize: config.BackendConfig.AccessConfig.MaxRequestMsgSize, | ||
| ScheduledCallbacksEnabled: builder.scheduledCallbacksEnabled, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.