Skip to content

Commit 4c69780

Browse files
authored
Passing initial rundler spec-tests (#3650)
* update test config. 2 failed, 8 passed, 2 errors in 18.94s * fix debug_traceCall to use parent state. * works with rundler --unsafe. * Passes rundler/rpc tests: 10 passed, 2 skipped in 40.73s. * remove bundler_tests from ci
1 parent 18d9a0a commit 4c69780

8 files changed

Lines changed: 95 additions & 78 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,23 @@ jobs:
108108
CXX: clang++
109109
CC: clang
110110
run: export PATH="/scilla/0/bin:$PATH" && ./scripts/js_test.sh
111-
bundler_test:
112-
runs-on: ubuntu-latest
113-
steps:
114-
- uses: actions/checkout@v6
115-
with:
116-
submodules: recursive
117-
- name: Install Rust
118-
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo "$HOME/.cargo/bin" >> $GITHUB_PATH
119-
- name: Install default toolchain
120-
run: rustup show active-toolchain || rustup toolchain install
121-
- name: Install foundry
122-
uses: foundry-rs/foundry-toolchain@v1
123-
- name: Install PDM
124-
uses: pdm-project/setup-pdm@v4
125-
- uses: Swatinem/rust-cache@v2
126-
- name: bundler-spec-test framework
127-
env:
128-
CXX: clang++
129-
CC: clang
130-
run: ./scripts/bundler_test.sh
111+
# bundler_test:
112+
# runs-on: ubuntu-latest
113+
# steps:
114+
# - uses: actions/checkout@v6
115+
# with:
116+
# submodules: recursive
117+
# - name: Install Rust
118+
# run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo "$HOME/.cargo/bin" >> $GITHUB_PATH
119+
# - name: Install default toolchain
120+
# run: rustup show active-toolchain || rustup toolchain install
121+
# - name: Install foundry
122+
# uses: foundry-rs/foundry-toolchain@v1
123+
# - name: Install PDM
124+
# uses: pdm-project/setup-pdm@v4
125+
# - uses: Swatinem/rust-cache@v2
126+
# - name: bundler-spec-test framework
127+
# env:
128+
# CXX: clang++
129+
# CC: clang
130+
# run: ./scripts/bundler_test.sh

‎bundler_tests/alto-config.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"network-name": "local",
3+
"environment": "development",
4+
"bundle-mode": "manual",
5+
"safe-mode": true,
6+
"rpc-url": "http://localhost:8545",
7+
"port": 3000,
8+
"executor-private-keys": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
9+
"utility-private-key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
10+
"entrypoints": "0x4337084d9e255ff0702461cf8895ce9e3b5ff108",
11+
"enable-debug-endpoints": true
12+
}

‎bundler_tests/config-bundler-spec-tests.toml‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ api_servers = [
77
]
88
eth_chain_id = 1337
99

10-
consensus.scilla_address = "http://localhost:13000"
10+
consensus.scilla_address = "http://localhost:3333"
1111
consensus.consensus_timeout = { secs = 15, nanos = 0 }
1212
consensus.genesis_deposits = [
1313
["b27aebb3b54effd7af87c4a064a711554ee0f3f5abf56ca910b46422f2b21603bc383d42eb3b927c4c3b0b8381ca30a3", "12D3KooWESMZ2ttSxDwjfnNe23sHCqsJf6sNEKwgHkdgtCHDsbWU", "10000000000000000000000000", "7E5F4552091A69125d5DfCb7b8C2659029395Bdf", "99F7f7C00526426b8dCA99302e96d85A0e5fd400"],
@@ -18,17 +18,35 @@ consensus.genesis_accounts = [
1818
["2B5AD5c4795c026514f8317c7a215E218DcCD6cF", "5000000000000000000000"],
1919
["6813Eb9362372EEF6200f3b1dbC3f819671cBA69", "5000000000000000000000"],
2020
["1efF47bc3a10a45D4B230B5d10E37751FE6AA718", "5000000000000000000000"],
21-
# spec-tests
22-
["f39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "5000000000000000000000"],
23-
["90F8bf6A479f320ead074411a4B0e7944Ea8c9C1", "5000000000000000000000"],
24-
["3fAB184622Dc19b6109349B94811493BF2a45362", "5000000000000000000000"],
21+
# geth account
22+
# ["71562b71999873db5b286df957af199ec94617f7", "5000000000000000000000"],
23+
# hardhat addresses
24+
["f39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "10000000000000000000000"], # 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
25+
["70997970c51812dc3a010c7d01b50e0d17dc79c8", "10000000000000000000000"], # 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
26+
# bundler-spec-test
27+
["90F8bf6A479f320ead074411a4B0e7944Ea8c9C1", "10000000000000000000000"], # 0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d
28+
# Arachnid account
29+
# ["3fAB184622Dc19b6109349B94811493BF2a45362", "10000000000000000000000"],
30+
# executor
2531
]
2632

2733
# Reward parameters
2834
consensus.rewards_per_hour = "51_000_000_000_000_000_000_000"
29-
consensus.blocks_per_hour = 3600
35+
consensus.blocks_per_hour = 36
3036
consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
3137
# Gas parameters
3238
consensus.eth_block_gas_limit = 84000000
3339
# spec-tests
34-
consensus.gas_price = "0"
40+
consensus.gas_price = "1"
41+
42+
43+
# ==entrypoint addr= 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108
44+
# reusing "SimpleAccountFactory" at 0x13E9ed32155810FDbd067D4522C492D6f68E5944
45+
# reusing "TestCounter" at 0x7FfFfe05FeeA7902AffBe5D991800Dd9F3d0460F
46+
# reusing "Simple7702Account" at 0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9
47+
48+
# entrypointSimulationContractV7: "0x703575F1c54Bd480e1431b3bFfDBf55722CF6025"
49+
# entrypointSimulationContractV8: "0xBC8Befa8737D4D46D78b397D0a587d15AA4c16C1"
50+
# entrypointSimulationContractV9: "0xB5B76553126c6075bef9b6313aE567aB2c5d7DFc"
51+
# pimlicoSimulationContract: "0x8D72441022399e256Dcbea0eA183EbD031d37B7C"
52+
# 0xe74a3c7427cda785e0000d42a705b1f3fd371e09

‎scripts/bundler_test.sh‎

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,47 @@ export NVM_DIR="$HOME/.nvm"
2222
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
2323

2424
echo "Installing nvm"
25-
nvm install 22.12
25+
nvm install 22.22
2626

27-
echo "Using node version 22.12"
28-
nvm use 22.12
27+
echo "Using node version 22.22"
28+
nvm use 22.22
2929
node --version
3030

31+
# link solc directly to skip download
32+
mkdir -p $HOME/.solcx/
33+
ln -s $(which solc) $HOME/.solcx/solc-v0.8.28
34+
35+
# Update bundler-spec-tests, hacking the remote origin url as SSH does not work in CI
36+
git clone --depth 1 https://github.com/eth-infinitism/bundler-spec-tests.git --branch version-0.8-addrs
37+
pushd bundler-spec-tests/
38+
git config --file=.gitmodules submodule.@rip7560.url https://github.com/eth-infinitism/rip7560_contracts.git
39+
pdm install && pdm run update-deps-remote
40+
popd
41+
3142
# wait till ZQ2 runs
32-
timeout 60 bash -c 'until curl -sf http://localhost:4201/health; do sleep 1; done'
43+
timeout 60 bash -c 'until curl -o /dev/null -sf http://localhost:4201/health; do sleep 1; done'
3344

3445
# Pre install contracts
3546
echo "Install Entrypoint v0.8"
36-
npm install @account-abstraction/contracts
37-
cast publish --rpc-url http://localhost:4200 0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222
38-
cast send --rpc-url http://localhost:4200 --private-key 0x0000000000000000000000000000000000000000000000000000000000000004 0x4e59b44847b379578588920cA78FbF26c0B4956C "$(node -e "const {bytecode} = require('@account-abstraction/contracts/artifacts/EntryPoint.json'); console.log('0x0a59dbff790c23c976a548690c27297883cc66b4c67024f9117b0238995e35e9' + bytecode.slice(2))")"
47+
npm install hardhat@3.5.0
48+
pushd bundler-spec-tests/@account-abstraction/
49+
yarn deploy --network proxy
50+
popd
3951

4052
# Install Bundler
4153
echo "Install Alto-Bundler"
4254
npm install @pimlico/alto
43-
npx alto \
44-
-r http://localhost:4200 \
45-
--port 3000 \
46-
-e 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108 \
47-
-x 0x0000000000000000000000000000000000000000000000000000000000000002 \
48-
-u 0x0000000000000000000000000000000000000000000000000000000000000003 \
49-
--enable-debug-endpoints true > /tmp/alto_log.txt 2>&1 &
50-
timeout 60 bash -c 'until curl -sf http://localhost:3000/health; do sleep 1; done'
51-
52-
# Update bundler-spec-tests, hacking the remote origin url as SSH does not work in CI
53-
git clone --depth 1 https://github.com/eth-infinitism/bundler-spec-tests.git --branch version-0.8-addrs
54-
cd bundler-spec-tests/
55-
git config --file=.gitmodules submodule.@rip7560.url https://github.com/eth-infinitism/rip7560_contracts.git
56-
pdm install && pdm run update-deps
57-
58-
# link solc directly to skip download
59-
mkdir -p $HOME/.solcx/
60-
ln -s $(which solc) $HOME/.solcx/solc-v0.8.28
55+
npx alto --config bundler_tests/alto-config.json > /tmp/alto_log.txt 2>&1 &
56+
timeout 60 bash -c 'until curl -o /dev/null -sf http://localhost:3000/health; do sleep 1; done'
6157

6258
# Run spec tests
59+
pushd bundler-spec-tests/
6360
pdm test \
6461
--url http://localhost:3000 \
6562
--entry-point 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108 \
6663
--ethereum-node http://localhost:4200 \
6764
tests/single/rpc/
65+
popd
6866

6967
# cleanup
7068
retVal=$?

‎zilliqa/src/api/bundler.rs‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use alloy::{
44
eips::BlockId,
55
rpc::types::{
6-
TransactionRequest,
6+
BlockOverrides, TransactionRequest,
77
state::{AccountOverride, StateOverride},
88
},
99
};
@@ -61,15 +61,14 @@ pub fn debug_trace_call(params: Params, node: &Arc<Node>) -> Result<GethTrace> {
6161
let call_params: TransactionRequest = params.next()?;
6262
let block_id: BlockId = params.optional_next()?.unwrap_or_default();
6363
let options: GethDebugTracingCallOptions = params.optional_next()?.unwrap_or_default();
64+
crate::api::eth::expect_end_of_params(&mut params, 1, 3)?;
6465

6566
anyhow::ensure!(
6667
options.block_overrides.is_none(),
6768
"block_overrides unexpected"
6869
);
6970
anyhow::ensure!(options.tx_index.is_none(), "tx_index unexpected");
7071

71-
let overrides = options.state_overrides.clone().unwrap_or_default();
72-
7372
let (mut evm_state, block) = {
7473
let block = node.get_block(block_id)?;
7574
let block = build_errored_response_for_missing_block(block_id, block)?;
@@ -81,9 +80,12 @@ pub fn debug_trace_call(params: Params, node: &Arc<Node>) -> Result<GethTrace> {
8180
"State required to execute request does not exist"
8281
);
8382

84-
tracing::trace!("debug contract: block={block:?} overrides={overrides:?}");
83+
let state_overrides = options.state_overrides.clone().unwrap_or_default();
84+
let block_overrides = options.block_overrides.clone().unwrap_or_default();
85+
86+
tracing::trace!(?state_overrides, ?block_overrides, ?block, "debug contract");
8587

86-
apply_state_overrides(&mut evm_state, &node.clone(), overrides)?;
88+
apply_state_overrides(&mut evm_state, &node.clone(), state_overrides)?;
8789

8890
let result = node.debug_trace_call(&mut evm_state, &block, call_params, options)?;
8991

@@ -97,7 +99,9 @@ pub fn eth_call(params: Params, node: &Arc<Node>) -> Result<String> {
9799
let mut params = params.sequence();
98100
let call_params: TransactionRequest = params.next()?;
99101
let block_id: BlockId = params.optional_next()?.unwrap_or_default();
100-
let overrides: StateOverride = params.optional_next()?.unwrap_or_default();
102+
let state_overrides: StateOverride = params.optional_next()?.unwrap_or_default();
103+
let block_overrides: BlockOverrides = params.optional_next()?.unwrap_or_default();
104+
crate::api::eth::expect_end_of_params(&mut params, 1, 4)?;
101105

102106
let (mut evm_state, block) = {
103107
let block = node.get_block(block_id)?;
@@ -109,9 +113,9 @@ pub fn eth_call(params: Params, node: &Arc<Node>) -> Result<String> {
109113
return Err(anyhow!("State required to execute request does not exist"));
110114
}
111115

112-
tracing::trace!("call_contract: block={block:?} overrides={overrides:?}");
116+
tracing::trace!(?block, ?state_overrides, ?block_overrides, "call_contract");
113117

114-
apply_state_overrides(&mut evm_state, &node.clone(), overrides)?;
118+
apply_state_overrides(&mut evm_state, &node.clone(), state_overrides)?;
115119

116120
let result = evm_state.call_contract(
117121
call_params.from.unwrap_or_default(),

‎zilliqa/src/api/eth.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub fn build_errored_response_for_missing_block(
228228
}
229229
}
230230

231-
fn expect_end_of_params(seq: &mut ParamsSequence, min: u32, max: u32) -> Result<()> {
231+
pub fn expect_end_of_params(seq: &mut ParamsSequence, min: u32, max: u32) -> Result<()> {
232232
// Styled after the geth error message.
233233
let msg = if min != max {
234234
format!("too many arguments, want at most {max}")

‎zilliqa/src/node.rs‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -969,21 +969,6 @@ impl Node {
969969
// .and_then(|s| duration_str::parse(s).ok())
970970
// .unwrap_or_default();
971971

972-
/*
973-
GethDebugTracingCallOptions {
974-
tracing_options: GethDebugTracingOptions {
975-
tracer: Some(GethDebugTracerType::JsTracer(
976-
validation_tracer_js().to_string(),
977-
)),
978-
timeout: Some(self.tracer_timeout.clone()),
979-
..Default::default()
980-
},
981-
state_overrides: Some(state_override),
982-
block_overrides: None,
983-
tx_index: None,
984-
},
985-
*/
986-
987972
let _timeout = timeout
988973
.map(|s| duration_str::parse_std(s).unwrap_or_default())
989974
.unwrap_or(Duration::from_mins(1)); // 1-min default

‎zilliqa/src/node_launcher.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl NodeLauncher {
142142
// A standalone RPC server is provided mainly to implement the API extensions needed to enable bundler support.
143143
// A decision may be made to enable the same extensions on the regular API in the future, and to directly incorporate it to the main JSON-RPC.
144144
let bundler_api = api::bundler::rpc_module(node.clone(), &crate::api::bundler_enabled());
145-
let rpc_middleware = RpcServiceBuilder::new().layer(RpcLoggerLayer::new(1_000));
145+
let rpc_middleware = RpcServiceBuilder::new().layer(RpcLoggerLayer::new(10_000));
146146
let bundler_rpc = jsonrpsee::server::ServerBuilder::new()
147147
.set_config(
148148
ServerConfig::builder()
@@ -151,7 +151,7 @@ impl NodeLauncher {
151151
.build(),
152152
)
153153
.set_rpc_middleware(rpc_middleware)
154-
.build((Ipv4Addr::UNSPECIFIED, 4200)) // hard-coded port number
154+
.build((Ipv4Addr::UNSPECIFIED, 8545)) // hard-coded port number
155155
.await;
156156
match bundler_rpc {
157157
Ok(server) => {

0 commit comments

Comments
 (0)