Skip to content

statetest: transaction.secretKey is ignored unless sender is provided #1490

@chfast

Description

@chfast

Summary

evmone-statetest does not recover transaction sender from transaction.secretKey and instead relies on optional JSON transaction.sender.

If sender is omitted (valid in canonical state-test style), evmone executes with zero-address sender and rejects with insufficient funds, while geth evm statetest signs/recover sender from secretKey and passes.

Reproducer (Cancun state test)

secretkey_sender_state_test.json

{
  "secretkey_sender_recovery": {
    "_info": { "comment": "State test where sender should be recovered from secretKey" },
    "env": {
      "currentCoinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1",
      "currentNumber": "0x01",
      "currentTimestamp": "0x54c99069",
      "currentGasLimit": "0x2fefd8",
      "currentDifficulty": "0x0",
      "currentRandom": "0x0000000000000000000000000000000000000000000000000000000000000001",
      "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "currentBaseFee": "0x1",
      "currentExcessBlobGas": "0x0",
      "withdrawals": []
    },
    "pre": {
      "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
        "code": "0x",
        "nonce": "0x00",
        "balance": "0xde0b6b3a7640000",
        "storage": {}
      },
      "0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
        "code": "0x",
        "nonce": "0x00",
        "balance": "0x00",
        "storage": {}
      }
    },
    "transaction": {
      "data": ["0x"],
      "gasLimit": ["0x5208"],
      "value": ["0x0"],
      "to": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
      "nonce": "0x0",
      "chainId": "0x1",
      "gasPrice": "0x1",
      "secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8"
    },
    "post": {
      "Cancun": [
        {
          "indexes": { "data": 0, "gas": 0, "value": 0 },
          "hash": "0x5a605f957d4aa4145411d63287ddf1bae2202c30cc6ec86ae003423bb6343778",
          "logs": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
        }
      ]
    }
  }
}

Commands

# evmone
evmone-statetest secretkey_sender_state_test.json

# geth
evm statetest --statetest.fork Cancun secretkey_sender_state_test.json

Observed divergence

  • evmone:
    • fails test as invalid tx:
    • unexpected invalid transaction: insufficient funds for gas * price + value
  • geth:
    • test passes ("pass": true)

Suspected root cause

  • Loader reads sender only from optional JSON sender:
    • test/utils/statetest_loader.cpp (o.sender = load_if_exists<evmc::address>(j, "sender"))
  • Loader has no secretKey handling in statetest path.
  • secretKey appears only in exporter (test/utils/statetest_export.cpp) and is not consumed by loader.

This makes state-test compatibility depend on non-standard sender being present instead of deriving sender from the key/signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions