Skip to content
Merged
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
4 changes: 2 additions & 2 deletions fillers/eips/eip4844/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Asserts that blocks with invalid `excess_data_gas` values in the header are igno

**3) 🔴 test_fork_transition_excess_data_gas_in_header():**

Tests that the `excess_data_gas` calculation is correct when transitioning from the Shanghai fork to the Sharding fork, where appended blocks are valid and state changes occur. Each block has a single transaction with `MAX_BLOBS_PER_BLOCK` blobs. The first block during the transition period has a parent of zero `excess_data_gas` in the header. Each block afterwards calculates `excess_data_gas` using the following `calc_excess_data_gas` function such that it continuously increases.
Tests that the `excess_data_gas` calculation is correct when transitioning from the Shanghai fork to the Cancun fork, where appended blocks are valid and state changes occur. Each block has a single transaction with `MAX_BLOBS_PER_BLOCK` blobs. The first block during the transition period has a parent of zero `excess_data_gas` in the header. Each block afterwards calculates `excess_data_gas` using the following `calc_excess_data_gas` function such that it continuously increases.

**4) 🔴 test_invalid_blob_txs():**

Expand All @@ -97,6 +97,6 @@ Asserts that blocks with invalid blob transactions are rejected and no state cha
- `len(blobs)` is zero within a transaction. Valid blob txs (type 3) must have at least one blob within it, obeying the following condition:
- `len(tx.message.blob_versioned_hashes) > 0`

- Blob transaction type 3 is used in a pre-Sharding fork. This transcation type can only be used in a post-Sharding fork.
- Blob transaction type 3 is used in a pre-Cancun fork. This transcation type can only be used in a post-Cancun fork.


12 changes: 6 additions & 6 deletions fillers/eips/eip4844/datahash_opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from copy import copy
from typing import Dict, List, Sequence

from ethereum_test_forks import Fork, ShardingFork
from ethereum_test_forks import Cancun, Fork
from ethereum_test_tools import (
Account,
Block,
Expand Down Expand Up @@ -52,7 +52,7 @@
)


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_datahash_opcode_contexts(_: Fork):
"""
Test DATAHASH opcode called on different contexts.
Expand Down Expand Up @@ -430,7 +430,7 @@ def test_datahash_opcode_contexts(_: Fork):
)


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_datahash_gas_cost(_: Fork):
"""
Test DATAHASH opcode gas cost using a variety of indexes.
Expand Down Expand Up @@ -521,7 +521,7 @@ def test_datahash_gas_cost(_: Fork):
yield BlockchainTest(pre=pre, post=post, blocks=blocks, tag="tx_type_3")


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_datahash_blob_versioned_hash(_: Fork):
"""
Tests that the `DATAHASH` opcode returns the correct versioned hash for
Expand Down Expand Up @@ -651,7 +651,7 @@ def datahash_sstore(index: int):
)


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_datahash_invalid_blob_index(_: Fork):
"""
Tests that the `DATAHASH` opcode returns a zeroed bytes32 value
Expand Down Expand Up @@ -719,7 +719,7 @@ def test_datahash_invalid_blob_index(_: Fork):
)


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_datahash_multiple_txs_in_block(_: Fork):
"""
Tests that the `DATAHASH` opcode returns the appropriate values
Expand Down
16 changes: 8 additions & 8 deletions fillers/eips/eip4844/excess_data_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from typing import List, Mapping, Optional

from ethereum_test_forks import (
Cancun,
Fork,
Shanghai,
ShanghaiToShardingAtTime15k,
ShardingFork,
ShanghaiToCancunAtTime15k,
is_fork,
)
from ethereum_test_tools import (
Expand Down Expand Up @@ -182,7 +182,7 @@ def generate(self) -> BlockchainTest:
)


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_excess_data_gas_calc(_: Fork):
"""
Test calculation of the excess_data_gas increase/decrease across multiple
Expand Down Expand Up @@ -397,7 +397,7 @@ def generate(self) -> BlockchainTest:
)


@test_from(fork=ShardingFork)
@test_from(fork=Cancun)
def test_invalid_excess_data_gas_in_header(_: Fork):
"""
Test rejection of a block with invalid excess_data_gas in the header.
Expand Down Expand Up @@ -526,7 +526,7 @@ def test_invalid_excess_data_gas_in_header(_: Fork):
yield tc.generate()


@test_only(fork=ShanghaiToShardingAtTime15k)
@test_only(fork=ShanghaiToCancunAtTime15k)
def test_fork_transition_excess_data_gas_in_header(_: Fork):
"""
Test excess_data_gas calculation in the header when the fork is activated.
Expand All @@ -537,7 +537,7 @@ def test_fork_transition_excess_data_gas_in_header(_: Fork):
}
destination_account = to_address(0x100)

# Generate some blocks to reach Sharding fork
# Generate some blocks to reach Cancun fork
FORK_TIMESTAMP = 15_000
blocks: List[Block] = []
for t in range(999, FORK_TIMESTAMP, 1_000):
Expand Down Expand Up @@ -735,7 +735,7 @@ def test_invalid_blob_txs(fork: Fork):
- block blob count > MAX_BLOBS_PER_BLOCK
"""
test_cases: List[InvalidBlobTransactionTestCase] = []
if is_fork(fork, ShardingFork):
if is_fork(fork, Cancun):
test_cases = [
InvalidBlobTransactionTestCase(
tag="insufficient_max_fee_per_data_gas",
Expand Down Expand Up @@ -783,7 +783,7 @@ def test_invalid_blob_txs(fork: Fork):
# ),
]
else:
# Pre-Sharding, blocks with type 3 txs must be rejected
# Pre-Cancun, blocks with type 3 txs must be rejected
test_cases = [
InvalidBlobTransactionTestCase(
tag="type_3_tx_pre_fork",
Expand Down
8 changes: 4 additions & 4 deletions src/ethereum_test_forks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from .forks.transition import (
BerlinToLondonAt5,
MergeToShanghaiAtTime15k,
ShanghaiToShardingAtTime15k,
ShanghaiToCancunAtTime15k,
)
from .forks.upcoming import ShardingFork
from .forks.upcoming import Cancun
from .helpers import (
fork_only,
forks_from,
Expand All @@ -50,8 +50,8 @@
"MergeToShanghaiAtTime15k",
"MuirGlacier",
"Shanghai",
"ShanghaiToShardingAtTime15k",
"ShardingFork",
"ShanghaiToCancunAtTime15k",
"Cancun",
"fork_only",
"forks_from",
"forks_from_until",
Expand Down
10 changes: 5 additions & 5 deletions src/ethereum_test_forks/forks/transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from ..transition_base_fork import transition_fork
from .forks import Berlin, London, Merge, Shanghai
from .upcoming import ShardingFork, TestOnlyUpcomingFork
from .upcoming import Cancun, TestOnlyUpcomingFork


# Transition Forks
Expand Down Expand Up @@ -35,16 +35,16 @@ def header_withdrawals_required(cls, _: int, timestamp: int) -> bool:
return timestamp >= 15_000


@transition_fork(to_fork=ShardingFork)
class ShanghaiToShardingAtTime15k(Shanghai):
@transition_fork(to_fork=Cancun)
class ShanghaiToCancunAtTime15k(Shanghai):
"""
Shanghai to Sharding transition at Timestamp 15k
Shanghai to Cancun transition at Timestamp 15k
"""

@classmethod
def header_excess_data_gas_required(cls, _: int, timestamp: int) -> bool:
"""
Excess data gas is required if transitioning to Sharding.
Excess data gas is required if transitioning to Cancun.
"""
return timestamp >= 15_000

Expand Down
6 changes: 3 additions & 3 deletions src/ethereum_test_forks/forks/upcoming.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
from .forks import Shanghai


class ShardingFork(Shanghai):
class Cancun(Shanghai):
"""
Sharding fork
Cancun fork
"""

@classmethod
def header_excess_data_gas_required(
cls, block_number: int, timestamp: int
) -> bool:
"""
Excess data gas is required starting from Sharding.
Excess data gas is required starting from Cancun.
"""
return True

Expand Down
1 change: 1 addition & 0 deletions whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ petersburg
randao
rlp
sharding
cancun
t8n
trie
txs
Expand Down