@@ -977,6 +977,14 @@ def header_beacon_root_required(
977977 del block_number , timestamp
978978 return False
979979
980+ @classmethod
981+ def header_slot_number_required (
982+ cls , * , block_number : int = 0 , timestamp : int = 0
983+ ) -> bool :
984+ """At genesis, header must not contain slot number (EIP-7843)."""
985+ del block_number , timestamp
986+ return False
987+
980988 @classmethod
981989 def engine_new_payload_blob_hashes (
982990 cls , * , block_number : int = 0 , timestamp : int = 0
@@ -1041,6 +1049,16 @@ def engine_payload_attribute_max_blobs_per_block(
10411049 del block_number , timestamp
10421050 return False
10431051
1052+ @classmethod
1053+ def engine_payload_attribute_slot_number (
1054+ cls , * , block_number : int = 0 , timestamp : int = 0
1055+ ) -> bool :
1056+ """
1057+ At genesis, payload attributes do not include the slot number.
1058+ """
1059+ del block_number , timestamp
1060+ return False
1061+
10441062 @classmethod
10451063 def engine_forkchoice_updated_version (
10461064 cls , * , block_number : int = 0 , timestamp : int = 0
@@ -3362,9 +3380,7 @@ class Amsterdam(BPO2):
33623380 def header_bal_hash_required (
33633381 cls , * , block_number : int = 0 , timestamp : int = 0
33643382 ) -> bool :
3365- """
3366- From Amsterdam, header must contain block access list hash (EIP-7928).
3367- """
3383+ """BAL hash in header required from Amsterdam (EIP-7928)."""
33683384 del block_number , timestamp
33693385 return True
33703386
@@ -3373,6 +3389,31 @@ def is_deployed(cls) -> bool:
33733389 """Return True if this fork is deployed."""
33743390 return False
33753391
3392+ @classmethod
3393+ def valid_opcodes (
3394+ cls , * , block_number : int = 0 , timestamp : int = 0
3395+ ) -> List [Opcodes ]:
3396+ """Add SLOTNUM opcode for Amsterdam (EIP-7843)."""
3397+ return [Opcodes .SLOTNUM ] + super (Amsterdam , cls ).valid_opcodes (
3398+ block_number = block_number , timestamp = timestamp
3399+ )
3400+
3401+ @classmethod
3402+ def opcode_gas_map (
3403+ cls , * , block_number : int = 0 , timestamp : int = 0
3404+ ) -> Dict [OpcodeBase , int | Callable [[OpcodeBase ], int ]]:
3405+ """Add SLOTNUM opcode gas cost for Amsterdam (EIP-7843)."""
3406+ gas_costs = cls .gas_costs (
3407+ block_number = block_number , timestamp = timestamp
3408+ )
3409+ base_map = super (Amsterdam , cls ).opcode_gas_map (
3410+ block_number = block_number , timestamp = timestamp
3411+ )
3412+ return {
3413+ ** base_map ,
3414+ Opcodes .SLOTNUM : gas_costs .G_BASE ,
3415+ }
3416+
33763417 @classmethod
33773418 def engine_new_payload_version (
33783419 cls , * , block_number : int = 0 , timestamp : int = 0
@@ -3391,3 +3432,27 @@ def engine_execution_payload_block_access_list(
33913432 """
33923433 del block_number , timestamp
33933434 return True
3435+
3436+ @classmethod
3437+ def header_slot_number_required (
3438+ cls , * , block_number : int = 0 , timestamp : int = 0
3439+ ) -> bool :
3440+ """Slot number in header required from Amsterdam (EIP-7843)."""
3441+ del block_number , timestamp
3442+ return True
3443+
3444+ @classmethod
3445+ def engine_forkchoice_updated_version (
3446+ cls , * , block_number : int = 0 , timestamp : int = 0
3447+ ) -> Optional [int ]:
3448+ """From Amsterdam, forkchoice updated calls must use version 4."""
3449+ del block_number , timestamp
3450+ return 4
3451+
3452+ @classmethod
3453+ def engine_payload_attribute_slot_number (
3454+ cls , * , block_number : int = 0 , timestamp : int = 0
3455+ ) -> bool :
3456+ """From Amsterdam, payload attributes include the slot number."""
3457+ del block_number , timestamp
3458+ return True
0 commit comments