From def5237da5ce9bef31eaf915d111ead880eff173 Mon Sep 17 00:00:00 2001 From: Felix H Date: Mon, 19 Jan 2026 15:49:28 +0000 Subject: [PATCH] add amsterdam instruction set etc. --- core/gen_genesis.go | 8 ++++---- core/genesis.go | 1 + core/vm/evm.go | 2 ++ core/vm/jump_table.go | 7 +++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/gen_genesis.go b/core/gen_genesis.go index cc17dad6cb..3f0023fe68 100644 --- a/core/gen_genesis.go +++ b/core/gen_genesis.go @@ -35,7 +35,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) { ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"` - SlotNumber *uint64 `json:"slotNumber"` + SlotNumber *math.HexOrDecimal64 `json:"slotNumber"` } var enc Genesis enc.Config = g.Config @@ -59,7 +59,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) { enc.ExcessBlobGas = (*math.HexOrDecimal64)(g.ExcessBlobGas) enc.BlobGasUsed = (*math.HexOrDecimal64)(g.BlobGasUsed) enc.BlockAccessListHash = g.BlockAccessListHash - enc.SlotNumber = g.SlotNumber + enc.SlotNumber = (*math.HexOrDecimal64)(g.SlotNumber) return json.Marshal(&enc) } @@ -82,7 +82,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error { ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas"` BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed"` BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"` - SlotNumber *uint64 `json:"slotNumber"` + SlotNumber *math.HexOrDecimal64 `json:"slotNumber"` } var dec Genesis if err := json.Unmarshal(input, &dec); err != nil { @@ -143,7 +143,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error { g.BlockAccessListHash = dec.BlockAccessListHash } if dec.SlotNumber != nil { - g.SlotNumber = dec.SlotNumber + g.SlotNumber = (*uint64)(dec.SlotNumber) } return nil } diff --git a/core/genesis.go b/core/genesis.go index 25b54cdfbd..03e2dfbbee 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -264,6 +264,7 @@ type genesisSpecMarshaling struct { BaseFee *math.HexOrDecimal256 ExcessBlobGas *math.HexOrDecimal64 BlobGasUsed *math.HexOrDecimal64 + SlotNumber *math.HexOrDecimal64 } // GenesisMismatchError is raised when trying to overwrite an existing diff --git a/core/vm/evm.go b/core/vm/evm.go index 428781713b..412cb28793 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -150,6 +150,8 @@ func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainCon evm.precompiles = activePrecompiledContracts(evm.chainRules) switch { + case evm.chainRules.IsAmsterdam: + evm.table = &amsterdamInstructionSet case evm.chainRules.IsOsaka: evm.table = &osakaInstructionSet case evm.chainRules.IsVerkle: diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index d7a4d9da1d..d8ec2b75fe 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -63,6 +63,7 @@ var ( verkleInstructionSet = newVerkleInstructionSet() pragueInstructionSet = newPragueInstructionSet() osakaInstructionSet = newOsakaInstructionSet() + amsterdamInstructionSet = newAmsterdamInstructionSet() ) // JumpTable contains the EVM opcodes supported at a given fork. @@ -92,6 +93,12 @@ func newVerkleInstructionSet() JumpTable { return validate(instructionSet) } +func newAmsterdamInstructionSet() JumpTable { + instructionSet := newOsakaInstructionSet() + enable7843(&instructionSet) // EIP-7843 (SLOTNUM opcode) + return validate(instructionSet) +} + func newOsakaInstructionSet() JumpTable { instructionSet := newPragueInstructionSet() enable7939(&instructionSet) // EIP-7939 (CLZ opcode)