Skip to content

fix(spec-tools): load txs that carry no signature material - #14

Merged
gurukamath merged 4 commits into
gurukamath:refactor/testing-alloc-as-prestatefrom
danceratopz:refactor-testing-alloc-as-prestate-fixup-json-loader-with-default-vrs-of-zero
Jul 6, 2026
Merged

fix(spec-tools): load txs that carry no signature material#14
gurukamath merged 4 commits into
gurukamath:refactor/testing-alloc-as-prestatefrom
danceratopz:refactor-testing-alloc-as-prestate-fixup-json-loader-with-default-vrs-of-zero

Conversation

@danceratopz

@danceratopz danceratopz commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes the json-loader CI failure on this branch: 136 cases, all test_bad_v_r_s, all failing with AssertionError: secret_key or signer must be set (run 28782882693) from ethereum#2924.

Bug

Filled state tests store a tx whose signature is deliberately invalid with no signature material at all: the state-test fixture format cannot express explicit v/r/s (the blockchain format carries them inside txbytes), so these fixtures rely on expectException. The json_loader feeds that tx to the CLI t8n verbatim. The new CLI parser builds a testing Transaction and RLP-encodes it for the returned body; RLP serialization auto-signs a tx whose v/r/s were never set and hits assert signing_key is not None because there is no secretKey and the sender EOA carries no key. The previous parser (t8n_types.Txs.parse_json_tx) defaulted each missing component to 0x00 and let the fork reject the invalid signature.

Fix

_normalize_tx_json now defaults v/r/s to zero when a tx carries none of v/r/s/secretKey, restoring the previous parser's behavior: the tx executes with an invalid signature and is rejected, which is exactly what these fixtures assert.

Verification

  • The filled bad_v_r_s.json fixture is byte-identical between this branch and forks/amsterdam (only the provenance URL differs), so the failure is purely in the loader path and this fix cannot change any fixture output.
  • Filled tests/frontier/validation/test_transaction.py::test_bad_v_r_s locally into tests/json_loader/fixtures for Homestead and Prague and ran pytest tests/json_loader: all cases pass with this fix and reproduce the CI assertion without it.
  • The new branch only triggers for a tx with no signature material at all; signed txs and secretKey-carrying txs take exactly the same path as before, so behavior for every other input is unchanged.

The CLI parser builds testing `Transaction` objects and RLP-encodes
them for the returned body. A tx with neither `v`/`r`/`s` nor
`secretKey` made `Transaction.rlp` auto-sign a key-less tx and die on
`assert signing_key is not None`, failing every json_loader case that
replays such a fixture (136 in CI, all `test_bad_v_r_s`).

Default the missing signature components to zero in
`_normalize_tx_json`, matching the previous parser
(`t8n_types.Txs.parse_json_tx`): the tx then executes with an invalid
signature and the fork rejects it, which is exactly what these
fixtures assert via `expectException`. Verified against locally
filled `bad_v_r_s` fixtures for Homestead and Prague.
Comment thread src/ethereum_spec_tools/evm_tools/t8n/cli.py Outdated
Comment thread src/ethereum_spec_tools/evm_tools/t8n/cli.py Outdated
@gurukamath
gurukamath merged commit 84fd374 into gurukamath:refactor/testing-alloc-as-prestate Jul 6, 2026
6 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants