Skip to content

Commit 28c38c5

Browse files
committed
close cip130 in gas estimation when align_evm feature is enabled
add align_evm features to execute-helper crate
1 parent 48ac153 commit 28c38c5

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bins/conflux/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ cfx-bytes = { workspace = true }
5252
keccak-hash = { workspace = true }
5353
cfx-rpc-eth-types = { workspace = true }
5454
hex = { workspace = true }
55+
cfx-execute-helper = { workspace = true }
5556

5657
[target.'cfg(not(target_env = "msvc"))'.dependencies.jemallocator]
5758
version = "0.3.2"
@@ -67,7 +68,7 @@ u64-mpt-db-key = ["client/u64_mpt_db_key"]
6768
# (https://doc.rust-lang.org/cargo/reference/features.html#feature-unification)
6869
blst-portable = ["bls-signatures/blst-portable"]
6970
testonly_code = ["cfx-statedb/testonly_code"]
70-
align_evm = ["cfx-executor/align_evm"]
71+
align_evm = ["cfx-executor/align_evm", "cfx-execute-helper/align_evm"]
7172

7273
[dev-dependencies]
7374
tokio = { workspace = true, features = ["full"] }

crates/execution/execute-helper/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ typemap = { workspace = true }
2121
alloy-rpc-types-trace = { workspace = true }
2222
geth-tracer = { workspace = true }
2323
cfx-parity-trace-types = { workspace = true }
24+
25+
[features]
26+
align_evm = ["cfx-vm-types/align_evm", "cfx-executor/align_evm"]

crates/execution/execute-helper/src/estimation.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl<'a> EstimationContext<'a> {
133133
pub fn transact_virtual(
134134
&mut self, mut tx: SignedTransaction, request: EstimateRequest,
135135
) -> DbResult<(ExecutionOutcome, EstimateExt)> {
136+
#[cfg(not(feature = "align_evm"))]
136137
if let Some(outcome) = self.check_cip130(&tx, &request) {
137138
return Ok(outcome);
138139
}
@@ -400,7 +401,11 @@ impl<'a> EstimationContext<'a> {
400401
}
401402

402403
fn estimated_gas_limit(executed: &Executed, tx: &SignedTransaction) -> U256 {
404+
#[cfg(not(feature = "align_evm"))]
403405
let cip130_min_gas_limit = U256::from(tx.data().len() * 100);
406+
#[cfg(feature = "align_evm")]
407+
let cip130_min_gas_limit = U256::zero();
408+
404409
let eip7623_gas_limit = 21000
405410
+ tx.data()
406411
.iter()

0 commit comments

Comments
 (0)