Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ impl RpcMethod<0> for EthAccounts {
const NAME: &'static str = "Filecoin.EthAccounts";
const NAME_ALIAS: Option<&'static str> = Some("eth_accounts");
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::all();
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::with_v2();
const PERMISSION: Permission = Permission::Read;

type Params = ();
Expand Down Expand Up @@ -791,7 +791,7 @@ impl RpcMethod<0> for EthChainId {
const NAME: &'static str = "Filecoin.EthChainId";
const NAME_ALIAS: Option<&'static str> = Some("eth_chainId");
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::all();
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::with_v2();
const PERMISSION: Permission = Permission::Read;

type Params = ();
Expand Down Expand Up @@ -1706,7 +1706,7 @@ impl RpcMethod<0> for EthSyncing {
const NAME: &'static str = "Filecoin.EthSyncing";
const NAME_ALIAS: Option<&'static str> = Some("eth_syncing");
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::all();
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::with_v2();
const PERMISSION: Permission = Permission::Read;

type Params = ();
Expand Down Expand Up @@ -2298,7 +2298,7 @@ impl RpcMethod<0> for EthProtocolVersion {
const NAME: &'static str = "Filecoin.EthProtocolVersion";
const NAME_ALIAS: Option<&'static str> = Some("eth_protocolVersion");
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::all();
const API_PATHS: BitFlags<ApiPaths> = ApiPaths::with_v2();
const PERMISSION: Permission = Permission::Read;

type Params = ();
Expand Down
7 changes: 7 additions & 0 deletions src/rpc/reflect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ impl ApiPaths {
make_bitflags!(Self::{ V0 | V1 })
}

// Remove this helper once all RPC methods are migrated to V2.
// We're incrementally migrating methods to V2 support. Once complete,
// update all() to include V2 and remove this temporary helper.
pub const fn with_v2() -> BitFlags<Self> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name is a bit misleading. When calling ApiPaths::with_v2 I'd expect only the v2 to be set.

Suggested change
pub const fn with_v2() -> BitFlags<Self> {
pub const fn all_with_v2() -> BitFlags<Self> {

For the logic - it'd be cleaner to call all and just set v2.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

make_bitflags!(Self::{ V0 | V1 | V2 })
}

pub fn from_uri(uri: &Uri) -> anyhow::Result<Self> {
Ok(Self::from_str(
uri.path().split("/").last().expect("infallible"),
Expand Down
Loading