diff --git a/src/ethereum/forks/monad_next/fork.py b/src/ethereum/forks/monad_next/fork.py index d8284e126c..06e3a5fabb 100644 --- a/src/ethereum/forks/monad_next/fork.py +++ b/src/ethereum/forks/monad_next/fork.py @@ -1009,15 +1009,21 @@ def process_transaction( # gas_refund_amount = tx_gas_left * effective_gas_price # For non-1559 transactions effective_gas_price == tx.gas_price - priority_fee_per_gas = effective_gas_price - block_env.base_fee_per_gas - transaction_fee = tx.gas * priority_fee_per_gas + # NOTE: commented out, see MIP-11 shim below + # TODO: uncomment and adjust after MIP-11 lands here + # priority_fee_per_gas = effective_gas_price - block_env.base_fee_per_gas + # transaction_fee = tx.gas * priority_fee_per_gas # Monad: gas is not refunded to the sender (note absence of # create_ether(tx_state, sender, U256(gas_refund_amount)) here). add_sender_authority(block_env.state, block_env.number, sender) - # transfer miner fees - create_ether(tx_state, block_env.coinbase, U256(transaction_fee)) + # MIP-11 shim: priority fees are routed to the staking distribution + # address and paid out to the proposer's validator and delegators. In + # tests no proposer is wired up, so distribution finds an unknown + # validator and the fees are burned rather than credited to the + # coinbase. Burn them here so post-state roots match a client that + # implements MIP-11 fully. for address in tx_output.accounts_to_delete: destroy_account(tx_state, address) diff --git a/tests/monad_eight/reserve_balance/test_transfers.py b/tests/monad_eight/reserve_balance/test_transfers.py index 5a06d5b19c..be3fdcf314 100644 --- a/tests/monad_eight/reserve_balance/test_transfers.py +++ b/tests/monad_eight/reserve_balance/test_transfers.py @@ -18,7 +18,7 @@ Op, Transaction, ) -from execution_testing.forks import MONAD_EIGHT +from execution_testing.forks import MONAD_EIGHT, MONAD_NEXT from execution_testing.forks.helpers import Fork from execution_testing.test_types.helpers import compute_create_address from execution_testing.tools.tools_code.generators import Initcode @@ -1152,7 +1152,8 @@ def test_credit_with_transaction_fee( gas_price = 10 base_fee_per_gas = 7 priority_gas_price = gas_price - base_fee_per_gas - reward = gas_limit * priority_gas_price + # MIP-11 burns priority fees rather than crediting the coinbase. + reward = 0 if fork >= MONAD_NEXT else gas_limit * priority_gas_price tx_1 = Transaction( gas_limit=gas_limit, diff --git a/tests/monad_nine/mip4_checkreservebalance/test_fork_transition.py b/tests/monad_nine/mip4_checkreservebalance/test_fork_transition.py index b7654e3cfd..3ed92bd2ac 100644 --- a/tests/monad_nine/mip4_checkreservebalance/test_fork_transition.py +++ b/tests/monad_nine/mip4_checkreservebalance/test_fork_transition.py @@ -32,10 +32,14 @@ def test_fork_transition( """ Test reserve balance precompile availability at fork transition. - Before the fork, the precompile doesn't exist, so CALL returns - empty output (RETURNDATASIZE == 0). After the fork, the precompile + Before the MONAD_NINE, the precompile doesn't exist, so CALL returns + empty output (RETURNDATASIZE == 0). After, the precompile returns a 32-byte result (RETURNDATASIZE == 32). """ + precompile_before = ( + Spec.RESERVE_BALANCE_PRECOMPILE + in fork.transitions_from().precompiles() + ) sender = pre.fund_eoa() callee_code = ( @@ -103,14 +107,14 @@ def test_fork_transition( post={ caller_address: Account( storage={ - 14_999: 1, # Call succeeds (precompile just returns empty) + 14_999: 1, # Call succeeds 15_000: 1, # Call succeeds on fork transition block 15_001: 1, # Call continues to succeed after transition } ), callee_address: Account( storage={ - 14_999: 0, # Precompile not available, RETURNDATASIZE==0 + 14_999: 1 if precompile_before else 0, 15_000: 1, # Precompile available, RETURNDATASIZE==32 15_001: 1, # Precompile continues to work }