Skip to content

[WIP] Add Gnosis support#6720

Draft
iovoid wants to merge 1 commit into
mainfrom
implement-gnosis
Draft

[WIP] Add Gnosis support#6720
iovoid wants to merge 1 commit into
mainfrom
implement-gnosis

Conversation

@iovoid
Copy link
Copy Markdown
Contributor

@iovoid iovoid commented May 22, 2026

Motivation

We want to be able to execute blocks in the Gnosis network.

Description

Gnosis is very similar to ethereum mainnet, and so the differences are rather small.

To test, start a consensus node as explained on the gnosis documentation, and start ethrex setting the network to 'gnosis'.

cargo run --release -- --network gnosis --authrpc.jwtsecret /path/to/jwtsecret

@iovoid iovoid requested review from a team as code owners May 22, 2026 15:04
@iovoid iovoid marked this pull request as draft May 22, 2026 15:05
@github-actions
Copy link
Copy Markdown

⚠️ Known Issues — intentionally skipped tests

Source: docs/known_issues.md

Known Issues

Tests intentionally excluded from CI. Source of truth for the Known
Issues
section the L1 workflow appends to each ef-tests job summary
and posts as a sticky PR comment.

EF Tests — Stateless coverage narrowed to EIP-8025 optional-proofs

make -C tooling/ef_tests/blockchain test calls test-stateless-zkevm
instead of test-stateless. The zkevm@v0.3.3 fixtures are filled against
bal@v5.6.1, out of sync with current bal spec; the broad target trips ~549
fixtures. Re-broaden once the zkevm bundle is regenerated.

Why and resolution path

PR #6527 broadened
test-stateless to extract the entire for_amsterdam/ tree from the
zkevm bundle and run all of it under --features stateless; combined with
this branch's bal-devnet-7 semantics that scope produces ~549
GasUsedMismatch / ReceiptsRootMismatch /
BlockAccessListHashMismatch failures.

test-stateless-zkevm filters cargo to the eip8025_optional_proofs
suite, which still validates the stateless harness without the bal-version
mismatch.

Re-broaden by switching test: back to test-stateless in
tooling/ef_tests/blockchain/Makefile once the zkevm bundle is regenerated
against the current bal spec.

@github-actions
Copy link
Copy Markdown

🤖 Claude Code Review

Now I have a thorough understanding of the diff. Let me write up the review.


Code Review: PR #6720 — Add Gnosis Support

Overview

This PR adds Gnosis Chain (chain ID 100) and Chiado testnet (chain ID 10200) support to ethrex. The implementation covers:

  • A new ethrex-gnosis crate for genesis data, ABI encoding, and system call helpers
  • Pre-Merge AuRa header RLP encoding/decoding in BlockHeader
  • Post-block system calls (withdrawals contract + block rewards contract)
  • EIP-1559/4844 fee redirection to a fee-collector contract
  • Gnosis-specific ChainConfig fields
  • P2P/snap sync improvements motivated by Gnosis network characteristics

The approach is generally sound and well-commented, but there are several correctness concerns and at least one critical cross-chain regression risk.


Critical Issues

1. Global snap-sync constants hardcoded for Gnosis break Ethereum mainnet

crates/networking/p2p/snap/constants.rs:

pub const SECONDS_PER_BLOCK: u64 = 5;          // was 12
pub const MISSING_SLOTS_PERCENTAGE: f64 = 0.98; // was 0.8

These are consumed globally — new_pivot_block_number, block_is_stale, and calculate_staleness_timestamp all depend on them. Changing them for all chains means Ethereum mainnet snap sync now uses a 5-second slot assumption and a 98% missing-slots rate, both of which are wrong for L1. The author's own comment says "this constant should eventually be plumbed through ChainConfig." That plumbing needs to happen before merge; shipping with hardcoded Gnosis values breaks mainnet sync.


Correctness Issues

2. AuRa seal length is not validated on decode

crates/common/types/block.rs (~line 415):

let (seal_bytes, decoder) = decoder.decode_field::<Bytes>("aura_seal")?;
// seal_bytes is accepted without length check

The doc comment on aura_seal says "Always 65 bytes when Some", but this is not enforced. A malicious or malformed peer can send a header with an aura_seal of arbitrary length, which will be stored and potentially re-hashed. Add a length check immediately after decode:

if seal_bytes.len() != 65 {
    return Err(RLPDecodeError::InvalidValue);
}

3. Fee-collector base fee double-credit risk

crates/vm/levm/src/hooks/default_hook.rs in pay_coinbase:

let base_fee_credit = U256::from(gas_to_pay)
    .checked_mul(vm.env.base_fee_per_gas)
    .ok_or(InternalError::Overflow)?;
vm.increase_account_balance(fee_collector, base_fee_credit)?;

This is correct only if gas_to_pay represents gas_used and the coinbase is separately credited with gas_used * priority_fee. If coinbase_fee computed earlier in pay_coinbase already embeds the full gas_price (base + priority) rather than only the priority fee, the base fee portion would be double-credited: once to coinbase and once to fee_collector. This code path is critical; a unit test or explicit cross-check against the pre-London path is needed to confirm there is no double-credit.

4. withdrawal_contract taken from deposit_contract_address

crates/vm/backends/levm/mod.rs (~line 2382):

let withdrawal_contract = chain_config.deposit_contract_address;

deposit_contract_address is the EIP-4881 deposit contract (0x0b98... on Gnosis mainnet). The withdrawal spec calls a different address. Verify this is intentional on Gnosis — if the deposit and withdrawal contract share the same address, add a comment; if not, this is a bug.

5. encode_execute_system_withdrawals length mismatch is silently ignored in release

crates/gnosis/src/system_calls.rs:

debug_assert_eq!(amounts_gwei.len(), addresses.len());

In release mode a mismatched slice pair produces malformed ABI calldata without any error. Since the contract would then be called with garbage, and a revert is fatal to the block, this should be a hard error:

assert_eq!(amounts_gwei.len(), addresses.len(), "withdrawal amounts/addresses length mismatch");

or return a Result.


Design / Architecture Issues

6. is_gnosis() is defined in two separate places

ChainConfig::is_gnosis() in genesis.rs and Network::is_gnosis() in networks.rs both check chain IDs 100/10200. The comment "Keep in sync with crates/gnosis/src/genesis.rs" is a fragile contract. The canonical check should live once in ethrex-gnosis (already exists as is_gnosis_chain()), and both callers should delegate to it.

7. genesis_hash_override skipped by serde but semantically required

#[serde(skip)]
pub genesis_hash_override: Option<H256>,

If a Genesis is round-tripped through serde (serialized then deserialized), the override is silently lost. Any downstream code that calls genesis.get_block() on the deserialized value would compute the wrong hash without any warning. Consider at minimum documenting this constraint as a # Panics / invariant note, or storing the override in a way that survives serialization.

8. OnceLock::set error is silently discarded

crates/common/types/genesis.rs:

let _ = header.hash.set(canonical);

If hash was already populated (e.g., by a hash computed during another code path before get_block() is called), set() fails and returns an error that is silently swallowed. The override would not be applied, but there is no indication of this. At minimum add debug_assert! or a log warning.

9. AuRa detection heuristic relies on an RLP prefix byte

crates/common/types/block.rs:

let is_geth_shape = next_encoded.first().copied() == Some(0xa0);

0xa0 = RLP prefix for a 32-byte string. This works because AuRa step values fit in far fewer bytes. The comment explains this well, but there is an edge case: if an AuRa step value were exactly 31 bytes (a 248-bit integer, step ≈ 10^74), the RLP prefix would be 0x9f, which would correctly be treated as non-geth-shape. The heuristic is sound for real-world step values, but the assumption should be captured in a test with a boundary step value (e.g., U256::from(u32::MAX)).


P2P / Security Issue

10. ENR peers without fork ID are now accepted optimistically

crates/networking/p2p/discovery/discv4_handlers.rs:

-self.peer_table.set_is_fork_id_valid(node_id, false)?;
+self.peer_table.set_is_fork_id_valid(node_id, true)?;

The intent (verify via eth/68+ handshake) is documented and reasonable. However, this widens the set of peers we attempt to connect to and shifts the filtering to a later, more expensive stage. On a high-traffic network, this could increase the number of useless RLPx connections attempted before the status handshake rejects them. This is an acceptable tradeoff, but worth calling out explicitly since it changes security-relevant behavior.


Minor / Style Issues

11. Missing newlines at end of JSON files

chiado_bootnodes.json, gnosis_bootnodes.json, and gnosis_genesis.json all lack a trailing newline. POSIX-compliant text files should end with \n.

12. U256ToBuf local trait is unnecessary

crates/gnosis/src/system_calls.rs:

trait U256ToBuf {
    fn to_big_endian_buf(&self) -> [u8; 32];
}

ethereum_types::U256::to_big_endian(buf: &mut [u8]) exists and takes a mutable slice. You can write:

let mut buf = [0u8; 32];
val.to_big_endian(&mut buf);
out.extend_from_slice(&buf);

The local trait adds an extra abstraction for no gain.

13. apply_gnosis_post_block_calls called from four code paths

The function is duplicated across execute_block, the BAL parallel branch, the sequential pipeline branch, and tracing.rs. This is error-prone — a new execution path added in the future might miss the call. A single hook point (e.g., called from a shared post_block_hooks() helper) would be more maintainable.


What's Done Well

  • The ethrex-gnosis crate is cleanly separated with good module-level documentation.
  • The AuRa header roundtrip and geth-shape regression tests in block.rs are exactly right.
  • The ABI encoder/decoder in system_calls.rs is well-structured with proper overflow checks in read_offset.
  • The genesis_hash_override mechanism is an elegant way to handle non-geth genesis hashing without forking the type.
  • The per-interval storage task fix in snap/client.rs is a non-trivial correctness improvement with a clear explanation.
  • The min_peer_earliest_block / effective_start sync logic is a sensible fix for Chiado's OtterSync-style pruned peers.
  • Selector tests verify ABI encoding against a known-good external value — good defensive testing.

Automated review by Claude (Anthropic) · sonnet · custom prompt

@github-actions
Copy link
Copy Markdown

Lines of code report

Total lines added: 791
Total lines removed: 0
Total lines changed: 791

Detailed view
+--------------------------------------------------------+-------+------+
| File                                                   | Lines | Diff |
+--------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/payload.rs                    | 847   | +6   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/config/networks.rs                | 264   | +36  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/rkyv_utils.rs                     | 221   | +30  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/types/block.rs                    | 1039  | +78  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/types/genesis.rs                  | 1044  | +23  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/gnosis/src/genesis.rs                    | 112   | +112 |
+--------------------------------------------------------+-------+------+
| ethrex/crates/gnosis/src/lib.rs                        | 2     | +2   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/gnosis/src/system_calls.rs               | 197   | +197 |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_handler.rs           | 629   | +24  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_table.rs             | 1170  | +33  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/connection/server.rs | 1410  | +12  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/eth/eth69/status.rs  | 42    | +3   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/eth/eth70/status.rs  | 118   | +3   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/eth/eth71/status.rs  | 42    | +3   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/eth/status.rs        | 109   | +3   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/snap/client.rs            | 1205  | +65  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/block.rs              | 371   | +6   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/fee_market.rs         | 243   | +11  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs                  | 2554  | +106 |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/tracing.rs              | 306   | +7   |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/environment.rs               | 109   | +11  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/default_hook.rs        | 509   | +15  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/utils.rs                     | 636   | +5   |
+--------------------------------------------------------+-------+------+

@github-actions
Copy link
Copy Markdown

🤖 Codex Code Review

  1. Shared snap-sync timing was changed to Gnosis-specific values for every network. In constants.rs SECONDS_PER_BLOCK is now 5 and MISSING_SLOTS_PERCENTAGE is 0.98, and snap_sync.rs uses those unconditionally to advance pivots. On Ethereum this will overestimate how far the chain moved since the last pivot by roughly 3x, so snap sync can chase blocks that are newer than intended and make stale-pivot handling much less stable. This needs to be derived from ChainConfig or otherwise gated by network, not changed globally.

  2. The new AuRa header decoder accepts malformed headers too easily. In block.rs any field 14 whose first byte is not 0xa0 is treated as AuRa, and block.rs accepts any Bytes as aura_seal. There is no follow-up validation that the seal is exactly 65 bytes or that AuRa is even valid for the current chain/fork, so malformed/truncated headers can be misparsed as (aura_step, aura_seal, ...) instead of being rejected. That is a consensus-facing decode relaxation.

  3. The encoder does not enforce the AuRa field invariant it documents. block.rs says aura_step and aura_seal must appear together and AuRa shape must be used when present, but block.rs silently falls back to the geth layout unless both are Some. A partially populated header will therefore hash/serialize incorrectly instead of failing fast, which is the kind of bug that is very hard to diagnose later.

I did not run cargo check here because the environment blocks rustup from creating temp files on this filesystem.


Automated review by OpenAI Codex · gpt-5.4 · custom prompt

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 22, 2026

Greptile Summary

This PR adds initial Gnosis Chain (chain ID 100) and Chiado testnet (chain ID 10200) support to ethrex, including post-block system calls (block-rewards + withdrawal contracts), EIP-1559/4844 fee redirection to a collector contract, AuRa-era genesis hash overrides, and pruning-aware header download.

  • New crates/gnosis crate: embeds genesis JSONs with canonical hash overrides, and provides hand-rolled ABI encoding for the two post-block system calls (executeSystemWithdrawals and reward); both calls are wired into all three LEVM execution pipelines.
  • BlockHeader RLP bifurcation: encode/decode detects AuRa-shaped pre-Merge headers (step + 65-byte seal instead of mix_hash + nonce) via the RLP length prefix of position 14; roundtrip tests cover both shapes.
  • Snap-sync tuning: SECONDS_PER_BLOCK is set to 5 (Gnosis's slot time) and several batch/timeout constants are raised to match geth's limits; min_peer_earliest_block is introduced so header download skips ranges all peers have pruned.

Confidence Score: 3/5

The Gnosis-specific execution logic is well-structured with tests, but one global constant change in the snap-sync layer directly degrades Ethereum mainnet sync behaviour and should be addressed before merging to main.

The snap-sync constant SECONDS_PER_BLOCK is set to 5 (Gnosis's block time) globally, shrinking the staleness window for Ethereum mainnet from ~25 minutes to ~10 minutes and making pivot-block estimation 2.4x too aggressive. The author's own comment acknowledges this needs to be parameterised through ChainConfig. Everything else — the new gnosis crate, AuRa RLP bifurcation, fee-collector hooks, and peer pruning logic — looks correct and is backed by unit tests.

crates/networking/p2p/snap/constants.rs (SECONDS_PER_BLOCK regression) and crates/vm/levm/src/environment.rs (inconsistent min_blob_base_fee default).

Important Files Changed

Filename Overview
crates/networking/p2p/snap/constants.rs Global snap-sync tuning constants changed for Gnosis compatibility; SECONDS_PER_BLOCK hardcoded to 5 (Gnosis value), regressing Ethereum mainnet staleness-window and pivot-estimation logic.
crates/gnosis/src/system_calls.rs New file: hand-rolled ABI encoding/decoding for the two Gnosis post-block system calls (withdrawal contract and POSDAO block-rewards contract); well-tested with round-trip and selector tests.
crates/gnosis/src/genesis.rs New file: loads embedded Gnosis/Chiado genesis JSON and applies canonical hash overrides to handle AuRa-era genesis blocks; tests verify hash matches live networks.
crates/common/types/block.rs Adds aura_step/aura_seal header fields and bifurcated RLP encode/decode path; detection heuristic (0xa0 prefix) is sound, but partial field population silently falls back to geth encoding without an error.
crates/vm/backends/levm/mod.rs Adds apply_gnosis_post_block_calls (withdrawal + block-rewards system calls) to all three execution pipelines, and skips native EIP-4895 withdrawal credits on Gnosis.
crates/common/types/genesis.rs Adds Gnosis-specific ChainConfig fields (fee collector, block-rewards contract, POSDAO block, Balancer hardfork, min blob price) and genesis_hash_override for canonical genesis hash override.
crates/networking/p2p/peer_handler.rs Reads min_peer_earliest_block before header download and skips to the peer-served window on Chiado/pruned networks; scoring change marks partial responses as failures to avoid score saturation.
crates/networking/p2p/snap/client.rs Refactors storage-range task scheduling to separate bulk and per-interval paths, fixing a stuck-account bug where completed big accounts were re-queued indefinitely.
crates/vm/levm/src/environment.rs Adds fee_collector and min_blob_base_fee to EVMConfig; min_blob_base_fee default uses literal 1 rather than MIN_BASE_FEE_PER_BLOB_GAS constant used elsewhere.
crates/networking/p2p/peer_table.rs Adds earliest_block field to PeerData, set_peer_earliest_block send handler, and min_peer_earliest_block request handler for pruning-aware peer selection.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Block received] --> B{is_gnosis?}
    B -- No --> C[Standard EIP-4895 withdrawal credits]
    B -- Yes --> D[Skip native withdrawal credits]
    D --> E{is_shanghai_activated?}
    E -- Yes --> F[Call withdrawal contract\nexecuteSystemWithdrawals\ndeposit_contract_address]
    E -- No --> G[Skip withdrawal contract]
    F --> H[Call block-rewards contract\nreward coinbase,0\nblock_rewards_contract]
    G --> H
    H --> I[Decode receivers+amounts\nCredit native balances]
    C --> J[Finalize block state]
    I --> J

    K[pay_coinbase hook] --> L{fee_collector set?}
    L -- Yes --> M[Credit base_fee to fee_collector\ninstead of burning]
    L -- No --> N[Burn base fee standard]

    O[deduct_caller hook] --> P{fee_collector set?}
    P -- Yes --> Q[Credit blob_gas_cost to fee_collector]
    P -- No --> R[Burn blob fee standard]
Loading

Comments Outside Diff (2)

  1. crates/networking/p2p/snap/constants.rs, line 162-172 (link)

    P1 SECONDS_PER_BLOCK is hardcoded to Gnosis's 5 s block time globally

    The comment in this PR explicitly says "this constant should eventually be plumbed through ChainConfig", acknowledging the regression. On Ethereum mainnet (12 s blocks), snap sync is now affected: the staleness window shrinks from 128 × 12 = 1 536 s (~25 min) to 128 × 5 = 640 s (~10 min), and new_pivot_block_number overestimates blocks elapsed by ×2.4, potentially requesting pivot numbers that haven't been produced yet. This forces unnecessary pivot re-selections and wasted state-root re-downloads on Ethereum mainnet. The constant must be read from ChainConfig (or passed as a parameter) before this lands on main so Ethereum sync isn't degraded.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: crates/networking/p2p/snap/constants.rs
    Line: 162-172
    
    Comment:
    **`SECONDS_PER_BLOCK` is hardcoded to Gnosis's 5 s block time globally**
    
    The comment in this PR explicitly says "this constant should eventually be plumbed through `ChainConfig`", acknowledging the regression. On Ethereum mainnet (12 s blocks), snap sync is now affected: the staleness window shrinks from `128 × 12 = 1 536 s (~25 min)` to `128 × 5 = 640 s (~10 min)`, and `new_pivot_block_number` overestimates blocks elapsed by ×2.4, potentially requesting pivot numbers that haven't been produced yet. This forces unnecessary pivot re-selections and wasted state-root re-downloads on Ethereum mainnet. The constant must be read from `ChainConfig` (or passed as a parameter) before this lands on main so Ethereum sync isn't degraded.
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. crates/common/types/block.rs, line 246-270 (link)

    P2 Partial AuRa fields silently fall back to geth encoding

    If a BlockHeader is constructed with aura_step = Some(…) but aura_seal = None (or vice versa), the condition if let (Some(aura_step), Some(aura_seal)) = (…) is false and the header is silently encoded with the geth prev_randao/nonce shape, even though the caller's intent was AuRa. This means the hash computed for the block will be wrong without any error. An assertion or a returned error when exactly one of the two fields is Some would catch this at the point of creation rather than producing a silently incorrect block hash.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: crates/common/types/block.rs
    Line: 246-270
    
    Comment:
    **Partial AuRa fields silently fall back to geth encoding**
    
    If a `BlockHeader` is constructed with `aura_step = Some(…)` but `aura_seal = None` (or vice versa), the condition `if let (Some(aura_step), Some(aura_seal)) = (…)` is `false` and the header is silently encoded with the geth `prev_randao`/`nonce` shape, even though the caller's intent was AuRa. This means the hash computed for the block will be wrong without any error. An assertion or a returned error when exactly one of the two fields is `Some` would catch this at the point of creation rather than producing a silently incorrect block hash.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
crates/networking/p2p/snap/constants.rs:162-172
**`SECONDS_PER_BLOCK` is hardcoded to Gnosis's 5 s block time globally**

The comment in this PR explicitly says "this constant should eventually be plumbed through `ChainConfig`", acknowledging the regression. On Ethereum mainnet (12 s blocks), snap sync is now affected: the staleness window shrinks from `128 × 12 = 1 536 s (~25 min)` to `128 × 5 = 640 s (~10 min)`, and `new_pivot_block_number` overestimates blocks elapsed by ×2.4, potentially requesting pivot numbers that haven't been produced yet. This forces unnecessary pivot re-selections and wasted state-root re-downloads on Ethereum mainnet. The constant must be read from `ChainConfig` (or passed as a parameter) before this lands on main so Ethereum sync isn't degraded.

### Issue 2 of 3
crates/vm/levm/src/environment.rs:93-97
Inconsistent default for `min_blob_base_fee` — literal `1` is used here while every other callsite in the PR uses `MIN_BASE_FEE_PER_BLOB_GAS`. They are equal today, but if the constant is ever changed the two defaults will diverge silently.

```suggestion
            min_blob_base_fee: chain_config.min_blob_gas_price.unwrap_or(MIN_BASE_FEE_PER_BLOB_GAS),
        }
    }

    /// This function is used for running the EF tests. If you don't
```

### Issue 3 of 3
crates/common/types/block.rs:246-270
**Partial AuRa fields silently fall back to geth encoding**

If a `BlockHeader` is constructed with `aura_step = Some(…)` but `aura_seal = None` (or vice versa), the condition `if let (Some(aura_step), Some(aura_seal)) = (…)` is `false` and the header is silently encoded with the geth `prev_randao`/`nonce` shape, even though the caller's intent was AuRa. This means the hash computed for the block will be wrong without any error. An assertion or a returned error when exactly one of the two fields is `Some` would catch this at the point of creation rather than producing a silently incorrect block hash.

Reviews (1): Last reviewed commit: "feat(l1): implement support for the gnos..." | Re-trigger Greptile

Comment on lines +93 to 97
min_blob_base_fee: chain_config.min_blob_gas_price.unwrap_or(1),
}
}

/// This function is used for running the EF tests. If you don't
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Inconsistent default for min_blob_base_fee — literal 1 is used here while every other callsite in the PR uses MIN_BASE_FEE_PER_BLOB_GAS. They are equal today, but if the constant is ever changed the two defaults will diverge silently.

Suggested change
min_blob_base_fee: chain_config.min_blob_gas_price.unwrap_or(1),
}
}
/// This function is used for running the EF tests. If you don't
min_blob_base_fee: chain_config.min_blob_gas_price.unwrap_or(MIN_BASE_FEE_PER_BLOB_GAS),
}
}
/// This function is used for running the EF tests. If you don't
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/vm/levm/src/environment.rs
Line: 93-97

Comment:
Inconsistent default for `min_blob_base_fee` — literal `1` is used here while every other callsite in the PR uses `MIN_BASE_FEE_PER_BLOB_GAS`. They are equal today, but if the constant is ever changed the two defaults will diverge silently.

```suggestion
            min_blob_base_fee: chain_config.min_blob_gas_price.unwrap_or(MIN_BASE_FEE_PER_BLOB_GAS),
        }
    }

    /// This function is used for running the EF tests. If you don't
```

How can I resolve this? If you propose a fix, please make it concise.

@github-actions
Copy link
Copy Markdown

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 2.982 ± 0.049 2.937 3.076 1.08 ± 0.02
main_levm_BubbleSort 2.770 ± 0.018 2.751 2.815 1.00 ± 0.01
pr_revm_BubbleSort 2.987 ± 0.044 2.931 3.087 1.08 ± 0.02
pr_levm_BubbleSort 2.768 ± 0.014 2.748 2.790 1.00

Benchmark Results: ERC20Approval

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Approval 990.1 ± 9.8 974.7 1007.7 1.02 ± 0.01
main_levm_ERC20Approval 1053.1 ± 6.7 1043.8 1066.3 1.08 ± 0.01
pr_revm_ERC20Approval 971.8 ± 8.0 964.0 992.3 1.00
pr_levm_ERC20Approval 1037.9 ± 5.3 1028.1 1044.0 1.07 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 133.3 ± 0.8 132.4 134.6 1.01 ± 0.01
main_levm_ERC20Mint 157.5 ± 1.2 156.4 160.1 1.19 ± 0.02
pr_revm_ERC20Mint 132.6 ± 1.3 131.1 134.7 1.00
pr_levm_ERC20Mint 155.6 ± 1.3 154.3 158.8 1.17 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 232.3 ± 2.1 229.8 237.8 1.01 ± 0.01
main_levm_ERC20Transfer 261.3 ± 1.5 259.0 263.1 1.14 ± 0.01
pr_revm_ERC20Transfer 229.1 ± 1.4 227.3 231.9 1.00
pr_levm_ERC20Transfer 258.8 ± 3.7 255.0 267.5 1.13 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 226.2 ± 0.9 224.9 228.4 1.00
main_levm_Factorial 271.6 ± 1.7 269.1 275.6 1.20 ± 0.01
pr_revm_Factorial 230.7 ± 11.8 224.9 262.0 1.02 ± 0.05
pr_levm_Factorial 271.3 ± 1.0 269.3 272.6 1.20 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.653 ± 0.037 1.604 1.734 1.03 ± 0.02
main_levm_FactorialRecursive 1.624 ± 0.033 1.586 1.669 1.01 ± 0.02
pr_revm_FactorialRecursive 1.621 ± 0.040 1.554 1.679 1.01 ± 0.03
pr_levm_FactorialRecursive 1.603 ± 0.014 1.588 1.635 1.00

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 207.4 ± 1.6 204.9 210.0 1.01 ± 0.01
main_levm_Fibonacci 257.7 ± 13.8 248.6 294.7 1.25 ± 0.07
pr_revm_Fibonacci 206.2 ± 0.5 205.4 207.1 1.00
pr_levm_Fibonacci 249.8 ± 3.0 244.8 256.7 1.21 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 849.9 ± 17.1 826.3 875.1 1.18 ± 0.03
main_levm_FibonacciRecursive 720.7 ± 6.7 714.1 732.7 1.00
pr_revm_FibonacciRecursive 858.3 ± 7.4 849.6 872.8 1.19 ± 0.02
pr_levm_FibonacciRecursive 727.4 ± 17.5 712.8 773.0 1.01 ± 0.03

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.2 ± 0.1 8.1 8.3 1.00 ± 0.01
main_levm_ManyHashes 9.9 ± 0.3 9.7 10.5 1.21 ± 0.03
pr_revm_ManyHashes 8.2 ± 0.1 8.1 8.3 1.00
pr_levm_ManyHashes 9.8 ± 0.1 9.7 10.1 1.20 ± 0.01

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 255.1 ± 1.9 252.4 258.4 1.08 ± 0.01
main_levm_MstoreBench 236.2 ± 0.8 234.8 237.9 1.00
pr_revm_MstoreBench 254.9 ± 5.5 252.3 270.4 1.08 ± 0.02
pr_levm_MstoreBench 237.1 ± 3.4 234.5 246.3 1.00 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 289.4 ± 0.8 288.1 290.7 1.00
main_levm_Push 291.9 ± 0.9 290.4 293.4 1.01 ± 0.00
pr_revm_Push 289.6 ± 1.2 287.7 291.5 1.00 ± 0.00
pr_levm_Push 295.5 ± 11.5 290.8 328.1 1.02 ± 0.04

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 167.9 ± 3.1 161.5 171.3 1.67 ± 0.03
main_levm_SstoreBench_no_opt 100.6 ± 0.3 100.2 101.1 1.00 ± 0.00
pr_revm_SstoreBench_no_opt 166.1 ± 4.7 160.9 173.4 1.65 ± 0.05
pr_levm_SstoreBench_no_opt 100.4 ± 0.2 100.2 100.7 1.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant