-
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
Dry run in the past #2661
Changes from 11 commits
64016b0
312077b
883a51b
b7dfc6e
3a0d381
07013c7
0dd8f64
52a981a
77e0b89
1dd6847
8345f46
2245cc1
d3984ca
bbbedd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 `--historical-execution` 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()), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ use super::{ | |
P2PAdapter, | ||
}, | ||
genesis::create_genesis_block, | ||
DbType, | ||
}; | ||
#[cfg(feature = "relayer")] | ||
use crate::relayer::Config as RelayerConfig; | ||
|
@@ -102,10 +103,14 @@ pub fn init_sub_services( | |
|
||
let last_height = *last_block_header.height(); | ||
|
||
let allow_historical_execution = config.combined_db_config.database_type | ||
== DbType::RocksDb | ||
&& config.historical_execution; | ||
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 allow it on config level for the whole 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. |
||
let upgradable_executor_config = fuel_core_upgradable_executor::config::Config { | ||
backtrace: config.vm.backtrace, | ||
utxo_validation_default: config.utxo_validation, | ||
native_executor_version: config.native_executor_version, | ||
allow_historical_execution, | ||
}; | ||
let executor = ExecutorAdapter::new( | ||
database.on_chain().clone(), | ||
|
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?