feat(tests): evmone blockchain tets tool to support invalid blocks

Aperta
#1,214 13 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@gumb0 ci sta già lavorando.

Dal 6/5/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Currently evmone-blockchain test runner does not support invalid blocks.

But thats pretty easy:

ok so when you verify invalid blockchain test, you go all blocks one by one.
once you hit invalid block. it looks like this:

        "blocks" : [
            {
                "blocknumber" : "1",
                "chainname" : "default",
                "expectException" : "BlockException.INVALID_STATE_ROOT",
                "rlp" : "0x...",
                "rlp_decoded" : {

you attmept to import data from rlp. need rlp here.
rlp usually valid. but can have wrong stateroot or coinbase or other header field.

so you import transactions from block. (from rlp)
if any tx is invalid, the whole block is invalid.
compare transaction exception error code with the one in
"expectException" : "TransactionException.INSUFFICIENT_ACCOUNT_FUNDS",

if all transactions are valid. executed the transition and calculate new post state. (header fields) then verify hashes against the ones provided in rlp's blockHeader
if there is a mismatch, throw an exception error code and compare to the one provided in expectException in the test.

in any case if exception match, the test passed. if you throw a different exception the test does not pass.
if you have no exception the test does not pass

if you don't have rlp, you can read data from rlp_decoded
but it is not recommended. as some invalid blocks might not have it.

example on invalid bc test:
https://github.com/ethereum/tests/blob/develop/BlockchainTests/InvalidBlocks/bcUncleHeaderValidity/diffTooLow2.json

Note. Difficulty block reorg tests are in Legacy, that support is optional.

Lingua principale
C++
Stelle
979
Fork
340
Merge medio
12h 16m
PR unite (30g)
25

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ipsilon/evmone

Tutte le issue di ipsilon/evmone

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.