Skip to content
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

feat: scroll execution strategy #63

Merged
merged 37 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
16d56c8
add l1_fee field to `Receipt`
greged93 Nov 21, 2024
8ac2d23
scroll consensus
greged93 Nov 28, 2024
54c1fd2
feat: scroll execution strategy
greged93 Nov 28, 2024
5183d5a
feat: expose `verify_receipts` from reth-ethereum-consensus
greged93 Nov 28, 2024
36adba4
feat: add `reth-scroll-evm` crate to avoid cyclic dep
greged93 Nov 28, 2024
38569b3
improve curie fork application + test
greged93 Nov 29, 2024
f431ef1
integrate l1 fee
greged93 Nov 29, 2024
86945bd
add `ScrollEvmConfig`
greged93 Nov 30, 2024
63c1986
add tests for `ScrollEvmConfig`
greged93 Nov 30, 2024
f828ab4
add tests for `ScrollExecutionStrategy`
greged93 Nov 30, 2024
9d1c225
add l1 message test for `ScrollExecutionStrategy`
greged93 Dec 1, 2024
5a100be
add legacy tx execution test for `ScrollExecutionStrategy`
greged93 Dec 1, 2024
19a0b73
Merge branch 'scroll' into feat/execution-strategy
greged93 Dec 2, 2024
ed2f736
use revm scroll fork
greged93 Dec 2, 2024
dc30358
introduce `ScrollExecutionStrategyFactory`
greged93 Dec 2, 2024
5c9ec2d
feat: patch revm crate to scroll fork
greged93 Dec 4, 2024
f6293f4
fix: lints
greged93 Dec 4, 2024
d4374f1
Merge branch 'scroll' into feat/execution-strategy
greged93 Dec 4, 2024
178979e
fix: deny
greged93 Dec 4, 2024
e74ca1d
Merge branch 'scroll' into feat/execution-strategy
greged93 Dec 7, 2024
da4631e
answer comments
greged93 Dec 7, 2024
5053bf9
Merge branch 'scroll' into feat/execution-strategy
greged93 Dec 9, 2024
66e61a1
fill `TxEnv.rlp_bytes` only for !is_l1_message
greged93 Dec 9, 2024
1e6724e
lints
greged93 Dec 9, 2024
8b9487b
switch revm to scroll default branch
greged93 Dec 9, 2024
e680a9a
fix: deny
greged93 Dec 9, 2024
1ee6050
fix: remove alloy-sol-types patch
greged93 Dec 9, 2024
d41b561
Merge branch 'scroll' into feat/execution-strategy
greged93 Dec 9, 2024
ca0580f
feat: propagate scroll chain spec in execution
greged93 Dec 9, 2024
1ce370c
fix: scroll ci
greged93 Dec 9, 2024
ca0275b
chore: bump `trust-dns-resolver` to 0.25 alpha4 to fix deny
greged93 Dec 9, 2024
a3204e2
fix: propagate serde feature
greged93 Dec 9, 2024
c3cdac5
fix: docs
greged93 Dec 9, 2024
a411b86
Merge branch 'scroll' into feat/execution-strategy
greged93 Dec 9, 2024
2d78cc4
answer comments
greged93 Dec 10, 2024
108c355
lint
greged93 Dec 10, 2024
05f2a85
answer comments
greged93 Dec 10, 2024
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion crates/scroll/consensus/src/curie.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
//! Curie fork transition for Scroll.
//!
//! On block 7096836, Scroll performed a transition to the Curie fork state, which brought various
//! changes to the protocol:
//! 1. Fee reduction cost thanks to the use of compressed blobs on the L1.
//! 2. Modified [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) pricing
//! model along with support for EIP-1559 and EIP-2930 transactions.
frisitano marked this conversation as resolved.
Show resolved Hide resolved
//! 3. Support for `MLOAD`, `TLOAD` and `MCOPY` ([EIP-1153](https://eips.ethereum.org/EIPS/eip-1153)
//! and [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656)).
//! 4. Dynamic block time.
//!
//! Compressed blobs allowed for more transactions to be stored in each blob, reducing the DA cost
//! per transactions. Accordingly, the L1 gas oracle contract's bytecode was updated in order to
//! reflect the update in the DA costs:
//! - original formula: `(l1GasUsed(txRlp) + overhead) * l1BaseFee * scalar`.
//! - updated formula: `l1BaseFee * commitScalar + len(txRlp) * l1BlobBaseFee * blobScalar`.
//!
//! More details on the Curie update: <https://scroll.io/blog/compressing-the-gas-scrolls-curie-upgrade>

use revm::{
frisitano marked this conversation as resolved.
Show resolved Hide resolved
db::states::StorageSlot,
primitives::{address, bytes, Address, Bytecode, Bytes, U256},
Expand All @@ -6,6 +25,7 @@ use revm::{
};

/// L1 gas price oracle address.
frisitano marked this conversation as resolved.
Show resolved Hide resolved
/// <https://scrollscan.com/address/0x5300000000000000000000000000000000000002>
pub const L1_GAS_PRICE_ORACLE_ADDRESS: Address =
address!("5300000000000000000000000000000000000002");
/// Bytecode of L1 gas price oracle at Curie transition.
Expand Down Expand Up @@ -34,12 +54,19 @@ pub const BLOB_SCALAR_SLOT: U256 = U256::from_limbs([7, 0, 0, 0]);
/// L1 gas price oracle "is Curie" slot. Added in the Curie fork.
pub const IS_CURIE_SLOT: U256 = U256::from_limbs([8, 0, 0, 0]);

/// The initial blob base fee used by the oracle contract.
const INITIAL_L1_BLOB_BASE_FEE: U256 = U256::from_limbs([1, 0, 0, 0]);
/// The initial commit scalar used by the oracle contract.
const INITIAL_COMMIT_SCALAR: U256 = U256::from_limbs([230759955285, 0, 0, 0]);
/// The initial blob scalar used by the oracle contract.
const INITIAL_BLOB_SCALAR: U256 = U256::from_limbs([417565260, 0, 0, 0]);
/// Curie slot is set to 1 (true) after the Curie block fork.
const IS_CURIE: U256 = U256::from_limbs([1, 0, 0, 0]);

/// Applies the Scroll Curie hard fork to the state.
/// Applies the Scroll Curie hard fork to the state:
/// - Updates the L1 oracle contract bytecode to reflect the DA cost reduction.
/// - Sets the initial blob base fee, commit and blob scalar and sets the `isCurie` slot to 1
/// (true).
pub fn apply_curie_hard_fork<DB: Database>(state: &mut State<DB>) -> Result<(), DB::Error> {
let oracle = state.load_cache_account(L1_GAS_PRICE_ORACLE_ADDRESS)?;

Expand Down
2 changes: 1 addition & 1 deletion crates/scroll/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#![cfg(feature = "scroll")]

mod curie;
pub use curie::{
apply_curie_hard_fork, BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT,
CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT,
L1_BASE_FEE_SLOT, L1_BLOB_BASE_FEE_SLOT, L1_GAS_PRICE_ORACLE_ADDRESS, OVER_HEAD_SLOT,
SCALAR_SLOT,
};
mod curie;
Loading