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

Flaky test: tests::signer::v0::multiple_miners_empty_sortition #5778

Open
obycode opened this issue Jan 30, 2025 · 4 comments · Fixed by #5784
Open

Flaky test: tests::signer::v0::multiple_miners_empty_sortition #5778

obycode opened this issue Jan 30, 2025 · 4 comments · Fixed by #5784
Assignees
Labels

Comments

@obycode
Copy link
Contributor

obycode commented Jan 30, 2025

Sample logs here.

On quick investigation, it appears that both miners are saying that they will not extend their tenures prior to the timeout:

INFO [1738255479.028965] [testnet/stacks-node/src/nakamoto_node/relayer.rs:1411] [relayer-http://127.0.0.1:47211] Relayer: will not extend tenure -- we won sortition b6f053c9e6d02533582c288890da9a1f3ed17ddf, but the highest valid sortition is 2675cd0f6486580ff3870e7ef4c213ac22a3dee4
INFO [1738255479.580336] [testnet/stacks-node/src/nakamoto_node/relayer.rs:1390] [relayer-http://127.0.0.1:11691] Relayer: Did not win the last sortition that commits to our Stacks fork. Cannot continue tenure.
@kantai
Copy link
Member

kantai commented Jan 30, 2025

Sort of duplicate issue (#5777).

Logs are here.

My logs seem to indicate a different failure:

2025-01-30T16:08:43.5655808Z thread 'tests::signer::v0::multiple_miners_empty_sortition' panicked at testnet/stacks-node/src/tests/signer/v0.rs:11748:9:
2025-01-30T16:08:43.5659720Z assertion failed: !cur_empty_sortition.was_sortition
2025-01-30T16:08:43.5660276Z stack backtrace:

@obycode
Copy link
Contributor Author

obycode commented Jan 30, 2025

Duplicate (#5777)

Oops, I missed that one.

@kantai
Copy link
Member

kantai commented Jan 30, 2025

In my logs, at least, the issue seems to be that the test thinks the last bitcoin block has been processed when it queries for the latest sortition (in the logs, the latest bitcoin block is 234, but 234 hasn't been processed yet). That has a simple-ish fix:

diff --git a/testnet/stacks-node/src/tests/signer/v0.rs b/testnet/stacks-node/src/tests/signer/v0.rs
index feb870143f..5aca9c618a 100644
--- a/testnet/stacks-node/src/tests/signer/v0.rs
+++ b/testnet/stacks-node/src/tests/signer/v0.rs
@@ -11733,13 +11733,17 @@ fn multiple_miners_empty_sortition() {
         // lets mine a btc flash block
         let rl2_commits_before = rl2_commits.load(Ordering::SeqCst);
         let rl1_commits_before = rl1_commits.load(Ordering::SeqCst);
+        let info_before = get_chain_info(&conf);
+
         signer_test
             .running_nodes
             .btc_regtest_controller
             .build_next_block(2);
 
         wait_for(60, || {
-            Ok(rl2_commits.load(Ordering::SeqCst) > rl2_commits_before
+            let info = get_chain_info(&conf);
+            Ok(info.burn_block_height >= 2 + info_before.burn_block_height
+                && rl2_commits.load(Ordering::SeqCst) > rl2_commits_before
                 && rl1_commits.load(Ordering::SeqCst) > rl1_commits_before)
         })
         .unwrap();

@kantai
Copy link
Member

kantai commented Jan 31, 2025

Okay, I'm pretty sure I know why your logs' flake happens: the "flash block" occurs across a reward cycle boundary: the miner can't extend from one reward cycle to the next.

@kantai kantai linked a pull request Jan 31, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants