-
Notifications
You must be signed in to change notification settings - Fork 968
feat: implement EIP-2935 #1354
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
Merged
Merged
feat: implement EIP-2935 #1354
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8334218
feat: add eip-2935 constants
onbjerg b95dbd3
feat: impl EIP-2935 `BLOCKHASH`
onbjerg 214706d
fix: early return in prague
onbjerg 379d951
chore: fmt
onbjerg 74cea76
refactor: `sload!` macro
onbjerg 7758c8a
chore: rm unused import
onbjerg 37ac22d
chore: rename consts
onbjerg 9cd780b
Merge branch 'main' into onbjerg/eip-2935
onbjerg 59eed4d
fix: typo from merge
onbjerg 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
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 |
|---|---|---|
| @@ -1,34 +1,54 @@ | ||
| use crate::Address; | ||
| use alloy_primitives::{address, Address}; | ||
|
|
||
| /// EIP-170: Contract code size limit | ||
| /// By default limit is 0x6000 (~25kb) | ||
| /// | ||
| /// By default the limit is `0x6000` (~25kb) | ||
| pub const MAX_CODE_SIZE: usize = 0x6000; | ||
|
|
||
| /// Number of block hashes that EVM can access in the past | ||
| /// Number of block hashes that EVM can access in the past (pre-Prague). | ||
| pub const BLOCK_HASH_HISTORY: usize = 256; | ||
|
|
||
| /// EIP-2935: Serve historical block hashes from state | ||
| /// | ||
| /// Number of block hashes the EVM can access in the past (Prague). | ||
| pub const HISTORY_SERVE_WINDOW: usize = 8192; | ||
|
|
||
| /// EIP-2935: Serve historical block hashes from state | ||
| /// | ||
| /// The address where historical blockhashes are available. | ||
| pub const HISTORY_STORAGE_ADDRESS: Address = address!("25a219378dad9b3503c8268c9ca836a52427a4fb"); | ||
|
|
||
| /// EIP-3860: Limit and meter initcode | ||
| /// | ||
| /// Limit of maximum initcode size is 2 * MAX_CODE_SIZE | ||
| /// Limit of maximum initcode size is `2 * MAX_CODE_SIZE`. | ||
| pub const MAX_INITCODE_SIZE: usize = 2 * MAX_CODE_SIZE; | ||
|
|
||
| /// Precompile 3 is special in few places | ||
| /// The address of precompile 3, which is handled specially in a few places. | ||
| pub const PRECOMPILE3: Address = | ||
| Address::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3]); | ||
| // EIP-4844 constants | ||
|
|
||
| // === EIP-4844 constants === | ||
|
|
||
| /// Gas consumption of a single data blob (== blob byte size). | ||
| pub const GAS_PER_BLOB: u64 = 1 << 17; | ||
|
|
||
| /// Target number of the blob per block. | ||
| pub const TARGET_BLOB_NUMBER_PER_BLOCK: u64 = 3; | ||
|
|
||
| /// Max number of blobs per block | ||
| pub const MAX_BLOB_NUMBER_PER_BLOCK: u64 = 2 * TARGET_BLOB_NUMBER_PER_BLOCK; | ||
|
|
||
| /// Maximum consumable blob gas for data blobs per block. | ||
| pub const MAX_BLOB_GAS_PER_BLOCK: u64 = MAX_BLOB_NUMBER_PER_BLOCK * GAS_PER_BLOB; | ||
|
|
||
| /// Target consumable blob gas for data blobs per block (for 1559-like pricing). | ||
| pub const TARGET_BLOB_GAS_PER_BLOCK: u64 = TARGET_BLOB_NUMBER_PER_BLOCK * GAS_PER_BLOB; | ||
|
|
||
| /// Minimum gas price for data blobs. | ||
| pub const MIN_BLOB_GASPRICE: u64 = 1; | ||
|
|
||
| /// Controls the maximum rate of change for blob gas price. | ||
| pub const BLOB_GASPRICE_UPDATE_FRACTION: u64 = 3338477; | ||
|
|
||
| /// First version of the blob. | ||
| pub const VERSIONED_HASH_VERSION_KZG: u8 = 0x01; | ||
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.
Uh oh!
There was an error while loading. Please reload this page.