mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: bump op-alloy (#11617)
This commit is contained in:
24
Cargo.lock
generated
24
Cargo.lock
generated
@ -5174,9 +5174,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-consensus"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4f7f318f885db6e1455370ca91f74b7faed152c8142f6418f0936d606e582ff"
|
||||
checksum = "7ea7162170c6f3cad8f67f4dd7108e3f78349fd553da5b8bebff1e7ef8f38896"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@ -5192,9 +5192,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-genesis"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8215c87b74d2fbbaff0fd2887868a8341df33a3c495ee01f813e5ddd5be9c46"
|
||||
checksum = "9f3d31dfbbd8dd898c7512f8ce7d30103980485416f668566100b0ed0994b958"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@ -5206,9 +5206,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-network"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3cd514c4ccd0b3c69fa3e7050cde77db842d4c308ae48f9a3e1ce263e823e45e"
|
||||
checksum = "d113b325527ba7da271a8793f1c14bdf7f035ce9e0611e668c36fc6812568c7f"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-network",
|
||||
@ -5220,9 +5220,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-protocol"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa5c397fbe35e07f9c95a571440ca2e90df754e198496d82ff4127de00b89dd9"
|
||||
checksum = "310873e4fbfc41986716c4fb6000a8b49d025d932d2c261af58271c434b05288"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@ -5237,9 +5237,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-rpc-types"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "547d29c5ab957ff32e14edddb93652dad748d2ef6cbe4b0fe8615ce06b0a3ddb"
|
||||
checksum = "323c65880e2561aa87f74f8af260fd15b9cc930c448c88a60ae95af86c88c634"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@ -5254,9 +5254,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-rpc-types-engine"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5041122e20b76644cc690bba688671eecdc4626e6384a76eb740535d6ddcef14"
|
||||
checksum = "349e7b420f45d1a00216ec4c65fcf3f0057a841bc39732c405c85ae782b94121"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-engine",
|
||||
|
||||
@ -460,10 +460,10 @@ alloy-transport-ipc = { version = "0.4.2", default-features = false }
|
||||
alloy-transport-ws = { version = "0.4.2", default-features = false }
|
||||
|
||||
# op
|
||||
op-alloy-rpc-types = "0.3.2"
|
||||
op-alloy-rpc-types-engine = "0.3.2"
|
||||
op-alloy-network = "0.3.2"
|
||||
op-alloy-consensus = "0.3.2"
|
||||
op-alloy-rpc-types = "0.4"
|
||||
op-alloy-rpc-types-engine = "0.4"
|
||||
op-alloy-network = "0.4"
|
||||
op-alloy-consensus = "0.4"
|
||||
|
||||
# misc
|
||||
aquamarine = "0.5"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use op_alloy_rpc_types_engine::OptimismExecutionPayloadEnvelopeV3;
|
||||
use op_alloy_rpc_types_engine::OpExecutionPayloadEnvelopeV3;
|
||||
use reth::rpc::types::engine::{ExecutionPayloadEnvelopeV3, ExecutionPayloadV3};
|
||||
|
||||
/// The execution payload envelope type.
|
||||
@ -7,7 +7,7 @@ pub trait PayloadEnvelopeExt: Send + Sync + std::fmt::Debug {
|
||||
fn execution_payload(&self) -> ExecutionPayloadV3;
|
||||
}
|
||||
|
||||
impl PayloadEnvelopeExt for OptimismExecutionPayloadEnvelopeV3 {
|
||||
impl PayloadEnvelopeExt for OpExecutionPayloadEnvelopeV3 {
|
||||
fn execution_payload(&self) -> ExecutionPayloadV3 {
|
||||
self.execution_payload.clone()
|
||||
}
|
||||
|
||||
@ -224,14 +224,14 @@ impl From<Genesis> for OpChainSpec {
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct OptimismGenesisInfo {
|
||||
optimism_chain_info: op_alloy_rpc_types::genesis::OptimismChainInfo,
|
||||
optimism_chain_info: op_alloy_rpc_types::genesis::OpChainInfo,
|
||||
base_fee_params: BaseFeeParamsKind,
|
||||
}
|
||||
|
||||
impl OptimismGenesisInfo {
|
||||
fn extract_from(genesis: &Genesis) -> Self {
|
||||
let mut info = Self {
|
||||
optimism_chain_info: op_alloy_rpc_types::genesis::OptimismChainInfo::extract_from(
|
||||
optimism_chain_info: op_alloy_rpc_types::genesis::OpChainInfo::extract_from(
|
||||
&genesis.config.extra_fields,
|
||||
)
|
||||
.unwrap_or_default(),
|
||||
@ -622,7 +622,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn parse_genesis_optimism_with_variable_base_fee_params() {
|
||||
use op_alloy_rpc_types::genesis::OptimismBaseFeeInfo;
|
||||
use op_alloy_rpc_types::genesis::OpBaseFeeInfo;
|
||||
|
||||
let geth_genesis = r#"
|
||||
{
|
||||
@ -673,11 +673,11 @@ mod tests {
|
||||
|
||||
let optimism_object = genesis.config.extra_fields.get("optimism").unwrap();
|
||||
let optimism_base_fee_info =
|
||||
serde_json::from_value::<OptimismBaseFeeInfo>(optimism_object.clone()).unwrap();
|
||||
serde_json::from_value::<OpBaseFeeInfo>(optimism_object.clone()).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
optimism_base_fee_info,
|
||||
OptimismBaseFeeInfo {
|
||||
OpBaseFeeInfo {
|
||||
eip1559_elasticity: Some(6),
|
||||
eip1559_denominator: Some(50),
|
||||
eip1559_denominator_canyon: None,
|
||||
|
||||
@ -2,8 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use alloy_rpc_types_engine::{ExecutionPayloadEnvelopeV2, ExecutionPayloadV1};
|
||||
use op_alloy_rpc_types_engine::{
|
||||
OptimismExecutionPayloadEnvelopeV3, OptimismExecutionPayloadEnvelopeV4,
|
||||
OptimismPayloadAttributes,
|
||||
OpExecutionPayloadEnvelopeV3, OpExecutionPayloadEnvelopeV4, OpPayloadAttributes,
|
||||
};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_node_api::{
|
||||
@ -35,13 +34,13 @@ impl<T: PayloadTypes> EngineTypes for OptimismEngineTypes<T>
|
||||
where
|
||||
T::BuiltPayload: TryInto<ExecutionPayloadV1>
|
||||
+ TryInto<ExecutionPayloadEnvelopeV2>
|
||||
+ TryInto<OptimismExecutionPayloadEnvelopeV3>
|
||||
+ TryInto<OptimismExecutionPayloadEnvelopeV4>,
|
||||
+ TryInto<OpExecutionPayloadEnvelopeV3>
|
||||
+ TryInto<OpExecutionPayloadEnvelopeV4>,
|
||||
{
|
||||
type ExecutionPayloadV1 = ExecutionPayloadV1;
|
||||
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadV3 = OptimismExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadV4 = OptimismExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadV3 = OpExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadV4 = OpExecutionPayloadEnvelopeV4;
|
||||
}
|
||||
|
||||
/// A default payload type for [`OptimismEngineTypes`]
|
||||
@ -51,7 +50,7 @@ pub struct OptimismPayloadTypes;
|
||||
|
||||
impl PayloadTypes for OptimismPayloadTypes {
|
||||
type BuiltPayload = OptimismBuiltPayload;
|
||||
type PayloadAttributes = OptimismPayloadAttributes;
|
||||
type PayloadAttributes = OpPayloadAttributes;
|
||||
type PayloadBuilderAttributes = OptimismPayloadBuilderAttributes;
|
||||
}
|
||||
|
||||
@ -112,12 +111,12 @@ pub fn validate_withdrawals_presence(
|
||||
|
||||
impl<Types> EngineValidator<Types> for OptimismEngineValidator
|
||||
where
|
||||
Types: EngineTypes<PayloadAttributes = OptimismPayloadAttributes>,
|
||||
Types: EngineTypes<PayloadAttributes = OpPayloadAttributes>,
|
||||
{
|
||||
fn validate_version_specific_fields(
|
||||
&self,
|
||||
version: EngineApiMessageVersion,
|
||||
payload_or_attrs: PayloadOrAttributes<'_, OptimismPayloadAttributes>,
|
||||
payload_or_attrs: PayloadOrAttributes<'_, OpPayloadAttributes>,
|
||||
) -> Result<(), EngineObjectValidationError> {
|
||||
validate_withdrawals_presence(
|
||||
&self.chain_spec,
|
||||
@ -138,7 +137,7 @@ where
|
||||
fn ensure_well_formed_attributes(
|
||||
&self,
|
||||
version: EngineApiMessageVersion,
|
||||
attributes: &OptimismPayloadAttributes,
|
||||
attributes: &OpPayloadAttributes,
|
||||
) -> Result<(), EngineObjectValidationError> {
|
||||
validate_version_specific_fields(&self.chain_spec, version, attributes.into())?;
|
||||
|
||||
|
||||
@ -15,6 +15,4 @@ pub mod builder;
|
||||
pub use builder::OptimismPayloadBuilder;
|
||||
pub mod error;
|
||||
pub mod payload;
|
||||
pub use payload::{
|
||||
OptimismBuiltPayload, OptimismPayloadAttributes, OptimismPayloadBuilderAttributes,
|
||||
};
|
||||
pub use payload::{OpPayloadAttributes, OptimismBuiltPayload, OptimismPayloadBuilderAttributes};
|
||||
|
||||
@ -7,10 +7,8 @@ use alloy_primitives::{Address, B256, U256};
|
||||
use alloy_rlp::Encodable;
|
||||
use alloy_rpc_types_engine::{ExecutionPayloadEnvelopeV2, ExecutionPayloadV1, PayloadId};
|
||||
/// Re-export for use in downstream arguments.
|
||||
pub use op_alloy_rpc_types_engine::OptimismPayloadAttributes;
|
||||
use op_alloy_rpc_types_engine::{
|
||||
OptimismExecutionPayloadEnvelopeV3, OptimismExecutionPayloadEnvelopeV4,
|
||||
};
|
||||
pub use op_alloy_rpc_types_engine::OpPayloadAttributes;
|
||||
use op_alloy_rpc_types_engine::{OpExecutionPayloadEnvelopeV3, OpExecutionPayloadEnvelopeV4};
|
||||
use reth_chain_state::ExecutedBlock;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
@ -40,13 +38,13 @@ pub struct OptimismPayloadBuilderAttributes {
|
||||
}
|
||||
|
||||
impl PayloadBuilderAttributes for OptimismPayloadBuilderAttributes {
|
||||
type RpcPayloadAttributes = OptimismPayloadAttributes;
|
||||
type RpcPayloadAttributes = OpPayloadAttributes;
|
||||
type Error = alloy_rlp::Error;
|
||||
|
||||
/// Creates a new payload builder for the given parent block and the attributes.
|
||||
///
|
||||
/// Derives the unique [`PayloadId`] for the given parent and attributes
|
||||
fn try_new(parent: B256, attributes: OptimismPayloadAttributes) -> Result<Self, Self::Error> {
|
||||
fn try_new(parent: B256, attributes: OpPayloadAttributes) -> Result<Self, Self::Error> {
|
||||
let id = payload_id_optimism(&parent, &attributes);
|
||||
|
||||
let transactions = attributes
|
||||
@ -213,7 +211,7 @@ impl From<OptimismBuiltPayload> for ExecutionPayloadEnvelopeV2 {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<OptimismBuiltPayload> for OptimismExecutionPayloadEnvelopeV3 {
|
||||
impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV3 {
|
||||
fn from(value: OptimismBuiltPayload) -> Self {
|
||||
let OptimismBuiltPayload { block, fees, sidecars, chain_spec, attributes, .. } = value;
|
||||
|
||||
@ -240,7 +238,7 @@ impl From<OptimismBuiltPayload> for OptimismExecutionPayloadEnvelopeV3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<OptimismBuiltPayload> for OptimismExecutionPayloadEnvelopeV4 {
|
||||
impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV4 {
|
||||
fn from(value: OptimismBuiltPayload) -> Self {
|
||||
let OptimismBuiltPayload { block, fees, sidecars, chain_spec, attributes, .. } = value;
|
||||
|
||||
@ -268,13 +266,10 @@ impl From<OptimismBuiltPayload> for OptimismExecutionPayloadEnvelopeV4 {
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates the payload id for the configured payload from the [`OptimismPayloadAttributes`].
|
||||
/// Generates the payload id for the configured payload from the [`OpPayloadAttributes`].
|
||||
///
|
||||
/// Returns an 8-byte identifier by hashing the payload components with sha256 hash.
|
||||
pub(crate) fn payload_id_optimism(
|
||||
parent: &B256,
|
||||
attributes: &OptimismPayloadAttributes,
|
||||
) -> PayloadId {
|
||||
pub(crate) fn payload_id_optimism(parent: &B256, attributes: &OpPayloadAttributes) -> PayloadId {
|
||||
use sha2::Digest;
|
||||
let mut hasher = sha2::Sha256::new();
|
||||
hasher.update(parent.as_slice());
|
||||
|
||||
@ -3,9 +3,7 @@
|
||||
use alloy_eips::eip2718::Encodable2718;
|
||||
use alloy_rpc_types::{AnyReceiptEnvelope, Log, TransactionReceipt};
|
||||
use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope};
|
||||
use op_alloy_rpc_types::{
|
||||
receipt::L1BlockInfo, OpTransactionReceipt, OptimismTransactionReceiptFields,
|
||||
};
|
||||
use op_alloy_rpc_types::{receipt::L1BlockInfo, OpTransactionReceipt, OpTransactionReceiptFields};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_node_api::{FullNodeComponents, NodeTypes};
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
@ -68,7 +66,7 @@ where
|
||||
tx: &TransactionSigned,
|
||||
l1_block_info: revm::L1BlockInfo,
|
||||
receipt: &Receipt,
|
||||
) -> Result<OptimismTransactionReceiptFields, OpEthApiError> {
|
||||
) -> Result<OpTransactionReceiptFields, OpEthApiError> {
|
||||
Ok(OpReceiptFieldsBuilder::default()
|
||||
.l1_block_info(&self.inner.provider().chain_spec(), tx, l1_block_info)?
|
||||
.deposit_nonce(receipt.deposit_nonce)
|
||||
@ -162,8 +160,8 @@ impl OpReceiptFieldsBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Builds the [`OptimismTransactionReceiptFields`] object.
|
||||
pub const fn build(self) -> OptimismTransactionReceiptFields {
|
||||
/// Builds the [`OpTransactionReceiptFields`] object.
|
||||
pub const fn build(self) -> OpTransactionReceiptFields {
|
||||
let Self {
|
||||
l1_block_timestamp: _, // used to compute other fields
|
||||
l1_fee,
|
||||
@ -177,7 +175,7 @@ impl OpReceiptFieldsBuilder {
|
||||
l1_blob_base_fee_scalar,
|
||||
} = self;
|
||||
|
||||
OptimismTransactionReceiptFields {
|
||||
OpTransactionReceiptFields {
|
||||
l1_block_info: L1BlockInfo {
|
||||
l1_gas_price,
|
||||
l1_gas_used,
|
||||
@ -201,7 +199,7 @@ pub struct OpReceiptBuilder {
|
||||
/// Transaction type.
|
||||
pub tx_type: TxType,
|
||||
/// Additional OP receipt fields.
|
||||
pub op_receipt_fields: OptimismTransactionReceiptFields,
|
||||
pub op_receipt_fields: OpTransactionReceiptFields,
|
||||
}
|
||||
|
||||
impl OpReceiptBuilder {
|
||||
@ -234,11 +232,8 @@ impl OpReceiptBuilder {
|
||||
pub fn build(self) -> OpTransactionReceipt {
|
||||
let Self { core_receipt, tx_type, op_receipt_fields } = self;
|
||||
|
||||
let OptimismTransactionReceiptFields {
|
||||
l1_block_info,
|
||||
deposit_nonce,
|
||||
deposit_receipt_version,
|
||||
} = op_receipt_fields;
|
||||
let OpTransactionReceiptFields { l1_block_info, deposit_nonce, deposit_receipt_version } =
|
||||
op_receipt_fields;
|
||||
|
||||
let TransactionReceipt {
|
||||
inner: AnyReceiptEnvelope { inner: receipt_with_bloom, .. },
|
||||
@ -261,10 +256,11 @@ impl OpReceiptBuilder {
|
||||
TxType::Legacy => OpReceiptEnvelope::<Log>::Legacy(receipt_with_bloom),
|
||||
TxType::Eip2930 => OpReceiptEnvelope::<Log>::Eip2930(receipt_with_bloom),
|
||||
TxType::Eip1559 => OpReceiptEnvelope::<Log>::Eip1559(receipt_with_bloom),
|
||||
TxType::Eip4844 => OpReceiptEnvelope::<Log>::Eip4844(receipt_with_bloom),
|
||||
TxType::Eip7702 => {
|
||||
unimplemented!("not implemented yet for OpReceiptEnvelope")
|
||||
TxType::Eip4844 => {
|
||||
// TODO: unreachable
|
||||
OpReceiptEnvelope::<Log>::Eip1559(receipt_with_bloom)
|
||||
}
|
||||
TxType::Eip7702 => OpReceiptEnvelope::<Log>::Eip7702(receipt_with_bloom),
|
||||
TxType::Deposit => {
|
||||
OpReceiptEnvelope::<Log>::Deposit(OpDepositReceiptWithBloom::<Log> {
|
||||
receipt: OpDepositReceipt::<Log> {
|
||||
@ -325,8 +321,8 @@ mod test {
|
||||
/// L1 block info for transaction at index 1 in block 124665056.
|
||||
///
|
||||
/// <https://optimistic.etherscan.io/tx/0x1059e8004daff32caa1f1b1ef97fe3a07a8cf40508f5b835b66d9420d87c4a4a>
|
||||
const TX_META_TX_1_OP_MAINNET_BLOCK_124665056: OptimismTransactionReceiptFields =
|
||||
OptimismTransactionReceiptFields {
|
||||
const TX_META_TX_1_OP_MAINNET_BLOCK_124665056: OpTransactionReceiptFields =
|
||||
OpTransactionReceiptFields {
|
||||
l1_block_info: L1BlockInfo {
|
||||
l1_gas_price: Some(1055991687), // since bedrock l1 base fee
|
||||
l1_gas_used: Some(4471),
|
||||
|
||||
@ -4,7 +4,7 @@ use alloy_rpc_types::{
|
||||
engine::{PayloadAttributes as EthPayloadAttributes, PayloadId},
|
||||
Withdrawal,
|
||||
};
|
||||
use op_alloy_rpc_types_engine::OptimismPayloadAttributes;
|
||||
use op_alloy_rpc_types_engine::OpPayloadAttributes;
|
||||
use reth_chain_state::ExecutedBlock;
|
||||
use reth_primitives::{SealedBlock, Withdrawals};
|
||||
use std::{future::Future, pin::Pin};
|
||||
@ -145,7 +145,7 @@ impl PayloadAttributes for EthPayloadAttributes {
|
||||
}
|
||||
}
|
||||
|
||||
impl PayloadAttributes for OptimismPayloadAttributes {
|
||||
impl PayloadAttributes for OpPayloadAttributes {
|
||||
fn timestamp(&self) -> u64 {
|
||||
self.payload_attributes.timestamp
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ impl TryFrom<WithOtherFields<alloy_rpc_types::Transaction>> for Transaction {
|
||||
#[cfg(feature = "optimism")]
|
||||
Some(TxType::Deposit) => {
|
||||
let fields = other
|
||||
.deserialize_into::<op_alloy_rpc_types::OptimismTransactionFields>()
|
||||
.deserialize_into::<op_alloy_rpc_types::OpTransactionFields>()
|
||||
.map_err(|e| ConversionError::Custom(e.to_string()))?;
|
||||
Ok(Self::Deposit(op_alloy_consensus::TxDeposit {
|
||||
source_hash: fields
|
||||
|
||||
Reference in New Issue
Block a user