Skip to content

Commit

Permalink
fix: gateway crate upgraded to latest blockifier
Browse files Browse the repository at this point in the history
Signed-off-by: Dori Medini <dori@starkware.co>
  • Loading branch information
dorimedini-starkware committed Jul 11, 2024
1 parent 15791bd commit aab8baf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
6 changes: 3 additions & 3 deletions crates/gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ testing = []
[dependencies]
async-trait.workspace = true
axum.workspace = true
blockifier = { path = "../blockifier", version = "0.8.0-dev.1" , features = ["testing"] }
blockifier = { path = "../blockifier", version = "0.8.0-dev.1", features = ["testing"] }
cairo-lang-starknet-classes.workspace = true
cairo-vm.workspace = true
hyper.workspace = true
mempool_test_utils = { path = "../mempool_test_utils", version = "0.0" }
num-traits.workspace = true
papyrus_config = { path = "../papyrus_config", version = "0.4.0-dev.4" }
papyrus_rpc = { path = "../papyrus_rpc", version = "0.4.0-dev.4" }
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
starknet-types-core.workspace = true
starknet_api = { path = "../starknet_api", version = "0.13.0-dev.9" }
starknet_mempool_infra = { path = "../mempool_infra", version = "0.0" }
starknet_mempool_types = { path = "../mempool_types", version = "0.0" }
starknet_sierra_compile = { path = "../starknet_sierra_compile", version = "0.0" }
starknet-types-core.workspace = true
mempool_test_utils = { path = "../mempool_test_utils", version = "0.0"}
thiserror.workspace = true
tokio.workspace = true
tracing.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/gateway/src/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn process_tx(

// TODO(Yael, 19/5/2024): pass the relevant deploy_account_hash.
let tx_hash =
stateful_tx_validator.run_validate(state_reader_factory, &tx, optional_class_info, None)?;
stateful_tx_validator.run_validate(state_reader_factory, &tx, optional_class_info)?;

// TODO(Arni): Add the Sierra and the Casm to the mempool input.
Ok(MempoolInput {
Expand Down
10 changes: 3 additions & 7 deletions crates/gateway/src/stateful_transaction_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ impl StatefulTransactionValidator {
state_reader_factory: &dyn StateReaderFactory,
external_tx: &RPCTransaction,
optional_class_info: Option<ClassInfo>,
deploy_account_tx_hash: Option<TransactionHash>,
) -> StatefulTransactionValidatorResult<TransactionHash> {
// TODO(yael 6/5/2024): consider storing the block_info as part of the
// StatefulTransactionValidator and update it only once a new block is created.
Expand All @@ -53,18 +52,15 @@ impl StatefulTransactionValidator {
BouncerConfig::max(),
);

let mut validator = BlockifierStatefulValidator::create(
state,
block_context,
self.config.max_nonce_for_validation_skip,
);
let mut validator = BlockifierStatefulValidator::create(state, block_context);
let account_tx = external_tx_to_account_tx(
external_tx,
optional_class_info,
&self.config.chain_info.chain_id,
)?;
let tx_hash = get_tx_hash(&account_tx);
validator.perform_validations(account_tx, deploy_account_tx_hash)?;
let skip_validation = false;
validator.perform_validations(account_tx, skip_validation)?;
Ok(tx_hash)
}
}
Expand Down
8 changes: 2 additions & 6 deletions crates/gateway/src/stateful_transaction_validator_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ fn test_stateful_tx_validator(
_ => None,
};

let result = stateful_validator.run_validate(
&state_reader_factory,
&external_tx,
optional_class_info,
None,
);
let result =
stateful_validator.run_validate(&state_reader_factory, &external_tx, optional_class_info);
assert_eq!(format!("{:?}", result), format!("{:?}", expected_result));
}

0 comments on commit aab8baf

Please sign in to comment.