Skip to content

Conversation

@Nodonisko
Copy link
Contributor

@Nodonisko Nodonisko commented Dec 12, 2025

Explanation

This batches some calls during account creation after SRP import. It reduced time it took from ~35s to ~9s on my device for SRP with ~250 accounts.

I am not sure if this is worth merging because of #6654

Screenshot 2025-12-12 at 18 38 26 Screenshot 2025-12-12 at 18 38 01

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

Batches EVM account discovery/creation and debounces wallet/group syncs to cut redundant vault updates during large imports.

  • MultichainAccountService:
    • Add debounced sync pipeline (50ms) using #pendingWalletSyncs and #pendingGroupSyncs; replace immediate wallet.sync()/group.sync() on account add with queued flush via #scheduleSync() and #flushSyncs().
  • MultichainAccountWallet:
    • Optimize discovery: detect contiguous active EVM accounts, then batch-create them and skip sequential EVM discovery; update maxGroupIndex accordingly.
  • EvmAccountProvider:
    • Add findActiveAccountCount (checks activity via eth_getTransactionCount), bulkCreateAccounts (single keyring write), and internal #createAccountsBatch helper; expose address/tx-count helpers for discovery flow.

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

@Nodonisko Nodonisko requested a review from a team as a code owner December 12, 2025 17:59
await keyring.addAccounts(count);
},
);
}
Copy link

Choose a reason for hiding this comment

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

Bug: bulkCreateAccounts adds count instead of reaching target count

The bulkCreateAccounts method passes count directly to keyring.addAccounts(), but addAccounts(N) adds N new accounts rather than setting the total to N. When called with maxGroupIndex + activeCount (e.g., 5 when there are 2 existing accounts and 3 new ones found), this will add 5 accounts instead of the intended 3. The private #createAccountsBatch method handles this correctly by computing toCreate = count - existingCount, but bulkCreateAccounts doesn't use that logic.

Additional Locations (1)

Fix in Cursor Fix in Web

@Nodonisko Nodonisko marked this pull request as draft December 12, 2025 18:20
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