Skip to content

Commit

Permalink
skip nonce check on fee estimation (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: Ammar Arif <[email protected]>
  • Loading branch information
steebchen and kariy committed Sep 5, 2024
1 parent 01f5e63 commit 2b187f9
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 78 deletions.
36 changes: 6 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 12 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[workspace]
exclude = [
"crates/load-test",
"crates/stark_hash_python",
"utils/pathfinder-probe",
]
members = [
"crates/common",
"crates/compiler",
Expand All @@ -22,27 +27,22 @@ members = [
"crates/tagged",
"crates/tagged-debug-derive",
]
exclude = [
"crates/load-test",
"crates/stark_hash_python",
"utils/pathfinder-probe",
]
resolver = "2"

[profile.release-lto]
inherits = "release"
codegen-units = 1
inherits = "release"
lto = true

[profile.dev.package.flate2]
opt-level = 3

[workspace.package]
version = "0.14.2"
authors = [ "Equilibrium Labs <[email protected]>" ]
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.80"
authors = ["Equilibrium Labs <[email protected]>"]
version = "0.14.2"

[workspace.dependencies]
anyhow = "1.0.75"
Expand All @@ -53,7 +53,7 @@ axum = "0.7.5"
base64 = "0.13.1"
bincode = "2.0.0-rc.3"
bitvec = "1.0.1"
blockifier = { git = "https://github.com/cartridge-gg/sequencer", branch = "skip-nonce-check" }
blockifier = { git = "https://github.com/cartridge-gg/sequencer", branch = "pathfinder-patch" }
bloomfilter = "1.0.12"
bytes = "1.4.0"
cached = "0.44.0"
Expand Down Expand Up @@ -106,11 +106,7 @@ r2d2_sqlite = "0.25.0"
rand = "0.8.5"
rand_chacha = "0.3.1"
rayon = "1.8.0"
reqwest = { version = "0.12.5", default-features = false, features = [
"http2",
"rustls-tls-native-roots",
"charset",
] }
reqwest = { version = "0.12.5", default-features = false, features = [ "http2", "rustls-tls-native-roots", "charset" ] }
rstest = "0.18.2"
rusqlite = "0.32.1"
semver = "1.0.18"
Expand All @@ -120,7 +116,8 @@ serde_with = "3.7.0"
sha2 = "0.10.7"
sha3 = "0.10"
# This one needs to match the version used by blockifier
starknet_api = "=0.13.0-rc.1"
# starknet_api = "=0.13.0-rc.1"
starknet_api = { git = "https://github.com/cartridge-gg/sequencer", branch = "pathfinder-patch" }
# This one needs to match the version used by blockifier
starknet-types-core = "=0.1.5"
syn = "1.0"
Expand Down
9 changes: 8 additions & 1 deletion crates/executor/src/estimate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub fn estimate(
execution_state: ExecutionState<'_>,
transactions: Vec<Transaction>,
skip_validate: bool,
skip_nonce_check: bool,
) -> Result<Vec<FeeEstimate>, TransactionExecutionError> {
let block_number = execution_state.header.number;

Expand All @@ -32,7 +33,13 @@ pub fn estimate(
let tx_info: Result<
blockifier::transaction::objects::TransactionExecutionInfo,
blockifier::transaction::errors::TransactionExecutionError,
> = transaction.execute(&mut state, &block_context, false, !skip_validate);
> = transaction.execute(
&mut state,
&block_context,
false,
!skip_validate,
!skip_nonce_check,
);

match tx_info {
Ok(tx_info) => {
Expand Down
3 changes: 2 additions & 1 deletion crates/executor/src/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ pub fn simulate(
&block_context,
!skip_fee_charge,
!skip_validate,
true,
);
let state_diff = to_state_diff(&mut tx_state, transaction_declared_deprecated_class_hash)?;
tx_state.commit();
Expand Down Expand Up @@ -185,7 +186,7 @@ pub fn trace(

let mut tx_state = CachedState::<_>::create_transactional(&mut state);
let tx_info = tx
.execute(&mut tx_state, &block_context, true, true)
.execute(&mut tx_state, &block_context, true, true, true)
.map_err(|e| {
// Update the cache with the error. Lock the cache before sending to avoid
// race conditions between senders and receivers.
Expand Down
Loading

0 comments on commit 2b187f9

Please sign in to comment.