@@ -33,7 +33,7 @@ def cost_per_state_byte(cls) -> int:
3333 @classmethod
3434 def sstore_state_gas (cls ) -> int :
3535 """Return state gas for a zero-to-nonzero SSTORE (EIP-8037)."""
36- STATE_BYTES_PER_STORAGE_SET = 32 # noqa: N806
36+ STATE_BYTES_PER_STORAGE_SET = 64 # noqa: N806
3737 return STATE_BYTES_PER_STORAGE_SET * cls .cost_per_state_byte ()
3838
3939 @classmethod
@@ -58,8 +58,8 @@ def gas_costs(cls) -> GasCosts:
5858 cpsb = cls .cost_per_state_byte ()
5959 parent = super (EIP8037 , cls ).gas_costs ()
6060 # EIP-8037 state byte sizes (EELS amsterdam/vm/gas.py)
61- STATE_BYTES_PER_STORAGE_SET = 32 # noqa: N806
62- STATE_BYTES_PER_NEW_ACCOUNT = 112 # noqa: N806
61+ STATE_BYTES_PER_STORAGE_SET = 64 # noqa: N806
62+ STATE_BYTES_PER_NEW_ACCOUNT = 120 # noqa: N806
6363 STATE_BYTES_PER_AUTH_BASE = 23 # noqa: N806
6464 # EIP-8037 regular gas base costs
6565 PER_AUTH_BASE_COST = 7_500 # noqa: N806
@@ -258,7 +258,7 @@ def transaction_intrinsic_state_gas(
258258 - Auth: (NEW_ACCOUNT + AUTH_BASE) * cpsb
259259 """
260260 cpsb = cls .cost_per_state_byte ()
261- STATE_BYTES_PER_NEW_ACCOUNT = 112 # noqa: N806
261+ STATE_BYTES_PER_NEW_ACCOUNT = 120 # noqa: N806
262262 STATE_BYTES_PER_AUTH_BASE = 23 # noqa: N806
263263 state_gas = 0
264264 if contract_creation :
@@ -278,7 +278,7 @@ def _calculate_sstore_gas(
278278 Calculate updated SSTORE gas cost.
279279
280280 For 0->nonzero: regular (UPDATE - COLD_SLOAD) + state
281- (32 * cpsb).
281+ (STATE_BYTES_PER_STORAGE_SET * cpsb).
282282 For nonzero->different nonzero: regular
283283 (UPDATE - COLD_SLOAD).
284284 Otherwise: WARM_SLOAD.
@@ -324,7 +324,7 @@ def _calculate_sstore_state_gas(
324324 and current_value != new_value
325325 and original_value == 0
326326 ):
327- return 32 * cpsb
327+ return 64 * cpsb
328328 return 0
329329
330330 @classmethod
@@ -368,9 +368,9 @@ def _calculate_sstore_state_refund(
368368 """
369369 Calculate SSTORE state gas refund.
370370
371- Return the state-gas portion (`32 * cpsb`) when a slot that
372- was originally empty is restored back to zero within the
373- transaction; otherwise return 0.
371+ Return the state-gas portion (`STATE_BYTES_PER_STORAGE_SET *
372+ cpsb`) when a slot that was originally empty is restored back
373+ to zero within the transaction; otherwise return 0.
374374 """
375375 del gas_costs
376376 metadata = opcode .metadata
@@ -384,7 +384,7 @@ def _calculate_sstore_state_refund(
384384 if current_value != new_value :
385385 if original_value == new_value :
386386 if original_value == 0 :
387- return 32 * cpsb
387+ return 64 * cpsb
388388 return 0
389389
390390 @classmethod
@@ -394,8 +394,9 @@ def _calculate_selfdestruct_state_refund(
394394 """
395395 Calculate SELFDESTRUCT state gas refund.
396396
397- Account creation: 112 × cost_per_state_byte
398- Created storage slots: 32 × cost_per_state_byte per non-zero slot
397+ Account creation: STATE_BYTES_PER_NEW_ACCOUNT × cost_per_state_byte
398+ Created storage slots: STATE_BYTES_PER_STORAGE_SET ×
399+ cost_per_state_byte per non-zero slot
399400 Code deposit: len(code) × cost_per_state_byte
400401 """
401402 del gas_costs
@@ -411,9 +412,9 @@ def _calculate_selfdestruct_state_refund(
411412 ]
412413 state_refund = 0
413414 if self_destructed_account :
414- state_refund = 112 * cpsb
415+ state_refund = 120 * cpsb
415416 state_refund += (
416- 32 * cpsb * self_destructed_account_storage_slot_count
417+ 64 * cpsb * self_destructed_account_storage_slot_count
417418 )
418419 state_refund += cpsb * self_destructed_account_code_deposit
419420 return state_refund
0 commit comments