Repository navigation
fix(platform-wallet)!: restore a coin as final as its stored transaction #5719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shumkov
merged 1 commit into
v5.0-dev
from
fix/heal-coins-confirmed-by-their-transaction
Nov 3, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Blocking: Negotiate the extended restore-row layout before reading it
Appending these fields changes UtxoRestoreEntryFFI's 64-bit size and array stride from 152 to 160 bytes, but on_load_wallet_list_fn and the existing manager constructors remain unchanged. A persistence host compiled against the previous header can still register and return its old allocation; build_wallet_start_state then constructs a slice with the new stride at persistence.rs:5665–5668. A single row now permits reads beyond its allocation, while subsequent rows are decoded at incorrect offsets, potentially interpreting unrelated bytes as script pointers and lengths. Updating the bundled Swift/JNI producers protects those rebuilt producers, but the documented rebuild requirement does not reject an older host before Rust dereferences its rows. This conflicts with the compatibility handling already present in PersistenceCallbacksExtension: its sidecars explicitly avoid changing bare-pointer payload strides, and manager.rs reads extension slots only after size/version negotiation. Keep the legacy restore row unchanged and transport parent evidence through a negotiated sidecar, or introduce a versioned restore interface that distinguishes the layouts before reading the allocation.
source:
gpt-6.1-sol(phase2-reviewer: ffi-engineer)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that the stride changes. I've handled it as a breaking change, not a sidecar, and the PR now says so: the title has
!, and the Breaking Changes section names the 152 → 160 byte growth, the rebuild requirement, and the KotlinUtxoRestoreDataconstructor change.Why not negotiate the layout:
PlatformWalletPersistenceHandlerand the JNI crate. The Swift package ships with its xcframework, and the JNI crate is compiled into the same native library as this FFI crate. Neither can pair an old header with this Rust.WalletRestoreEntryFFIthe same way. That struct is read through this sameon_load_wallet_list_fnarray, and the PR was marked!with the same rebuild note.If a maintainer prefers the sidecar shape here (as #4799 did for the identity rows), I'll switch to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right: I treated cross-version binary compatibility as a requirement without establishing that it is supported here. I checked that Swift allocates these rows using the header from its XCFramework, JNI constructs them using its direct Rust dependency, and #5026 likewise extended
WalletRestoreEntryFFI. The mixed-version external-host case I described remains unsafe, but the documented rebuild requirement explicitly excludes that pairing; it does not demonstrate a defect in the matched producers shipped here. I withdraw the blocker—layout negotiation is not required merely because this deliberately breaks the old ABI.Withdrawing this finding.