-
Notifications
You must be signed in to change notification settings - Fork 2.9k
GraphQL: historical contract storage and balances #2682
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 39 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
64016b0
Implement dry run in the past
Dentosal 312077b
Add changelog entry
Dentosal 883a51b
Fix typo
Dentosal b7dfc6e
Require --debug flag for setting block height to past
Dentosal 3a0d381
Merge branch 'master' into dento/2062_dry_run_in_the_past
Dentosal 07013c7
Fix broken merge
Dentosal 0dd8f64
Workaround linux pthread issue of rocksdb
Dentosal 52a981a
Merge branch 'master' into dento/2062_dry_run_in_the_past
Dentosal 77e0b89
Merge branch 'master' into dento/2062_dry_run_in_the_past
Dentosal 1dd6847
Move from --debug to --historical-execution, force off for InMemory db
Dentosal 8345f46
fmt
Dentosal 2245cc1
Properly use --historical-execution
Dentosal d3984ca
Enable --historical-execution for dry run in past test
Dentosal 4599802
Add API endpoints to read the storage information
xgreenx 046e902
Add support for storage balances as well
xgreenx 0d62baa
Merge branch 'master' into dento/graphql-storage-api
Dentosal bfecd5f
Fix issues after merge
Dentosal ab176bf
fmt
Dentosal 9916070
clippy
Dentosal 58e5312
Do not log full byte arrays on "schema not up to date" test
Dentosal be86870
Update schema
Dentosal a9ec886
fmt
Dentosal a28be05
Merge branch 'master' into dento/graphql-storage-api
Dentosal 5fe40cb
Fix merge of CHANGELOG.md
Dentosal 1f001ed
Merge branch 'master' into dento/graphql-storage-api
Dentosal 8aac38a
Merge branch 'master' into dento/graphql-storage-api
Dentosal 2a3c62b
Fix some lifetime bounds
Dentosal 2c0b8fc
Add changelog
Dentosal d2a58c4
Merge branch 'master' into dento/graphql-storage-api
Dentosal 33b2883
Return back caching of the `ReadView` but now after the required heig…
xgreenx 7e4b9bd
Fixed the issue with the subscription and non-working required block …
xgreenx 2e4e005
Updated CHANGELOG
xgreenx c194340
Merge branch 'master' into dento/graphql-storage-api
xgreenx 49b3f7c
Condense storage tests
Dentosal df92693
Add storage tests
Dentosal b615bda
Document that this is using historical execution flag
Dentosal 48dfd68
Update schema.sdl
Dentosal 809534b
Improve changelog
Dentosal 1ee14ee
fmt
Dentosal dc031e1
Update tests/tests/balances.rs
Dentosal 756a8b6
Merge branch 'master' into dento/graphql-storage-api
Dentosal 47cc999
Merge branch 'master' into dento/graphql-storage-api
Dentosal 1d45cbc
Merge branch 'master' into dento/graphql-storage-api
xgreenx 3760f03
Merge branch 'master' into dento/graphql-storage-api
AurelienFT 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added GraphQL APIs to get contract storage and balances for current and past blocks. |
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 @@ | ||
| Fixed the issue with RPC consistency feature for the subscriptions(without the fix first we perform the logic of the query, and only after verify the required height). |
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 |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| use crate::client::schema::{ | ||
| contract::ContractBalance, | ||
| schema, | ||
| AssetId, | ||
| Bytes32, | ||
| ContractId, | ||
| HexString, | ||
| U32, | ||
| }; | ||
| use fuel_core_types::fuel_tx; | ||
|
|
||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic( | ||
| schema_path = "./assets/schema.sdl", | ||
| graphql_type = "Subscription", | ||
| variables = "ContractStorageSlotsArgs" | ||
| )] | ||
| pub struct ContractStorageSlots { | ||
| #[arguments(contractId: $contract_id)] | ||
| pub contract_storage_slots: StorageSlot, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryVariables, Debug)] | ||
| pub struct ContractStorageSlotsArgs { | ||
| /// The ID of the contract. | ||
| pub contract_id: ContractId, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic( | ||
| schema_path = "./assets/schema.sdl", | ||
| graphql_type = "Query", | ||
| variables = "ContractSlotValuesArgs" | ||
| )] | ||
| pub struct ContractSlotValues { | ||
| #[arguments(contractId: $contract_id, blockHeight: $block_height, storageSlots: $storage_slots)] | ||
| pub contract_slot_values: Vec<StorageSlot>, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryVariables, Debug)] | ||
| pub struct ContractSlotValuesArgs { | ||
| pub contract_id: ContractId, | ||
| pub block_height: Option<U32>, | ||
| pub storage_slots: Vec<Bytes32>, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic(schema_path = "./assets/schema.sdl")] | ||
| pub struct StorageSlot { | ||
| pub key: Bytes32, | ||
| pub value: HexString, | ||
| } | ||
|
|
||
| impl From<StorageSlot> for (fuel_tx::Bytes32, Vec<u8>) { | ||
| fn from(value: StorageSlot) -> Self { | ||
| (value.key.into(), value.value.into()) | ||
| } | ||
| } | ||
|
|
||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic( | ||
| schema_path = "./assets/schema.sdl", | ||
| graphql_type = "Subscription", | ||
| variables = "ContractStorageBalancesArgs" | ||
| )] | ||
| pub struct ContractStorageBalances { | ||
| #[arguments(contractId: $contract_id)] | ||
| pub contract_storage_balances: ContractBalance, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryVariables, Debug)] | ||
| pub struct ContractStorageBalancesArgs { | ||
| /// The ID of the contract. | ||
| pub contract_id: ContractId, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryFragment, Clone, Debug)] | ||
| #[cynic( | ||
| schema_path = "./assets/schema.sdl", | ||
| graphql_type = "Query", | ||
| variables = "ContractBalanceValuesArgs" | ||
| )] | ||
| pub struct ContractBalanceValues { | ||
| #[arguments(contractId: $contract_id, blockHeight: $block_height, assets: $assets)] | ||
| pub contract_balance_values: Vec<ContractBalance>, | ||
| } | ||
|
|
||
| #[derive(cynic::QueryVariables, Debug)] | ||
| pub struct ContractBalanceValuesArgs { | ||
| pub contract_id: ContractId, | ||
| pub block_height: Option<U32>, | ||
| pub assets: Vec<AssetId>, | ||
| } |
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
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.