diff --git a/README.md b/README.md index 9383f9b..105043f 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,7 @@ See [examples](./examples) for more See [benchmark/README.md](./benchmark/) for the methodology and commands to reproduce these results -versions: evmole v0.3.5; whatsabi v0.12.0; sevm v0.6.17; evm-hound-rs v0.1.4; heimdall-rs v0.7.3 +versions: evmole v0.3.6; whatsabi v0.12.0; sevm v0.6.17; evm-hound-rs v0.1.4; heimdall-rs v0.7.3 (*): sevm and heimdall-rs are full decompilers, not limited to extracting function selectors diff --git a/benchmark/providers/evmole-rs/Cargo.lock b/benchmark/providers/evmole-rs/Cargo.lock index 6097d90..8a3aae4 100644 --- a/benchmark/providers/evmole-rs/Cargo.lock +++ b/benchmark/providers/evmole-rs/Cargo.lock @@ -355,7 +355,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "evmole" -version = "0.3.4" +version = "0.3.5" dependencies = [ "ruint", ] diff --git a/dev.sh b/dev.sh index 7d2c112..48a2cc7 100755 --- a/dev.sh +++ b/dev.sh @@ -4,11 +4,14 @@ DS=$2 BDIR=`pwd`/benchmark +# MODE=selectors +MODE=arguments + case $1 in js) ln -s `pwd`/js ${BDIR}/providers/evmole-js 2>/dev/null || true node ${BDIR}/providers/evmole-js/main.mjs \ - arguments \ + ${MODE} \ ${BDIR}/datasets/${2} \ out.json \ ${BDIR}/results/etherscan.selectors_${2}.json \ @@ -21,7 +24,7 @@ case $1 in cargo run \ --manifest-path benchmark/providers/evmole-rs/Cargo.toml \ --features "evmole/trace" \ - arguments \ + ${MODE} \ ${BDIR}/datasets/${2} \ out.json \ ${BDIR}/results/etherscan.selectors_${2}.json \ @@ -33,7 +36,7 @@ case $1 in PYTHONPATH=`pwd` \ python3.12 \ ${BDIR}/providers/evmole-py/main.py \ - arguments \ + ${MODE} \ ${BDIR}/datasets/${2} \ out.json \ ${BDIR}/results/etherscan.selectors_${2}.json \ diff --git a/js/package.json b/js/package.json index 7cbf599..d8dcee8 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "evmole", - "version": "0.3.5", + "version": "0.3.6", "description": "Extracts function selectors and arguments from EVM bytecode", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", diff --git a/js/src/arguments.js b/js/src/arguments.js index 3c5bdaa..f083951 100644 --- a/js/src/arguments.js +++ b/js/src/arguments.js @@ -351,7 +351,13 @@ export function functionArguments(code, selector, gas_limit = 5e4) { const E256M1 = (1n << 256n) - 1n - if (rl.offset == 0 && rl.add_val == 0 && rl.path.length != 0 && uint8ArrayToBigInt(r.data) === 0n && ot_val == E256M1) { + if ( + rl.offset == 0 && + rl.add_val == 0 && + rl.path.length != 0 && + uint8ArrayToBigInt(r.data) === 0n && + ot_val == E256M1 + ) { vm.stack.peek().data = bigIntToUint8Array(0n) } const add = (ot_val + BigInt(rl.add_val)) & E256M1 diff --git a/js/src/selectors.js b/js/src/selectors.js index eeaa720..a7caf2b 100644 --- a/js/src/selectors.js +++ b/js/src/selectors.js @@ -9,6 +9,7 @@ function process(vm, gasLimit) { let gasUsed = 0 while (!vm.stopped) { + // console.log('selectors', selectors) // console.log(vm.toString()) let ret try { @@ -82,9 +83,12 @@ function process(vm, gasLimit) { const p = vm.stack.peek() if (p.data.slice(-4).every((v, i) => v === vm.calldata.data[i])) { p.label = 'signature' - } else if (r1.label === 'mulsig') { + } else { p.label = 'mulsig' } + } else if (r1.label === 'mulsig') { + const p = vm.stack.peek() + p.label = 'mulsig' } break diff --git a/pyproject.toml b/pyproject.toml index 1fa42fe..530352a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "evmole" -version = "0.3.5" +version = "0.3.6" description = "Extracts function selectors and arguments from EVM bytecode" authors = ["Maxim Andreev "] license = "MIT" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 40458e2..d3e16e1 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -260,7 +260,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "evmole" -version = "0.3.4" +version = "0.3.5" dependencies = [ "hex", "ruint", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index f76d233..6abd8e3 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "evmole" -version = "0.3.5" +version = "0.3.6" edition = "2021" description = "Extracts function selectors and arguments from EVM bytecode" authors = ["Maxim Andreev "]