Skip to content

testing(prover): fix flaky racy test #336

@distractedm1nd

Description

@distractedm1nd

From CI:

       FAIL [ 723.486s] prism-prover prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions
  stdout ───

    running 1 test
    test prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions has been running for over 60 seconds
    test prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions ... FAILED

    failures:

    failures:
        prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 10 filtered out; finished in 723.18s
    
  stderr ───
    stderr: WARNING: Using insecure random number generator.
    stderr: WARNING: Using insecure random number generator.
    stderr: WARNING: Using insecure random number generator.
    stderr: WARNING: Using insecure random number generator.

    thread 'prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions' panicked at crates/node_types/prover/src/prover/tests/mod.rs:350:37:
    called `Result::unwrap()` on an `Err` value: channel lagged by 1

    Stack backtrace:
       0: <anyhow::Error as core::convert::From<tokio::sync::broadcast::error::RecvError>>::from
       1: <prism_prover::syncer::Syncer>::sync_loop::{closure#0}
       2: <prism_prover::prover::Prover>::run::{closure#0}::{closure#0}
       3: <tokio::runtime::task::core::Core<<prism_prover::prover::Prover>::run::{closure#0}::{closure#0}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       4: <tokio::runtime::task::harness::Harness<<prism_prover::prover::Prover>::run::{closure#0}::{closure#0}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       5: <tokio::runtime::scheduler::current_thread::Context>::enter::<(), <tokio::runtime::scheduler::current_thread::Context>::run_task<(), <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}::{closure#1}>::{closure#0}>
       6: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<<tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       7: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       8: <tokio::runtime::runtime::Runtime>::block_on::<core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>
       9: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions
      10: <prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0} as core::ops::function::FnOnce<()>>::call_once
      11: test::__rust_begin_short_backtrace
      12: test::run_test::{{closure}}
      13: std::sys::backtrace::__rust_begin_short_backtrace
      14: core::ops::function::FnOnce::call_once{{vtable.shim}}
      15: std::sys::pal::unix::thread::Thread::new::thread_start
      16: <unknown>
      17: <unknown>
    stack backtrace:
       0: rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::result::unwrap_failed
       3: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}::{closure#1}
       4: <tokio::runtime::task::core::Core<prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}::{closure#1}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       5: <tokio::runtime::task::harness::Harness<prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}::{closure#1}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       6: <tokio::runtime::scheduler::current_thread::Context>::enter::<(), <tokio::runtime::scheduler::current_thread::Context>::run_task<(), <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}::{closure#1}>::{closure#0}>
       7: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<<tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       8: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       9: <tokio::runtime::runtime::Runtime>::block_on::<core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>
      10: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions
      11: <prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0} as core::ops::function::FnOnce<()>>::call_once
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

    thread 'prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions' panicked at crates/node_types/prover/src/prover/tests/mod.rs:345:35:
    called `Result::unwrap()` on an `Err` value: channel lagged by 110

    Stack backtrace:
       0: <anyhow::Error as core::convert::From<tokio::sync::broadcast::error::RecvError>>::from
       1: <prism_prover::syncer::Syncer>::sync_loop::{closure#0}
       2: <prism_prover::prover::Prover>::run::{closure#0}::{closure#0}
       3: <tokio::runtime::task::core::Core<<prism_prover::prover::Prover>::run::{closure#0}::{closure#0}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       4: <tokio::runtime::task::harness::Harness<<prism_prover::prover::Prover>::run::{closure#0}::{closure#0}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       5: <tokio::runtime::scheduler::current_thread::Context>::enter::<(), <tokio::runtime::scheduler::current_thread::Context>::run_task<(), <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}::{closure#1}>::{closure#0}>
       6: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<<tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       7: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       8: <tokio::runtime::runtime::Runtime>::block_on::<core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>
       9: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions
      10: <prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0} as core::ops::function::FnOnce<()>>::call_once
      11: test::__rust_begin_short_backtrace
      12: test::run_test::{{closure}}
      13: std::sys::backtrace::__rust_begin_short_backtrace
      14: core::ops::function::FnOnce::call_once{{vtable.shim}}
      15: std::sys::pal::unix::thread::Thread::new::thread_start
      16: <unknown>
      17: <unknown>
    stack backtrace:
       0: rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::result::unwrap_failed
       3: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}::{closure#0}
       4: <tokio::runtime::task::core::Core<prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}::{closure#0}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       5: <tokio::runtime::task::harness::Harness<prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}::{closure#0}, alloc::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>>::poll
       6: <tokio::runtime::scheduler::current_thread::Context>::enter::<(), <tokio::runtime::scheduler::current_thread::Context>::run_task<(), <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}::{closure#1}>::{closure#0}>
       7: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<<tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       8: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       9: <tokio::runtime::runtime::Runtime>::block_on::<core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>
      10: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions
      11: <prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0} as core::ops::function::FnOnce<()>>::call_once
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

    thread 'prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions' panicked at crates/node_types/prover/src/prover/tests/mod.rs:420:5:
    assertion `left == right` failed: Prover and fullnode should have matching commitments even with racing transactions
      left: CommitmentResponse { commitment: Digest([162, 252, 221, 79, 119, 188, 143, 127, 205, 88, 254, 95, 103, 3, 179, 176, 164, 234, 226, 129, 165, 205, 54, 220, 84, 71, 71, 63, 183, 39, 253, 1]) }
     right: CommitmentResponse { commitment: Digest([120, 24, 222, 250, 130, 230, 210, 5, 180, 116, 235, 224, 200, 79, 58, 254, 134, 9, 12, 150, 209, 159, 161, 72, 85, 99, 199, 74, 60, 70, 80, 22]) }
    stack backtrace:
       0: rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::panicking::assert_failed_inner
       3: core::panicking::assert_failed::<prism_common::api::types::CommitmentResponse, prism_common::api::types::CommitmentResponse>
       4: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0}
       5: <tokio::runtime::scheduler::current_thread::Context>::enter::<core::task::poll::Poll<()>, <tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}::{closure#0}>
       6: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<<tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       7: <std::thread::local::LocalKey<tokio::runtime::context::Context>>::with::<tokio::runtime::context::set_scheduler<(alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>), <tokio::runtime::scheduler::current_thread::CoreGuard>::enter<<tokio::runtime::scheduler::current_thread::CoreGuard>::block_on<core::pin::Pin<&mut core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>>::{closure#0}, core::option::Option<()>>::{closure#0}>::{closure#0}, (alloc::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, core::option::Option<()>)>
       8: <tokio::runtime::runtime::Runtime>::block_on::<core::pin::Pin<&mut dyn core::future::future::Future<Output = ()>>>
       9: prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions
      10: <prism_prover::prover::tests::test_prover_fullnode_commitment_sync_with_racing_transactions::{closure#0} as core::ops::function::FnOnce<()>>::call_once
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions