Skip to content

Commit

Permalink
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
Browse files Browse the repository at this point in the history
…to snap-storage-range
  • Loading branch information
fmoletta committed Nov 4, 2024
2 parents aa29e5f + ad30e09 commit 200d014
Show file tree
Hide file tree
Showing 59 changed files with 1,146 additions and 729 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/assertoor.yaml

This file was deleted.

26 changes: 1 addition & 25 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI
on:
merge_group:
push:
branches: [main]
pull_request:
branches: ["**"]
paths-ignore:
Expand Down Expand Up @@ -44,7 +42,7 @@ jobs:
- name: Run cargo clippy
run: |
cargo clippy --all-targets --all-features --workspace -- -D warnings
cargo clippy --all-targets --all-features --workspace --exclude ethereum_rust-prover -- -D warnings
- name: Run cargo fmt
run: |
Expand Down Expand Up @@ -86,25 +84,3 @@ jobs:
context: .
file: ./Dockerfile
load: true # Important for building without pushing

prover:
name: Build RISC-V zkVM program
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Rust toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}

- name: RISC-V zkVM toolchain install
run: |
curl -L https://risczero.com/install | bash
~/.risc0/bin/rzup install
- name: Build prover and zkVM
run: |
cd crates/l2/prover
cargo build --release --features build_zkvm
124 changes: 124 additions & 0 deletions .github/workflows/hive_and_assertoor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: "Hive & Assertoor"
on:
merge_group:
paths-ignore:
- "crates/l2/**"
- 'README.md'
- 'LICENSE'
- "**/README.md"
- "**/docs/**"
pull_request:
branches: ["**"]
paths-ignore:
- "crates/l2/**"
- 'README.md'
- 'LICENSE'
- "**/README.md"
- "**/docs/**"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
RUST_VERSION: 1.80.1

jobs:
docker-build:
name: Docker Build image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
load: true
tags: ethereum_rust
outputs: type=docker,dest=/tmp/ethereum_rust_image.tar

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ethereum_rust_image
path: /tmp/ethereum_rust_image.tar

run-hive:
name: Hive - ${{ matrix.name }}
needs: [docker-build]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- simulation: rpc-compat
name: "Rpc Compat tests"
run_command: make run-hive-on-latest SIMULATION=ethereum/rpc-compat TEST_PATTERN="/eth_chainId|eth_getTransactionByBlockHashAndIndex|eth_getTransactionByBlockNumberAndIndex|eth_getCode|eth_getStorageAt|eth_call|eth_getTransactionByHash|eth_getBlockByHash|eth_getBlockByNumber|eth_createAccessList|eth_getBlockTransactionCountByNumber|eth_getBlockTransactionCountByHash|eth_getBlockReceipts|eth_getTransactionReceipt|eth_blobGasPrice|eth_blockNumber|ethGetTransactionCount|debug_getRawHeader|debug_getRawBlock|debug_getRawTransaction|debug_getRawReceipts|eth_estimateGas|eth_getBalance|eth_sendRawTransaction|eth_getProof|eth_getLogs"
- simulation: rpc-auth
name: "Rpc Auth tests"
run_command: make run-hive-on-latest SIMULATION=ethereum/rpc-compat TEST_PATTERN="/engine-auth"
- simulation: discv4
name: "Devp2p discv4 tests"
run_command: make run-hive-on-latest SIMULATION=devp2p TEST_PATTERN="discv4"
- simulation: snap
name: "Devp2p snap tests"
run_command: make run-hive-on-latest SIMULATION=devp2p TEST_PATTERN="/AccountRange|StorageRanges"
- simulation: engine
name: "Engine tests"
run_command: make run-hive-on-latest SIMULATION=ethereum/engine TEST_PATTERN="/Blob Transactions On Block 1, Cancun Genesis|Blob Transactions On Block 1, Shanghai Genesis|Blob Transaction Ordering, Single Account, Single Blob|Blob Transaction Ordering, Single Account, Dual Blob|Blob Transaction Ordering, Multiple Accounts|Replace Blob Transactions|Parallel Blob Transactions|ForkchoiceUpdatedV3 Modifies Payload ID on Different Beacon Root|NewPayloadV3 After Cancun|NewPayloadV3 Versioned Hashes|ForkchoiceUpdated Version on Payload Request"
- simulation: engine-cancun
name: "Cancun Engine tests"
run_command: make run-hive-on-latest SIMULATION=ethereum/engine TEST_PATTERN="cancun/Unique Payload ID|ParentHash equals BlockHash on NewPayload|Re-Execute Payload|Payload Build after New Invalid Payload|RPC|Build Payload with Invalid ChainID|Invalid PayloadAttributes, Zero timestamp, Syncing=False|Invalid PayloadAttributes, Parent timestamp, Syncing=False|Invalid PayloadAttributes, Missing BeaconRoot, Syncing=False|Suggested Fee Recipient Test|PrevRandao Opcode Transactions Test|Invalid Missing Ancestor ReOrg, StateRoot"
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ethereum_rust_image
path: /tmp

- name: Load image
run: |
docker load --input /tmp/ethereum_rust_image.tar
- name: Checkout sources
uses: actions/checkout@v3

- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}

- name: Setup Go
uses: actions/setup-go@v3

- name: Run Hive Simulation
run: ${{ matrix.run_command }}

run-assertoor:
name: Assertoor - Stability Check
runs-on: ubuntu-latest
needs: [docker-build]
steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ethereum_rust_image
path: /tmp

- name: Load image
run: |
docker load --input /tmp/ethereum_rust_image.tar
- name: Setup kurtosis testnet and run assertoor tests
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
kurtosis_version: '1.3.1'
ethereum_package_url: 'github.com/lambdaclass/ethereum-package'
ethereum_package_branch: 'ethereum-rust-integration'
ethereum_package_args: './test_data/network_params.yaml'
57 changes: 57 additions & 0 deletions .github/workflows/l2_prover_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: L2 Prover CI
on:
push:
branches: ["main"]
paths:
- "crates/l2/prover/**"
pull_request:
branches: ["**"]
paths:
- "crates/l2/prover/**"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
action:
- command: check
args: -p ethereum_rust-prover
- command: clippy
args: -p ethereum_rust-prover --all-targets --no-default-features
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Add Rust Cache
uses: Swatinem/rust-cache@v2
- name: ${{ matrix.action.command }} Command
run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }}

build_and_test:
name: Build and Test RISC-V zkVM program
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Rust toolchain install
uses: dtolnay/rust-toolchain@stable
- name: RISC-V zkVM toolchain install
run: |
curl -L https://risczero.com/install | bash
~/.risc0/bin/rzup install
- name: Caching
uses: Swatinem/rust-cache@v2
- name: Build prover and zkVM
run: |
cd crates/l2/prover
cargo build --release --features build_zkvm
- name: Test Prover Execution
run: |
cd crates/l2/prover
RUST_LOG=info make perf_test_proving
2 changes: 0 additions & 2 deletions .github/workflows/levm_bench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ name: LEVM benchmarks

on:
merge_group:
push:
paths:
- 'crates/vm/levm/**'
branches: [ main ]
pull_request:
paths:
- 'crates/vm/levm/**'
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SPECTEST_VECTORS_DIR := cmd/ef_tests/vectors

CRATE ?= *
test: $(SPECTEST_VECTORS_DIR) ## 🧪 Run each crate's tests
cargo test -p '$(CRATE)' --workspace
cargo test -p '$(CRATE)' --workspace --exclude ethereum_rust-prover

clean: clean-vectors ## 🧹 Remove build artifacts
cargo clean
Expand Down Expand Up @@ -97,6 +97,9 @@ TEST_PATTERN ?= /
run-hive: build-image setup-hive ## 🧪 Run Hive testing suite
cd hive && ./hive --sim $(SIMULATION) --client ethereumrust --sim.limit "$(TEST_PATTERN)"

run-hive-on-latest: setup-hive ## 🧪 Run Hive testing suite with the latest docker image
cd hive && ./hive --sim $(SIMULATION) --client ethereumrust --sim.limit "$(TEST_PATTERN)"

run-hive-debug: build-image setup-hive ## 🐞 Run Hive testing suite in debug mode
cd hive && ./hive --sim $(SIMULATION) --client ethereumrust --sim.limit "$(TEST_PATTERN)" --docker.output

Expand Down
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ In a bit more detail:
| Add `libmdbx` bindings and basic API, create tables for state (blocks, transactions, etc) | ✅
| EVM wrapper for block execution ||
| JSON RPC API server setup ||
| RPC State-serving endpoints | 🏗️ (almost done, a few endpoint are left) |
| RPC State-serving endpoints | 🏗️ (almost done, a few endpoints are left) |
| Basic Engine API implementation. Set new chain head (`forkchoiceUpdated`) and new block (`newPayload`). | ✅

See detailed issues and progress for this milestone [here](https://github.com/lambdaclass/ethereum_rust/milestone/1).
Expand Down Expand Up @@ -350,7 +350,31 @@ It also supports EIP 4844 for L1 commit transactions, which means state diffs ar
| Adapt the prover to prove a KZG commitment to the state diff and use the point evaluation precompile to show that the blob sent to the L1 is indeed the correct one through a proof of equivalence protocol ||
| Add a command to the CLI to reconstructing the full L2 state from all the blob data on the L1. ||

### Milestone 4: Custom Native token
### Milestone 4: Account Abstraction

The L2 supports native account abstraction following EIP 7702, allowing for custom transaction validation logic and paymaster flows.

#### Status

| Task Description | Status |
| -------------------------------------------------------------------------- | ------ |
| Add support for `SET_CODE_TX_TYPE` transactions (i.e. implement EIP 7702). ||
| Add examples of WebAuthn signing and paymaster flows using EIP 7702 ||

### Milestone 5: L2s interoperability

Support multiple L2s sharing the same bridge contract on L1 for seamless interoperability.

#### Status

| Task Description | Status |
| ------------------------------------------------------------------------------------------ | ------ |
| Change state of the `commonBridge` and `onChainProposer` to be a mapping over `chainId` ||
| Adapt sequencer to be aware of its chain id and interact with the L1 contracts accordingly ||

TODO: Expand on tasks about proper interoperability between chains (seamlessly bridging between chains, etc).

### Milestone 6: Custom Native token

The L2 can also be deployed using a custom native token, meaning that a certain ERC20 can be the common currency that's used for paying network fees.

Expand All @@ -362,7 +386,7 @@ The L2 can also be deployed using a custom native token, meaning that a certain
| On the `commonBridge`, for custom native token deposits, `msg.value` should always be zero, and the amount of the native token to mint should be a new `valueToMintOnL2` argument. The amount should be deducted from the caller thorugh a `transferFrom`. ||
| On the CLI, add support for custom native token deposits and withdrawals ||

### Milestone 5: Security (TEEs and Multi Prover support)
### Milestone 7: Security (TEEs and Multi Prover support)

The L2 has added security mechanisms in place, running on Trusted Execution Environments and Multi Prover setup where multiple guarantees (Execution on TEEs, zkVMs/proving systems) are required for settlement on the L1. This better protects against possible security bugs on implementations.

Expand All @@ -374,18 +398,7 @@ The L2 has added security mechanisms in place, running on Trusted Execution Envi
| Support verifying multiple different zkVM executions on the `onChainProposer` L1 contract. ||
| Support running the operator on a TEE environment ||

### Milestone 6: Account Abstraction

The L2 supports native account abstraction following EIP 7702, allowing for custom transaction validation logic and paymaster flows.

#### Status

| Task Description | Status |
| ---------------- | ------ |

TODO: Expand on account abstraction tasks.

### Milestone 7: Based Contestable Rollup
### Milestone 8: Based Contestable Rollup

The network can be run as a Based Rollup, meaning sequencing is done by the Ethereum Validator set; transactions are sent to a private mempool and L1 Validators that opt into the L2 sequencing propose blocks for the L2 on every L1 block.

Expand All @@ -397,7 +410,7 @@ The network can be run as a Based Rollup, meaning sequencing is done by the Ethe

TODO: Expand on this.

### Milestone 8: Validium
### Milestone 9: Validium

The L2 can be initialized in Validium Mode, meaning the Data Availability layer is no longer the L1, but rather a DA layer of the user's choice.

Expand Down
Loading

0 comments on commit 200d014

Please sign in to comment.