Skip to content

Fixing flaky test#3438

Draft
SimonRastikian wants to merge 1 commit into
3169-per-domain-ReconstructionThreshold-in-resharingfrom
simon/3169-caitsith-resharing-lock
Draft

Fixing flaky test#3438
SimonRastikian wants to merge 1 commit into
3169-per-domain-ReconstructionThreshold-in-resharingfrom
simon/3169-caitsith-resharing-lock

Conversation

@SimonRastikian
Copy link
Copy Markdown
Contributor

Fixing a flaky test.

[Description to be added]

@SimonRastikian SimonRastikian self-assigned this Jun 1, 2026
@SimonRastikian SimonRastikian marked this pull request as draft June 1, 2026 16:14
@claude
Copy link
Copy Markdown

claude Bot commented Jun 1, 2026

PR title type suggestion: This PR is missing a conventional commit type prefix. Since it's fixing source code to resolve a test flakiness issue, the type should be fix:

Suggested title: fix: resolve flaky test in running state

@claude
Copy link
Copy Markdown

claude Bot commented Jun 1, 2026

Pull request overview

Fixes a flaky test (process_new_parameters_proposal__should_accept_empty_per_domain_overlay) in crates/contract/src/state/running.rs. The test was signing with state.parameters.participants()[0], but gen_valid_params_proposal keeps only a random subset of current participants (size [threshold, current_n]), so participant [0] could be absent from the proposal — causing AuthenticatedAccountId::new(proposal.participants()) inside process_new_parameters_proposal to fail with NotParticipant. The fix picks a signer present in both the current and proposed sets.

Changes:

  • In the should_accept_empty_per_domain_overlay test, replace the unconditional participants()[0] signer with one selected from the proposal that is also a current participant.
  • Adds a clear comment explaining the overlap-set requirement.

Reviewed changes

Per-file summary
File Description
crates/contract/src/state/running.rs Pick a signer in proposal ∩ current_participants so AuthenticatedAccountId::new always succeeds; previously used current_participants[0] which may not be in the random subset retained by gen_valid_params_proposal.

Findings

I verified:

  • gen_valid_params_proposal keeps n_old_participants ∈ [current_k, current_n] of the existing participants, and gen_threshold_params enforces k ≥ 2, so the retained overlap is non-empty and the .expect(...) is unreachable in practice.
  • The sibling tests that did not need fixing (should_reject_overlay_with_unknown_domain_id, should_apply_overlay_to_threshold_validation) hit overlay/threshold validation in process_new_parameters_proposal before the AuthenticatedAccountId::new signer check, so they are correctly unaffected by the same randomness.

No blocking issues.

Non-blocking (nits, optional):

  • crates/contract/src/state/running.rs:561 — minor: iter().map(...).find(...) could be iter().find_map(|(account_id, _, _)| ...) to avoid the eager clone() on every candidate before the predicate. Not worth a re-spin on its own.

✅ Approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant