Skip to content

Commit

Permalink
feat(forks): Add max request type to fork
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Sep 27, 2024
1 parent 1778558 commit d6d6ddf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ethereum_test_forks/base_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ def create_opcodes(
"""
pass

@classmethod
@abstractmethod
def max_request_type(cls, block_number: int = 0, timestamp: int = 0) -> int:
"""
Returns the max request type supported by the fork.
"""
pass

# Meta information about the fork
@classmethod
def name(cls) -> str:
Expand Down
14 changes: 14 additions & 0 deletions src/ethereum_test_forks/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ def create_opcodes(
(Opcodes.CREATE, EVMCodeType.LEGACY),
]

@classmethod
def max_request_type(cls, block_number: int = 0, timestamp: int = 0) -> int:
"""
At genesis, no request type is supported, signaled by -1
"""
return -1

@classmethod
def pre_allocation(cls) -> Mapping:
"""
Expand Down Expand Up @@ -862,6 +869,13 @@ def system_contracts(cls, block_number: int = 0, timestamp: int = 0) -> List[Add
SystemContract.BLOCK_HISTORY_CONTRACT,
] + super(Prague, cls).system_contracts(block_number, timestamp)

@classmethod
def max_request_type(cls, block_number: int = 0, timestamp: int = 0) -> int:
"""
At Prague, three request types are introduced, hence the max request type is 2
"""
return 2

@classmethod
def pre_allocation_blockchain(cls) -> Mapping:
"""
Expand Down

0 comments on commit d6d6ddf

Please sign in to comment.