statetest: BLOCKHASH range check breaks when currentNumber > 2^63-1
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- cpp
- Área
- blockchain
Línea de trabajo
Start by reading lib/evmone/instructions.hpp around blockhash(), then trace how test/utils/statetest_loader.cpp and test/state/block.hpp represent the current block number. Run the provided reproducer with build/debug/bin/evmone-statetest; done means its post-state root matches the geth result for this high-number Cancun test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
evmone-statetest diverges from geth on a valid Cancun state test when env.currentNumber is above INT64_MAX.
The test executes BLOCKHASH(currentNumber - 1) and then stores ISZERO(result).
- geth returns non-zero
BLOCKHASH(in-range lookup), soISZEROis0. - evmone-statetest returns
0x0for the same in-range lookup, soISZEROis1.
This produces different post-state roots.
Reproducer
files/case12-statetest-blockhash-highnum/blockhash_highnum_state_test.json
Commands
# geth: passes
~/go/bin/evm statetest --statetest.fork Cancun files/case12-statetest-blockhash-highnum/blockhash_highnum_state_test.json
# evmone: fails
build/debug/bin/evmone-statetest files/case12-statetest-blockhash-highnum/blockhash_highnum_state_test.json
Observed:
- geth state root:
0x27ebe6aaf81779a3f3516512f8bdd8d543be038c26b9bba4bba5d85cce73f02f(PASS) - evmone state root:
0x48e2b3fe41a421a38716c88d2e14ad390b55ff6301db7d3b24079e55dc01e768(FAIL)
Trace difference
For the same bytecode (0x6780000000000000ff401560005500):
- geth trace shows
BLOCKHASHpushes non-zero. - evmone trace shows
BLOCKHASHpushes0x0.
Likely root cause
The statetest path stores block numbers as signed 64-bit and BLOCKHASH range checks with signed bounds:
test/utils/statetest_loader.cpp:currentNumberparsed viafrom_json<int64_t>.test/state/block.hpp:BlockInfo::numberisint64_t.lib/evmone/instructions.hppblockhash():upper_bound = state.get_tx_context().block_number(signed)lower_bound = std::max(upper_bound - 256, 0)n = static_cast<int64_t>(number)- signed comparison path rejects what should be valid
currentNumber-1lookups aboveINT64_MAX.
The EVM BLOCKHASH semantics are based on unsigned block numbers modulo 2^256 on stack values, with recent-256 window check relative to the current block number. Using signed block numbers in this path causes incorrect behavior for values above 2^63-1.
- Lenguaje dominante
- C++
- Estrellas
- 979
- Forks
- 340
- Merge medio
- 12 h 16 min
- PR fusionados (30 d)
- 25
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ipsilon/evmone
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
Los mantenedores suelen responder en 1 día
Todos los issues de ipsilon/evmone
Issues similares
-
Reference check: findingsAbiertoaudit-reference-check
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
schrodinger/pymol-open-source#532 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
xlnt-community/xlnt#174 ·
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
sleepyviper1213/redis#30 ·