fix: remove race condition in bouncer observe event#6023
Conversation
…lock subscription
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MxmUrw
left a comment
There was a problem hiding this comment.
Looks good to me, the change moves the check for historical blocks into the loop that checks new blocks coming in from the subscription. This way we won't accidentally miss a block height. (Which could have happened previously)
|
Let's merge this to increase the probability of followup PRs to be merged. |
…reward * origin/main: feat: delegated staking auction integration (#6022) ci: improve secret passing 🥷 (#6042) feat: generate backspin chain spec (#6041) refactor: return `Ok(None)` instead of error if sol egress witnessing cannot find a tx (#6036) feat: add operator to validator info (#6040) feat: Support for DCA 1 block interval (#6025) feat: added account balance of operator (#6035) fix: remove race condition in bouncer observe event (#6023) fix: use `any::Asset` instead of `ChainlinkAssetpair` in internal price API (#6034) feat: price oracle elections (#5971) feat: don't error if tx is Confirmed (#6019) chore: process all events in a block in parallel (#6013)
This reverts commit ecb2caa.
* fix: remove race condition between historic blocks checking and new block subscription * fix: properly convert header.number to number
* Revert "fix: remove race condition in bouncer observe event (#6023)" This reverts commit ecb2caa. * WIP * chore: lint bouncer * fix: pass header hash as argument * fix: Pass block hash via subscription * fix: stringify block hashes * fix: increase default historical block margin * feat: move bouncer header subs into background thread - allow us to share a single sub instead of opening/closing new ones. - allow more reliable update of eg. finalized block height. * chore: restore `historicalCheckBlocks` to 2 * fix: graceful abort handling. * fix: fix event cache garbage collection (use Array). * fix: correct ordering of historical events * chore: simplify governance test * fix: wait for all order deletion events * fix: more explicit stopping in observeEvent * fix: longer timeout for evm deposit test. * fix: lint * fix: take all matching events in a block * fix: check 2 historical blocks * fix: start historical query at parent block hash * fix: stopping logic operator precendence & tidy up * fix: evm deposits test * feat: further improvements: - Add utility for handling dispatch error - Add utility for waiting for extrinsic inclusion - Use EventRecord type where possible, rather than any - Fix event check in multiple members governance test - Don't rely on observeEvents to detect extrinsic success. * fix: remove asset hub zero balance warning * feat: Use new utils for btc vault swap & open channel checks * feat: increase vitest maxConcurrency value * chore: update timeout values * fix: private btc channel * chore: extra logging * feat: observe current block immediately - add AsyncQueue class for more robust `observableToIterable` impl - store current finalised block hash - prepend current best events to event subscription - set default historical blocks to zero * feat: bouncer: better swap progress diagnostics * chore: reduce number of historical blocks for observerSwapRequested * feat: better logging * feat: more `stopAfter` options. * fix: ensure correct event ordering * chore: reduce vitest concurrency setting * fix: eslint * chore: prettier * refactor: missing changes from Jamie's PR * fix: lint * fix: reduce maxConcurrency * fix: remove waitForPrivateBtcChannel * fix: hold broker mutex while opening private btc channel * fix: make all concurrent tests run at the same time * chore: reduce logger noise * fix: mutex per broker/lp uri instead of global mutexes * fix: use describe correctly * fix: make swaps run concurrently * fix: reduce logger spam * fix: CCM gasLimit tests * fix: prefer isFinalized over isInBlock for AssetHub/Polkadot bouncer submissions * fix: make forceRecoverSolNonce parallel. --------- Co-authored-by: Jamie Ford <Jamie@chainflip.io> Co-authored-by: Maxim Urschumzew <MxmUrw@users.noreply.github.com>
* fix: remove race condition between historic blocks checking and new block subscription * fix: properly convert header.number to number
* fix: remove race condition between historic blocks checking and new block subscription * fix: properly convert header.number to number
* Revert "fix: remove race condition in bouncer observe event (#6023)" This reverts commit ecb2caa. * WIP * chore: lint bouncer * fix: pass header hash as argument * fix: Pass block hash via subscription * fix: stringify block hashes * fix: increase default historical block margin * feat: move bouncer header subs into background thread - allow us to share a single sub instead of opening/closing new ones. - allow more reliable update of eg. finalized block height. * chore: restore `historicalCheckBlocks` to 2 * fix: graceful abort handling. * fix: fix event cache garbage collection (use Array). * fix: correct ordering of historical events * chore: simplify governance test * fix: wait for all order deletion events * fix: more explicit stopping in observeEvent * fix: longer timeout for evm deposit test. * fix: lint * fix: take all matching events in a block * fix: check 2 historical blocks * fix: start historical query at parent block hash * fix: stopping logic operator precendence & tidy up * fix: evm deposits test * feat: further improvements: - Add utility for handling dispatch error - Add utility for waiting for extrinsic inclusion - Use EventRecord type where possible, rather than any - Fix event check in multiple members governance test - Don't rely on observeEvents to detect extrinsic success. * fix: remove asset hub zero balance warning * feat: Use new utils for btc vault swap & open channel checks * feat: increase vitest maxConcurrency value * chore: update timeout values * fix: private btc channel * chore: extra logging * feat: observe current block immediately - add AsyncQueue class for more robust `observableToIterable` impl - store current finalised block hash - prepend current best events to event subscription - set default historical blocks to zero * feat: bouncer: better swap progress diagnostics * chore: reduce number of historical blocks for observerSwapRequested * feat: better logging * feat: more `stopAfter` options. * fix: ensure correct event ordering * chore: reduce vitest concurrency setting * fix: eslint * chore: prettier * refactor: missing changes from Jamie's PR * fix: lint * fix: reduce maxConcurrency * fix: remove waitForPrivateBtcChannel * fix: hold broker mutex while opening private btc channel * fix: make all concurrent tests run at the same time * chore: reduce logger noise * fix: mutex per broker/lp uri instead of global mutexes * fix: use describe correctly * fix: make swaps run concurrently * fix: reduce logger spam * fix: CCM gasLimit tests * fix: prefer isFinalized over isInBlock for AssetHub/Polkadot bouncer submissions * fix: make forceRecoverSolNonce parallel. --------- Co-authored-by: Jamie Ford <Jamie@chainflip.io> Co-authored-by: Maxim Urschumzew <MxmUrw@users.noreply.github.com>
* Revert "fix: remove race condition in bouncer observe event (#6023)" This reverts commit ecb2caa. * WIP * chore: lint bouncer * fix: pass header hash as argument * fix: Pass block hash via subscription * fix: stringify block hashes * fix: increase default historical block margin * feat: move bouncer header subs into background thread - allow us to share a single sub instead of opening/closing new ones. - allow more reliable update of eg. finalized block height. * chore: restore `historicalCheckBlocks` to 2 * fix: graceful abort handling. * fix: fix event cache garbage collection (use Array). * fix: correct ordering of historical events * chore: simplify governance test * fix: wait for all order deletion events * fix: more explicit stopping in observeEvent * fix: longer timeout for evm deposit test. * fix: lint * fix: take all matching events in a block * fix: check 2 historical blocks * fix: start historical query at parent block hash * fix: stopping logic operator precendence & tidy up * fix: evm deposits test * feat: further improvements: - Add utility for handling dispatch error - Add utility for waiting for extrinsic inclusion - Use EventRecord type where possible, rather than any - Fix event check in multiple members governance test - Don't rely on observeEvents to detect extrinsic success. * fix: remove asset hub zero balance warning * feat: Use new utils for btc vault swap & open channel checks * feat: increase vitest maxConcurrency value * chore: update timeout values * fix: private btc channel * chore: extra logging * feat: observe current block immediately - add AsyncQueue class for more robust `observableToIterable` impl - store current finalised block hash - prepend current best events to event subscription - set default historical blocks to zero * feat: bouncer: better swap progress diagnostics * chore: reduce number of historical blocks for observerSwapRequested * feat: better logging * feat: more `stopAfter` options. * fix: ensure correct event ordering * chore: reduce vitest concurrency setting * fix: eslint * chore: prettier * refactor: missing changes from Jamie's PR * fix: lint * fix: reduce maxConcurrency * fix: remove waitForPrivateBtcChannel * fix: hold broker mutex while opening private btc channel * fix: make all concurrent tests run at the same time * chore: reduce logger noise * fix: mutex per broker/lp uri instead of global mutexes * fix: use describe correctly * fix: make swaps run concurrently * fix: reduce logger spam * fix: CCM gasLimit tests * fix: prefer isFinalized over isInBlock for AssetHub/Polkadot bouncer submissions * fix: make forceRecoverSolNonce parallel. --------- Co-authored-by: Jamie Ford <Jamie@chainflip.io> Co-authored-by: Maxim Urschumzew <MxmUrw@users.noreply.github.com>
Pull Request
Closes: PRO-xxx
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
observeEventfunction between checking for the event in historic blocks and in the new block from a subscription