Skip to content

Commit

Permalink
Merge branch 'main' into automate-perf-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dsocolobsky committed Jan 20, 2025
2 parents 785f32b + 56acbbc commit 534d9d0
Show file tree
Hide file tree
Showing 39 changed files with 1,121 additions and 1,306 deletions.
28 changes: 24 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
.github
.gitignore

target/
# Generated by Cargo
# will have compiled files and executables
**/target/

LICENSE
README.md
# These are backup files generated by rustfmt
**/*.rs.bk

cmd/ef_tests/ethrex/vectors
cmd/ef_tests/levm/vectors

**/.DS_Store
**/.vscode

# EVM Mlir stuff
**/*.mlir
**/*.ll
**/*.o
**/*.asm
crates/levm_mlir/output

crates/levm_mlir/ethtests
crates/levm_mlir/*.tar.gz

# used by Flamegraph and Samply
cmd/ef_tests/levm/levm_perfgraphs
3 changes: 2 additions & 1 deletion .github/config/assertoor/network_params_blob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ assertoor_params:
run_stability_check: false
run_block_proposal_check: false
tests:
- https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/blob-transactions-test.yaml
# The blob check is disabled until the flaky test is tackled.
# - https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/blob-transactions-test.yaml
- https://raw.githubusercontent.com/lambdaclass/ethrex/refs/heads/main/.github/config/assertoor/el-stability-check.yaml

tx_spammer_params:
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/levm_revm_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


set -e
set -x

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <revm_file> <levm_file>"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_gha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
branches: ["**"]
paths:
".github/**.yaml"
- ".github/**.yaml"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_l1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Transaction Check
enclave_name: "ethrex-assertoor-tx"
ethereum_package_args: "./.github/config/assertoor/network_params_tx.yaml"
- name: Blobs & Stability Check
- name: Stability Check
enclave_name: "ethrex-assertoor-blob"
ethereum_package_args: "./.github/config/assertoor/network_params_blob.yaml"

Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
test_pattern: "engine-api/RPC|Re-Org Back to Canonical Chain From Syncing Chain|Re-org to Previously Validated Sidechain Payload|Re-Org Back into Canonical Chain, Depth=5|Safe Re-Org|Transaction Re-Org|Inconsistent|Suggested Fee|PrevRandao|Fork ID|Unknown|Invalid PayloadAttributes|Bad Hash|Unique Payload ID|Re-Execute Payload|In-Order|Multiple New Payloads|Valid NewPayload|NewPayload with|Invalid NewPayload|Payload Build|Invalid NewPayload, Transaction|ParentHash equals|Build Payload|Invalid Missing Ancestor ReOrg"
- name: "Engine withdrawal tests"
simulation: ethereum/engine
test_pattern: "engine-withdrawals/engine-withdrawals test loader|GetPayloadV2 Block Value|Sync after 2 blocks - Withdrawals on Genesis|Max Initcode Size|Pre-Merge Fork Number > 0|Empty Withdrawals|Corrupted Block Hash Payload"
test_pattern: "engine-withdrawals/engine-withdrawals test loader|GetPayloadV2 Block Value|Sync after 2 blocks - Withdrawals on Genesis|Max Initcode Size|Pre-Merge Fork Number > 0|Empty Withdrawals|Corrupted Block Hash Payload|Withdrawals Fork on Block 2|Withdrawals Fork on Block 3|GetPayloadBodies"
- name: "Sync"
simulation: ethereum/sync
test_pattern: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_l2_prover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: RISC-V SP1 toolchain install
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up
~/.sp1/bin/sp1up --version 3.0.0
- name: Build prover and SP1's zkVM
run: |
cd crates/l2/prover
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/daily_loc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ jobs:
${{ github.event_name == 'workflow_dispatch'
&& secrets.TEST_CHANNEL_SLACK
|| format(
'{0}, {1}, {2}',
secrets.ETHREX_REPORTS_SLACK_WEBHOOK,
'{0} {1} {2}',
secrets.ETHREX_L1_SLACK_WEBHOOK,
secrets.ETHREX_L2_SLACK_WEBHOOK,
secrets.LEVM_SLACK_WEBHOOK
)
Expand Down
35 changes: 20 additions & 15 deletions .github/workflows/daily_reports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
vm: [ levm, revm ]
vm: [levm, revm]
test:
- {
name: "Rpc Compat tests",
file_name: rpc-compat,
simulation: ethereum/rpc-compat,
}
name: "Rpc Compat tests",
file_name: rpc-compat,
simulation: ethereum/rpc-compat,
}
- { name: "Devp2p eth tests", file_name: devp2p, simulation: devp2p }
- {
name: "Cancun Engine tests",
file_name: engine,
simulation: ethereum/engine,
}
name: "Cancun Engine tests",
file_name: engine,
simulation: ethereum/engine,
}
- { name: "Sync tests", file_name: sync, simulation: ethereum/sync }

steps:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
vm: [ levm, revm ]
vm: [levm, revm]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -108,8 +108,9 @@ jobs:
${{ github.event_name == 'workflow_dispatch'
&& secrets.TEST_CHANNEL_SLACK
|| format(
'{0}, {1}',
secrets.ETHREX_REPORTS_SLACK_WEBHOOK,
'{0} {1} {2}',
secrets.ETHREX_L1_SLACK_WEBHOOK,
secrets.ETHREX_L2_SLACK_WEBHOOK,
secrets.LEVM_SLACK_WEBHOOK
)
}}
Expand All @@ -135,13 +136,17 @@ jobs:
uses: actions/download-artifact@v4
with:
name: results_levm.md
path: ./results_levm.md

- name: Rename result (1)
run: cp results.md results_levm.md

- name: Download results (revm)
uses: actions/download-artifact@v4
with:
name: results_revm.md
path: ./results_revm.md

- name: Rename result (2)
run: cp results.md results_revm.md

- name: Post results diff to Slack
env:
Expand Down Expand Up @@ -192,7 +197,7 @@ jobs:
&& secrets.TEST_CHANNEL_SLACK
|| secrets.LEVM_SLACK_WEBHOOK
}}
run: sh .github/scripts/publish_levm_ef_tests.sh $SLACK_WEBHOOK
run: sh .github/scripts/publish_levm_ef_tests.sh "$SLACK_WEBHOOK"

flamegraphs-page:
name: Post to Slack link to Flamegraphs Page
Expand Down
22 changes: 18 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ RUN cargo install cargo-chef
WORKDIR /ethrex

FROM chef AS planner
COPY . .
COPY crates ./crates
COPY cmd ./cmd
COPY Cargo.* .
# Determine the crates that need to be built from dependencies
RUN cargo chef prepare --recipe-path recipe.json

Expand All @@ -23,7 +25,9 @@ RUN cargo chef cook --release --recipe-path recipe.json

# Optional build flags
ARG BUILD_FLAGS=""
COPY . .
COPY crates ./crates
COPY cmd ./cmd
COPY Cargo.* ./
RUN cargo build --release $BUILD_FLAGS

FROM ubuntu:24.04
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ stop-localnet-silent:
@kurtosis enclave stop $(ENCLAVE) >/dev/null 2>&1 || true
@kurtosis enclave rm $(ENCLAVE) --force >/dev/null 2>&1 || true

HIVE_REVISION := df7d5103d4ddc772307f9947be4ad1f20ce03ed0
HIVE_REVISION := 37bde6deee7044b86fff88a39a52b33be460ae9c
# Shallow clones can't specify a single revision, but at least we avoid working
# the whole history by making it shallow since a given date (one day before our
# target revision).
Expand Down
18 changes: 17 additions & 1 deletion cmd/ef_tests/levm/deserialize.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::types::{EFTest, EFTestAccessListItem, EFTests, TransactionExpectedException};
use crate::types::{
EFTest, EFTestAccessListItem, EFTestAuthorizationListTuple, EFTests,
TransactionExpectedException,
};
use bytes::Bytes;
use ethrex_core::{H256, U256};
use serde::{Deserialize, Deserializer};
Expand Down Expand Up @@ -194,6 +197,18 @@ where
Ok(Some(final_access_lists))
}

pub fn deserialize_authorization_lists<'de, D>(
deserializer: D,
) -> Result<Option<Vec<EFTestAuthorizationListTuple>>, D::Error>
where
D: serde::Deserializer<'de>,
{
let authorization_list: Option<Vec<EFTestAuthorizationListTuple>> =
Option::<Vec<EFTestAuthorizationListTuple>>::deserialize(deserializer)?;

Ok(authorization_list)
}

pub fn deserialize_u256_optional_safe<'de, D>(deserializer: D) -> Result<Option<U256>, D::Error>
where
D: serde::Deserializer<'de>,
Expand Down Expand Up @@ -322,6 +337,7 @@ impl<'de> Deserialize<'de> for EFTests {
.get(data_id)
.cloned()
.unwrap_or_default(),
authorization_list: raw_tx.authorization_list.clone(),
};
transactions.insert((data_id, gas_limit_id, value_id), tx);
}
Expand Down
19 changes: 18 additions & 1 deletion cmd/ef_tests/levm/runner/levm_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ethrex_core::{
use ethrex_levm::{
db::CacheDB,
errors::{TransactionReport, TxValidationError, VMError},
vm::VM,
vm::{AuthorizationTuple, VM},
Environment,
};
use ethrex_storage::AccountUpdate;
Expand Down Expand Up @@ -88,6 +88,22 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result<VM, EFTes
.map(|arg| (arg.address, arg.storage_keys.clone()))
.collect();

// Check if the tx has the authorization_lists field implemented by eip7702.
let authorization_list = tx.authorization_list.clone().map(|list| {
list.iter()
.map(|auth_tuple| AuthorizationTuple {
chain_id: auth_tuple.chain_id,
address: auth_tuple.address,
nonce: auth_tuple.nonce,
v: auth_tuple.v,
r_signature: auth_tuple.r,
s_signature: auth_tuple.s,
// If the signer is not present, set it to Address::zero()
signer: auth_tuple.signer.unwrap_or_default(),
})
.collect::<Vec<AuthorizationTuple>>()
});

VM::new(
tx.to.clone(),
Environment {
Expand Down Expand Up @@ -116,6 +132,7 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result<VM, EFTes
db,
CacheDB::default(),
access_lists,
authorization_list,
)
.map_err(|err| EFTestRunnerError::VMInitializationFailed(err.to_string()))
}
Expand Down
29 changes: 28 additions & 1 deletion cmd/ef_tests/levm/runner/revm_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,33 @@ pub fn prepare_revm_for_tx<'state>(
})
.collect();

let authorization_list = None;
// The latest version of revm(19.3.0) is needed.
// Update it in every Cargo.toml.
// revm-inspectors and revm-primitives have to be bumped too.
/*
let revm_authorization_list: Vec<SignedAuthorization> = tx
.authorization_list
.clone()
.unwrap_or_default()
.iter()
.map(|auth_t| {
SignedAuthorization::new_unchecked(
Authorization {
chain_id: RevmU256::from_le_bytes(auth_t.chain_id.to_little_endian()),
address: RevmAddress(auth_t.address.0.into()),
nonce: auth_t.nonce,
},
auth_t.v.as_u32() as u8,
RevmU256::from_le_bytes(auth_t.r.to_little_endian()),
RevmU256::from_le_bytes(auth_t.s.to_little_endian()),
)
})
.collect();
let authorization_list = Some(revm_authorization_list.into());
*/

let tx_env = RevmTxEnv {
caller: tx.sender.0.into(),
gas_limit: tx.gas_limit,
Expand All @@ -160,7 +187,7 @@ pub fn prepare_revm_for_tx<'state>(
max_fee_per_blob_gas: tx
.max_fee_per_blob_gas
.map(|fee| RevmU256::from_limbs(fee.0)),
authorization_list: None,
authorization_list,
};

let evm_builder = Revm::builder()
Expand Down
Loading

0 comments on commit 534d9d0

Please sign in to comment.