Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

- [#4976](https://github.com/ChainSafe/forest/issues/4976) Add support for the `Filecoin.EthSubscribe` and `Filecoin.EthUnsubscribe` API methods to enable subscriptions to Ethereum event types: `heads` and `logs`.

- [#5999](https://github.com/ChainSafe/forest/pull/5999) Add `forest-cli mpool nonce` command to get the current nonce for an address.

### Changed

- [#5886](https://github.com/ChainSafe/forest/issues/5886) Updated `forest-tool archive metadata` to print F3 snapshot header info when applicable.
Expand Down
1 change: 1 addition & 0 deletions docs/docs/users/reference/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ generate_markdown_section "forest-cli" "sync mark-bad"
generate_markdown_section "forest-cli" "mpool"
generate_markdown_section "forest-cli" "mpool pending"
generate_markdown_section "forest-cli" "mpool stat"
generate_markdown_section "forest-cli" "mpool nonce"

generate_markdown_section "forest-cli" "state"
generate_markdown_section "forest-cli" "state fetch"
Expand Down
11 changes: 11 additions & 0 deletions src/cli/subcommands/mpool_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ pub enum MpoolCommands {
#[arg(long)]
from: Option<String>,
},
/// Get the current nonce for an address
Nonce {
/// Address to check nonce for
address: Address,
},
/// Print mempool stats
Stat {
/// Number of blocks to look back for minimum `basefee`
Expand Down Expand Up @@ -273,6 +278,12 @@ impl MpoolCommands {

print_stats(&stats, basefee_lookback);

Ok(())
}
Self::Nonce { address } => {
let nonce = MpoolGetNonce::call(&client, (address,)).await?;
println!("{nonce}");

Ok(())
}
}
Expand Down
20 changes: 19 additions & 1 deletion src/tool/subcommands/api_cmd/api_compare_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ static KNOWN_CALIBNET_ADDRESS: LazyLock<Address> = LazyLock::new(|| {
.into()
});

/// This address is known to be empty on calibnet. It should always have a zero balance.
static KNOWN_EMPTY_CALIBNET_ADDRESS: LazyLock<Address> = LazyLock::new(|| {
crate::shim::address::Network::Testnet
.parse_address("t1qb2x5qctp34rxd7ucl327h5ru6aazj2heno7x5y")
.unwrap()
.into()
});

const TICKET_QUALITY_GREEDY: f64 = 0.9;
const TICKET_QUALITY_OPTIMAL: f64 = 0.8;
const ZERO_ADDRESS: &str = "0x0000000000000000000000000000000000000000";
Expand Down Expand Up @@ -506,6 +514,16 @@ fn auth_tests() -> anyhow::Result<Vec<RpcTest>> {
fn mpool_tests() -> Vec<RpcTest> {
vec![
RpcTest::identity(MpoolGetNonce::request((*KNOWN_CALIBNET_ADDRESS,)).unwrap()),
// This should cause an error with `actor not found` in both Lotus and Forest. The messages
// are quite different, so we don't do strict equality check.
// "forest_response": {
// "Err": "ErrorObject { code: InternalError, message: \"Actor not found: addr=t1qb2x5qctp34rxd7ucl327h5ru6aazj2heno7x5y\", data: None }"
// },
// "lotus_response": {
// "Err": "ErrorObject { code: ServerError(1), message: \"resolution lookup failed (t1qb2x5qctp34rxd7ucl327h5ru6aazj2heno7x5y): resolve address t1qb2x5qctp34rxd7ucl327h5ru6aazj2heno7x5y: actor not found\", data: None }"
// }
RpcTest::identity(MpoolGetNonce::request((*KNOWN_EMPTY_CALIBNET_ADDRESS,)).unwrap())
.policy_on_rejected(PolicyOnRejected::Pass),
RpcTest::basic(MpoolPending::request((ApiTipsetKey(None),)).unwrap()),
Comment thread
LesnyRumcajs marked this conversation as resolved.
RpcTest::basic(MpoolSelect::request((ApiTipsetKey(None), TICKET_QUALITY_GREEDY)).unwrap()),
RpcTest::basic(MpoolSelect::request((ApiTipsetKey(None), TICKET_QUALITY_OPTIMAL)).unwrap())
Expand Down Expand Up @@ -1147,7 +1165,7 @@ fn wallet_tests(worker_address: Option<Address>) -> Vec<RpcTest> {
Address::from_str("t3wmbvnabsj6x2uki33phgtqqemmunnttowpx3chklrchy76pv52g5ajnaqdypxoomq5ubfk65twl5ofvkhshq").unwrap(),
Address::from_str("t410fx2cumi6pgaz64varl77xbuub54bgs3k5xsvn3ki").unwrap(),
// This address should have 0 FIL
Address::from_str("t1qb2x5qctp34rxd7ucl327h5ru6aazj2heno7x5y").unwrap(),
*KNOWN_EMPTY_CALIBNET_ADDRESS,
];

let mut tests = vec![];
Expand Down
2 changes: 2 additions & 0 deletions src/tool/subcommands/api_cmd/test_snapshots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ filecoin_ethuninstallfilter_1737446676698857.rpcsnap.json.zst
filecoin_gasestimategaslimit_1741782110512299.rpcsnap.json.zst
filecoin_getactoreventsraw_1741782590255476.rpcsnap.json.zst
filecoin_minergetbaseinfo_1737022538681402.rpcsnap.json.zst
filecoin_mpoolgetnonce_1756218632700175.rpcsnap.json.zst
Comment thread
coderabbitai[bot] marked this conversation as resolved.
filecoin_mpoolgetnonce_1756220013069333.rpcsnap.json.zst
filecoin_msiggetavailablebalance_1741782824665885.rpcsnap.json.zst
filecoin_msiggetpending_1741783576868798.rpcsnap.json.zst
filecoin_msiggetvested_1741783652819678.rpcsnap.json.zst
Expand Down
1 change: 0 additions & 1 deletion src/tool/subcommands/api_cmd/test_snapshots_ignored.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Filecoin.MarketAddBalance
Filecoin.MinerCreateBlock
Filecoin.MpoolBatchPush
Filecoin.MpoolBatchPushUntrusted
Filecoin.MpoolGetNonce
Filecoin.MpoolPending
Filecoin.MpoolPush
Filecoin.MpoolPushMessage
Expand Down
Loading