Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

feat(rpc): Setup RPC Crate #35

wants to merge 1 commit into from

Conversation

refcell
Copy link
Collaborator

@refcell refcell commented Aug 26, 2024

Description

Sets up an rpc crate.

Metadata

#7

@refcell refcell marked this pull request as draft August 26, 2024 11:54
@refcell refcell self-assigned this Aug 26, 2024
@refcell refcell added the A-rpc Area: rpc crate label Aug 26, 2024
@refcell refcell marked this pull request as ready for review August 26, 2024 21:29
@refcell
Copy link
Collaborator Author

refcell commented Aug 26, 2024

Going to cut this off here with unimplemented for others to impl - I'm not as familiar with how this could work well with reth. Would appreciate any guidance if you have bandwidth @Rjected

@refcell refcell marked this pull request as draft August 26, 2024 23:12
Copy link
Member

@Rjected Rjected left a 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

Comment on lines +12 to +48
/// 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())
}
}
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: rpc crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants