-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Dry run in the past #2661
Merged
Merged
Dry run in the past #2661
Changes from 8 commits
Commits
Show all changes
14 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 bbbedd1
Error on startup if --historical-execution passed without RocksDB
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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
use super::scalars::U64; | ||
use super::scalars::{ | ||
U32, | ||
U64, | ||
}; | ||
use crate::{ | ||
fuel_core_graphql_api::{ | ||
api_service::{ | ||
|
@@ -7,6 +10,7 @@ use crate::{ | |
TxPool, | ||
}, | ||
query_costs, | ||
Config as GraphQLConfig, | ||
IntoApiResult, | ||
}, | ||
graphql_api::{ | ||
|
@@ -293,13 +297,24 @@ impl TxMutation { | |
// for read-only calls. | ||
utxo_validation: Option<bool>, | ||
gas_price: Option<U64>, | ||
// This can be used to run the dry-run on top of a past block. | ||
// Requires `--debug` flag to be enabled. | ||
block_height: Option<U32>, | ||
) -> async_graphql::Result<Vec<DryRunTransactionExecutionStatus>> { | ||
let config = ctx.data_unchecked::<GraphQLConfig>().clone(); | ||
let block_producer = ctx.data_unchecked::<BlockProducer>(); | ||
let consensus_params = ctx | ||
.data_unchecked::<ConsensusProvider>() | ||
.latest_consensus_params(); | ||
let block_gas_limit = consensus_params.block_gas_limit(); | ||
|
||
if block_height.is_some() && !config.debug { | ||
return Err(anyhow::anyhow!( | ||
"The `blockHeight` parameter requires the `--debug` option" | ||
) | ||
.into()); | ||
} | ||
|
||
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. It still uses 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. Fixed in 2245cc1 |
||
let mut transactions = txs | ||
.iter() | ||
.map(|tx| FuelTx::from_bytes(&tx.0)) | ||
|
@@ -317,7 +332,7 @@ impl TxMutation { | |
let tx_statuses = block_producer | ||
.dry_run_txs( | ||
transactions, | ||
None, // TODO(#1749): Pass parameter from API | ||
block_height.map(|x| x.into()), | ||
None, // TODO(#1749): Pass parameter from API | ||
utxo_validation, | ||
gas_price.map(|x| x.into()), | ||
|
This file contains 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 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 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should consider combining the
utxoValidation
,gasPrice
andblockHeight
args into a single input struct. This would allow us to add more fields in the future without breaking the API (though currently it's still breaking if we use the new arg in the client until we resolve #2676).If you think this sounds sensible, we could create a follow-up issue for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extra args are already optional, isn't that already good enough? But it's good to consider the forward compatibility. I'm not sure if a struct would help in this case?