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
6 changes: 4 additions & 2 deletions .config/forest.dic
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
274
276
Algorand/M
API's
API/SM
Expand Down Expand Up @@ -147,13 +147,14 @@ MD5
MDBX
MDNS
MDX
mempool
mempool/M
Merkle
MetaMask
MiB
middleware
migrator/S
milliGas
mpool
multiaddr/SM
multiaddress
multiaddresses
Expand All @@ -163,6 +164,7 @@ mutex
namespace/S
Neo4j
nextest
nonces
NVMe
NVXX
onwards
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/forest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- main
# This needs to be declared explicitly so that the RPC checks job is actually
# run when PR is labeled.
types: [opened, synchronize, reopened, labeled, unlabeled]
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
paths-ignore:
- "docs/**"
- ".github/workflows/docs-*.yml"
Expand Down Expand Up @@ -226,6 +226,7 @@ jobs:
run: ./scripts/tests/calibnet_migration_regression_tests.sh
timeout-minutes: ${{ fromJSON(env.SCRIPT_TIMEOUT_MINUTES) }}
calibnet-wallet-check:
if: github.event.pull_request.draft == false
Comment thread
coderabbitai[bot] marked this conversation as resolved.
concurrency:
group: calibnet-wallet-tests
cancel-in-progress: false
Expand Down
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ zstd = "0.13"

# optional dependencies
console-subscriber = { version = "0.5", features = ["parking_lot"], optional = true }
libtest-mimic = "0.8"
sqlx = { version = "0.9", default-features = false, features = ["sqlite", "runtime-tokio", "macros"], optional = true }
tikv-jemallocator = { version = "0.7", optional = true }
tracing-loki = { version = "0.2", default-features = false, features = ["compat-0-2-1", "rustls"], optional = true }
Expand Down Expand Up @@ -351,7 +352,6 @@ cargo-test = [] # group of tests that is recommended to run with `cargo test` in
doctest-private = [] # see lib.rs::doctest_private
benchmark-private = ["dep:criterion"] # see lib.rs::benchmark_private
interop-tests-private = [] # see lib.rs::interop_tests_private
calibnet-integration = [] # see tests/calibnet_*.rs (wallet, mpool_tools, etc.)
jemalloc-profiling = [
"jemalloc",
"tikv-jemallocator?/profiling",
Expand Down Expand Up @@ -384,16 +384,6 @@ name = "tipset-validation"
harness = false
required-features = ["benchmark-private"]

[[test]]
name = "mpool_tools"
path = "tests/calibnet_mpool_tools.rs"
required-features = ["calibnet-integration"]

[[test]]
name = "wallet"
path = "tests/calibnet_wallet.rs"
required-features = ["calibnet-integration"]

[package.metadata.docs.rs]
# See https://docs.rs/about/metadata
rustdoc-args = ["--document-private-items"]
Expand Down
4 changes: 2 additions & 2 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ run = '''
set -euo pipefail
source ./scripts/tests/harness.sh
forest_wallet_init "${usage_preloaded_key?}"
cargo test --profile quick-test --features calibnet-integration --test mpool_tools -- --nocapture
cargo test --profile quick-test --features calibnet-integration --test wallet -- --nocapture
forest-dev tests calibnet mpool
forest-dev tests calibnet wallet
'''

[tasks."codecov:nextest"]
Expand Down
4 changes: 4 additions & 0 deletions src/dev/subcommands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod archive_missing_cmd;
mod export_state_tree_cmd;
mod export_tipset_lookup_cmd;
mod state_cmd;
mod tests_cmd;
mod update_checkpoints_cmd;

use crate::cli_shared::cli::HELP_MESSAGE;
Expand Down Expand Up @@ -53,6 +54,8 @@ pub enum Subcommand {
ArchiveMissing(archive_missing_cmd::ArchiveMissingCommand),
ExportTipsetLookup(export_tipset_lookup_cmd::ExportTipsetLookupCommand),
ExportStateTree(export_state_tree_cmd::ExportStateTreeCommand),
#[command(subcommand)]
Tests(tests_cmd::TestsCommand),
}

impl Subcommand {
Expand All @@ -64,6 +67,7 @@ impl Subcommand {
Self::ArchiveMissing(cmd) => cmd.run().await,
Self::ExportTipsetLookup(cmd) => cmd.run().await,
Self::ExportStateTree(cmd) => cmd.run().await,
Self::Tests(cmd) => cmd.run().await,
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/dev/subcommands/tests_cmd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2019-2026 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

mod calibnet;

/// Integration tests
#[derive(Debug, clap::Subcommand)]
pub enum TestsCommand {
#[command(subcommand)]
Calibnet(calibnet::CalibnetTestsCommand),
}

impl TestsCommand {
pub async fn run(self) -> anyhow::Result<()> {
match self {
Self::Calibnet(cmd) => cmd.run().await,
}
}
}
22 changes: 22 additions & 0 deletions src/dev/subcommands/tests_cmd/calibnet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2019-2026 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

mod helpers;
mod mpool;
mod wallet;

/// Calibnet integration tests
#[derive(Debug, clap::Subcommand)]
pub enum CalibnetTestsCommand {
Wallet(wallet::CalibnetWalletTestCommand),
Mpool(mpool::CalibnetMpoolTestCommand),
}

impl CalibnetTestsCommand {
pub async fn run(self) -> anyhow::Result<()> {
match self {
Self::Wallet(cmd) => cmd.run().await,
Self::Mpool(cmd) => cmd.run().await,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,10 @@ pub async fn filecoin_to_eth(address: &str) -> anyhow::Result<String> {
.map(str::to_owned)
.with_context(|| format!("expected string ETH address, got {result}"))
}

pub fn block_on<F: std::future::Future>(future: F) -> F::Output {
tokio::task::block_in_place(|| {
let rt = tokio::runtime::Handle::current();
rt.block_on(future)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,36 @@
//! Run via [`calibnet_wallet_mpool`] before [`calibnet_wallet`]; see `mise test:wallet`.
//! Each test assumes the same environment as [`calibnet_wallet`].

#[path = "common/calibnet_wallet_helpers.rs"]
mod helpers;
use super::helpers::*;
use libtest_mimic::{Arguments, Trial};

use helpers::*;
use serial_test::serial;
/// Calibnet mpool integration tests
#[derive(Debug, clap::Args)]
pub struct CalibnetMpoolTestCommand {}

impl CalibnetMpoolTestCommand {
pub async fn run(self) -> anyhow::Result<()> {
let args = Arguments {
test_threads: Some(1),
..Default::default()
};
libtest_mimic::run(&args, tests()).exit();
}
}

fn tests() -> Vec<Trial> {
vec![
Trial::test("mpool_nonce_fix_auto_unblocks_pending", || {
block_on(mpool_nonce_fix_auto_unblocks_pending());
Ok(())
}),
Trial::test("mpool_replace_auto_unblocks_pending", || {
block_on(mpool_replace_auto_unblocks_pending());
Ok(())
}),
]
}

#[tokio::test]
#[serial]
async fn mpool_nonce_fix_auto_unblocks_pending() {
let addr = FOREST_TEST_PRELOADED_ADDRESS.as_str();
let nonce = mpool_nonce(addr).unwrap();
Expand All @@ -40,8 +62,6 @@ async fn mpool_nonce_fix_auto_unblocks_pending() {
);
}

#[tokio::test]
#[serial]
async fn mpool_replace_auto_unblocks_pending() {
let addr = FOREST_TEST_PRELOADED_ADDRESS.as_str();
let nonce = mpool_nonce(addr).unwrap();
Expand Down
Loading
Loading