fix(bifrost): migrate legacy XMR recovery files for sealed signer restore

🔎 Visual review of f3896ae1: explainer, review flags and prompts to ask an AI about the change

Why

serai !76 makes the signer reject legacy TKE\x01 recovery files. Bifrost's current recovery tool creates those files from on-chain backups, so its restore loop needs the signer's migration endpoint before it can use the sealed format.

Change

  • Send the legacy file to /v1/monero/keys/recovery/migrate with its vault identity, then restore the returned sealed blob using recovery_vault_pub_key.
  • Require the signer to report a persisted, signable share for that group. Also verify the original vault that Bifrost will use for signing is signable before consuming the file.
  • Check that the migrated group equals the group's identity derived from the recovery vault. A mismatched file stays on disk without restoring an unrelated share.
  • Fall back to the old restore path only when an older signer returns 404 for the migration endpoint, allowing either deployment order.

Validation

go test -tags=mocknet ./bifrost/pkg/chainclients/monero ./bifrost/pkg/chainclients/monero/sidecar -count=1 passes. Tests cover migration, legacy-signer fallback, migration rejection, unverified restore, and a mismatched group even when the alias already has another signable share.

Coordination

This is a draft dependency for serai !76 (merged). Keep the signer review blocker open until both MRs are reviewed and the legacy backup path is verified together. A legacy artifact whose bound group differs from the vault's group is retained and needs investigation; this MR does not claim to recover that inconsistent identity.

Edited by Huginn Ai

Merge request reports

Loading
Loading