Skip to content

SEPARATE (optional): keep long-poll on for an echoed legacy -32021 - #100

Merged
ristik merged 2 commits into
mainfrom
fix/longpoll-legacy-32021-echo-202611020739
Nov 2, 2026
Merged

ristik merged 2 commits into
mainfrom
fix/longpoll-legacy-32021-echo-202611020739

Conversation

@ristik

@ristik ristik commented Nov 2, 2026

Copy link
Copy Markdown
Member

Separate, optional parity change; independent of the echo corpus sync PR. The owner may decline it.

The waiter disabled long-poll on every legacy -32021, even when the error echoed data.waitedMs. Aligns with the Rust SDK: an echoed pending error keeps long polling, a malformed echo is a protocol error, and a pending error without an echo still drops the wait.

Separate parity change (not part of the echo corpus sync). The waiter dropped
the wait on every legacy -32021, even when the error carried data.waitedMs.
Align with the Rust SDK: an echoed pending error keeps long polling, a
malformed echo is a protocol error, and a pending error without an echo still
drops the wait.

@MastaP MastaP left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving df6db7c. The change is correct and matches the Rust SDK (src/client/http/wait.rs, the RPC_INCLUSION_PENDING branch) and JS #205. Whether to take it is the owner's call; notes below.

  • A pending error that echoes waitedMs keeps long polling. After the pending error, the waiter still calls next(max(interval, MIN_POLL_GAP_MILLIS)), so an instant waitedMs: 0 cannot cause a tight loop.
  • The echo counts only in a narrow case. It must be data.has("waitedMs") on object data, on a call that asked for a wait (asked > 0), on an id-matched -32021 that was not classified as an overload first. Non-object data, or data without the member, still drops the wait (aLegacyPendingErrorWithDataButNoEchoStillDropsTheWait).
  • There is one new terminal path. A malformed echo (LongPoll.isWireMillis false) now ends the wait with JsonRpcResponseException; before, it polled on without long poll. This matches Rust and the existing treatment of a malformed waitedMs on a result.
  • Our servers never reach this code today. Neither aggregator-go nor the gateway sends -32021. It only matters for a legacy or third-party aggregator.
  • Checks pass. ./gradlew build passes, with checkstyle and all tests; InclusionProofWaiterTest runs 49 of 49. With InclusionProofWaiter.java reverted to main, aLegacyPendingErrorThatEchoesTheWaitKeepsLongPolling and aLegacyPendingErrorWithAMalformedEchoIsAProtocolError fail.
  • Nit. The tests spell out com.fasterxml.jackson… types fully qualified instead of importing them.

@ristik
ristik merged commit 6ac0c58 into main Nov 2, 2026
1 check passed
@ristik
ristik deleted the fix/longpoll-legacy-32021-echo-202611020739 branch November 2, 2026 11:47
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.

2 participants