Skip to content

Commit aa98f41

Browse files
authored
Change from fork from ShardingFork to Cancun. (#111)
1 parent a59999e commit aa98f41

File tree

7 files changed

+29
-28
lines changed

7 files changed

+29
-28
lines changed

fillers/eips/eip4844/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Asserts that blocks with invalid `excess_data_gas` values in the header are igno
7676

7777
**3) 🔴 test_fork_transition_excess_data_gas_in_header():**
7878

79-
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.
79+
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.
8080

8181
**4) 🔴 test_invalid_blob_txs():**
8282

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

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

102102

fillers/eips/eip4844/datahash_opcode.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from copy import copy
77
from typing import Dict, List, Sequence
88

9-
from ethereum_test_forks import Fork, ShardingFork
9+
from ethereum_test_forks import Cancun, Fork
1010
from ethereum_test_tools import (
1111
Account,
1212
Block,
@@ -52,7 +52,7 @@
5252
)
5353

5454

55-
@test_from(fork=ShardingFork)
55+
@test_from(fork=Cancun)
5656
def test_datahash_opcode_contexts(_: Fork):
5757
"""
5858
Test DATAHASH opcode called on different contexts.
@@ -430,7 +430,7 @@ def test_datahash_opcode_contexts(_: Fork):
430430
)
431431

432432

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

523523

524-
@test_from(fork=ShardingFork)
524+
@test_from(fork=Cancun)
525525
def test_datahash_blob_versioned_hash(_: Fork):
526526
"""
527527
Tests that the `DATAHASH` opcode returns the correct versioned hash for
@@ -651,7 +651,7 @@ def datahash_sstore(index: int):
651651
)
652652

653653

654-
@test_from(fork=ShardingFork)
654+
@test_from(fork=Cancun)
655655
def test_datahash_invalid_blob_index(_: Fork):
656656
"""
657657
Tests that the `DATAHASH` opcode returns a zeroed bytes32 value
@@ -719,7 +719,7 @@ def test_datahash_invalid_blob_index(_: Fork):
719719
)
720720

721721

722-
@test_from(fork=ShardingFork)
722+
@test_from(fork=Cancun)
723723
def test_datahash_multiple_txs_in_block(_: Fork):
724724
"""
725725
Tests that the `DATAHASH` opcode returns the appropriate values

fillers/eips/eip4844/excess_data_gas.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from typing import List, Mapping, Optional
77

88
from ethereum_test_forks import (
9+
Cancun,
910
Fork,
1011
Shanghai,
11-
ShanghaiToShardingAtTime15k,
12-
ShardingFork,
12+
ShanghaiToCancunAtTime15k,
1313
is_fork,
1414
)
1515
from ethereum_test_tools import (
@@ -182,7 +182,7 @@ def generate(self) -> BlockchainTest:
182182
)
183183

184184

185-
@test_from(fork=ShardingFork)
185+
@test_from(fork=Cancun)
186186
def test_excess_data_gas_calc(_: Fork):
187187
"""
188188
Test calculation of the excess_data_gas increase/decrease across multiple
@@ -397,7 +397,7 @@ def generate(self) -> BlockchainTest:
397397
)
398398

399399

400-
@test_from(fork=ShardingFork)
400+
@test_from(fork=Cancun)
401401
def test_invalid_excess_data_gas_in_header(_: Fork):
402402
"""
403403
Test rejection of a block with invalid excess_data_gas in the header.
@@ -526,7 +526,7 @@ def test_invalid_excess_data_gas_in_header(_: Fork):
526526
yield tc.generate()
527527

528528

529-
@test_only(fork=ShanghaiToShardingAtTime15k)
529+
@test_only(fork=ShanghaiToCancunAtTime15k)
530530
def test_fork_transition_excess_data_gas_in_header(_: Fork):
531531
"""
532532
Test excess_data_gas calculation in the header when the fork is activated.
@@ -537,7 +537,7 @@ def test_fork_transition_excess_data_gas_in_header(_: Fork):
537537
}
538538
destination_account = to_address(0x100)
539539

540-
# Generate some blocks to reach Sharding fork
540+
# Generate some blocks to reach Cancun fork
541541
FORK_TIMESTAMP = 15_000
542542
blocks: List[Block] = []
543543
for t in range(999, FORK_TIMESTAMP, 1_000):
@@ -735,7 +735,7 @@ def test_invalid_blob_txs(fork: Fork):
735735
- block blob count > MAX_BLOBS_PER_BLOCK
736736
"""
737737
test_cases: List[InvalidBlobTransactionTestCase] = []
738-
if is_fork(fork, ShardingFork):
738+
if is_fork(fork, Cancun):
739739
test_cases = [
740740
InvalidBlobTransactionTestCase(
741741
tag="insufficient_max_fee_per_data_gas",
@@ -783,7 +783,7 @@ def test_invalid_blob_txs(fork: Fork):
783783
# ),
784784
]
785785
else:
786-
# Pre-Sharding, blocks with type 3 txs must be rejected
786+
# Pre-Cancun, blocks with type 3 txs must be rejected
787787
test_cases = [
788788
InvalidBlobTransactionTestCase(
789789
tag="type_3_tx_pre_fork",

src/ethereum_test_forks/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from .forks.transition import (
2222
BerlinToLondonAt5,
2323
MergeToShanghaiAtTime15k,
24-
ShanghaiToShardingAtTime15k,
24+
ShanghaiToCancunAtTime15k,
2525
)
26-
from .forks.upcoming import ShardingFork
26+
from .forks.upcoming import Cancun
2727
from .helpers import (
2828
fork_only,
2929
forks_from,
@@ -50,8 +50,8 @@
5050
"MergeToShanghaiAtTime15k",
5151
"MuirGlacier",
5252
"Shanghai",
53-
"ShanghaiToShardingAtTime15k",
54-
"ShardingFork",
53+
"ShanghaiToCancunAtTime15k",
54+
"Cancun",
5555
"fork_only",
5656
"forks_from",
5757
"forks_from_until",

src/ethereum_test_forks/forks/transition.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
from ..transition_base_fork import transition_fork
55
from .forks import Berlin, London, Merge, Shanghai
6-
from .upcoming import ShardingFork, TestOnlyUpcomingFork
6+
from .upcoming import Cancun, TestOnlyUpcomingFork
77

88

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

3737

38-
@transition_fork(to_fork=ShardingFork)
39-
class ShanghaiToShardingAtTime15k(Shanghai):
38+
@transition_fork(to_fork=Cancun)
39+
class ShanghaiToCancunAtTime15k(Shanghai):
4040
"""
41-
Shanghai to Sharding transition at Timestamp 15k
41+
Shanghai to Cancun transition at Timestamp 15k
4242
"""
4343

4444
@classmethod
4545
def header_excess_data_gas_required(cls, _: int, timestamp: int) -> bool:
4646
"""
47-
Excess data gas is required if transitioning to Sharding.
47+
Excess data gas is required if transitioning to Cancun.
4848
"""
4949
return timestamp >= 15_000
5050

src/ethereum_test_forks/forks/upcoming.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
from .forks import Shanghai
77

88

9-
class ShardingFork(Shanghai):
9+
class Cancun(Shanghai):
1010
"""
11-
Sharding fork
11+
Cancun fork
1212
"""
1313

1414
@classmethod
1515
def header_excess_data_gas_required(
1616
cls, block_number: int, timestamp: int
1717
) -> bool:
1818
"""
19-
Excess data gas is required starting from Sharding.
19+
Excess data gas is required starting from Cancun.
2020
"""
2121
return True
2222

whitelist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ petersburg
3434
randao
3535
rlp
3636
sharding
37+
cancun
3738
t8n
3839
trie
3940
txs

0 commit comments

Comments
 (0)