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

オープン
#1,214 コメント 13 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@gumb0 がすでに取り組んでいます。

2025年5月6日 から。

評価

この issue はまだ評価されていません。

説明

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.

主要言語
C++
スター
979
フォーク
340
平均マージ
12時間 16分
マージ済み PR(30日)
25

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ipsilon/evmone のほかの issue

ipsilon/evmone の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。