Skip to content

t8n: legacy tx with v>255 (high chainId) is rejected by JSON parser #1487

@chfast

Description

@chfast

Summary

evmone-t8n parses transaction signature v as uint8_t and aborts for valid legacy EIP-155 signatures where v > 0xff (e.g. chain id 300 gives v=0x27c).

go-ethereum evm t8n accepts and executes the same transaction.

Reproducer (Cancun, chain id = 300)

alloc.json

{
  "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
    "code": "0x",
    "nonce": "0x0",
    "balance": "0xde0b6b3a7640000",
    "storage": {}
  },
  "0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
    "code": "0x",
    "nonce": "0x0",
    "balance": "0x0",
    "storage": {}
  }
}

env.json

{
  "currentCoinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1",
  "currentNumber": "0x01",
  "currentTimestamp": "0x54c99069",
  "currentGasLimit": "0x2fefd8",
  "currentRandom": "0x0000000000000000000000000000000000000000000000000000000000000001",
  "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "currentBaseFee": "0x1",
  "currentExcessBlobGas": "0x0",
  "withdrawals": []
}

txs.json

[
  {
    "chainId": "0x12c",
    "gas": "0x5208",
    "gasPrice": "0x1",
    "hash": "0x402403f289d43e6ece4e68b5411243db91ab51d1cac2263b800c8e1f514734bc",
    "input": "0x",
    "nonce": "0x0",
    "r": "0x1dc61f343f04852f8024e5e693c1ed4e7d363aaa8e22b2f9059d4f999c434fbe",
    "s": "0x78e6472429c9d0279ab4145d8cacdb98180ede3097ded74ae4582300996cb3c9",
    "sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "to": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
    "v": "0x27c",
    "value": "0x0"
  }
]

Commands

# evmone
evmone-t8n \
  --state.fork Cancun --state.chainid 300 \
  --input.alloc alloc.json --input.env env.json --input.txs txs.json \
  --output.basedir out-evmone --output.result result.json --output.alloc alloc.json

# geth
evm t8n \
  --state.fork Cancun --state.chainid 300 \
  --input.alloc alloc.json --input.env env.json --input.txs txs.json \
  --output.basedir out-geth --output.result result.json --output.alloc alloc.json

Observed divergence

  • evmone exits with parser error:
    • from_json<uint8_t>: value > 0xFF
  • geth executes successfully:
    • gasUsed = 0x5208
    • post-state updated (nonce increment + gas charged)

Suspected root cause

evmone loader narrows v to uint8:

  • test/utils/statetest_loader.cpp
    • o.v = from_json<uint8_t>(j.at("v"));
    • from_json<uint8_t> throws if value > 0xff.

In contrast, geth legacy tx JSON unmarshalling reads v as big integer (*big.Int) and validates signature from that value:

  • core/types/transaction_marshalling.go (legacy tx path).

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