Skip to content

Conversation

fmoletta
Copy link
Contributor

@fmoletta fmoletta commented Aug 5, 2024

Motivation

Being able to fully validate execute and store blocks received by engine_newPayloadV3

Description

  • Add block validation, execution & storing to engine_newPayloadV3 endpoint

Fixes:

  • Genesis.get_block:
    • Now uses the INITIAL_BASE_FEE as base_fee_per_gas
    • Now computes roots instead of using zero as default
    • Now uses default values for cancun fields instead of leaving them as None

(With these fixes the genesis' block hash now matches the parentBlockHash of the next block when running with kurtosis)

  • beacon_root_contract_call now sets the block's gas_limit to avoid tx validation errors

Misc:

  • compute_transactions_root is now a standalone function matching the other compute functions
  • Log more steps of the engine_newPayloadV3 endpoint
  • Improve api of ExecutionPayloadV3 & PayloadStatus

Other
We can now execute payloads when running with kurtosis 🚀
Captura de pantalla 2024-08-07 a la(s) 17 38 59

Disclaimer: We are still getting some execution errors in later blocks that we need to look into (They are all currently passing the block validations)

Closes #51

@fmoletta fmoletta changed the base branch from main to store-cancun-time August 5, 2024 19:26
github-merge-queue bot pushed a commit that referenced this pull request Aug 6, 2024
…idation (#220)

**Motivation**

Fetch cancun time from DB when validating payload v3 timestamp

<!-- Why does this pull request exist? What are its goals? -->

**Description**

* Store cancun_time in db
* Use the stored cancun_time when validating payload timestamp in
`eth_newPayloadV3`
* Replace update methods for chain data in `Store` with
`set_chain_config`

Bonus:

* Move `NewPayloadV3Request` to its corresponding module and update is
parsing to match the rest of the codebase

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None, but is part of #51
Base automatically changed from store-cancun-time to main August 6, 2024 14:11
ElFantasma pushed a commit that referenced this pull request Aug 6, 2024
**Motivation**

Having a way to obtain lates/earliest/pending/etc block numbers

<!-- Why does this pull request exist? What are its goals? -->

**Description**

* Add get and update methods for earliest, latest, finalized, safe &
pending block number to `Store` & `StoreEngine`
* Resolve block numbers from tag in rpc methods

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None, but fixes many and enables others
github-merge-queue bot pushed a commit that referenced this pull request Aug 7, 2024
…pts & withdrawals (#225)

**Motivation**

These roots are currently being calculated using `from_sorted_iter` but
without being sorted beforehand. This PR replaces this behavior with
inserting directly into the trie to ensure that it is ordered, then
computing the root (The same fix that has been previously applied to
storage root)

**Description**

Fixes `compute_transactions_root`, `compute_receipts_root` &
`compute_withdrawals_root`
<!-- A clear and concise general description of the changes this PR
introduces -->

**Notes**

After this change, the payloads created by kurtosis local net now pass
the block hash validations in `engine_NewPayloadV3`
<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None, but is needed for #51

Co-authored-by: Federica Moletta <federicamoletta@MacBook-Pro-de-Federica.local>
ilitteri pushed a commit that referenced this pull request Sep 24, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
We are using `String` and `&str` for URLs instead of the more specific
`Url`.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Replace CLI and occurrences, primarly in `EthClient` to use `Url`
instead.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Related: #2673
github-merge-queue bot pushed a commit that referenced this pull request Sep 25, 2025
**Motivation**

The CI is broken due to not having space left to run the jobs

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
github-merge-queue bot pushed a commit that referenced this pull request Sep 25, 2025
…4646)

**Motivation**

Our last attempt at making a release failed because protobuf is now a
dependency for building (see [this
action](https://github.com/lambdaclass/ethrex/actions/runs/17991396735/job/51181982770)).
This should fix it.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
github-merge-queue bot pushed a commit that referenced this pull request Sep 25, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Execution with eth_getProof had some caveats regarding the trie. For
making it work we need to do 2 things:
1. Pre-inject possible nodes to the trie
2. Make a modification to the MPT in case we don't find a missing node.

The `1` was already done in the code but wasn't working properly, the
problem was just that the root node wasn't being inserted into the nodes
that were used for building the trie that's used for getting potential
child nodes.

The 2 is a modification that we don't want in our MPT so we didn't carry
along [with that](#2952).
However, in execution without zkVM we have the possibility of inserting
arbitrary nodes with the hashes that we want and RLP content that
doesn't necessarily match to that hash, so we can "deceive" the trie
into thinking it has some nodes when in fact they are just dummy nodes.
How can we use it to our advantage? We insert dummy branch nodes in
every single place where a storage node is being referenced but it's
missing. This way, if we want to do a trie restructuring we will find
the node that otherwise we wouldn't have found, and the good thing is
that we don't care about the contents of this node because they won't
change, in this particular case the node will be referenced by a one
nibble extension node. For more info read
https://github.com/kkrt-labs/zk-pig/blob/main/docs/modified-mpt.md#modified-mpt-implementation




<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 25, 2025
**Motivation**
We want to stop using the keccak-hash crate and implement it with sha3.
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Removed the keccak-hash crate and implemented it with sha3
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #4535

---------

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 26, 2025
**Motivation**
The mempool has several locks being used at the same time, which is
prone to concurrency issues
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Unify the mempool state in a single struct and use only one lock for it,
since we write everything at the same time, this shouldn't affect
performance, since we can still do concurrent readings
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #4592

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 26, 2025
…4656)

**Motivation**
We currently return a "NonceTooLow" error when we fail to replace a
mempool transaction (aka we receive a transaction with the same sender
and nonce as an existing one but without a higher fee value). This
doesn't make any sense and can be quite confusing. This PR adds a
MempoolError enum variant for this specific case.
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Use a specific error variant when we fail to replace a mempool
transaction
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None
github-merge-queue bot pushed a commit that referenced this pull request Sep 26, 2025
**Motivation**
The removal of elements from the mempool when it is full is not
efficient.
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Now the array that represent the order of insertion to the mempool is a
vecdeque, which is not changed when an arbitrary element is removed from
the mempool.
Only when the mempool is full, we remove from the vecdeque until we find
an element present in the mempool.
Also if the vecdeque is greater than 150% of the maximum mempool size,
we prune it, keeping only the txs that are actually in the mempool,
preserving the order.
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes
#4605

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 29, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
CLI reference is hard to find across de docs.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Add links to CLI reference at startup and configuration docs

<!-- Link to issues: Resolves #111, Resolves #222 -->

---------

Co-authored-by: Martin Paulucci <martin.c.paulucci@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Sep 29, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
We don't set the `extra_data` field in the block header.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Use a CLI provided `extra_data` string or a default one.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #4662
github-merge-queue bot pushed a commit that referenced this pull request Sep 29, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
Currently when someone wants to upgrade the ethrex version of an L2,
they have to perform an UUPS upgrade to the contract in order to upgrade
the verification keys.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Add a function to upgrade SP1 and RISC0 VKs without the need of a full
upgrade to the contract

<!-- Link to issues: Resolves #111, Resolves #222 -->
github-merge-queue bot pushed a commit that referenced this pull request Sep 29, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Block number being displayed on screen was wrong.
We now do store the actual block number to execute and this is used for
the post-state proofs, whereas the `block number - 1` is used for the
pre-state proofs.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
github-merge-queue bot pushed a commit that referenced this pull request Sep 29, 2025
**Motivation**
We want to make the mempool max size a parameter
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Adds the mempool max size as a parameter to ethrex command
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #4600
github-merge-queue bot pushed a commit that referenced this pull request Sep 29, 2025
…s in `TxBroadcaster` (#4675)

**Motivation**

We were seeing spikes of 3~10Gb on post-sync execution, most of it was
due to `resize_rehash` during the `add_txs` of the `TxBroadcaster`.

**Description**

This PR replace the current hashmap of `(tx_hash, peer_id) -> Instant`
for a less duplicated `tx_hash -> (peer_bitmap, last_seen)` + another
`peer_id -> peer_index`. This removes orders of magnitud of entries,
going from 27M to less than 100k. Now all the memory taken from the
TxBroadcaster disappeared from our memory flamegraphs.

WIP: ~I'm right now analyzing the execution of the client throughout the
weekend, we still appear to have a memory issue.~ This was related to a
change in rocksdb that enabled transaction. It didn't affected this fix.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**


<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
JereSalo added a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**
Remove rem as a workspace dependency
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Remove `revm` feature from all workspace crates
* Remove revm backend from `ethrex-vm` crate
* Remove `tooling/ef_tests/state` and
`crates/vm/levm/bench/revm_comparison` from workspace (They still retain
revm as a dependency)
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
…4656)

**Motivation**
We currently return a "NonceTooLow" error when we fail to replace a
mempool transaction (aka we receive a transaction with the same sender
and nonce as an existing one but without a higher fee value). This
doesn't make any sense and can be quite confusing. This PR adds a
MempoolError enum variant for this specific case.
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Use a specific error variant when we fail to replace a mempool
transaction
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**
The removal of elements from the mempool when it is full is not
efficient.
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Now the array that represent the order of insertion to the mempool is a
vecdeque, which is not changed when an arbitrary element is removed from
the mempool.
Only when the mempool is full, we remove from the vecdeque until we find
an element present in the mempool.
Also if the vecdeque is greater than 150% of the maximum mempool size,
we prune it, keeping only the txs that are actually in the mempool,
preserving the order.
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes
#4605

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
CLI reference is hard to find across de docs.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Add links to CLI reference at startup and configuration docs

<!-- Link to issues: Resolves #111, Resolves #222 -->

---------

Co-authored-by: Martin Paulucci <martin.c.paulucci@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
We don't set the `extra_data` field in the block header.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Use a CLI provided `extra_data` string or a default one.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #4662
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
Currently when someone wants to upgrade the ethrex version of an L2,
they have to perform an UUPS upgrade to the contract in order to upgrade
the verification keys.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Add a function to upgrade SP1 and RISC0 VKs without the need of a full
upgrade to the contract

<!-- Link to issues: Resolves #111, Resolves #222 -->
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Block number being displayed on screen was wrong.
We now do store the actual block number to execute and this is used for
the post-state proofs, whereas the `block number - 1` is used for the
pre-state proofs.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**
We want to make the mempool max size a parameter
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Adds the mempool max size as a parameter to ethrex command
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #4600
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
…s in `TxBroadcaster` (#4675)

**Motivation**

We were seeing spikes of 3~10Gb on post-sync execution, most of it was
due to `resize_rehash` during the `add_txs` of the `TxBroadcaster`.

**Description**

This PR replace the current hashmap of `(tx_hash, peer_id) -> Instant`
for a less duplicated `tx_hash -> (peer_bitmap, last_seen)` + another
`peer_id -> peer_index`. This removes orders of magnitud of entries,
going from 27M to less than 100k. Now all the memory taken from the
TxBroadcaster disappeared from our memory flamegraphs.

WIP: ~I'm right now analyzing the execution of the client throughout the
weekend, we still appear to have a memory issue.~ This was related to a
change in rocksdb that enabled transaction. It didn't affected this fix.

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
SDartayet pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**


<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
SDartayet added a commit that referenced this pull request Sep 30, 2025
**Motivation**
Remove rem as a workspace dependency
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Remove `revm` feature from all workspace crates
* Remove revm backend from `ethrex-vm` crate
* Remove `tooling/ef_tests/state` and
`crates/vm/levm/bench/revm_comparison` from workspace (They still retain
revm as a dependency)
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2025
**Motivation**

`RLPxInitiatorError` was not in use.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Oct 1, 2025
…perf (#4684)

**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number

<img width="3024" height="3826" alt="image"
src="https://github.com/user-attachments/assets/31ef9703-e365-4c36-821c-df0738237805"
/>
github-merge-queue bot pushed a commit that referenced this pull request Oct 1, 2025
**Motivation**

This PR refactors the KZG functionality by moving it from the
ethrex-common crate to a dedicated ethrex-crypto crate. This change
improves code organization by consolidating cryptographic operations in
a single location.

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: ilitteri <ilitteri@fi.uba.ar>
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.

Implement engine_newPayloadV3 (partially) endpoint
3 participants