-
Notifications
You must be signed in to change notification settings - Fork 167
feat(fw): EIP-7892 BPO functionality added (related to issues #1797 , #1790) #1918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
felix314159
wants to merge
7
commits into
ethereum:main
Choose a base branch
from
felix314159:bpo-7892
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e0a2b67
added bpo config + function to retrieve from it + unit test for that β¦
felix314159 c1fe28d
added bpo test, still WIP
felix314159 6da66a9
fix
felix314159 9ea546c
fix
felix314159 dcd23aa
started modifying BlockchainTest class to allow bpo schedule overwrites
felix314159 645277c
wip
felix314159 09d451d
sanity checks added for TimestampBlobSchedule
felix314159 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"blobSchedule": { | ||
"cancun": { | ||
"target": 3, | ||
"max": 6, | ||
"baseFeeUpdateFraction": 3338477 | ||
}, | ||
"prague": { | ||
"target": 6, | ||
"max": 9, | ||
"baseFeeUpdateFraction": 5007716 | ||
}, | ||
"osaka": { | ||
"target": 6, | ||
"max": 9, | ||
"maxBlobsPerTx": 6, | ||
"baseFeeUpdateFraction": 5007716 | ||
}, | ||
"bpo1": { | ||
"target": 12, | ||
"max": 16, | ||
"maxBlobsPerTx": 12, | ||
"baseFeeUpdateFraction": 5007716 | ||
}, | ||
"bpo2": { | ||
"target": 16, | ||
"max": 24, | ||
"maxBlobsPerTx": 12, | ||
"baseFeeUpdateFraction": 5007716 | ||
} | ||
}, | ||
"cancunTime": 0, | ||
"pragueTime": 0, | ||
"osakaTime": 1747387400, | ||
"bpo1Time": 1757387400, | ||
"bpo2Time": 1767387784 | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""EIP-7892 Tests.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Pytest (plugin) definitions local to EIP-7892 tests.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Defines EIP-7892 specification constants and functions.""" | ||
|
||
from dataclasses import dataclass | ||
|
||
# Base the spec on EIP-4844 which EIP-7892 extends | ||
from ...cancun.eip4844_blobs.spec import Spec as EIP4844Spec | ||
|
||
|
||
@dataclass(frozen=True) | ||
class ReferenceSpec: | ||
"""Defines the reference spec version and git path.""" | ||
|
||
git_path: str | ||
version: str | ||
|
||
|
||
ref_spec_7892 = ReferenceSpec("EIPS/eip-7892.md", "e42c14f83052bfaa8c38832dcbc46e357dd1a1d9") | ||
|
||
|
||
@dataclass(frozen=True) | ||
class Spec(EIP4844Spec): | ||
"""Parameters from the EIP-7892 specifications.""" | ||
|
||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
"""abstract: Test [EIP-7892: Blob Parameter Only Hardforks](https://eips.ethereum.org/EIPS/eip-7892).""" | ||
|
||
import pytest | ||
|
||
from ethereum_test_base_types.composite_types import ForkBlobSchedule, TimestampBlobSchedule | ||
from ethereum_test_forks import Fork | ||
from ethereum_test_tools import ( | ||
Alloc, | ||
Block, | ||
BlockchainTestFiller, | ||
) | ||
from ethereum_test_types import Environment | ||
|
||
from .spec import ref_spec_7892 # type: ignore | ||
|
||
REFERENCE_SPEC_GIT_PATH = ref_spec_7892.git_path | ||
REFERENCE_SPEC_VERSION = ref_spec_7892.version | ||
|
||
|
||
@pytest.mark.valid_from("Osaka") | ||
def test_bpo_schedule( | ||
blockchain_test: BlockchainTestFiller, | ||
pre: Alloc, | ||
post: Alloc, | ||
env: Environment, | ||
fork: Fork, | ||
): | ||
"""Test whether clients correctly set provided BPO schedules.""" | ||
bpo_schedule = TimestampBlobSchedule() | ||
# below ensure that there is a timestamp difference of at least 3 between each scheduled fork | ||
bpo_schedule.add_schedule( | ||
1234, ForkBlobSchedule(max=6, target=5, base_fee_update_fraction=5007716) | ||
) | ||
bpo_schedule.add_schedule( | ||
2345, ForkBlobSchedule(max=4, target=3, base_fee_update_fraction=5007716) | ||
) | ||
|
||
blocks = [] | ||
for schedule_dict in bpo_schedule.root: | ||
for t in schedule_dict: | ||
# add block before bpo | ||
blocks.append(Block(timestamp=t - 1)) | ||
# add block at bpo | ||
blocks.append(Block(timestamp=t)) | ||
# add block after bpo | ||
blocks.append(Block(timestamp=t + 1)) | ||
|
||
# amount of created blocks = 3 * len(bpo_schedule.root) | ||
assert len(blocks) == 3 * len(bpo_schedule.root) | ||
|
||
# TODO: | ||
# for each block the client should report the current values of: max, target and base_fee_update_fraction # noqa: E501 | ||
# we need to signal to the client that the expected response is according to the bpo_schedule defined above # noqa: E501 | ||
|
||
blockchain_test( | ||
genesis_environment=env, | ||
pre=pre, | ||
post=post, | ||
blocks=blocks, | ||
bpo_schedule=bpo_schedule, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally the approach here is not via extra queries to the client, rather via positive and negative testing of a valid and invalid block respectively:
x
toy
att
, produce the following tests:timestamp=t
andy
blobs, and verify that the client accepts the block.timestamp=t
andy+1
blobs, and verify that the client rejects the block.y
tox
att
, produce the following tests:timestamp=t
andx
blobs, and verify that the client accepts the block.timestamp=t
andx+1
blobs, and verify that the client rejects the block.For negative tests examples where we exceed the blob count for the block see:
execution-spec-tests/tests/cancun/eip4844_blobs/test_blob_txs.py
Lines 569 to 604 in ae95b1b