-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rpc): internal F3 RPC methods to power go-f3 sidecar
- Loading branch information
1 parent
187d8c6
commit d70b7fe
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Copyright 2019-2024 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
//! | ||
//! This module contains F3(fast finality) related V1 RPC methods | ||
//! as well as some internal RPC methods(F3.*) that power | ||
//! the go-f3 node in sidecar mode. | ||
//! | ||
mod types; | ||
use types::*; | ||
|
||
use crate::{ | ||
rpc::{ApiPaths, Ctx, Permission, RpcMethod, ServerError}, | ||
shim::clock::ChainEpoch, | ||
}; | ||
use fvm_ipld_blockstore::Blockstore; | ||
|
||
pub enum F3GetTipsetByEpoch {} | ||
impl RpcMethod<1> for F3GetTipsetByEpoch { | ||
const NAME: &'static str = "F3.GetTipsetByEpoch"; | ||
const PARAM_NAMES: [&'static str; 1] = ["epoch"]; | ||
const API_PATHS: ApiPaths = ApiPaths::V1; | ||
const PERMISSION: Permission = Permission::Read; | ||
|
||
type Params = (ChainEpoch,); | ||
type Ok = F3TipSet; | ||
|
||
async fn handle( | ||
ctx: Ctx<impl Blockstore>, | ||
(epoch,): Self::Params, | ||
) -> Result<Self::Ok, ServerError> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
pub enum F3GetTipset {} | ||
impl RpcMethod<1> for F3GetTipset { | ||
const NAME: &'static str = "F3.GetTipset"; | ||
const PARAM_NAMES: [&'static str; 1] = ["tipset_key"]; | ||
const API_PATHS: ApiPaths = ApiPaths::V1; | ||
const PERMISSION: Permission = Permission::Read; | ||
|
||
type Params = (F3TipSetKey,); | ||
type Ok = F3TipSet; | ||
|
||
async fn handle( | ||
ctx: Ctx<impl Blockstore>, | ||
(epoch,): Self::Params, | ||
) -> Result<Self::Ok, ServerError> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
pub enum F3GetHead {} | ||
impl RpcMethod<0> for F3GetHead { | ||
const NAME: &'static str = "F3.GetHead"; | ||
const PARAM_NAMES: [&'static str; 0] = []; | ||
const API_PATHS: ApiPaths = ApiPaths::V1; | ||
const PERMISSION: Permission = Permission::Read; | ||
|
||
type Params = (); | ||
type Ok = F3TipSet; | ||
|
||
async fn handle(ctx: Ctx<impl Blockstore>, _: Self::Params) -> Result<Self::Ok, ServerError> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
pub enum F3GetParent {} | ||
impl RpcMethod<1> for F3GetParent { | ||
const NAME: &'static str = "F3.GetParent"; | ||
const PARAM_NAMES: [&'static str; 1] = ["tipset"]; | ||
const API_PATHS: ApiPaths = ApiPaths::V1; | ||
const PERMISSION: Permission = Permission::Read; | ||
|
||
type Params = (F3TipSet,); | ||
type Ok = F3TipSet; | ||
|
||
async fn handle( | ||
ctx: Ctx<impl Blockstore>, | ||
(ts,): Self::Params, | ||
) -> Result<Self::Ok, ServerError> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
pub enum F3GetPowerTable {} | ||
impl RpcMethod<1> for F3GetPowerTable { | ||
const NAME: &'static str = "F3.GetPowerTable"; | ||
const PARAM_NAMES: [&'static str; 1] = ["tipset_key"]; | ||
const API_PATHS: ApiPaths = ApiPaths::V1; | ||
const PERMISSION: Permission = Permission::Read; | ||
|
||
type Params = (F3TipSetKey,); | ||
type Ok = Vec<F3PowerEntry>; | ||
|
||
async fn handle( | ||
ctx: Ctx<impl Blockstore>, | ||
(ts,): Self::Params, | ||
) -> Result<Self::Ok, ServerError> { | ||
unimplemented!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2019-2024 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use crate::lotus_json::lotus_json_with_self; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] | ||
pub struct F3TipSetKey; | ||
lotus_json_with_self!(F3TipSetKey); | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] | ||
pub struct F3TipSet; | ||
lotus_json_with_self!(F3TipSet); | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] | ||
pub struct F3PowerEntry; | ||
lotus_json_with_self!(F3PowerEntry); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters