Skip to content

Commit

Permalink
fix: map RPC aliases to what Lotus uses
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Feb 24, 2025
1 parent 32a34e9 commit cd36072
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

- [#4261](https://github.com/ChainSafe/forest/issues/4261) Remove the short flags from `forest-wallet list` and `forest-wallet balance` commands.

- [#5329](https://github.com/ChainSafe/forest/pull/5329) Changed JSON-RPC alias for `Filecoin.NetListening`, `Filecoin.NetVersion`, `Filecoin.EthTraceBlock`, `Filecoin.EthTraceReplayBlockTransactions` to adhere to Lotus API.

### Added

- [#5244](https://github.com/ChainSafe/forest/issues/5244) Add `live` and `healthy` subcommands to `forest-cli healthcheck`.
Expand Down Expand Up @@ -77,6 +79,8 @@

- [#5237](https://github.com/ChainSafe/forest/pull/5237) Stylistic changes to FIL pretty printing.

- [#5329](https://github.com/ChainSafe/forest/pull/5329) `Filecoin.Web3ClientVersion` now returns the name of the node and its version, e.g., `forest/0.23.3+git.32a34e92`.

### Removed

### Fixed
Expand Down
9 changes: 6 additions & 3 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,10 @@ impl RpcMethod<0> for Web3ClientVersion {
_: Ctx<impl Blockstore + Send + Sync + 'static>,
(): Self::Params,
) -> Result<Self::Ok, ServerError> {
Ok(crate::utils::version::FOREST_VERSION_STRING.clone())
Ok(format!(
"forest/{}",
*crate::utils::version::FOREST_VERSION_STRING
))
}
}

Expand Down Expand Up @@ -2842,7 +2845,7 @@ impl RpcMethod<1> for EthGetFilterLogs {
pub enum EthTraceBlock {}
impl RpcMethod<1> for EthTraceBlock {
const NAME: &'static str = "Filecoin.EthTraceBlock";
const NAME_ALIAS: Option<&'static str> = Some("eth_traceBlock");
const NAME_ALIAS: Option<&'static str> = Some("trace_block");
const N_REQUIRED_PARAMS: usize = 1;
const PARAM_NAMES: [&'static str; 1] = ["block_param"];
const API_PATHS: ApiPaths = ApiPaths::V1;
Expand Down Expand Up @@ -2912,7 +2915,7 @@ pub enum EthTraceReplayBlockTransactions {}
impl RpcMethod<2> for EthTraceReplayBlockTransactions {
const N_REQUIRED_PARAMS: usize = 2;
const NAME: &'static str = "Filecoin.EthTraceReplayBlockTransactions";
const NAME_ALIAS: Option<&'static str> = Some("eth_traceReplayBlockTransactions");
const NAME_ALIAS: Option<&'static str> = Some("trace_replayBlockTransactions");
const PARAM_NAMES: [&'static str; 2] = ["block_param", "trace_types"];
const API_PATHS: ApiPaths = ApiPaths::V1;
const PERMISSION: Permission = Permission::Read;
Expand Down
2 changes: 2 additions & 0 deletions src/rpc/methods/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl RpcMethod<0> for NetListening {
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: ApiPaths = ApiPaths::V1;
const PERMISSION: Permission = Permission::Read;
const NAME_ALIAS: Option<&'static str> = Some("net_listening");

type Params = ();
type Ok = bool;
Expand Down Expand Up @@ -249,6 +250,7 @@ impl RpcMethod<0> for NetVersion {
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: ApiPaths = ApiPaths::V1;
const PERMISSION: Permission = Permission::Read;
const NAME_ALIAS: Option<&'static str> = Some("net_version");

type Params = ();
type Ok = String;
Expand Down

0 comments on commit cd36072

Please sign in to comment.