Skip to content

Commit

Permalink
chore: make some fields owned (paradigmxyz#12274)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 2, 2024
1 parent c74d2a0 commit f2de55d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions crates/node/api/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static {
}

/// Context passed to [`NodeAddOns::launch_add_ons`],
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct AddOnsContext<'a, N: FullNodeComponents> {
/// Node with all configured components.
pub node: &'a N,
pub node: N,
/// Node configuration.
pub config: &'a NodeConfig<<N::Types as NodeTypes>::ChainSpec>,
/// Handle to the beacon consensus engine.
pub beacon_engine_handle:
&'a BeaconConsensusEngineHandle<<N::Types as NodeTypesWithEngine>::Engine>,
BeaconConsensusEngineHandle<<N::Types as NodeTypesWithEngine>::Engine>,
/// JWT secret for the node.
pub jwt_secret: &'a JwtSecret,
pub jwt_secret: JwtSecret,
}

/// Customizable node add-on types.
Expand Down
6 changes: 3 additions & 3 deletions crates/node/builder/src/launch/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ where
let jwt_secret = ctx.auth_jwt_secret()?;

let add_ons_ctx = AddOnsContext {
node: ctx.node_adapter(),
node: ctx.node_adapter().clone(),
config: ctx.node_config(),
beacon_engine_handle: &beacon_engine_handle,
jwt_secret: &jwt_secret,
beacon_engine_handle,
jwt_secret,
};

let RpcHandle { rpc_server_handles, rpc_registry } =
Expand Down
6 changes: 3 additions & 3 deletions crates/node/builder/src/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ where
let jwt_secret = ctx.auth_jwt_secret()?;

let add_ons_ctx = AddOnsContext {
node: ctx.node_adapter(),
node: ctx.node_adapter().clone(),
config: ctx.node_config(),
beacon_engine_handle: &beacon_engine_handle,
jwt_secret: &jwt_secret,
beacon_engine_handle,
jwt_secret,
};

let RpcHandle { rpc_server_handles, rpc_registry } =
Expand Down
10 changes: 6 additions & 4 deletions crates/node/builder/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,11 @@ where
type Handle = RpcHandle<N, EthApi>;

async fn launch_add_ons(self, ctx: AddOnsContext<'_, N>) -> eyre::Result<Self::Handle> {
let AddOnsContext { node, config, beacon_engine_handle, jwt_secret } = ctx;
let Self { eth_api_builder, engine_validator_builder, hooks, _pd: _ } = self;

let engine_validator = engine_validator_builder.build(&ctx).await?;
let AddOnsContext { node, config, beacon_engine_handle, jwt_secret } = ctx;

let client = ClientVersionV1 {
code: CLIENT_CODE,
name: NAME_CLIENT.to_string(),
Expand All @@ -422,17 +424,17 @@ where
let engine_api = EngineApi::new(
node.provider().clone(),
config.chain.clone(),
beacon_engine_handle.clone(),
beacon_engine_handle,
node.payload_builder().clone().into(),
node.pool().clone(),
Box::new(node.task_executor().clone()),
client,
EngineCapabilities::default(),
engine_validator_builder.build(&ctx).await?,
engine_validator,
);
info!(target: "reth::cli", "Engine API handler initialized");

let auth_config = config.rpc.auth_server_config(*jwt_secret)?;
let auth_config = config.rpc.auth_server_config(jwt_secret)?;
let module_config = config.rpc.transport_rpc_module_config();
debug!(target: "reth::cli", http=?module_config.http(), ws=?module_config.ws(), "Using RPC module config");

Expand Down

0 comments on commit f2de55d

Please sign in to comment.