-
Notifications
You must be signed in to change notification settings - Fork 4
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(rpc): Setup RPC Crate #35
base: main
Are you sure you want to change the base?
Conversation
Going to cut this off here with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keeping these unimplemented for now makes sense in terms of crate setup, added some comments on how you might implement the full thing
/// An implementation of the [`RollupNodeServer`] trait. | ||
#[derive(Debug, Clone)] | ||
pub struct RollupNodeRpc { | ||
/// The version of the node. | ||
version: String, | ||
} | ||
|
||
#[async_trait] | ||
impl RollupNodeServer for RollupNodeRpc { | ||
async fn op_output_at_block( | ||
&self, | ||
block_number: BlockNumberOrTag, | ||
) -> RpcResult<OutputResponse> { | ||
trace!("op_output_at_block: {:?}", block_number); | ||
unimplemented!() | ||
} | ||
|
||
async fn op_safe_head_at_l1_block( | ||
&self, | ||
block_number: BlockNumberOrTag, | ||
) -> RpcResult<SafeHeadResponse> { | ||
trace!("op_safe_head_at_l1_block: {:?}", block_number); | ||
unimplemented!() | ||
} | ||
|
||
async fn op_sync_status(&self) -> RpcResult<SyncStatus> { | ||
unimplemented!() | ||
} | ||
|
||
async fn op_rollup_config(&self) -> RpcResult<RollupConfig> { | ||
unimplemented!() | ||
} | ||
|
||
async fn op_version(&self) -> RpcResult<String> { | ||
Ok(self.version.clone()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually rpc extensions contain have a reth Provider
, where various on disk information can be fetched. I'm assuming this rpc will be used either in the standalone binary or in the exex. For the standalone binary, I am guessing that the L1 RPC will be used for this, making the reth Provider
traits the wrong abstraction. So maybe an enum would have to implement fetching each type of data:
enum ProviderType<RP, AP> {
Local(RP), // reth provider
Network(AP) // alloy provider
}
lmk if my understanding is off. There are probably other ways to implement this as well
Just to confirm: the op_output_at_block
and op_safe_head_at_l1_block
seem like the only two things that would need to fetch information from the L1 node?
Description
Sets up an
rpc
crate.Metadata
#7