Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rpc) Implement Filecoin.EthMaxPriorityFeePerGas #4511

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
`forest-cli state compute` method, and a corresponding RPC method
`Forest.StateCompute`.

- [#4511](https://github.com/ChainSafe/forest/pull/4511) Add support for the
`Filecoin.EthMaxPriorityFeePerGas` RPC method.

### Changed

### Removed
Expand Down
21 changes: 21 additions & 0 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,27 @@ impl RpcMethod<2> for EthGetTransactionCount {
}
}

pub enum EthMaxPriorityFeePerGas {}
impl RpcMethod<0> for EthMaxPriorityFeePerGas {
const NAME: &'static str = "Filecoin.EthMaxPriorityFeePerGas";
const PARAM_NAMES: [&'static str; 0] = [];
const API_PATHS: ApiPaths = ApiPaths::V1;
const PERMISSION: Permission = Permission::Read;

type Params = ();
type Ok = EthBigInt;

async fn handle(
ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
(): Self::Params,
) -> Result<Self::Ok, ServerError> {
match crate::rpc::gas::estimate_gas_premium(&ctx, 0).await {
Ok(gas_premium) => Ok(EthBigInt(gas_premium.atto().clone())),
Err(_) => Ok(EthBigInt(num_bigint::BigInt::zero())),
}
}
}

pub enum EthProtocolVersion {}
impl RpcMethod<0> for EthProtocolVersion {
const NAME: &'static str = "Filecoin.EthProtocolVersion";
Expand Down
1 change: 1 addition & 0 deletions src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ macro_rules! for_each_method {
$callback!(crate::rpc::eth::EthGetBlockTransactionCountByNumber);
$callback!(crate::rpc::eth::EthGetMessageCidByTransactionHash);
$callback!(crate::rpc::eth::EthGetTransactionCount);
$callback!(crate::rpc::eth::EthMaxPriorityFeePerGas);
$callback!(crate::rpc::eth::EthProtocolVersion);
$callback!(crate::rpc::eth::EthGetTransactionHashByCid);

Expand Down
1 change: 1 addition & 0 deletions src/tool/subcommands/api_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,7 @@ fn eth_tests() -> Vec<RpcTest> {
.unwrap(),
),
RpcTest::basic(Web3ClientVersion::request(()).unwrap()),
RpcTest::basic(EthMaxPriorityFeePerGas::request(()).unwrap()),
sudo-shashank marked this conversation as resolved.
Show resolved Hide resolved
RpcTest::identity(EthProtocolVersion::request(()).unwrap()),
]
}
Expand Down
Loading