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: allow 7702 receipts after Isthmus active #959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
242 changes: 152 additions & 90 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ kona-preimage = { path = "crates/proof-sdk/preimage", version = "0.2.1", default
kona-std-fpvm-proc = { path = "crates/proof-sdk/std-fpvm-proc", version = "0.1.2", default-features = false }

# Maili
maili-consensus = { version = "0.1.6", default-features = false }
maili-protocol = { version = "0.1.6", default-features = false }
maili-registry = { version = "0.1.6", default-features = false }
maili-genesis = { version = "0.1.6", default-features = false }
maili-rpc = { version = "0.1.8", default-features = false }
maili-protocol = { version = "0.1.8", default-features = false }
maili-registry = { version = "0.1.8", default-features = false }
maili-genesis = { version = "0.1.8", default-features = false }

# Alloy
alloy-rlp = { version = "0.3.10", default-features = false }
alloy-rlp = { version = "0.3.11", default-features = false }
alloy-trie = { version = "0.7.8", default-features = false }
alloy-eips = { version = "0.9.2", default-features = false }
alloy-serde = { version = "0.9.2", default-features = false }
Expand All @@ -94,16 +94,16 @@ alloy-consensus = { version = "0.9.2", default-features = false }
alloy-transport = { version = "0.9.2", default-features = false }
alloy-rpc-types = { version = "0.9.2", default-features = false }
alloy-rpc-client = { version = "0.9.2", default-features = false }
alloy-primitives = { version = "0.8.14", default-features = false }
alloy-primitives = { version = "0.8.19", default-features = false }
alloy-node-bindings = { version = "0.9.2", default-features = false }
alloy-transport-http = { version = "0.9.2", default-features = false }
alloy-rpc-types-engine = { version = "0.9.2", default-features = false }
alloy-rpc-types-beacon = { version = "0.9.2", default-features = false }
alloy-sol-types = { version = "0.8.18", default-features = false }
alloy-sol-types = { version = "0.8.19", default-features = false }

# OP Alloy
op-alloy-consensus = { version = "0.9.5", default-features = false }
op-alloy-rpc-types-engine = { version = "0.9.5", default-features = false }
op-alloy-consensus = { version = "0.9.6", default-features = false }
op-alloy-rpc-types-engine = { version = "0.9.6", default-features = false }

# General
lru = "0.12.5"
Expand Down
3 changes: 2 additions & 1 deletion bin/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ kona-client.workspace = true
kona-providers-alloy.workspace = true

# Maili
maili-protocol = { workspace = true, features = ["std", "serde"] }
maili-rpc.workspace = true
maili-registry.workspace = true
maili-protocol = { workspace = true, features = ["std", "serde"] }
maili-genesis = { workspace = true, features = ["std", "serde"] }

# Alloy
Expand Down
23 changes: 10 additions & 13 deletions bin/host/src/interop/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,17 @@ impl InteropHostCli {
)
})?;

refcell marked this conversation as resolved.
Show resolved Hide resolved
rollup_config_paths.iter().try_fold(
HashMap::with_capacity(rollup_config_paths.len()),
|mut acc, path| {
// Read the serialized config from the file system.
let ser_config = std::fs::read_to_string(path)
.map_err(|e| anyhow!("Error reading RollupConfig file: {e}"))?;
rollup_config_paths.iter().try_fold(HashMap::default(), |mut acc, path| {
// Read the serialized config from the file system.
let ser_config = std::fs::read_to_string(path)
.map_err(|e| anyhow!("Error reading RollupConfig file: {e}"))?;

// Deserialize the config and return it.
let cfg: RollupConfig = serde_json::from_str(&ser_config)
.map_err(|e| anyhow!("Error deserializing RollupConfig: {e}"))?;
// Deserialize the config and return it.
let cfg: RollupConfig = serde_json::from_str(&ser_config)
.map_err(|e| anyhow!("Error deserializing RollupConfig: {e}"))?;

acc.insert(cfg.l2_chain_id, cfg);
Ok(acc)
},
)
acc.insert(cfg.l2_chain_id, cfg);
Ok(acc)
})
}
}
5 changes: 3 additions & 2 deletions bin/host/src/interop/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use super::{InteropFetcher, InteropHostCli, LocalKeyValueStore};
use crate::eth::http_provider;
use alloy_primitives::map::HashMap;
use alloy_provider::{Provider, ReqwestProvider};
use anyhow::{anyhow, Result};
use async_trait::async_trait;
Expand All @@ -11,7 +12,7 @@ use kona_host::{
};
use kona_preimage::{HintWriter, NativeChannel, OracleReader};
use kona_providers_alloy::{OnlineBeaconClient, OnlineBlobProvider};
use std::{collections::HashMap, sync::Arc};
use std::sync::Arc;
use tokio::sync::RwLock;

/// The providers required for the single chain host.
Expand Down Expand Up @@ -45,7 +46,7 @@ impl HostOrchestrator for InteropHostCli {
// Resolve all chain IDs to their corresponding providers.
let l2_node_addresses =
self.l2_node_addresses.as_ref().ok_or(anyhow!("L2 node addresses must be set"))?;
let mut l2_providers = HashMap::with_capacity(l2_node_addresses.len());
let mut l2_providers = HashMap::default();
for l2_node_address in l2_node_addresses {
let l2_provider = http_provider(l2_node_address);
let chain_id = l2_provider.get_chain_id().await?;
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ workspace = true

[dependencies]
# Maili
maili-rpc.workspace = true
maili-genesis.workspace = true
maili-protocol.workspace = true

Expand Down Expand Up @@ -41,7 +42,6 @@ spin.workspace = true
proptest.workspace = true
serde_json.workspace = true
maili-registry.workspace = true
maili-consensus.workspace = true
tokio = { workspace = true, features = ["full"] }
tracing-subscriber = { workspace = true, features = ["fmt"] }
tracing = { workspace = true, features = ["std"] }
Expand Down
5 changes: 3 additions & 2 deletions crates/derive/src/pipeline/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use async_trait::async_trait;
use core::fmt::Debug;
use maili_genesis::{RollupConfig, SystemConfig};
use maili_protocol::{BlockInfo, L2BlockInfo};
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use maili_rpc::OpAttributesWithParent;

/// The derivation pipeline is responsible for deriving L2 inputs from L1 data.
#[derive(Debug)]
Expand Down Expand Up @@ -197,7 +197,8 @@ mod tests {
use alloy_rpc_types_engine::PayloadAttributes;
use maili_genesis::{RollupConfig, SystemConfig};
use maili_protocol::L2BlockInfo;
use op_alloy_rpc_types_engine::{OpAttributesWithParent, OpPayloadAttributes};
use maili_rpc::OpAttributesWithParent;
use op_alloy_rpc_types_engine::OpPayloadAttributes;

fn default_test_payload_attributes() -> OpAttributesWithParent {
OpAttributesWithParent {
Expand Down
3 changes: 2 additions & 1 deletion crates/derive/src/stages/attributes_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use async_trait::async_trait;
use core::fmt::Debug;
use maili_genesis::RollupConfig;
use maili_protocol::{BlockInfo, L2BlockInfo, SingleBatch};
use op_alloy_rpc_types_engine::{OpAttributesWithParent, OpPayloadAttributes};
use maili_rpc::OpAttributesWithParent;
use op_alloy_rpc_types_engine::OpPayloadAttributes;

/// [AttributesQueue] accepts batches from the [BatchQueue] stage
/// and transforms them into [OpPayloadAttributes].
Expand Down
3 changes: 1 addition & 2 deletions crates/derive/src/stages/batch/batch_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,9 @@ mod tests {
use alloy_eips::{eip2718::Decodable2718, BlockNumHash};
use alloy_primitives::{address, b256, Address, Bytes, TxKind, B256, U256};
use alloy_rlp::{BytesMut, Encodable};
use maili_consensus::TxDeposit;
use maili_genesis::{ChainGenesis, MAX_RLP_BYTES_PER_CHANNEL_FJORD};
use maili_protocol::{BatchReader, L1BlockInfoBedrock, L1BlockInfoTx};
use op_alloy_consensus::{OpBlock, OpTxEnvelope, OpTxType};
use op_alloy_consensus::{OpBlock, OpTxEnvelope, OpTxType, TxDeposit};
use tracing::Level;
use tracing_subscriber::layer::SubscriberExt;

Expand Down
10 changes: 3 additions & 7 deletions crates/derive/src/test_utils/chain_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use crate::{
traits::{ChainProvider, L2ChainProvider},
};
use alloc::{boxed::Box, string::ToString, sync::Arc, vec::Vec};
use alloy_consensus::{Block, Header, Receipt, TxEnvelope};
use alloy_consensus::{Header, Receipt, TxEnvelope};
use alloy_primitives::{map::HashMap, B256};
use async_trait::async_trait;
use maili_genesis::{RollupConfig, SystemConfig};
use maili_protocol::{BatchValidationProvider, BlockInfo, L2BlockInfo};
use op_alloy_consensus::{OpBlock, OpTxEnvelope};
use op_alloy_consensus::OpBlock;
use thiserror::Error;

/// A mock chain provider for testing.
Expand Down Expand Up @@ -177,7 +177,6 @@ impl TestL2ChainProvider {
#[async_trait]
impl BatchValidationProvider for TestL2ChainProvider {
type Error = TestProviderError;
type Transaction = OpTxEnvelope;

async fn l2_block_info_by_number(&mut self, number: u64) -> Result<L2BlockInfo, Self::Error> {
if self.short_circuit {
Expand All @@ -190,10 +189,7 @@ impl BatchValidationProvider for TestL2ChainProvider {
.ok_or_else(|| TestProviderError::BlockNotFound)
}

async fn block_by_number(
&mut self,
number: u64,
) -> Result<Block<Self::Transaction>, Self::Error> {
async fn block_by_number(&mut self, number: u64) -> Result<OpBlock, Self::Error> {
self.op_blocks
.iter()
.find(|p| p.header.number == number)
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/test_utils/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
use alloc::{boxed::Box, sync::Arc};
use maili_genesis::RollupConfig;
use maili_protocol::{BlockInfo, L2BlockInfo};
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use maili_rpc::OpAttributesWithParent;

// Re-export these types used internally to the test pipeline.
use crate::{
Expand Down
6 changes: 2 additions & 4 deletions crates/derive/src/test_utils/sys_config_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ use crate::{
traits::L2ChainProvider,
};
use alloc::{boxed::Box, string::ToString, sync::Arc};
use alloy_consensus::Block;
use alloy_primitives::map::HashMap;
use async_trait::async_trait;
use maili_genesis::{RollupConfig, SystemConfig};
use maili_protocol::{BatchValidationProvider, L2BlockInfo};
use op_alloy_consensus::OpTxEnvelope;
use op_alloy_consensus::OpBlock;
use thiserror::Error;

/// A mock implementation of the `SystemConfigL2Fetcher` for testing.
Expand Down Expand Up @@ -49,9 +48,8 @@ impl From<TestSystemConfigL2FetcherError> for PipelineErrorKind {
#[async_trait]
impl BatchValidationProvider for TestSystemConfigL2Fetcher {
type Error = TestSystemConfigL2FetcherError;
type Transaction = OpTxEnvelope;

async fn block_by_number(&mut self, _: u64) -> Result<Block<Self::Transaction>, Self::Error> {
async fn block_by_number(&mut self, _: u64) -> Result<OpBlock, Self::Error> {
unimplemented!()
}

Expand Down
3 changes: 2 additions & 1 deletion crates/derive/src/traits/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use alloc::boxed::Box;
use alloy_eips::BlockNumHash;
use async_trait::async_trait;
use maili_protocol::{L2BlockInfo, SingleBatch};
use op_alloy_rpc_types_engine::{OpAttributesWithParent, OpPayloadAttributes};
use maili_rpc::OpAttributesWithParent;
use op_alloy_rpc_types_engine::OpPayloadAttributes;

/// [AttributesProvider] is a trait abstraction that generalizes the [BatchQueue] stage.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/traits/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use async_trait::async_trait;
use core::iter::Iterator;
use maili_genesis::{RollupConfig, SystemConfig};
use maili_protocol::L2BlockInfo;
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use maili_rpc::OpAttributesWithParent;

use crate::{errors::PipelineErrorKind, traits::OriginProvider, types::StepResult};

Expand Down
1 change: 1 addition & 0 deletions crates/driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ workspace = true
kona-derive.workspace = true

# Maili
maili-rpc.workspace = true
maili-genesis.workspace = true
maili-protocol.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion crates/driver/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use kona_derive::{
};
use maili_genesis::RollupConfig;
use maili_protocol::L2BlockInfo;
use maili_rpc::OpAttributesWithParent;
use op_alloy_consensus::{OpBlock, OpTxEnvelope, OpTxType};
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use spin::RwLock;

/// The Rollup Driver entrypoint.
Expand Down
2 changes: 1 addition & 1 deletion crates/driver/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use alloc::boxed::Box;
use async_trait::async_trait;
use maili_protocol::L2BlockInfo;
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use maili_rpc::OpAttributesWithParent;

use kona_derive::{
errors::{PipelineError, PipelineErrorKind, ResetError},
Expand Down
8 changes: 6 additions & 2 deletions crates/executor/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ where
base.build()
};

let is_isthmus = self.config.is_isthmus_active(payload.payload_attributes.timestamp);

// Execute the transactions in the payload.
let decoded_txs = transactions
.iter()
Expand Down Expand Up @@ -239,8 +241,10 @@ where
.flatten(),
);
// Ensure the receipt is not an EIP-7702 receipt.
if matches!(receipt, OpReceiptEnvelope::Eip7702(_)) {
panic!("EIP-7702 receipts are not supported by the fault proof program");
if matches!(receipt, OpReceiptEnvelope::Eip7702(_)) && !is_isthmus {
panic!(
"EIP-7702 receipts are not supported by the fault proof program before Isthmus"
refcell marked this conversation as resolved.
Show resolved Hide resolved
);
}
receipts.push(receipt);
}
Expand Down
10 changes: 5 additions & 5 deletions crates/interop/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub struct ChainBuilder {

impl SuperchainBuilder {
pub fn new(timestamp: u64) -> Self {
Self { chains: HashMap::new(), timestamp }
Self { chains: HashMap::default(), timestamp }
}

pub fn chain(&mut self, chain_id: u64) -> &mut ChainBuilder {
Expand All @@ -93,20 +93,20 @@ impl SuperchainBuilder {

/// Builds the scenario into the format needed for testing
pub fn build(self) -> (Vec<(u64, Sealed<Header>)>, MockInteropProvider) {
let mut headers_map = HashMap::new();
let mut receipts_map = HashMap::new();
let mut headers_map = HashMap::default();
let mut receipts_map = HashMap::default();
let mut sealed_headers = Vec::new();

for (chain_id, chain) in self.chains {
let header = chain.header;
let header_hash = header.hash_slow();
let sealed_header = header.seal(header_hash);

let mut chain_headers = HashMap::new();
let mut chain_headers = HashMap::default();
chain_headers.insert(0, sealed_header.clone());
headers_map.insert(chain_id, chain_headers);

let mut chain_receipts = HashMap::new();
let mut chain_receipts = HashMap::default();
chain_receipts.insert(0, chain.receipts);
receipts_map.insert(chain_id, chain_receipts);

Expand Down
2 changes: 1 addition & 1 deletion crates/proof-sdk/proof-interop/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
{
/// Creates a new [OracleInteropProvider] with the given oracle client and [PreState].
pub fn new(oracle: Arc<T>, pre_state: PreState) -> Self {
Self { oracle, pre_state, safe_head_cache: Arc::new(RwLock::new(HashMap::new())) }
Self { oracle, pre_state, safe_head_cache: Arc::new(RwLock::new(HashMap::default())) }
}

/// Fetch the [Header] for the block with the given hash.
Expand Down
1 change: 1 addition & 0 deletions crates/proof-sdk/proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ kona-preimage.workspace = true
kona-executor.workspace = true

# Maili
maili-rpc.workspace = true
maili-protocol.workspace = true
maili-registry.workspace = true
maili-genesis = { workspace = true, features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/proof-sdk/proof/src/l1/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use kona_driver::{DriverPipeline, PipelineCursor};
use kona_preimage::CommsClient;
use maili_genesis::{RollupConfig, SystemConfig};
use maili_protocol::{BlockInfo, L2BlockInfo};
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use maili_rpc::OpAttributesWithParent;
use spin::RwLock;

/// An oracle-backed derivation pipeline.
Expand Down
8 changes: 2 additions & 6 deletions crates/proof-sdk/proof/src/l2/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::{errors::OracleProviderError, HintType};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_consensus::{Block, BlockBody, Header};
use alloy_consensus::{BlockBody, Header};
use alloy_eips::eip2718::Decodable2718;
use alloy_primitives::{Address, Bytes, B256};
use alloy_rlp::Decodable;
Expand Down Expand Up @@ -74,7 +74,6 @@ impl<T: CommsClient> OracleL2ChainProvider<T> {
#[async_trait]
impl<T: CommsClient + Send + Sync> BatchValidationProvider for OracleL2ChainProvider<T> {
type Error = OracleProviderError;
type Transaction = OpTxEnvelope;

async fn l2_block_info_by_number(&mut self, number: u64) -> Result<L2BlockInfo, Self::Error> {
// Get the block at the given number.
Expand All @@ -85,10 +84,7 @@ impl<T: CommsClient + Send + Sync> BatchValidationProvider for OracleL2ChainProv
.map_err(OracleProviderError::BlockInfo)
}

async fn block_by_number(
&mut self,
number: u64,
) -> Result<Block<Self::Transaction>, Self::Error> {
async fn block_by_number(&mut self, number: u64) -> Result<OpBlock, Self::Error> {
// Fetch the header for the given block number.
let header @ Header { transactions_root, timestamp, .. } =
self.header_by_number(number).await?;
Expand Down
Loading
Loading