Skip to content

Fix race condition in Espress input tests#73

Open
jbearer wants to merge 1 commit into
mainfrom
jb/fix-flaky-test
Open

Fix race condition in Espress input tests#73
jbearer wants to merge 1 commit into
mainfrom
jb/fix-flaky-test

Conversation

@jbearer
Copy link
Copy Markdown
Member

@jbearer jbearer commented Mar 26, 2026

The combination of wait_for_state_and_rewards and assert_reward_balances used in many tests was problematic, because the former returned a specific Espresso block number without locking the Espresso state to that number.

Now wait_for_state_and_rewards returns a lock on the Espresso state, to ensure that assert_reward_balances is called with the Espresso state at a known block number.

The combination of `wait_for_state_and_rewards` and
`assert_reward_balances` used in many tests was problematic,
because the former returned a specific Espresso block number
without locking the Espresso state to that number.

Now `wait_for_state_and_rewards` returns a lock on the Espresso
state, to ensure that `assert_reward_balances` is called with the
Espresso state at a known block number.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the wait_for_state_and_rewards and assert_reward_balances test utilities in src/input/espresso.rs. The wait_for_state_and_rewards function now returns a RwLockReadGuard of the state, and assert_reward_balances has been updated to accept a direct reference to the state, streamlining the test flow and reducing redundant lock operations. I have no feedback to provide.

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