Skip to content

Conversation

@storybehind
Copy link
Collaborator

@storybehind storybehind commented Oct 31, 2025

Multi-Wallet Support & Stability Fixes

This PR introduces comprehensive Multi-Wallet support for the Go SDK and includes critical stability fixes verified by a new system test suite.

1. New Features (Multi-Wallet Support)

  • WASM Bindings: Added _mw.go files to expose multi-wallet functionality to web clients (WASM SDK).
  • Allocation Ownership: Introduced OwnerPublicKey field in Allocation to distinguish between the allocation owner and the specific signing wallet.
  • Worker Updates: Updated SDK workers (Upload, Copy, Move, etc.) to support the multiWalletSupportKey logic, allowing operations to be signed by secondary wallets.

2. Stability & Bug Fixes (New)

  • Fix: "Wallet Not Found" Error: Implemented dual-indexing in core/client/set.go. Wallets are now indexed by BOTH ClientID and PublicKey. This resolves critical lookup failures where workers searched by ClientID but wallets were only indexed by PublicKey.
  • Fix: Null Safety: Added robust null checks in IsWalletSet and standard wallet iterations to prevent nil pointer dereferences.
  • Fix: Signing Logic: Improved Sign function to clearly report errors when a specific key is missing, rather than failing silently or with confusing messages.

3. Verification (New System Test Suite)

Added a complete sdk_tests suite to system_test to validate these changes. All 24 tests passed with 0 skips:

  • Storage: Full Upload/Download lifecycle with secondary wallets.
  • Transactions: Token transfer and staking between multiple wallets.
  • Management: Concurrent wallet operations and correct lookup behavior.
  • Recovery: Wallet recovery from mnemonics.

Copy link

@balakumarr15 balakumarr15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added few basic comments that could improve code clarity. Please check these. Thanks.

PrintError(err.Error())
return "", err
}
defer sys.Files.Remove(option.LocalPath) //nolint

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is deferring here would be fine? If the number of iterations goes long, all accumulated files will be deferred to get deleted at end of function call.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create an anonymous function within this iteration if it needs to be deleted within this iteration.


// getMintWZCNPayload returns the mint payload for the given burn transaction hash
// - burnTrxHash: hash of the burn transaction
func getMintWZCNPayloadMW(burnTrxHash string, key string) string { //nolint:unused

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key is passed here but not used. Please check its usage, similar to mintZCNMW function

// - amountToken: amount of tokens to mint (as a string)
// - nonce: nonce of the transaction
// - signaturesRaw: encoded format (base-64) of the burn signatures received from the authorizers.
func estimateMintWZCNGasAmountMW(from, to, zcnTransaction, amountToken string, nonce int64, signaturesRaw []string, key string) string { // nolint:golint,unused

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes here, key is unused

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.

5 participants