Skip to content

Commit

Permalink
fix: bundler spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vid201 committed Sep 21, 2023
1 parent d15b51e commit 8f25059
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
wget -c https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.11.6-ea9e62ca.tar.gz
tar -xf geth-linux-amd64-1.11.6-ea9e62ca.tar.gz
mv geth-linux-amd64-1.11.6-ea9e62ca/geth /usr/local/bin/
wget -c https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.12.0-e501b3b0.tar.gz
tar -xf geth-linux-amd64-1.12.0-e501b3b0.tar.gz
mv geth-linux-amd64-1.12.0-e501b3b0/geth /usr/local/bin/
chmod a+x /usr/local/bin/geth
- name: Build
Expand Down Expand Up @@ -111,4 +111,4 @@ jobs:
- run: npm install -g yarn

- name: Run tests
run: pdm run test --launcher-script silius/bundler-spec-tests/launcher.sh --url http://localhost:3000
run: pdm run test --launcher-script silius/bundler-spec-tests/launcher.sh --url http://127.0.0.1:3000
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN apk add openssl1.1-compat

COPY --from=builder /silius/target/release/silius /usr/local/bin/silius

EXPOSE 3000
EXPOSE 3000 3001

ENTRYPOINT ["usr/local/bin/silius"]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For more information: https://hackmd.io/@Vid201/aa-bundler-rust
Rust version: 1.71.1

1. `libclang-dev`, `pkg-config` and `libssl-dev` on Debian/Ubuntu.
2. Ethereum execution client JSON-RPC API with enabled [`debug_traceCall`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debug_tracecall). For production, you can use [Geth](https://github.com/ethereum/go-ethereum) or [Erigon](https://github.com/ledgerwatch/erigon). For testing, we are using Geth dev mode (tested with [v1.11.6](https://github.com/ethereum/go-ethereum/releases/tag/v1.11.6)); so you need to install [Geth](https://geth.ethereum.org/docs/getting-started/installing-geth) for running tests.
2. Ethereum execution client JSON-RPC API with enabled [`debug_traceCall`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debug_tracecall). For production, you can use [Geth](https://github.com/ethereum/go-ethereum) or [Erigon](https://github.com/ledgerwatch/erigon). For testing, we are using Geth dev mode (tested with [v1.12.0](https://github.com/ethereum/go-ethereum/releases/tag/v1.12.0)); so you need to install [Geth](https://geth.ethereum.org/docs/getting-started/installing-geth) for running tests.
3. [`solc`](https://docs.soliditylang.org/en/v0.8.17/installing-solidity.html) >=0.8.12.
4. [`cargo-sort`](https://crates.io/crates/cargo-sort) and [`cargo-udeps`](https://crates.io/crates/cargo-udeps).

Expand Down
2 changes: 1 addition & 1 deletion bin/silius/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub struct UoPoolArgs {
pub datadir: Option<ExpandedPathBuf>,

/// Max allowed verification gas.
#[clap(long, default_value="3000000", value_parser=parse_u256)]
#[clap(long, default_value="5000000", value_parser=parse_u256)]
pub max_verification_gas: U256,

/// Minimum stake required for entities.
Expand Down
29 changes: 26 additions & 3 deletions bundler-spec-tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
version: '2'
version: "3"

services:
geth-dev:
build: geth-dev
image: ethereum/client-go:release-1.12
healthcheck:
test: [ "CMD-SHELL", "geth attach --exec eth.blockNumber" ]
interval: 10s
timeout: 5s
retries: 5
ports:
- 8545:8545
- 8546:8546
command:
- --miner.gaslimit=12000000
- --http
- --http.api=personal,eth,net,web3,debug
- --allow-insecure-unlock
- --rpc.allow-unprotected-txs
- --http.vhosts=*
- --http.corsdomain=*
- --http.addr=0.0.0.0
- --ws
- --ws.api=personal,eth,net,web3,debug
- --ws.origins=*
- --ws.addr=0.0.0.0
- --dev
- --nodiscover
- --maxpeers=0
- --mine
- --verbosity=2
fund-signer:
image: ethereum/client-go:release-1.10
image: ethereum/client-go:release-1.12
entrypoint: 'geth --exec "eth.sendTransaction({from: eth.accounts[0], to: \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\", value: web3.toWei(10000, \"ether\")})" attach http://geth-dev:8545'
depends_on:
geth-dev:
Expand Down
19 changes: 0 additions & 19 deletions bundler-spec-tests/geth-dev/Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion bundler-spec-tests/launcher.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ case $1 in

start)
docker-compose up -d
sleep 2
silius bundler \
--verbosity 4 \
--eth-client-address ws://localhost:8545 \
--eth-client-address ws://127.0.0.1:8546 \
--mnemonic-file keys/0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--beneficiary 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--entry-points 0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789 \
Expand Down
5 changes: 4 additions & 1 deletion crates/contracts/src/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ pub const JS_TRACER: &str = r#"
this.lastThreeOpcodes.shift();
}
// this.debug.push(this.lastOp + '-' + opcode + '-' + log.getDepth() + '-' + log.getGas() + '-' + log.getCost())
if (log.getGas() < log.getCost()) {
if (log.getGas() < log.getCost() || (
// special rule for SSTORE with gas metering
opcode === 'SSTORE' && log.getGas() < 2300)
) {
this.currentLevel.oog = true;
}
if (opcode === 'REVERT' || opcode === 'RETURN') {
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: "3"

services:
silius:
image: ghcr.io/vid201/silius:latest
Expand Down

0 comments on commit 8f25059

Please sign in to comment.