Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
ec46f3e
Start `op-revm` changes
clabby Sep 1, 2023
66d200d
Start fee distribution changes
clabby Sep 1, 2023
c61c762
Add L1 fee deduction
clabby Sep 1, 2023
2257bb9
Start deposit tx gas accounting
clabby Sep 1, 2023
3fd2f61
Move L1 cost into `TxEnv`
clabby Sep 2, 2023
2cc96da
Add helpers for computing the L1 cost of a transaction back
clabby Sep 2, 2023
75f8287
:broom:
clabby Sep 2, 2023
4154183
Enforce runtime config flag for cross-compatibility
clabby Sep 2, 2023
9bb0c49
style: Use env rather than passing a flag
clabby Sep 2, 2023
a31c31c
review: Address first few comments
clabby Sep 5, 2023
9490270
Flatten optimism hoisted tx fields
refcell Sep 5, 2023
8f0caa1
feat flag ontop
refcell Sep 5, 2023
2d137e2
Merge pull request #2 from anton-rs/refcell/tx-field-flattening
refcell Sep 5, 2023
128e440
Refactor l1 cost and mint computations
refcell Sep 5, 2023
6b868b3
l1 cost erroring
refcell Sep 5, 2023
ae76b7e
Merge pull request #4 from anton-rs/refcell/refactors
refcell Sep 5, 2023
d642582
Refactor gas usage functions
refcell Sep 5, 2023
868f593
Rip gas construction back to the transact
refcell Sep 5, 2023
8eab1ad
Rip out crate use gas
refcell Sep 5, 2023
f2d59b9
Merge pull request #5 from anton-rs/refcell/gas-refactor
refcell Sep 5, 2023
063b4e6
push gas usage unit logic into the gas impl
refcell Sep 6, 2023
21bba33
Resolve env conflicts
refcell Sep 6, 2023
f97400f
Merge pull request #7 from anton-rs/refcell/upstream-sync
refcell Sep 6, 2023
b0d703c
Further document the cfg env optimism bool field.
refcell Sep 6, 2023
0404385
Reword
refcell Sep 6, 2023
d9cd733
Add deposit sys tx docs
refcell Sep 6, 2023
cee3dae
Fix the spec enabled function and add unit tests.
refcell Sep 6, 2023
af654a3
data gas tests
refcell Sep 6, 2023
e60a4d5
calculate tx l1 cost test
refcell Sep 6, 2023
fa8b4e0
Add a zero rollup data gas cost check
refcell Sep 6, 2023
f0d7ad6
Fix suggestions
refcell Sep 6, 2023
43254d1
Merge pull request #10 from anton-rs/refcell/spec-enabling-fixes
refcell Sep 6, 2023
5ef737f
Merge pull request #8 from anton-rs/refcell/optimism-hot-toggle
refcell Sep 6, 2023
fc227f6
Merge pull request #9 from anton-rs/refcell/deposit-sys-tx
refcell Sep 6, 2023
d193011
Bump the account nonce post-regolith for contract creation
refcell Sep 6, 2023
710c6ed
Add tx validation tests
refcell Sep 7, 2023
988d640
Add a deposit tx test
refcell Sep 7, 2023
f7a3373
Add gas tests
refcell Sep 7, 2023
b31029e
Add gas tests
refcell Sep 7, 2023
a0cc070
Fix regolith check
refcell Sep 7, 2023
dc28e02
Merge pull request #12 from anton-rs/refcell/validate-tx-tests
refcell Sep 7, 2023
99a364e
Merge pull request #11 from anton-rs/refcell/bump-nonce-post-regolith
refcell Sep 7, 2023
b163419
Fix func ordering
refcell Sep 7, 2023
742c79a
Merge pull request #6 from anton-rs/refcell/refactor-gas-usage
refcell Sep 7, 2023
b0f4d1f
Merge branch 'main' into refcell/upstreamsync
refcell Sep 7, 2023
d3057fd
Merge pull request #14 from anton-rs/refcell/upstreamsync
refcell Sep 7, 2023
23373ae
Fix test
refcell Sep 7, 2023
4acb344
Merge pull request #15 from anton-rs/refcell/fix-test
refcell Sep 7, 2023
531aca0
Swap the l1_cost to use the raw enveloped tx
refcell Sep 7, 2023
bdc334e
Update crates/revm/src/evm_impl.rs
refcell Sep 7, 2023
a92bb4f
Update crates/revm/src/evm_impl.rs
refcell Sep 7, 2023
21d907d
Update crates/primitives/src/env.rs
refcell Sep 7, 2023
8b0a222
Merge pull request #16 from anton-rs/refcell/l1_cost_refactor
refcell Sep 7, 2023
27760ca
Make clippy happy
clabby Sep 7, 2023
4fd2422
Merge pull request #17 from anton-rs/clippy
refcell Sep 7, 2023
0d4ccb5
perf: Only load `L1BlockInfo` once
clabby Sep 7, 2023
bb9acfe
Remove extra `try_fetch` fn
clabby Sep 7, 2023
3f9ca9d
perf: lazy `try_fetch` eval
clabby Sep 7, 2023
8fd3a3c
andreas was right
clabby Sep 8, 2023
2c72f86
Improve error abstraction
clabby Sep 8, 2023
03fd637
Merge pull request #18 from anton-rs/clabby/reduce-db-reads
refcell Sep 8, 2023
61b21a0
EVM Impl Tests
refcell Sep 7, 2023
476f7f2
More tests
refcell Sep 7, 2023
2096fd0
Merge pull request #13 from anton-rs/refcell/mint-value-commits
clabby Sep 8, 2023
e7a2440
Fix breaking changes
refcell Sep 8, 2023
21880f7
Merge pull request #21 from anton-rs/refcell/hot-fix
clabby Sep 8, 2023
2962e7a
Update the enveloped tx to be optional.
refcell Sep 8, 2023
0970280
Merge branch 'main' into refcell/quick-upstream-sync
refcell Sep 8, 2023
ad2c951
Merge pull request #23 from anton-rs/refcell/quick-upstream-sync
refcell Sep 8, 2023
bd03c2f
Merge pull request #22 from anton-rs/refcell/optional-envelope
refcell Sep 8, 2023
c1d667f
Merge REVM upgrades
clabby Sep 16, 2023
3c7878a
Merge pull request #24 from anton-rs/cl/merge-revm-upgrades
refcell Sep 17, 2023
fff1d42
Upstream sync?
refcell Sep 17, 2023
572f52c
Merge pull request #25 from anton-rs/refcell/upstream-fixes
clabby Sep 17, 2023
feec29a
Introduce call return handler
rakita Sep 22, 2023
2b9d0cc
Merge pull request #26 from rakita/call_return_handler
refcell Sep 25, 2023
5918f28
feat: Handler logic
rakita Sep 26, 2023
07c4cbc
Merge remote-tracking branch 'origin/main' into final_handler
rakita Sep 26, 2023
8fa4ea3
Merge pull request #27 from rakita/handler
refcell Sep 26, 2023
c656896
Merge pull request #28 from rakita/oprevm-merge
refcell Sep 26, 2023
8d97ea3
remove USE_GAS from handlers
rakita Sep 27, 2023
feaafe8
Merge pull request #30 from rakita/rm_handler_use_gas
refcell Sep 27, 2023
5eacff1
Fix lints
refcell Sep 27, 2023
ba0266a
Merge branch 'main' into refcell/quick-us
refcell Sep 27, 2023
d87381b
Merge pull request #31 from anton-rs/refcell/quick-us
refcell Sep 27, 2023
e63c990
Update runner.rs
clabby Sep 27, 2023
7aaf390
Merge branch 'main' into refcell/another-quick-us
refcell Sep 27, 2023
4a615ea
Merge pull request #32 from anton-rs/refcell/another-quick-us
refcell Sep 27, 2023
ec1f488
Fix param mutability
refcell Sep 27, 2023
8048613
Merge pull request #33 from anton-rs/refcell/fix-param-mutability
refcell Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove USE_GAS from handlers
  • Loading branch information
rakita committed Sep 27, 2023
commit 8d97ea31445e7801834246c62ce4db64a159f02f
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
cache-on-failure: true

- name: cargo test
run: cargo test --workspace

- name: cargo test all features
run: cargo test --workspace --all-features

- name: cargo check no_std
Expand Down
18 changes: 8 additions & 10 deletions crates/revm/src/handler/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ pub fn handle_call_return<SPEC: Spec>(
let mut gas = Gas::new(tx_gas_limit);
gas.record_cost(tx_gas_limit);

if crate::USE_GAS {
match call_result {
return_ok!() => {
gas.erase_cost(returned_gas.remaining());
gas.record_refund(returned_gas.refunded());
}
return_revert!() => {
gas.erase_cost(returned_gas.remaining());
}
_ => {}
match call_result {
return_ok!() => {
gas.erase_cost(returned_gas.remaining());
gas.record_refund(returned_gas.refunded());
}
return_revert!() => {
gas.erase_cost(returned_gas.remaining());
}
_ => {}
}
gas
}
Expand Down
87 changes: 42 additions & 45 deletions crates/revm/src/handler/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::{
};

/// Handle output of the transaction
#[cfg(feature = "optimism")]
pub fn handle_call_return<SPEC: Spec>(
env: &Env,
call_result: InstructionResult,
Expand All @@ -26,52 +25,50 @@ pub fn handle_call_return<SPEC: Spec>(
let mut gas = Gas::new(tx_gas_limit);
gas.record_cost(tx_gas_limit);

if crate::USE_GAS {
match call_result {
return_ok!() => {
// On Optimism, deposit transactions report gas usage uniquely to other
// transactions due to them being pre-paid on L1.
//
// Hardfork Behavior:
// - Bedrock (success path):
// - Deposit transactions (non-system) report their gas limit as the usage.
// No refunds.
// - Deposit transactions (system) report 0 gas used. No refunds.
// - Regular transactions report gas usage as normal.
// - Regolith (success path):
// - Deposit transactions (all) report their gas used as normal. Refunds
// enabled.
// - Regular transactions report their gas used as normal.
if is_optimism && (!is_deposit || is_regolith) {
// For regular transactions prior to Regolith and all transactions after
// Regolith, gas is reported as normal.
gas.erase_cost(returned_gas.remaining());
gas.record_refund(returned_gas.refunded());
} else if is_deposit && tx_system.unwrap_or(false) {
// System transactions were a special type of deposit transaction in
// the Bedrock hardfork that did not incur any gas costs.
gas.erase_cost(tx_gas_limit);
}
match call_result {
return_ok!() => {
// On Optimism, deposit transactions report gas usage uniquely to other
// transactions due to them being pre-paid on L1.
//
// Hardfork Behavior:
// - Bedrock (success path):
// - Deposit transactions (non-system) report their gas limit as the usage.
// No refunds.
// - Deposit transactions (system) report 0 gas used. No refunds.
// - Regular transactions report gas usage as normal.
// - Regolith (success path):
// - Deposit transactions (all) report their gas used as normal. Refunds
// enabled.
// - Regular transactions report their gas used as normal.
if is_optimism && (!is_deposit || is_regolith) {
// For regular transactions prior to Regolith and all transactions after
// Regolith, gas is reported as normal.
gas.erase_cost(returned_gas.remaining());
gas.record_refund(returned_gas.refunded());
} else if is_deposit && tx_system.unwrap_or(false) {
// System transactions were a special type of deposit transaction in
// the Bedrock hardfork that did not incur any gas costs.
gas.erase_cost(tx_gas_limit);
}
return_revert!() => {
// On Optimism, deposit transactions report gas usage uniquely to other
// transactions due to them being pre-paid on L1.
//
// Hardfork Behavior:
// - Bedrock (revert path):
// - Deposit transactions (all) report the gas limit as the amount of gas
// used on failure. No refunds.
// - Regular transactions receive a refund on remaining gas as normal.
// - Regolith (revert path):
// - Deposit transactions (all) report the actual gas used as the amount of
// gas used on failure. Refunds on remaining gas enabled.
// - Regular transactions receive a refund on remaining gas as normal.
if is_optimism && (!is_deposit || is_regolith) {
gas.erase_cost(returned_gas.remaining());
}
}
return_revert!() => {
// On Optimism, deposit transactions report gas usage uniquely to other
// transactions due to them being pre-paid on L1.
//
// Hardfork Behavior:
// - Bedrock (revert path):
// - Deposit transactions (all) report the gas limit as the amount of gas
// used on failure. No refunds.
// - Regular transactions receive a refund on remaining gas as normal.
// - Regolith (revert path):
// - Deposit transactions (all) report the actual gas used as the amount of
// gas used on failure. Refunds on remaining gas enabled.
// - Regular transactions receive a refund on remaining gas as normal.
if is_optimism && (!is_deposit || is_regolith) {
gas.erase_cost(returned_gas.remaining());
}
_ => {}
}
_ => {}
}
gas
}
Expand Down Expand Up @@ -141,7 +138,7 @@ pub fn reward_beneficiary<SPEC: Spec, DB: Database>(
Ok(())
}

#[cfg(feature = "optimism")]

#[cfg(test)]
mod tests {
use crate::primitives::{BedrockSpec, RegolithSpec};
Expand Down