Skip to content

electrum: take a trailing asof: on any negotiated protocol - #1244

Open
bkeroack wants to merge 3 commits into
reardencode:masterfrom
bkeroack:electrum/asof-no-dialect
Open

bkeroack wants to merge 3 commits into
reardencode:masterfrom
bkeroack:electrum/asof-no-dialect

Conversation

@bkeroack

Copy link
Copy Markdown
Contributor

A trailing asof:<blockhash> is now the opt-in by itself. take_trailing_asof refused it with asof requires protocol 1.4.2-asof unless the connection had negotiated that dialect. Negotiating it also sets conn.protocol to 1.4.2-asof, so protocol_ge_1_6 is false for the whole connection: a client that wanted as-of lost 1.6 shapes such as the blockchain.block.headers headers array.

  • take_trailing_asof and electrum_at_chain_view lose the asof_ok flag; the three per-method callers and the connection path stop computing it.
  • server.version(name, "1.4.2-asof") is still accepted and still echoed, so clients that negotiate it see no change. server.features still reports asof and asof_protocol.
  • The token is still recognised only by its asof: prefix as the last argument, on the five methods in method_stamps_chain_tip. A bare trailing hex hash is still not taken as asof.

Test: electrum_and_esplora_asof_hides_later_spend now opens a 1.6 connection, sends asof: on get_balance and gets the as-of balance and chain_tip, then checks block.headers still returns headers. It failed before the change with asof requires protocol 1.4.2-asof. The rest of the journey still runs on a 1.4.2-asof connection.

Local: fmt, clippy, deny, ast-grep and ci-os-smoke.sh pass. cargo test --workspace --no-fail-fast had two timing failures outside Electrum under full-workspace load (tip_accept::two_full_senders_both_enqueue, cross_surface::sv2_tp_bootstrap); each passes 3 of 3 alone.

🤖 Generated with Claude Code

bkeroack and others added 2 commits October 27, 2026 16:10
A trailing `asof:<blockhash>` is the opt-in by itself. It was refused unless
the connection had negotiated `1.4.2-asof`, which also held that connection
to 1.4.x shapes, so a 1.6 client could not use as-of. `1.4.2-asof` is still
accepted for clients that negotiate it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

REQUEST_CHANGES

1 bug, 1 nit.

The scripthash and transaction.get rows in COMPAT.md still require negotiating 1.4.2-asof. See the comment on the new paragraph: a 1.6 client that follows those rows still loses 1.6 shapes.

Nit: the updated dispatch assertion message still says "without dialect".

Comment thread COMPAT.md
without the dialect is an error. `server.features.protocol_max` stays
`"1.6"`. As-of discovery is `asof` / `asof_protocol` (`1.4.2-asof`), not
`protocol_max`.
Electrum clients that want as-of add a trailing `asof:<blockhash>`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The scripthash row still says a trailing asof: "Requires negotiated 1.4.2-asof (first server.version only)", and the transaction.get / get_merkle row still says "same dialect as scripthash". This paragraph says the token works on any negotiated protocol. A client that follows the method table sends server.version with 1.4.2-asof. negotiate_protocol still returns that string, so protocol_ge_1_6 stays false and blockchain.block.headers stays the 1.4 hex blob. Drop the requirement from both rows. Keep asof_protocol as the legacy version that pins 1.4.x shapes; the last sentence here should not tell a client that negotiating it is how they turn the token on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 22cdebb: the scripthash and transaction.get / get_merkle rows no longer require the dialect, the server.version row and the paragraph call 1.4.2-asof the legacy dialect that pins 1.4.x shapes, and discovery is server.features.asof.

assert!(err.contains("1.4.2-asof"), "asof without dialect: {err}");
assert!(
err.contains("asof not on chain"),
"asof without dialect: {err}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: the failure text still says "asof without dialect". This check is now that an unknown hash returns asof not on chain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 22cdebb: the message is now "unknown asof hash".

… legacy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

APPROVE

Both earlier findings are fixed. The scripthash and transaction.get / get_merkle rows no longer require negotiating 1.4.2-asof, and asof_protocol is the legacy pin that still forces 1.4.x shapes. The assertion message now says unknown asof hash.

Nothing new. The added commit is those two edits only.

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