#35744·go-ethereum

activePrecompiledContracts: no Amsterdam arm — Osaka precompiles missing when amsterdamTime set without osakaTime

Author: Lucian-code233Created Sep 20, 2026Updated Sep 24, 2026
Labelsstatus:triage

Hi geth maintainers — we found a hardfork-gating gap in activePrecompiledContracts that produces a consensus split vs revm/evmone on configs that activate Amsterdam without Osaka.

Summary

params.ChainConfig allows amsterdamTime set with osakaTime == nil (CheckConfigForkOrder: both timestamps optional: true). Rules.IsOsaka and Rules.IsAmsterdam are independent booleans.

core/vm/contracts.go activePrecompiledContracts has no IsAmsterdam case:

go
switch {
case rules.IsUBT:    return &PrecompiledContractsVerkle  // = Berlin
case rules.IsBogota: return &PrecompiledContractsOsaka
case rules.IsOsaka:  return &PrecompiledContractsOsaka
case rules.IsPrague: return &PrecompiledContractsPrague
...
}

NewEVM does select amsterdamInstructionSet when IsAmsterdam — so this config runs Amsterdam opcodes + Prague precompiles.

Measured (geth v1.17.5-128-ga5b90d2a2)

Config A: pragueTime=0, amsterdamTime=0, osakaTime=nil Config B: pragueTime=0, osakaTime=0, amsterdamTime=0

Check Config A (Ams without Osaka) Config B (Osaka+Ams)
0x0100 P256 in ActivePrecompiledContracts absent present
MODEXP base_len=2000, exp=1, mod=1 success, reqGas=20833, out=00 fail EIP-7823 …length exceeded 1024 bytes
MODEXP base_len=1025 success, reqGas=5547 fail, reqGas=33282
Warm list ActivePrecompiles(0x0100) absent present

Counterparty policy at Amsterdam:

  • revm: OSAKA | AMSTERDAM => PrecompileSpecId::OSAKA
  • evmone: is_precompile(EVMC_AMSTERDAM, 0x0100) = 1

Impact

On a chain with Amsterdam active and Osaka omitted:

CALL geth revm/evmone
0x0100 P256 witness empty-account success (no precompile) P256 runs
0x05 modexp base_len>1024 success (Prague gas) fail (EIP-7823)

→ different gas, returndata, and receipt status → state-root / receipt split.

Mainnet today: official schedules set Osaka before Amsterdam, so IsOsaka is already true — no live mainnet split. The bug bites custom/devnet/state-test configs and any future schedule that optional-skips Osaka.

Related: ActivePrecompiles has the same missing arm (warm-list vs exec-map).

Suggested fix

Add an explicit arm (and keep warm-list in sync):

go
case rules.IsAmsterdam:
    return &PrecompiledContractsOsaka

and/or reject configs with amsterdamTime != nil && osakaTime == nil in CheckConfigForkOrder.

UBT/Bogota inheritance of Osaka precompiles may deserve the same review.

Repro

bash
go test ./core/vm/ -run 'TestZZPrecompileSetMembership|TestZZModexp7823ConfigSplit' -v

Chain config:

json
{ "pragueTime": 0, "amsterdamTime": 0 }

Raw logs and a fuller write-up are available on request.