Skip to content

fix(swift-sdk): drop a held shielded-tree inconsistency event after a committed rebuild that reports a checkpoint error #6446

Backlog

Description

@lklimek

TL;DR: After a shielded-tree rebuild that succeeded but reported a storage checkpoint error, an iOS wallet app can show the "wallet needs repair" prompt once more for the tree that was already rebuilt.

User story

As an iOS wallet app developer, I want the repair prompt to appear only for the tree that is actually inconsistent, to avoid asking users to repair a wallet that was just repaired.

Scenario

Base flow

The app receives a shielded-tree inconsistency result, offers a repair, and calls rebuildShieldedTree().

Actual behavior

The reset commits, but the following storage checkpoint fails, so the call reports an error. The Swift SDK advances its callback generation only on success, so a sync-completion event held from before the rebuild is published with the unchanged generation and can raise the repair prompt again.

Expected behavior

An event that describes the tree as it was before a committed reset is never delivered after that reset, whatever error the call reports afterwards.

Detailed discussion

Proposed approach: have Rust attach a committed-tree identity (a generation that changes on every committed reset) to the sync result and events, and let the hosts drop events for an older identity instead of inferring it from the call's outcome. Wrappers only compare the identity; the decision stays in Rust.

Prior work

🤖 Co-authored by Claudius the Magnificent AI Agent

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions