Skip to content

perf(multichain-account-service): add Solana account batching#8131

Open
ccharly wants to merge 1 commit intocc/feat/backup-and-sync-batchfrom
cc/feat/solana-batch-accounts
Open

perf(multichain-account-service): add Solana account batching#8131
ccharly wants to merge 1 commit intocc/feat/backup-and-sync-batchfrom
cc/feat/solana-batch-accounts

Conversation

@ccharly
Copy link
Contributor

@ccharly ccharly commented Mar 6, 2026

Explanation

Implementing proper batching for our Solana account provider.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes Solana account creation to use a new batch Snap keyring API and adjusts how BIP-44 entropy metadata is synthesized, which could impact account derivation/indexing and timeouts if the Snap/keyring behavior differs from expectations.

Overview
Solana account creation is now batched. SolAccountProvider.createAccounts switches from per-account createAccount calls (looping for ranges) to a single SnapKeyring.createAccounts call for both single-index and range creation, reducing keyring locking/API overhead.

To support this, SnapAccountProvider’s restricted keyring surface now exposes createAccounts, and the Solana provider maps returned Snap accounts to BIP-44 accounts by injecting entropy/derivationPath based on the requested indices before asserting compatibility and tracking created IDs.

Tests and mocks were updated to expect the batch API (and not the singular call), and a small helper toGroupIndexRangeArray was added for range-based test keyring behavior; changelog updated to note the optimization.

Written by Cursor Bugbot for commit 20605ec. This will update automatically on new commits. Configure here.

@ccharly ccharly changed the title feat(multichain-account-service): add Solana account batching perf(multichain-account-service): add Solana account batching Mar 6, 2026
@ccharly ccharly force-pushed the cc/feat/solana-batch-accounts branch from 8f805c8 to 6d1259e Compare March 6, 2026 10:58
@ccharly ccharly force-pushed the cc/feat/backup-and-sync-batch branch 5 times, most recently from 716a57a to 16a70a6 Compare March 9, 2026 17:12
@ccharly ccharly force-pushed the cc/feat/solana-batch-accounts branch from 6d1259e to 99d0aa2 Compare March 9, 2026 17:17
@ccharly ccharly marked this pull request as ready for review March 9, 2026 17:17
@ccharly ccharly requested review from a team as code owners March 9, 2026 17:17
@ccharly ccharly force-pushed the cc/feat/solana-batch-accounts branch 2 times, most recently from 18c070d to 05ecd6a Compare March 9, 2026 18:18
@ccharly ccharly force-pushed the cc/feat/backup-and-sync-batch branch from 25d09e4 to 957ea19 Compare March 10, 2026 09:35
@ccharly ccharly force-pushed the cc/feat/solana-batch-accounts branch 2 times, most recently from 6fd4e76 to fb482ca Compare March 10, 2026 14:43
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

);

// Group indices are sequential, so we just need the starting index.
groupIndexOffset = options.range.from;
Copy link

Choose a reason for hiding this comment

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

Undefined range.from causes NaN group indices

High Severity

groupIndexOffset = options.range.from doesn't handle the optional from field. The GroupIndexRange type defines from as from?: number, so when omitted, groupIndexOffset becomes undefined. This causes groupIndexOffset + index to evaluate to NaN, producing invalid derivation paths like m/44'/501'/NaN'/0' and incorrect groupIndex values in the entropy metadata. A nullish coalescing default like ?? 0 is needed, consistent with how from is handled elsewhere (e.g., toGroupIndexRangeArray and assertGroupIndexRangeIsValid both default from to 0).

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Contributor Author

@ccharly ccharly Mar 10, 2026

Choose a reason for hiding this comment

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

This range.from comes from the keyring API, it cannot be undefined (at least, type-wise, we do not expect it to be undefined)

@ccharly ccharly force-pushed the cc/feat/solana-batch-accounts branch from fb482ca to 20605ec Compare March 10, 2026 15:32
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.

1 participant