From 835c34098114084facada88d27baeed884b8a0ff Mon Sep 17 00:00:00 2001 From: refcell Date: Thu, 9 Jan 2025 19:08:08 -0700 Subject: [PATCH] chore: Remove rpc-jsonrpsee Crate (#376) ### Description Replaces #370 Removes the `op-alloy-rpc-jsonrpsee` crate since `maili` provides this functionality in `maili-rpc-jsonrpsee`. --- Cargo.toml | 1 - README.md | 2 - book/src/links.md | 1 - book/src/starting.md | 1 - crates/op-alloy/Cargo.toml | 4 - crates/op-alloy/README.md | 1 - crates/op-alloy/src/lib.rs | 4 - crates/rpc-jsonrpsee/Cargo.toml | 41 -------- crates/rpc-jsonrpsee/README.md | 10 -- crates/rpc-jsonrpsee/src/lib.rs | 12 --- crates/rpc-jsonrpsee/src/traits.rs | 162 ----------------------------- 11 files changed, 239 deletions(-) delete mode 100644 crates/rpc-jsonrpsee/Cargo.toml delete mode 100644 crates/rpc-jsonrpsee/README.md delete mode 100644 crates/rpc-jsonrpsee/src/lib.rs delete mode 100644 crates/rpc-jsonrpsee/src/traits.rs diff --git a/Cargo.toml b/Cargo.toml index b4e95d15..2c54091a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,6 @@ op-alloy-genesis = { version = "0.9.2", path = "crates/genesis", default-feature op-alloy-consensus = { version = "0.9.2", path = "crates/consensus", default-features = false } op-alloy-network = { version = "0.9.2", path = "crates/network", default-features = false } op-alloy-rpc-types = { version = "0.9.2", path = "crates/rpc-types", default-features = false } -op-alloy-rpc-jsonrpsee = { version = "0.9.2", path = "crates/rpc-jsonrpsee", default-features = false } op-alloy-rpc-types-engine = { version = "0.9.2", path = "crates/rpc-types-engine", default-features = false } # Alloy diff --git a/README.md b/README.md index 2df9e204..e589bee6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ The following crates are provided by `op-alloy`. - [`op-alloy-consensus`][op-alloy-consensus] - [`op-alloy-genesis`][op-alloy-genesis] - [`op-alloy-network`][op-alloy-network] -- [`op-alloy-rpc-jsonrpsee`][op-alloy-rpc-jsonrpsee] - [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] - [`op-alloy-rpc-types`][op-alloy-rpc-types] @@ -90,6 +89,5 @@ shall be dual licensed as above, without any additional terms or conditions. [op-alloy-consensus]: https://crates.io/crates/op-alloy-consensus [op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis [op-alloy-network]: https://crates.io/crates/op-alloy-network -[op-alloy-rpc-jsonrpsee]: https://crates.io/crates/op-alloy-rpc-jsonrpsee [op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine [op-alloy-rpc-types]: https://crates.io/crates/op-alloy-rpc-types diff --git a/book/src/links.md b/book/src/links.md index d3991582..702bb383 100644 --- a/book/src/links.md +++ b/book/src/links.md @@ -9,7 +9,6 @@ [op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis [op-alloy-network]: https://crates.io/crates/op-alloy-network [op-alloy-protocol]: https://crates.io/crates/op-alloy-protocol -[op-alloy-rpc-jsonrpsee]: https://crates.io/crates/op-alloy-rpc-jsonrpsee [op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine [op-alloy-rpc-types]: https://crates.io/crates/op-alloy-rpc-types diff --git a/book/src/starting.md b/book/src/starting.md index 898d8fb4..0ad60419 100644 --- a/book/src/starting.md +++ b/book/src/starting.md @@ -65,7 +65,6 @@ so `op-alloy-consensus` types can be used from `op-alloy` through `op_alloy::con - [`op-alloy-genesis`][op-alloy-genesis] (supports `no_std`) - [`op-alloy-protocol`][op-alloy-protocol] (supports `no_std`) - [`op-alloy-consensus`][op-alloy-consensus] (supports `no_std`) -- [`op-alloy-rpc-jsonrpsee`][op-alloy-rpc-jsonrpsee] - [`op-alloy-rpc-types`][op-alloy-rpc-types] (supports `no_std`) - [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] (supports `no_std`) diff --git a/crates/op-alloy/Cargo.toml b/crates/op-alloy/Cargo.toml index da49818f..cb0b8570 100644 --- a/crates/op-alloy/Cargo.toml +++ b/crates/op-alloy/Cargo.toml @@ -22,7 +22,6 @@ workspace = true op-alloy-consensus = { workspace = true, optional = true } op-alloy-genesis = { workspace = true, optional = true } op-alloy-network = { workspace = true, optional = true } -op-alloy-rpc-jsonrpsee = { workspace = true, optional = true } op-alloy-rpc-types-engine = { workspace = true, optional = true } op-alloy-rpc-types = { workspace = true, optional = true } @@ -42,7 +41,6 @@ full = [ "network", "rpc-types", "rpc-types-engine", - "rpc-jsonrpsee", ] k256 = [ @@ -70,5 +68,3 @@ rpc-types-engine = ["dep:op-alloy-rpc-types-engine"] # std features network = ["dep:op-alloy-network"] -rpc-jsonrpsee = ["dep:op-alloy-rpc-jsonrpsee"] - diff --git a/crates/op-alloy/README.md b/crates/op-alloy/README.md index fb63b7c7..4430ca0a 100644 --- a/crates/op-alloy/README.md +++ b/crates/op-alloy/README.md @@ -88,6 +88,5 @@ shall be dual licensed as above, without any additional terms or conditions. [op-alloy-consensus]: https://crates.io/crates/op-alloy-consensus [op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis [op-alloy-network]: https://crates.io/crates/op-alloy-network -[op-alloy-rpc-jsonrpsee]: https://crates.io/crates/op-alloy-rpc-jsonrpsee [op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine [op-alloy-rpc-types]: https://crates.io/crates/op-alloy-rpc-types diff --git a/crates/op-alloy/src/lib.rs b/crates/op-alloy/src/lib.rs index fc54e120..6a50e33f 100644 --- a/crates/op-alloy/src/lib.rs +++ b/crates/op-alloy/src/lib.rs @@ -26,7 +26,3 @@ pub use op_alloy_rpc_types as rpc_types; #[cfg(feature = "rpc-types-engine")] #[doc(inline)] pub use op_alloy_rpc_types_engine as rpc_types_engine; - -#[cfg(feature = "rpc-jsonrpsee")] -#[doc(inline)] -pub use op_alloy_rpc_jsonrpsee as rpc_jsonrpsee; diff --git a/crates/rpc-jsonrpsee/Cargo.toml b/crates/rpc-jsonrpsee/Cargo.toml deleted file mode 100644 index e709e977..00000000 --- a/crates/rpc-jsonrpsee/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "op-alloy-rpc-jsonrpsee" -description = "Optimism RPC Client" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -homepage.workspace = true -authors.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -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 - -# Maili -maili-protocol.workspace = true - -# rpc -jsonrpsee.workspace = true - -[features] -default = ["std"] -std = [ - "op-alloy-rpc-types/std", - "op-alloy-rpc-types-engine/std", - "alloy-eips/std", - "alloy-primitives/std", -] -client = [ - "jsonrpsee/client", - "jsonrpsee/async-client", -] diff --git a/crates/rpc-jsonrpsee/README.md b/crates/rpc-jsonrpsee/README.md deleted file mode 100644 index 6eb7eb9e..00000000 --- a/crates/rpc-jsonrpsee/README.md +++ /dev/null @@ -1,10 +0,0 @@ -## `op-alloy-rpc-jsonrpsee` - -CI -op-alloy-rpc-jsonrpsee crate -MIT License -Apache License -Book - - -Low-level Optimism JSON-RPC server and client implementations. diff --git a/crates/rpc-jsonrpsee/src/lib.rs b/crates/rpc-jsonrpsee/src/lib.rs deleted file mode 100644 index dd08fe38..00000000 --- a/crates/rpc-jsonrpsee/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(feature = "std"), no_std)] - -extern crate alloc; - -pub mod traits; diff --git a/crates/rpc-jsonrpsee/src/traits.rs b/crates/rpc-jsonrpsee/src/traits.rs deleted file mode 100644 index e13c531b..00000000 --- a/crates/rpc-jsonrpsee/src/traits.rs +++ /dev/null @@ -1,162 +0,0 @@ -#![allow(missing_docs)] - -//! Rollup Node - -use alloc::{boxed::Box, string::String, vec::Vec}; -use core::net::IpAddr; - -use alloy_eips::BlockNumberOrTag; -use alloy_primitives::{B256, U64}; -use jsonrpsee::{core::RpcResult, proc_macros::rpc}; -use maili_protocol::{ExecutingMessage, SafetyLevel}; -use op_alloy_rpc_types::{ - OutputResponse, PeerDump, PeerInfo, PeerStats, RollupConfig, SafeHeadResponse, SyncStatus, -}; -use op_alloy_rpc_types_engine::{ProtocolVersion, SuperchainSignal}; - -/// Optimism specified rpc interface. -/// -/// https://docs.optimism.io/builders/node-operators/json-rpc -/// https://github.com/ethereum-optimism/optimism/blob/8dd17a7b114a7c25505cd2e15ce4e3d0f7e3f7c1/op-node/node/api.go#L114 -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "optimism"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "optimism"))] -pub trait RollupNode { - /// Get the output root at a specific block. - #[method(name = "outputAtBlock")] - async fn op_output_at_block(&self, block_number: BlockNumberOrTag) - -> RpcResult; - - /// Gets the safe head at an L1 block height. - #[method(name = "safeHeadAtL1Block")] - async fn op_safe_head_at_l1_block( - &self, - block_number: BlockNumberOrTag, - ) -> RpcResult; - - /// Get the synchronization status. - #[method(name = "syncStatus")] - async fn op_sync_status(&self) -> RpcResult; - - /// Get the rollup configuration parameters. - #[method(name = "rollupConfig")] - async fn op_rollup_config(&self) -> RpcResult; - - /// Get the software version. - #[method(name = "version")] - async fn op_version(&self) -> RpcResult; -} - -/// The opp2p namespace handles peer interactions. -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "opp2p"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "opp2p"))] -pub trait OpP2PApi { - /// Returns information of node - #[method(name = "self")] - async fn opp2p_self(&self) -> RpcResult; - - #[method(name = "peers")] - async fn opp2p_peers(&self) -> RpcResult; - - #[method(name = "peerStats")] - async fn opp2p_peer_stats(&self) -> RpcResult; - - #[method(name = "discoveryTable")] - async fn opp2p_discovery_table(&self) -> RpcResult>; - - #[method(name = "blockPeer")] - async fn opp2p_block_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "listBlockedPeers")] - async fn opp2p_list_blocked_peers(&self) -> RpcResult>; - - #[method(name = "blocAddr")] - async fn opp2p_block_addr(&self, ip: IpAddr) -> RpcResult<()>; - - #[method(name = "unblockAddr")] - async fn opp2p_unblock_addr(&self, ip: IpAddr) -> RpcResult<()>; - - #[method(name = "listBlockedAddrs")] - async fn opp2p_list_blocked_addrs(&self) -> RpcResult>; - - /// todo: should be IPNet? - #[method(name = "blockSubnet")] - async fn opp2p_block_subnet(&self, subnet: String) -> RpcResult<()>; - - /// todo: should be IPNet? - #[method(name = "unblockSubnet")] - async fn opp2p_unblock_subnet(&self, subnet: String) -> RpcResult<()>; - - /// todo: should be IPNet? - #[method(name = "listBlockedSubnets")] - async fn opp2p_list_blocked_subnets(&self) -> RpcResult>; - - #[method(name = "protectPeer")] - async fn opp2p_protect_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "unprotectPeer")] - async fn opp2p_unprotect_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "connectPeer")] - async fn opp2p_connect_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "disconnectPeer")] - async fn opp2p_disconnect_peer(&self, peer: String) -> RpcResult<()>; -} - -/// The admin namespace endpoints -/// https://github.com/ethereum-optimism/optimism/blob/c7ad0ebae5dca3bf8aa6f219367a95c15a15ae41/op-node/node/api.go#L28-L36 -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "admin"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "admin"))] -pub trait OpAdminApi { - #[method(name = "resetDerivationPipeline")] - async fn admin_reset_derivation_pipeline(&self) -> RpcResult<()>; - - #[method(name = "startSequencer")] - async fn admin_start_sequencer(&self, block_hash: B256) -> RpcResult<()>; - - #[method(name = "stopSequencer")] - async fn admin_stop_sequencer(&self) -> RpcResult; - - #[method(name = "sequencerActive")] - async fn admin_sequencer_active(&self) -> RpcResult; -} - -/// 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: - #[method(name = "signalSuperchainV1")] - async fn signal_superchain_v1(&self, signal: SuperchainSignal) -> RpcResult; -} - -/// Op API extension for controlling the miner. -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "miner"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "miner"))] -pub trait MinerApiExt { - /// Sets the maximum data availability size of any tx allowed in a block, and the total max l1 - /// data size of the block. 0 means no maximum. - #[method(name = "setMaxDASize")] - async fn set_max_da_size(&self, max_tx_size: U64, max_block_size: U64) -> RpcResult; -} - -/// Supervisor API for interop. -#[rpc(client, namespace = "supervisor")] -pub trait SupervisorApi { - /// Checks if the given messages meet the given minimum safety level. - #[method(name = "checkMessages")] - async fn check_messages( - &self, - messages: Vec, - min_safety: SafetyLevel, - ) -> RpcResult<()>; -}