Skip to content

Commit

Permalink
feat: add jsonrpsee trait for SuperchainSignal (#217)
Browse files Browse the repository at this point in the history
related issues  paradigmxyz/reth#12275
<!--
Thank you for your Pull Request. Please provide a description above and
review
the requirements below.

Bug fixes and new features should include tests.

Contributors guide:
https://github.com/alloy-rs/core/blob/main/CONTRIBUTING.md

The contributors guide includes instructions for running rustfmt and
building the
documentation.
-->

<!-- ** Please select "Allow edits from maintainers" in the PR Options
** -->

## Motivation

<!--
Explain the context and why you're making that change. What is the
problem
you're trying to solve? In some cases there is not a problem and this
can be
thought of as being the motivation for your change.
-->

## Solution

<!--
Summarize the solution and provide any necessary context needed to
understand
the code change.
-->

## PR Checklist

- [ ] Added Tests
- [ ] Added Documentation
- [ ] Breaking changes

---------

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
hoank101 and mattsse authored Nov 3, 2024
1 parent 47aa994 commit 8c0562d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/rpc-jsonrpsee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ workspace = true
[dependencies]
# Alloy
op-alloy-rpc-types.workspace = true
op-alloy-rpc-types-engine = { workspace = true, features = ["serde"] }
alloy-eips.workspace = true
alloy-primitives.workspace = true

Expand Down
19 changes: 19 additions & 0 deletions crates/rpc-jsonrpsee/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use op_alloy_rpc_types::{
safe_head::SafeHeadResponse,
sync::SyncStatus,
};
use op_alloy_rpc_types_engine::{ProtocolVersion, SuperchainSignal};
use std::net::IpAddr;

/// Optimism specified rpc interface.
Expand Down Expand Up @@ -120,3 +121,21 @@ pub trait OpAdminApi {
#[method(name = "sequencerActive")]
async fn admin_sequencer_active(&self) -> RpcResult<bool>;
}

/// Engine API extension for Optimism superchain signaling
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "engine"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "engine"))]
pub trait EngineApiExt {
/// Signal superchain v1 message
///
/// The execution engine SHOULD warn when the recommended version is newer than the current
/// version. The execution engine SHOULD take safety precautions if it does not meet
/// the required version.
///
/// # Returns
/// The latest supported OP-Stack protocol version of the execution engine.
///
/// See: <https://specs.optimism.io/protocol/exec-engine.html#engine_signalsuperchainv1>
#[method(name = "signalSuperchainV1")]
async fn signal_superchain_v1(&self, signal: SuperchainSignal) -> RpcResult<ProtocolVersion>;
}

0 comments on commit 8c0562d

Please sign in to comment.