mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-22 04:29:42 +00:00
ensureFreshMerkleProofPath coalesces concurrent callers onto a single in-flight refetch future and awaited it directly. Chronos propagates cancellation into the awaited future, so one caller being cancelled (e.g. a publish retry whose RlnRefreshRetryTimeout fired mid-refetch) cancelled the shared future under every coalesced caller — and threw away an eth_call that may have been about to complete. Await the in-flight future via join() instead: cancelling a caller only detaches its callback. The refetch always runs to completion, coalesced callers keep waiting, and even when every caller times out the cache still gets populated in the background so the next publish fast-paths instead of paying the RPC round-trip again. Detaching is safe because doRefresh cannot fail with an unhandled exception: the eth_call wrappers catch CatchableError and return Result, and failures surface to callers through fetchOk / an empty cache exactly as before. Adds a test cancelling the initiating caller mid-refetch and asserting the shared future survives and the coalesced caller completes with a populated cache. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>