Skip to content

Commit

Permalink
feat: migrate more jsonrpsee methods (#1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhani-cw authored Jun 17, 2024
1 parent f30f68d commit d94b3da
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/eth/rpc/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ fn register_methods(mut module: RpcModule<RpcContext>) -> anyhow::Result<RpcModu
// debug
#[cfg(feature = "dev")]
{
module.register_async_method("evm_setNextBlockTimestamp", evm_set_next_block_timestamp)?;
module.register_async_method("evm_mine", evm_mine)?;
module.register_async_method("debug_setHead", debug_set_head)?;
module.register_async_method("debug_readAllSlotsFromAccount", debug_read_all_slots)?;
module.register_blocking_method("evm_setNextBlockTimestamp", evm_set_next_block_timestamp)?;
module.register_async_method("evm_mine", evm_mine)?; // TODO: blocking
module.register_blocking_method("debug_setHead", debug_set_head)?;
module.register_blocking_method("debug_readAllSlotsFromAccount", debug_read_all_slots)?;
}

// stratus health check
Expand Down Expand Up @@ -198,7 +198,7 @@ fn register_methods(mut module: RpcModule<RpcContext>) -> anyhow::Result<RpcModu

// Debug
#[cfg(feature = "dev")]
async fn debug_set_head(params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> anyhow::Result<JsonValue, RpcError> {
fn debug_set_head(params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> anyhow::Result<JsonValue, RpcError> {
let (_, number) = next_rpc_param::<BlockNumber>(params.sequence())?;
ctx.storage.reset(number)?;
Ok(serde_json::to_value(number).expect_infallible())
Expand All @@ -211,7 +211,7 @@ async fn evm_mine(_params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> a
}

#[cfg(feature = "dev")]
async fn evm_set_next_block_timestamp(params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> anyhow::Result<JsonValue, RpcError> {
fn evm_set_next_block_timestamp(params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> anyhow::Result<JsonValue, RpcError> {
use crate::eth::primitives::UnixTime;
use crate::log_and_err;

Expand All @@ -225,7 +225,7 @@ async fn evm_set_next_block_timestamp(params: Params<'_>, ctx: Arc<RpcContext>,
}

#[cfg(feature = "dev")]
async fn debug_read_all_slots(params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> anyhow::Result<JsonValue, RpcError> {
fn debug_read_all_slots(params: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> anyhow::Result<JsonValue, RpcError> {
let (_, address) = next_rpc_param::<Address>(params.sequence())?;
let slots = ctx.storage.read_all_slots(&address)?;
Ok(serde_json::to_value(slots).expect_infallible())
Expand Down

0 comments on commit d94b3da

Please sign in to comment.