-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Execution tracing: GraphQL query to get storage inputs for past blocks #2491
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
Merged
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
676a08b
Initial support for historical execution tracing
Dentosal 1e018f1
Update schema.sdl
Dentosal 5f6c079
Fix typo exection => execution
Dentosal 7c8548f
Make execution trace endpoint to work on block level
Dentosal 6ebe050
Fix cli arguments
Dentosal cd0704a
Various fixes and work towards Rust client support
Dentosal 63a0016
Merge branch 'master' into dento/execution-trace
Dentosal f76c96f
WIP
Dentosal 3ba2bc7
Change from tracing to storage read replay recording
Dentosal 88a2730
Merge branch 'master' into dento/execution-trace
Dentosal f558296
Merge branch 'master' into dento/execution-trace
Dentosal 5abde1c
Add wasm executor support
Dentosal 6827e0d
Move behind --debug flag
Dentosal acb9bab
Adjust query cost
Dentosal bb6c9dd
Add debug flag decription
Dentosal 75ff219
Approve snapshot changes
Dentosal 73cb7a6
Add a test case
Dentosal 7d76dc3
Merge branch 'master' into dento/execution-trace
Dentosal 341544f
Add changelog entry
Dentosal 84140f4
fmt
Dentosal 3587605
Use rng correctly to avoid repeat txids
Dentosal 2a52ec2
restore #[deny(warnings)]
Dentosal 2c2c788
fmt
Dentosal 83e2919
clippy
Dentosal b0c40fb
Merge branch 'master' into dento/execution-trace
Dentosal de92215
more clippy
Dentosal 31fd109
fix typo
Dentosal a90b559
Add TODO comments for refactoring
Dentosal 017c03e
more clippy
Dentosal f740d28
Merge branch 'master' into dento/execution-trace
Dentosal fce82ea
Address PR comments
Dentosal a4a6bbf
Merge branch 'master' into dento/execution-trace
Dentosal 4aa858e
Merge branch 'master' into dento/execution-trace
Dentosal fc097bf
Address PR feedback
Dentosal a1fd558
Merge branch 'master' into dento/execution-trace
Dentosal 294ea09
Fix https://github.com/FuelLabs/fuel-core/pull/2661#discussion_r19489…
Dentosal 9eeee84
Fix https://github.com/FuelLabs/fuel-core/pull/2661#discussion_r19488…
Dentosal 8f5c527
Move from --debug to --historical-execution
Dentosal 3e67f50
Migrate to use pre-existing counter contract test code
Dentosal 54bec6b
Update insta snapshots
Dentosal 3f33473
Update CHANGELOG.md
Dentosal d02a5dc
Update query cost
Dentosal 71a6a56
Address PR feedback
Dentosal 3154797
Merge branch 'master' into dento/execution-trace
Dentosal 338ffc1
Fix tests
Dentosal 364c7c7
Merge branch 'master' into dento/execution-trace
Dentosal 65a5957
Fix broken merge
Dentosal 8469824
Update crates/client/assets/schema.sdl
Dentosal a260194
Update CHANGELOG.md
Dentosal 0a1b16a
Merge branch 'master' into dento/execution-trace
Dentosal aaaa57b
Run replay in spawn_fifo to avoid clogging main runtime
Dentosal 1871919
Use u32 column id instead of column name string
Dentosal a23c2bb
Update rest of the column fields to U32
Dentosal 684e8cc
Change the test to use column number
Dentosal 233d29a
fmt
Dentosal b255c46
clippy
Dentosal de6b170
Fix missing import in test
Dentosal 35fa7df
Update tests/tests/storage_read_replay.rs
Dentosal 9c78b11
Limit debug print size of replay event keys and values to
Dentosal b4a1d08
Address PR review comments
Dentosal 3659ff0
Merge branch 'master' into dento/execution-trace
Dentosal 075e960
Fix tests to use query instead of mutation
Dentosal 582a30c
Move get_full_block to fuel-core
Dentosal c080532
Fix tests
Dentosal 8ea800b
Merge branch 'master' into dento/execution-trace
Dentosal 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
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
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
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
11 changes: 11 additions & 0 deletions
11
...ent__client__schema__storage_read_replay__tests__execution_trace_block_tx_gql_output.snap
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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| source: crates/client/src/client/schema/storage_read_replay.rs | ||
| expression: query.query | ||
| --- | ||
| mutation StorageReadReplay($height: U32!) { | ||
| storageReadReplay(height: $height) { | ||
| column | ||
| key | ||
| value | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...e_client__client__schema__storage_read_replay__tests__storage_read_replay_gql_output.snap
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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| source: crates/client/src/client/schema/storage_read_replay.rs | ||
| expression: query.query | ||
| --- | ||
| query StorageReadReplay($height: U32!) { | ||
| storageReadReplay(height: $height) { | ||
| column | ||
| key | ||
| value | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| use super::HexString; | ||
| use crate::client::schema::{ | ||
| schema, | ||
| U32, | ||
| }; | ||
|
|
||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic(schema_path = "./assets/schema.sdl")] | ||
| pub struct StorageReadReplayEvent { | ||
| pub column: U32, | ||
| pub key: HexString, | ||
| pub value: Option<HexString>, | ||
| } | ||
| impl From<StorageReadReplayEvent> | ||
| for fuel_core_types::services::executor::StorageReadReplayEvent | ||
| { | ||
| fn from(event: StorageReadReplayEvent) -> Self { | ||
| fuel_core_types::services::executor::StorageReadReplayEvent { | ||
| column: event.column.into(), | ||
| key: event.key.into(), | ||
| value: event.value.map(Into::into), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(cynic::QueryVariables, Debug)] | ||
| pub struct StorageReadReplayArgs { | ||
| pub height: U32, | ||
| } | ||
|
|
||
| /// Retrieves the transaction in opaque form | ||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic( | ||
| schema_path = "./assets/schema.sdl", | ||
| graphql_type = "Query", | ||
| variables = "StorageReadReplayArgs" | ||
| )] | ||
| pub struct StorageReadReplay { | ||
| #[arguments(height: $height)] | ||
| pub storage_read_replay: Vec<StorageReadReplayEvent>, | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| pub mod tests { | ||
| use super::*; | ||
| use fuel_core_types::fuel_types::BlockHeight; | ||
|
|
||
| #[test] | ||
| fn storage_read_replay_gql_output() { | ||
| use cynic::QueryBuilder; | ||
| let query = StorageReadReplay::build(StorageReadReplayArgs { | ||
| height: BlockHeight::new(1234).into(), | ||
| }); | ||
| insta::assert_snapshot!(query.query) | ||
| } | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,10 @@ use fuel_core_types::{ | |
| fuel_types::BlockHeight, | ||
| services::{ | ||
| block_importer::SharedImportResult, | ||
| executor::TransactionExecutionStatus, | ||
| executor::{ | ||
| StorageReadReplayEvent, | ||
| TransactionExecutionStatus, | ||
| }, | ||
| p2p::PeerInfo, | ||
| txpool::TransactionStatus, | ||
| }, | ||
|
|
@@ -130,6 +133,13 @@ impl BlockProducerPort for BlockProducerAdapter { | |
| .dry_run(transactions, height, time, utxo_validation, gas_price) | ||
| .await | ||
| } | ||
|
|
||
| async fn storage_read_replay( | ||
| &self, | ||
| height: BlockHeight, | ||
| ) -> anyhow::Result<Vec<StorageReadReplayEvent>> { | ||
| self.block_producer.storage_read_replay(height).await | ||
|
Collaborator
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. I think we need to add a back pressure here. Or use
Member
Author
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. Right. Done in aaaa57b. |
||
| } | ||
| } | ||
|
|
||
| #[async_trait::async_trait] | ||
|
|
||
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.