Skip to content

feat(l2): based full-sync #3243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 43 commits into
base: based/p2p-scaffolding
Choose a base branch
from
Draft

Conversation

tomip01
Copy link
Contributor

@tomip01 tomip01 commented Jun 19, 2025

Motivation

Description

Closes #issue_number

juanbono and others added 16 commits June 18, 2025 18:53
**Motivation**

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

This PRs makes sure we batch the insertions of new code into the DB. For
that, it adds a new field to the `UpdatesBatch` struct and modifies the
relevant functions.

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

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

Closes #3193
**Motivation**

Dissallow unwraps on l1.

**Description**

This pr drops unwraps on crate common in networking. Test's unwraps
remain. Resolves partially #2879

Closes #2879
**Motivation**

Publish the mdbook of this repo (book.toml) to https://docs.ethrex.xyz/

**Description**

These changes are to leave the setup like this:

* https://docs.ethrex.xyz/ will have the mdbook
* https://docs.ethrex.xyz/benchmarks will have the benchmarks graphs
* https://docs.ethrex.xyz/flamegraphs will have the flamegraphs
**Motivation**

Our L2 documentation lacks a clear structure.

**Description**

This PR reorganizes our L2 docs, also moving documentation on L2
load-tests under `Developers`->`L2 load-tests`. The rest of the
documentation was restructured to a structure like that of other L1 and
L2 projects:

<img width="297" alt="new structure of L2 docs"
src="https://github.com/user-attachments/assets/b9c89a10-c175-4610-b141-3fa4b0097cfb"
/>

Documentation on smart contracts still needs to be filled and is only
acting as a placeholder for now.

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

Closes #3174
**Motivation**

Our build payload process was not computing and setting the `logs_bloom`
field on the block's header, which resulted in other clients rejecting
blocks built by us. This came up when testing setting up a localnet with
ethrex along with other clients.

**Description**

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

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

Closes #issue_number
**Motivation**

Fix for #3217

**Description**

Fixes lack of permissions for mdbook workflow, and new path to publish
L1 block proving benchmark
**Motivation**

- Benchmarks are a key piece for measuring performance, the code wasn't
very concise so this simplifies it to make further changes that will
help us work on performance in LEVM.

**Description**

Behavior is pretty much the same, the code is just more clear now.

Closes #issue_number
…ins empty (#3228)

**Motivation**

The l2 committer was stuck because it failed when trying to encode state
diffs of an account that was initially empty, remained empty after the
transaction so the AccountUpdate was completely empty and state diff
creation failed with `StateDiffError::EmptyAccountDiff`

**Description**

- `LEVM::get_state_transitions` now checks if the account was initially
empty, in case it was and it remains empty after the transaction do not
count it as an AccountUpdate
**Motivation**

`EstimateGasPriceError` is actually an error triggered in
`estimate_gas`.

**Description**

Renames `EstimateGasPriceError` to `EstimateGasError`

Closes None
…3192)

**Motivation**
In the `ProofCoordinator`'s `handle_listens` function, a semaphore is
used to limit the number of concurrent connections. This constraint can
be removed since it is not necessary and adds complexity to the
codebase.

**Description**
Removes the semaphore and the concurrent connections limit from the
`ProofCoordinator`'s `handle_listens` function.

It also adds the `ConnectionHandler::spawn` method to encapsulate the
`ConnectionHandler` startup logic.
…rt for ContextResult in some places (#3134)

**Motivation**

- `ExecutionResult` isn't accurate for interaction between callframes so
the goal is to replace it for `ContextResult` that has the necessary
data. Also, `Substate` should be as specified in Yellow Paper.

**Description**

- Add logs to substate and remove them from the callframe. They belong
to the substate according to section 6.1 of the [yellow
paper](https://ethereum.github.io/yellowpaper/paper.pdf).
- Replace usage of ExecutionReport in callframes execution for
ContextResult. The former contained data that wasn't necessary and
caused a little bit of confusion. In ContextResult we have only the data
we need: `gas_used`, `output` and `result`.
- Move `is_create` logic to `CallFrame`. So now it is not
`create_op_called`, it is `is_create` and it takes into account external
transactions, not only internal `create`.
- Make functions `handle_opcode_result()` and `handle_opcode_error()`
prettier.
- `finalize_execution()` now returns an `ExecutionReport` given a
`ContextResult`
- Refactor `increase_consumed_gas()`, behavior is still the same but
logic before was kinda repetitive.

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

Closes #3045

---------

Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
Co-authored-by: juanbono <[email protected]>
Co-authored-by: fedacking <[email protected]>
**Motivation**

The default value of `proof-coordinator.dev-mode` is set to true. This
means the only way to set it to false is through the environment
variable `ETHREX_PROOF_COORDINATOR_DEV_MODE`. This is also inconsistent
with the rest of the parameters, where we set dev values only in the
Makefile.

**Description**

Changes the default value of `dev-mode` to false.

Closes None
**Motivation**

As outlined in #3124, sometimes a committed batch can't be verified or
the operator wants to prevent it from going though.

**Description**

This PR implements a `revertBatch` function that allows reverting back
to any batch, as long as no verified batches are being discarded.

There's also a l2 CLI subcommand, revert-batch that lets you revert a
batch and remove it from the local database.

Usage on local network:
```
PRIVATE_KEY=key cargo run --features l2,rollup_storage_libmdbx -- l2 revert-batch \
  <batch to revert to> <OnChainProposer address> \
  --datadir dev_ethrex_l2 --network test_data/genesis-l2.json
```

Closes #3124
@tomip01 tomip01 changed the base branch from main to based/p2p-scaffolding June 19, 2025 20:24
Copy link

github-actions bot commented Jun 19, 2025

Lines of code report

Total lines added: 1452
Total lines removed: 337
Total lines changed: 1789

Detailed view
+-----------------------------------------------------------------+-------+------+
| File                                                            | Lines | Diff |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ef_tests/blockchain/test_runner.rs                   | 312   | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ef_tests/state/report.rs                             | 834   | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ef_tests/state/runner/levm_runner.rs                 | 387   | +5   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ef_tests/state/runner/mod.rs                         | 259   | +10  |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ef_tests/state/runner/revm_runner.rs                 | 564   | +10  |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/bench/import_blocks_benchmark.rs              | 35    | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/decode.rs                                     | 68    | -4   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs                               | 346   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/l2/command.rs                                 | 464   | +94  |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/networks.rs                                   | 91    | -1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/utils.rs                                      | 144   | -4   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/blockchain.rs                          | 735   | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/error.rs                               | 136   | +17  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/mempool.rs                             | 664   | +39  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/metrics/metrics_transactions.rs        | 149   | +26  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/blockchain/vm.rs                                  | 100   | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/common/constants.rs                               | 42    | +40  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/account.rs                           | 188   | -10  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/block.rs                             | 753   | +4   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/block_execution_witness.rs           | 428   | +7   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/genesis.rs                           | 684   | +31  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/common/types/requests.rs                          | 198   | -5   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/based/block_fetcher.rs                         | 438   | -4   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/based/state_updater.rs                         | 309   | +40  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/common/src/l1_messages.rs                      | 96    | +96  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/common/src/state_diff.rs                       | 506   | -10  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/system_contracts_updater/main.rs | 49    | +11  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/prover/zkvm/interface/src/execution.rs         | 338   | -3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sdk/src/calldata.rs                            | 582   | +217 |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sdk/src/sdk.rs                                 | 512   | +20  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/block_producer/payload_builder.rs    | 328   | -6   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/errors.rs                            | 267   | +5   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs                      | 545   | -3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/metrics.rs                           | 111   | -1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/mod.rs                               | 150   | -8   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/proof_coordinator.rs                 | 495   | -18  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/api.rs                             | 92    | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store.rs                           | 288   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store_db/in_memory.rs              | 231   | +18  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store_db/libmdbx.rs                | 329   | +29  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/storage/src/store_db/redb.rs                   | 332   | +27  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/mod.rs                                   | 4     | -1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_handler.rs                    | 715   | +45  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/based.rs                      | 199   | +75  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/connection.rs                 | 1423  | +40  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/message.rs                    | 242   | +23  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/snap.rs                       | 408   | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync.rs                            | 612   | +37  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync/state_healing.rs              | 133   | -3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync_manager.rs                    | 196   | +69  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/clients/eth/errors.rs              | 226   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/clients/eth/mod.rs                 | 1223  | +11  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/engine/fork_choice.rs              | 358   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/engine/payload.rs                  | 672   | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/mod.rs                         | 171   | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/l2/l1_message.rs                   | 88    | +88  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/types/block.rs                     | 182   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/types/payload.rs                   | 251   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/types/receipt.rs                   | 235   | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/types/transaction.rs               | 95    | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/utils.rs                           | 370   | -14  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/storage/api.rs                                    | 269   | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/storage/store.rs                                  | 1370  | +11  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/in_memory.rs                     | 675   | +14  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/libmdbx.rs                       | 1479  | +22  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/redb.rs                          | 1312  | +21  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs                           | 514   | +8   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/tracing.rs                       | 51    | +8   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/revm/mod.rs                           | 558   | +2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/revm/tracing.rs                       | 222   | +8   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/bench/revm_comparison/src/benchmark.rs    | 63    | +29  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/bench/revm_comparison/src/compile.rs      | 43    | -26  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/bench/revm_comparison/src/levm_bench.rs   | 65    | +65  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/bench/revm_comparison/src/lib.rs          | 2     | -169 |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/bench/revm_comparison/src/revm_bench.rs   | 26    | +26  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/call_frame.rs                         | 204   | -4   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/db/cache.rs                           | 28    | -3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/db/gen_db.rs                          | 261   | -6   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/errors.rs                             | 190   | +14  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/execution_handlers.rs                 | 208   | -30  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/default_hook.rs                 | 318   | +1   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/push.rs               | 78    | +37  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/system.rs             | 742   | -2   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcodes.rs                            | 323   | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/utils.rs                              | 455   | +3   |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs                                 | 198   | +12  |
+-----------------------------------------------------------------+-------+------+
| ethrex/crates/vm/witness_db.rs                                  | 87    | -2   |
+-----------------------------------------------------------------+-------+------+

LeanSerra and others added 11 commits June 19, 2025 21:32
**Motivation**

Most Ethereum clients let you speed up or overwrite transactions by
accepting new transactions with the same nonce but higher fees.
This PR adds validations similar to what [Geth
does](https://github.com/ethereum/go-ethereum/blob/09289fd154a45420ec916eb842bfb172df7e0d83/core/txpool/legacypool/list.go#L298-L345)
but without the `PriceBump` minimum bump percentage

**Description**

- for eip-1559 check that both `max_fee_per_gas` and
`max_priority_fee_per_gas` are greater in the new tx
- for legacy tx check that new `gas_price` is greater in the new tx
- for eip-4844 txs check that `max_fee_per_gas`,
`max_priority_fee_per_gas` and `max_fee_per_blob_gas` are grater in the
new tx

**How to test**

- Send a tx with very low gas price

```shell
rex send --gas-price 1 --priority-gas-price 1 --rpc-url http://localhost:1729 0x2B29Bea668B044b2b355C370f85b729bcb43EC40 100000000000000 0x8f87d3aca3eff8132256f69e17df5ba3c605e1b5f4e2071d56f7e6cd66047cc2
```

- Check tx pool the you should see something like
`"maxPriorityFeePerGas":"0x1","maxFeePerGas":"0x1","gasPrice":"0x1"` the
tx will probably get stuck

```
curl 'http://localhost:1729' --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "txpool_content",
  "params": []
}' -H 'accept: application/json' -H 'Content-Type: application/json'
```

- Send tx with higher gas

```shell
rex send --gas-price 100000000 --priority-gas-price 100000000 --rpc-url http://localhost:1729 0x2B29Bea668B044b2b355C370f85b729bcb43EC40 100000000000000 0x8f87d3aca3eff8132256f69e17df5ba3c605e1b5f4e2071d56f7e6cd66047cc2
```

- Check that the tx pool you should see something like
`"maxPriorityFeePerGas":"0x5f5e100","maxFeePerGas":"0x5f5e100","gasPrice":"0x5f5e100"`

```shell
curl 'http://localhost:1729' --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "txpool_content",
  "params": []
}' -H 'accept: application/json' -H 'Content-Type: application/json'
```
**Motivation**

The LEVM CI workflow in pr-main_levm.yaml that runs EF state tests
should fail with an exit code if a test fails.

**Description**
This pr introduces a new `EFTestRunnerError::TestsFailed` error to use
when there's a report of a test failing. This error is thrown under the
`summary` flag, which is the one used in the target the CI job executes:
`make run-evm-ef-tests-ci`. So whenever there is any failing tests, the
introduced code should print the EFTestReport and then finish with the
`EFTestRunnerError::TestsFailed` error.

Note: The `summary` flag is used in other targets as well, so the
previously described behavior is being implemented for other targets
too.

The ef-test-main job in pr-main_levm has also been refactored, I dropped
steps "Check EF-TESTS from Paris to Prague is 100%" and "Check EF-TESTS
status is 100%" since now in the case any test fails, the CI job exits
with an error code and outputs the failing tests in the console.

In this pr there are some commits with a hardcoded error with the
intentions of having the LEVM CI workflow fail on purpose and check the
console output is the one expected.
[Here](https://github.com/lambdaclass/ethrex/actions/runs/15738130731/job/44356244936)
is a failing workflow execution under this circumstances to see. (The
underscore line above "Failed tests" was removed on a later commit.)

Closes #2887
**Motivation**

We want to include diagrams in the mdbook. The easiest way to manage
diagrams with `git` is to declare them with `mermaid`.

**Description**

This PR adds [the `mdbook-mermaid`
preprocessor](https://github.com/badboy/mdbook-mermaid), which
automatically renders the mermaid diagrams in our docs.

As part of this, it also adds make targets to automatically install
preprocessors/backends, and to generate the files required by
`mdbook-mermaid`.

<img width="836" alt="example mermaid diagram in the L2 docs"
src="https://github.com/user-attachments/assets/d14d57f4-4c73-4c99-82e3-281f1693ee84"
/>
**Motivation**

When running a localnet with kurtosis the ethrex client wasn't exposing
a metrics port.

**Description**

To expose the metrics port, the ETHEREUM_PACKAGE_REVISION in the
Makefile was updated to the latest commit in our fork of
ethereum-package. Additionally, the metrics feature flag was enabled
when building the Docker image (without it, metrics won't work).
The ethereum_metrics_exporter_enabled setting was also enabled for all
participants in the ethrex-only localnet.
With these changes, we are now able to use metrics with ethrex clients.

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

Closes #3213
…s file (#3111)

**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
When using a pre-merge genesis.json for importing blocks, which is not
supported by ethrex, the error received was `ParentNotFound`, which
doesn't explain the real problem.

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
Before merging blocks the genesis.json fork is checked, in case that its
pre Paris return a custom error message.
For doing this new checks were added to the `fork()` function.
<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #3102

---------

Co-authored-by: Martin Paulucci <[email protected]>
**Motivation**

This was failing on multiple PRs because the ethrex_dev image was not
being built.

The difference between the failing job and the others (which were
succeeding) is the runner (larger_runners). Maybe that has something to
do with it.

**Description**

- adds a step to build ethrex_dev explicitly
… names (#3261)

**Motivation**

We can avoid a double lookup with `storage_original_values` by using a
tuple.

I found gen_db field names to be a bit confusing and not giving useful
information, "immutable_cache" is not really a cache but a store for
initial account states, so i changed it. Same with cache.

**Description**

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

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

Closes #issue_number
**Motivation**
According to stats from @azteca1998 PUSH2 and PUSH1 are widely used:

```
Loaded 903636264 rows (3447.10MiB)
Stats (of 903636264 records):
  0xf1: count=   730979  t_min=  2278  t_max=1512728  t_avg=110877.43  t_acc=81049072024  CALL
  0x61: count=131856777  t_min=   136  t_max= 549032  t_avg=   189.29  t_acc=24959614846  PUSH2
  0x56: count= 78745029  t_min=   170  t_max=1488792  t_avg=   243.75  t_acc=19194034756  JUMP
  0x60: count= 86327863  t_min=   136  t_max= 837080  t_avg=   199.78  t_acc=17246262544  PUSH1
  0x5b: count=107216057  t_min=   102  t_max= 267308  t_avg=   159.43  t_acc=17093508806  JUMPDEST
  0x50: count= 86546732  t_min=   102  t_max= 353260  t_avg=   174.49  t_acc=15101132640  POP
  0x57: count= 53096953  t_min=   102  t_max=1382576  t_avg=   233.40  t_acc=12393069292  JUMPI
  0x81: count= 55585321  t_min=   102  t_max= 267410  t_avg=   192.79  t_acc=10716509980  DUP2
  0x01: count= 56493418  t_min=   102  t_max=1431060  t_avg=   189.52  t_acc=10706399944  ADD
  0x91: count= 31380921  t_min=   102  t_max= 146030  t_avg=   205.38  t_acc= 6444862520  SWAP2
```

Furthermore i keep seeing `U256::from_big_endian` taking quite some time
on samply so I made specialized PUSH1 and PUSH2 implementations that
avoid that, also using fixed size arrays.

Benchmarks:

Hoodi 11k:

main 9m10.471s
pr 8m25.933s

**Description**

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

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

Closes #issue_number

# Benchmark Results Comparison

#### Benchmark Results: Factorial
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `levm_Factorial_pr` | 634.2 ± 7.3 | 629.6 | 654.2 | 2.71 ± 0.04 |
| `levm_Factorial` | 726.1 ± 5.2 | 722.5 | 740.1 | 3.11 ± 0.03 |
| `levm_FactorialRecursive_pr` | 3.567 ± 0.021 | 3.541 | 3.604 | 2.22 ±
0.05 |
| `levm_FactorialRecursive` | 3.828 ± 0.035 | 3.775 | 3.889 | 2.39 ±
0.03 |
| `levm_Fibonacci_pr` | 629.2 ± 6.4 | 625.7 | 646.9 | 2.99 ± 0.03 |
| `levm_Fibonacci` | 727.7 ± 6.5 | 722.3 | 743.9 | 3.47 ± 0.03 |
| `levm_ManyHashes_pr` | 14.9 ± 0.2 | 14.7 | 15.3 | 1.70 ± 0.03 |
| `levm_ManyHashes` | 16.3 ± 0.1 | 16.2 | 16.4 | 1.87 ± 0.02 |
| `levm_BubbleSort_pr` | 5.065 ± 0.023 | 5.034 | 5.107 | 1.58 ± 0.01 |
| `levm_BubbleSort` | 5.508 ± 0.035 | 5.489 | 5.603 | 1.71 ± 0.02 |
| `levm_ERC20Transfer_pr` | 461.5 ± 1.3 | 459.7 | 463.4 | 1.87 ± 0.03 |
| `levm_ERC20Transfer` | 487.9 ± 2.4 | 484.1 | 491.0 | 1.99 ± 0.01 |
| `levm_ERC20Mint_pr` | 306.8 ± 8.9 | 300.1 | 328.5 | 2.22 ± 0.07 |
| `levm_ERC20Mint` | 320.1 ± 1.5 | 317.9 | 322.6 | 2.31 ± 0.05 |
| `levm_ERC20Approval_pr` | 1.779 ± 0.023 | 1.763 | 1.838 | 1.69 ± 0.02
|
| `levm_ERC20Approval` | 1.850 ± 0.011 | 1.837 | 1.873 | 1.76 ± 0.02 |



![image](https://github.com/user-attachments/assets/8f08cb93-ac5d-4909-a15d-cf799f1ce023)

According to the samply this makes op_push nearly negligible (from 30%
to 0%)

---------

Co-authored-by: Jeremías Salomón <[email protected]>
**Motivation**

On x86_64, rust has a harder time when the match is used, 2 things
happen:

With match;
- Apparently it also uses a lookup table internally but it doesn't have
as much "info" about what we doing than when doing it manually, for
example the function has an extra xor instruction, it also looks like it
has more trouble inlining the From

Without match:
- No unneeded xor instruction
- Easier to inline for the compiler (as seen on the godbolt url), this
avoids a full function call.

Godbolt: https://godbolt.org/z/eG8M1jz3M

Closes #2896

Should close #2896
@ilitteri ilitteri changed the title Based/full sync feat(l2): based full-sync Jun 23, 2025
Add type 4 transaction validations to validations.md docs

Closes #2545
@tomip01 tomip01 changed the base branch from based/p2p-scaffolding to main June 23, 2025 19:08
@tomip01 tomip01 changed the base branch from main to based/p2p-scaffolding June 23, 2025 19:08
mpaulucci and others added 9 commits June 23, 2025 19:33
**Motivation**
Improve write up of the L1 roadmap
**Motivation**

Remove unused method.

**Description**

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

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

Closes #issue_number
**Motivation**

Go back to the normal GitHub runners, instead of larger runners, because
the disk size constraint has been removed from this CI job

**Description**

* Changes `runs-on:` from `integration-test` job in `pr-main_l2.yaml`
workflow.
* Removes actionlint label
* Removes step and comment related to using the larger runners

---------

Co-authored-by: Javier Chatruc <[email protected]>
Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
**Description**

This PR changes the mdbook build action to use the `docs-deps` and
`docs` targets from the makefile to install dependencies and build
documentation, instead of manually doing so like until now.
**Motivation**

We want to be able to decode ABI-packed data.

**Description**

This PR copies the implementation [made for
rex](lambdaclass/rex#134), with two slicing
operations fixed to avoid panicking.

---------

Co-authored-by: Avila Gastón <[email protected]>
#3180 happened again

Co-authored-by: LeanSerra <[email protected]>
Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
**Motivation**

Roadmap was hard to follow through in a fast read. 

**Description**

Rearranged the roadmap items to group "In Progress" and "Planned" tasks
properly.
**Motivation**

In preparation to support more complex bridging (such as of ERC20
assets), we want to use generic L2->L1 messaging primitives that can be
easily extended and reused.

**Description**

This replaces withdrawals with a new type L1Message, and has the bridge
make use of them.

- Allows for multiple messages per transaction
- Allows for arbitrary data to be sent. Hashed for easier handling.

---------

Co-authored-by: Tomás Grüner <[email protected]>
Co-authored-by: Avila Gastón <[email protected]>
@ManuelBilbao ManuelBilbao added the L2 Rollup client label Jun 24, 2025
avilagaston9 and others added 6 commits June 24, 2025 13:45
**Motivation**

Our `transaction_tracker` metric is reset every time the node is
restarted.

**Description**

- Uses the `increase()` function in Grafana to avoid resetting the
counter on node restarts.
- Initializes each possible value to 0 when starting the metrics to
properly calculate increments.
- Splits the Transaction panel into two: `Transactions` and `Transaction
Errors`.
- Inverts the colors in `Gas Limit Usage` and `Blob Gas Usage`.
- Pushes transaction metrics only after closing the block in L2, since
transactions may be added or removed depending on the state diff size.

**Last Blob Usage**:  Before | After



<img width="312" alt="image"
src="https://github.com/user-attachments/assets/cd8e5471-3fa9-491b-93c0-10cf24da663c"
/>


<img width="324" alt="image"
src="https://github.com/user-attachments/assets/1fe9b992-1d05-4269-86dd-78ec1f885be0"
/>


**Transactions**

<img width="700" alt="image"
src="https://github.com/user-attachments/assets/ff785f62-fc07-406f-8e8e-4d0f2b4d9aa1"
/>

**Transaction Errors**

<img width="694" alt="image"
src="https://github.com/user-attachments/assets/146d46b0-c22b-4ff4-969d-a57acdc7916b"
/>


### How to test

1. Start an L2 node with metrics enabled:

```bash
cd ethrex/crates/l2
make init
```
2. Go to `http://localhost:3802/` to watch the Grafana dashboard.

3. Restart the node and check that the `Transactions` panel is not
reset.

```bash
crtl + c
make init-l2-no-metrics
```

4. Modify `apply_plain_transactions` in
`ethrex/crates/blockchain/payload.rs:543` to generate some errors:

```Rust
pub fn apply_plain_transaction(
head: &HeadTransaction,
context: &mut PayloadBuildContext,
) -> Result<Receipt, ChainError> {
 
      use std::time::{SystemTime, UNIX_EPOCH};
      
      let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
      let seed = (now.as_secs() ^ now.subsec_nanos() as u64) as usize;

      match seed % 5 {
            1 => Err(ChainError::ParentNotFound),
            2 => Err(ChainError::ParentStateNotFound),
            3 => Err(ChainError::InvalidTransaction("tx error".into())),
            4 => Err(ChainError::WitnessGeneration("witness failure".into())),
            _ => Err(ChainError::Custom("custom error".into())),
      }

}
```

5. Restart the node and send some transactions:

```bash
cd ethrex
cargo run --release --manifest-path ./tooling/load_test/Cargo.toml -- -k ./test_data/private_keys.txt -t eth-transfers -n http://localhost:1729
```

if necessary run `ulimit -n 65536` before the command.

Closes None
**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
**Motivation**

Make the "build block" benchmark run in the CI.

---------

Co-authored-by: Martin Paulucci <[email protected]>
**Motivation**

We are using a specific `aligned-sdk` commit. Now that we've bumped the
SP1 version to `v5.0.0`, we can use the latest release.

**Description**

- Uses the latest release of the `aligned-sdk`.
- Refactors `estimate_gas` since some clients don't allow empty
`blobVersionedHashes`, and our deployer doesn't work with
`ethereum-package`.
- Adds a guide on how to run an Aligned dev environment.

## How to test

Read the new section `How to Run Using an Aligned Dev Environment` in
`docs/l2/aligned_mode.md`.

Closes #3169
Copy link

Benchmark Results Comparison

PR Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 233.0 ± 1.6 230.4 236.1 1.00
levm_Factorial 604.5 ± 4.9 600.4 617.2 2.59 ± 0.03

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.627 ± 0.020 1.586 1.652 1.00
levm_FactorialRecursive 3.301 ± 0.036 3.272 3.394 2.03 ± 0.03

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 208.8 ± 0.5 208.3 209.8 1.00
levm_Fibonacci 620.5 ± 31.4 597.9 688.9 2.97 ± 0.15

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.7 ± 0.1 8.6 9.0 1.00
levm_ManyHashes 14.1 ± 0.2 13.9 14.3 1.62 ± 0.03

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.192 ± 0.029 3.165 3.254 1.00
levm_BubbleSort 4.997 ± 0.196 4.903 5.551 1.57 ± 0.06

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 243.5 ± 1.5 242.0 245.8 1.00
levm_ERC20Transfer 458.8 ± 32.1 443.5 547.8 1.88 ± 0.13

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 136.9 ± 0.7 136.4 138.6 1.00
levm_ERC20Mint 294.6 ± 6.9 289.7 313.5 2.15 ± 0.05

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.048 ± 0.009 1.036 1.066 1.00
levm_ERC20Approval 1.717 ± 0.016 1.693 1.748 1.64 ± 0.02

Main Results

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Factorial 234.4 ± 1.4 232.8 238.2 1.00
levm_Factorial 604.3 ± 4.0 601.1 612.5 2.58 ± 0.02

Benchmark Results: Factorial - Recursive

Command Mean [s] Min [s] Max [s] Relative
revm_FactorialRecursive 1.596 ± 0.057 1.450 1.662 1.00
levm_FactorialRecursive 3.295 ± 0.027 3.267 3.354 2.06 ± 0.08

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
revm_Fibonacci 211.1 ± 0.4 210.3 211.5 1.00
levm_Fibonacci 604.5 ± 4.3 599.7 612.0 2.86 ± 0.02

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ManyHashes 8.8 ± 0.1 8.7 8.9 1.00
levm_ManyHashes 14.1 ± 0.1 13.9 14.3 1.61 ± 0.02

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
revm_BubbleSort 3.191 ± 0.024 3.164 3.227 1.00
levm_BubbleSort 4.924 ± 0.018 4.909 4.966 1.54 ± 0.01

Benchmark Results: ERC20 - Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Transfer 241.6 ± 1.1 240.4 244.0 1.00
levm_ERC20Transfer 446.5 ± 3.4 443.0 453.0 1.85 ± 0.02

Benchmark Results: ERC20 - Mint

Command Mean [ms] Min [ms] Max [ms] Relative
revm_ERC20Mint 137.0 ± 0.8 136.3 139.0 1.00
levm_ERC20Mint 293.8 ± 5.1 289.2 306.5 2.15 ± 0.04

Benchmark Results: ERC20 - Approval

Command Mean [s] Min [s] Max [s] Relative
revm_ERC20Approval 1.032 ± 0.003 1.029 1.036 1.00
levm_ERC20Approval 1.716 ± 0.027 1.695 1.787 1.66 ± 0.03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Rollup client
Projects
None yet
Development

Successfully merging this pull request may close these issues.