Skip to content

fix: missing bugs in the ui and keystore - #649

Merged
pablocampogo merged 1 commit into
developmentfrom
fix-keystore-missing-bug
Nov 6, 2026
Merged

pablocampogo merged 1 commit into
developmentfrom
fix-keystore-missing-bug

Conversation

@pablocampogo

Copy link
Copy Markdown
Collaborator

Fix: keystore missing/misread key bug for launchpad ED25519 keys

Summary

Keys imported from the launchpad are ED25519 but stored as a raw 32-byte seed. Since a BLS12-381 private key is also 32 bytes, the decrypt path misread these seeds as BLS keys, producing the wrong public key and address (the key appeared "missing"). This PR disambiguates 32-byte keys using the recorded public key, with a safe fallback to the existing length-based detection.

Changes

lib/crypto/key.go

  • Added NewPrivateKeyFromBytesWithPublicKey(bz, recordedPublicKey). When the private key is 32 bytes (ambiguous between BLS12-381 and an ED25519 seed) and the recorded public key is ED25519-sized, it interprets the bytes as an ED25519 seed and verifies the derived public key matches. Otherwise it falls back to NewPrivateKeyFromBytes (legacy length-based detection), preserving backwards compatibility.

lib/crypto/keystore.go

  • DecryptPrivateKey now decodes the recorded public key from the EncryptedPrivateKey and passes it through to NewPrivateKeyFromBytesWithPublicKey for both the current (prepended-nonce) and legacy decrypt paths.

lib/crypto/keystore_test.go

  • Added TestDecryptPrivateKeyLaunchpadEd25519Seed, which encrypts an ED25519 key as a raw 32-byte seed with a prepended random nonce (launchpad format) and asserts it decrypts back to an ED25519 key with the original address, rather than being misread as a BLS key.

cmd/rpc/web/wallet/src/actions/ActionRunner.tsx

  • Added a resolvedDsSnapshot state and effect so action-level DS params can reference sibling DS results (e.g. an account DS querying ds.validator.output). The snapshot is synced from resolved DS results and guarded against no-op updates to avoid render loops.

Backwards compatibility

  • Existing keystores (32-byte BLS and 64-byte ED25519) continue to decrypt unchanged; the new public-key disambiguation only triggers for the ambiguous 32-byte + ED25519-sized public key case.

@pablocampogo
pablocampogo merged commit 14447c7 into development Nov 6, 2026
3 checks passed
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.

2 participants