Skip to content

Commit

Permalink
renamed OptimismBuiltPayload to OpBuiltPayload (#12227)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencartavia authored Oct 31, 2024
1 parent 1f1dcc9 commit 460e26c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions crates/optimism/node/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use reth_node_api::{
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_forks::{OptimismHardfork, OptimismHardforks};
use reth_optimism_payload_builder::{
builder::decode_eip_1559_params, OpPayloadBuilderAttributes, OptimismBuiltPayload,
builder::decode_eip_1559_params, OpBuiltPayload, OpPayloadBuilderAttributes,
};

/// The types used in the optimism beacon consensus engine.
Expand Down Expand Up @@ -51,7 +51,7 @@ where
pub struct OptimismPayloadTypes;

impl PayloadTypes for OptimismPayloadTypes {
type BuiltPayload = OptimismBuiltPayload;
type BuiltPayload = OpBuiltPayload;
type PayloadAttributes = OpPayloadAttributes;
type PayloadBuilderAttributes = OpPayloadBuilderAttributes;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub use node::OptimismNode;
pub mod txpool;

pub use reth_optimism_payload_builder::{
OpPayloadBuilderAttributes, OptimismBuiltPayload, OptimismPayloadBuilder,
OpBuiltPayload, OpPayloadBuilderAttributes, OptimismPayloadBuilder,
};

pub use reth_optimism_evm::*;
4 changes: 2 additions & 2 deletions crates/optimism/node/tests/e2e/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use reth_e2e_test_utils::{
};
use reth_optimism_chainspec::OpChainSpecBuilder;
use reth_optimism_node::{
node::OptimismAddOns, OpPayloadBuilderAttributes, OptimismBuiltPayload, OptimismNode,
node::OptimismAddOns, OpBuiltPayload, OpPayloadBuilderAttributes, OptimismNode,
};
use reth_payload_builder::EthPayloadBuilderAttributes;
use std::sync::Arc;
Expand All @@ -31,7 +31,7 @@ pub(crate) async fn advance_chain(
length: usize,
node: &mut OpNode,
wallet: Arc<Mutex<Wallet>>,
) -> eyre::Result<Vec<(OptimismBuiltPayload, OpPayloadBuilderAttributes)>> {
) -> eyre::Result<Vec<(OpBuiltPayload, OpPayloadBuilderAttributes)>> {
node.advance(length as u64, |_| {
let wallet = wallet.clone();
Box::pin(async move {
Expand Down
18 changes: 9 additions & 9 deletions crates/optimism/payload/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use tracing::{debug, trace, warn};

use crate::{
error::OptimismPayloadBuilderError,
payload::{OpPayloadBuilderAttributes, OptimismBuiltPayload},
payload::{OpBuiltPayload, OpPayloadBuilderAttributes},
};
use op_alloy_consensus::DepositTransaction;

Expand Down Expand Up @@ -97,12 +97,12 @@ where
EvmConfig: ConfigureEvm<Header = Header>,
{
type Attributes = OpPayloadBuilderAttributes;
type BuiltPayload = OptimismBuiltPayload;
type BuiltPayload = OpBuiltPayload;

fn try_build(
&self,
args: BuildArguments<Pool, Client, OpPayloadBuilderAttributes, OptimismBuiltPayload>,
) -> Result<BuildOutcome<OptimismBuiltPayload>, PayloadBuilderError> {
args: BuildArguments<Pool, Client, OpPayloadBuilderAttributes, OpBuiltPayload>,
) -> Result<BuildOutcome<OpBuiltPayload>, PayloadBuilderError> {
let (cfg_env, block_env) = self
.cfg_and_block_env(&args.config, &args.config.parent_header)
.map_err(PayloadBuilderError::other)?;
Expand All @@ -111,7 +111,7 @@ where

fn on_missing_payload(
&self,
_args: BuildArguments<Pool, Client, OpPayloadBuilderAttributes, OptimismBuiltPayload>,
_args: BuildArguments<Pool, Client, OpPayloadBuilderAttributes, OpBuiltPayload>,
) -> MissingPayloadBehaviour<Self::BuiltPayload> {
// we want to await the job that's already in progress because that should be returned as
// is, there's no benefit in racing another job
Expand All @@ -124,7 +124,7 @@ where
&self,
client: &Client,
config: PayloadConfig<Self::Attributes>,
) -> Result<OptimismBuiltPayload, PayloadBuilderError> {
) -> Result<OpBuiltPayload, PayloadBuilderError> {
let args = BuildArguments {
client,
config,
Expand Down Expand Up @@ -154,11 +154,11 @@ where
#[inline]
pub(crate) fn optimism_payload<EvmConfig, Pool, Client>(
evm_config: &EvmConfig,
args: BuildArguments<Pool, Client, OpPayloadBuilderAttributes, OptimismBuiltPayload>,
args: BuildArguments<Pool, Client, OpPayloadBuilderAttributes, OpBuiltPayload>,
initialized_cfg: CfgEnvWithHandlerCfg,
initialized_block_env: BlockEnv,
_compute_pending_block: bool,
) -> Result<BuildOutcome<OptimismBuiltPayload>, PayloadBuilderError>
) -> Result<BuildOutcome<OpBuiltPayload>, PayloadBuilderError>
where
EvmConfig: ConfigureEvm<Header = Header>,
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = OpChainSpec>,
Expand Down Expand Up @@ -523,7 +523,7 @@ where

let no_tx_pool = attributes.no_tx_pool;

let payload = OptimismBuiltPayload::new(
let payload = OpBuiltPayload::new(
attributes.payload_attributes.id,
sealed_block,
total_fees,
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub mod builder;
pub use builder::OptimismPayloadBuilder;
pub mod error;
pub mod payload;
pub use payload::{OpPayloadAttributes, OpPayloadBuilderAttributes, OptimismBuiltPayload};
pub use payload::{OpBuiltPayload, OpPayloadAttributes, OpPayloadBuilderAttributes};
30 changes: 15 additions & 15 deletions crates/optimism/payload/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl PayloadBuilderAttributes for OpPayloadBuilderAttributes {

/// Contains the built payload.
#[derive(Debug, Clone)]
pub struct OptimismBuiltPayload {
pub struct OpBuiltPayload {
/// Identifier of the payload
pub(crate) id: PayloadId,
/// The built block
Expand All @@ -174,7 +174,7 @@ pub struct OptimismBuiltPayload {

// === impl BuiltPayload ===

impl OptimismBuiltPayload {
impl OpBuiltPayload {
/// Initializes the payload with the given initial block.
pub const fn new(
id: PayloadId,
Expand Down Expand Up @@ -208,7 +208,7 @@ impl OptimismBuiltPayload {
}
}

impl BuiltPayload for OptimismBuiltPayload {
impl BuiltPayload for OpBuiltPayload {
fn block(&self) -> &SealedBlock {
&self.block
}
Expand All @@ -226,7 +226,7 @@ impl BuiltPayload for OptimismBuiltPayload {
}
}

impl BuiltPayload for &OptimismBuiltPayload {
impl BuiltPayload for &OpBuiltPayload {
fn block(&self) -> &SealedBlock {
(**self).block()
}
Expand All @@ -245,24 +245,24 @@ impl BuiltPayload for &OptimismBuiltPayload {
}

// V1 engine_getPayloadV1 response
impl From<OptimismBuiltPayload> for ExecutionPayloadV1 {
fn from(value: OptimismBuiltPayload) -> Self {
impl From<OpBuiltPayload> for ExecutionPayloadV1 {
fn from(value: OpBuiltPayload) -> Self {
block_to_payload_v1(value.block)
}
}

// V2 engine_getPayloadV2 response
impl From<OptimismBuiltPayload> for ExecutionPayloadEnvelopeV2 {
fn from(value: OptimismBuiltPayload) -> Self {
let OptimismBuiltPayload { block, fees, .. } = value;
impl From<OpBuiltPayload> for ExecutionPayloadEnvelopeV2 {
fn from(value: OpBuiltPayload) -> Self {
let OpBuiltPayload { block, fees, .. } = value;

Self { block_value: fees, execution_payload: convert_block_to_payload_field_v2(block) }
}
}

impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV3 {
fn from(value: OptimismBuiltPayload) -> Self {
let OptimismBuiltPayload { block, fees, sidecars, chain_spec, attributes, .. } = value;
impl From<OpBuiltPayload> for OpExecutionPayloadEnvelopeV3 {
fn from(value: OpBuiltPayload) -> Self {
let OpBuiltPayload { block, fees, sidecars, chain_spec, attributes, .. } = value;

let parent_beacon_block_root =
if chain_spec.is_cancun_active_at_timestamp(attributes.timestamp()) {
Expand All @@ -287,9 +287,9 @@ impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV3 {
}
}
}
impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV4 {
fn from(value: OptimismBuiltPayload) -> Self {
let OptimismBuiltPayload { block, fees, sidecars, chain_spec, attributes, .. } = value;
impl From<OpBuiltPayload> for OpExecutionPayloadEnvelopeV4 {
fn from(value: OpBuiltPayload) -> Self {
let OpBuiltPayload { block, fees, sidecars, chain_spec, attributes, .. } = value;

let parent_beacon_block_root =
if chain_spec.is_cancun_active_at_timestamp(attributes.timestamp()) {
Expand Down

0 comments on commit 460e26c

Please sign in to comment.