Batch Electrum witnesses during RGB transfer import - #79
Draft
Jainakin wants to merge 4 commits into
Draft
Conversation
This was referenced Aug 10, 2026
Jainakin
force-pushed
the
hardik/rgb-witness-prefetch
branch
from
August 12, 2026 12:16
08351cb to
d23b31f
Compare
Jainakin
force-pushed
the
hardik/rgb-witness-prefetch
branch
from
August 12, 2026 14:07
cd382e6 to
d08b367
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
accept_transferandsave_new_assetvalidationDesign constraints
This PR intentionally contains no persistent cache, memoizing resolver cache, worker pool, or new background executor. The response map is the direct materialized result of one Electrum batch; it lives only for the enclosing synchronous wallet operation and is dropped afterward. Fallback lookups are not cached.
The previous cache/prefetch experiment, benchmark fixture, and delay proxy have been removed from the final diff. The runtime performance change is limited to the operation-local Electrum batch resolver in
src/utils.rs, its use insrc/wallet/rust_only.rs, and theelectrum-clientAPI adjustment insrc/wallet/indexer.rs. The remaining diff keeps the root, C-FFI, and UniFFI workspaces aligned to the same audited RGB dependency graph through manifest and lockfile updates.Motivation and measured result
A controlled 88-history consignment was replayed through the exact RGB-lib validation/import/acceptance path.
On localhost the complete path moved from 948 ms to 628 ms. The RTT run used a deterministic local delay proxy and is not a claim about production Signet infrastructure.
Dependency alignment
rgb-ops
0.11.1-rc.11useselectrum-client 0.25, so this PR aligns RGB-lib and its standalone binding workspaces with:rgb-* 0.11.1-rc.11rgb-strict-* 1.0.2bdk_electrum 0.24electrum-client 0.25The branch is temporarily pinned to the reviewed Electrum-only commit in rgb-protocol/rgb-ops#18. That pin is a stacking mechanism only and must be replaced by an official rgb-ops release before this PR merges.
Correctness behavior
Validation
Passed locally on the final pin:
cargo fmt --all -- --check-D warningsThe final clean head is green across all 23 required Linux/macOS/Windows build, MSRV/stable/nightly, Electrum, unchanged Esplora, no-default-feature, docs, lint, feature-test, and all-feature coverage checks: https://github.com/UTEXO-Protocol/rgb-lib/pull/79/checks
The upstream all-feature integration harness cannot complete on this Apple Silicon host because
blockstream/esplora:latestexits immediately with a zero-byterunit_boot.sh, poisoning the shared test initializer. Linux CI is therefore a required merge gate; this PR does not claim that local cascade as passing or as a code regression.Scope and rollout
This reduces historical witness network round trips for native Electrum only. It does not batch Esplora or WASM resolution, move validation outside LDK peer locking, alter transfer persistence, or implement channel-funding recovery.
Production rollout must exercise the exact authenticated Electrum deployment. Unsupported or rejected native batches safely fall back to serial resolution but will not deliver the latency improvement.