Skip to content

Commit

Permalink
chore(deps): fast forward op alloy dep
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Jun 16, 2024
1 parent 49a9d9c commit 84843ec
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 84 deletions.
97 changes: 66 additions & 31 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async-trait = "0.1.80"
alloy-primitives = { version = "0.7.6", default-features = false }
alloy-rlp = { version = "0.3.5", default-features = false }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "cb95183", default-features = false }
op-alloy-consensus = { git = "https://github.com/clabby/op-alloy", branch = "refcell/consensus-port", default-features = false }
op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", branch = "refcell/re-exports", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "cb95183", default-features = false }
revm = { git = "https://github.com/bluealloy/revm", rev = "a832a4e", default-features = false }

Expand Down
3 changes: 1 addition & 2 deletions bin/programs/client/src/l2/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use crate::{BootInfo, CachingOracle, HintType, HINT_WRITER};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_consensus::Header;
use alloy_eips::eip2718::Decodable2718;
use alloy_primitives::{Bytes, B256};
use alloy_rlp::Decodable;
use anyhow::{anyhow, Result};
Expand All @@ -14,7 +13,7 @@ use kona_preimage::{HintWriterClient, PreimageKey, PreimageKeyType, PreimageOrac
use kona_primitives::{
L2BlockInfo, L2ExecutionPayloadEnvelope, OpBlock, RollupConfig, SystemConfig,
};
use op_alloy_consensus::OpTxEnvelope;
use op_alloy_consensus::{Decodable2718, OpTxEnvelope};

/// The oracle-backed L2 chain provider for the client program.
#[derive(Debug, Clone)]
Expand Down
73 changes: 46 additions & 27 deletions bin/programs/client/src/l2/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

use alloc::{sync::Arc, vec::Vec};
use alloy_consensus::{Header, Sealable, Sealed, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
use alloy_primitives::{address, keccak256, Address, Bytes, TxKind, B256, U256};
use anyhow::{anyhow, Result};
use kona_derive::types::{L2PayloadAttributes, RawTransaction, RollupConfig};
use kona_mpt::{ordered_trie_with_encoder, TrieDB, TrieDBFetcher, TrieDBHinter};
use op_alloy_consensus::{OpReceipt, OpReceiptEnvelope, OpReceiptWithBloom, OpTxEnvelope};
use op_alloy_consensus::{
Decodable2718, Eip658Value, Encodable2718, OpDepositReceipt, OpDepositReceiptWithBloom,
OpReceiptEnvelope, OpTxEnvelope, OpTxType, Receipt, ReceiptWithBloom,
};
use revm::{
db::{states::bundle_state::BundleRetention, State},
primitives::{
Expand All @@ -17,6 +19,7 @@ use revm::{
},
Evm, StateBuilder,
};
use tracing::{debug, info};

mod hinter;
pub use hinter::TrieDBHintWriter;
Expand All @@ -28,10 +31,7 @@ mod canyon;
pub(crate) use canyon::ensure_create2_deployer_canyon;

mod util;
use tracing::{debug, info};
pub(crate) use util::{logs_bloom, wrap_receipt_with_bloom};

use self::util::{extract_tx_gas_limit, is_system_transaction};
pub(crate) use util::{extract_tx_gas_limit, is_system_transaction, logs_bloom};

/// The block executor for the L2 client program. Operates off of a [TrieDB] backed [State],
/// allowing for stateless block execution of OP Stack blocks.
Expand Down Expand Up @@ -195,28 +195,47 @@ where

// Create receipt envelope.
let logs_bloom = logs_bloom(result.logs());
let receipt_envelope = wrap_receipt_with_bloom(
OpReceiptWithBloom {
receipt: OpReceipt {
status: result.is_success(),
cumulative_gas_used: cumulative_gas_used as u128,
logs: result.into_logs(),
deposit_nonce: depositor
.as_ref()
.map(|depositor| depositor.account_info().unwrap_or_default().nonce),
// The deposit receipt version was introduced in Canyon to indicate an
// update to how receipt hashes should be computed
// when set. The state transition process
// ensures this is only set for post-Canyon deposit transactions.
deposit_receipt_version: depositor
.is_some()
.then(|| self.config.is_canyon_active(payload.timestamp).then_some(1))
.flatten(),
},
let inner_receipt = Receipt {
status: Eip658Value::Eip658(result.is_success()),
cumulative_gas_used: cumulative_gas_used as u128,
logs: result.into_logs(),
};
let receipt_envelope = match transaction.tx_type() {
OpTxType::Legacy => OpReceiptEnvelope::Legacy(ReceiptWithBloom {
receipt: inner_receipt,
logs_bloom,
},
transaction.tx_type(),
);
}),
OpTxType::Eip2930 => OpReceiptEnvelope::Eip2930(ReceiptWithBloom {
receipt: inner_receipt,
logs_bloom,
}),
OpTxType::Eip1559 => OpReceiptEnvelope::Eip1559(ReceiptWithBloom {
receipt: inner_receipt,
logs_bloom,
}),
OpTxType::Eip4844 => OpReceiptEnvelope::Eip4844(ReceiptWithBloom {
receipt: inner_receipt,
logs_bloom,
}),
OpTxType::Deposit => {
let inner = OpDepositReceiptWithBloom {
receipt: OpDepositReceipt {
inner: inner_receipt,
deposit_nonce: depositor.as_ref().map(|depositor| {
depositor.account_info().unwrap_or_default().nonce
}),
deposit_receipt_version: depositor
.is_some()
.then(|| {
self.config.is_canyon_active(payload.timestamp).then_some(1)
})
.flatten(),
},
logs_bloom,
};
OpReceiptEnvelope::Deposit(inner)
}
};
receipts.push(receipt_envelope);
}

Expand Down
Loading

0 comments on commit 84843ec

Please sign in to comment.