Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/ethereum/forks/monad_next/fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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
}
Expand Down