Skip to content

feat(sdk-api,express): configurable Argon2id concurrency limit - #10236

Open
mohammadalfaiyazbitgo wants to merge 1 commit into
masterfrom
mohammadalfaiyaz/wcn-4893-configurable-concurrency-limit-for
Open

mohammadalfaiyazbitgo wants to merge 1 commit into
masterfrom
mohammadalfaiyaz/wcn-4893-configurable-concurrency-limit-for

Conversation

@mohammadalfaiyazbitgo

Copy link
Copy Markdown
Contributor

What

Adds a shared FIFO limiter around Argon2id hashing in sdk-api. Default is 16 running hashes and 500 waiting; calls beyond the waiting limit fail fast with AsyncWorkQueueFullError.

  • SDK: BitGoAPIOptions.argon2Concurrency (positive safe integer, last explicit value wins across clients in one isolate).
  • Express: --argon2concurrency / BITGO_ARGON2_CONCURRENCY (CLI wins; malformed env fails fast).
  • Express maps queue-full to the existing 500 response, not an incorrect-password error.

Bulk-share batching and AES/HKDF-only paths are unchanged.

Memory (default case)

Profiled on Apple M1 Max, 64 GB RAM. Offline mocked burst of 50 concurrent Go Account wallets with real v2 encryption. Whole-process RSS, so these show shape rather than production load.

Cap Peak RSS Elapsed
4 ~1.1 GB ~9.1 s
16 (default) ~1.8 GB ~9.5 s
50 (effectively uncapped) ~4.0 GB ~9.1 s

Idle startup is ~0.7 GB. Each default-cap hash is ~64 MiB of WASM memory, so 16 in flight budgets about 1 GiB. Accepted decrypts can use up to 256 MiB each. Not a total RSS cap, and each process or worker has its own limit.

Test status

  • sdk-api unit suite: 295 passing.
  • express unit suite: 2022 passing (needs a local BITGOJS_TEST_PASSWORD).
  • bitgo test/v2/unit/wallets.ts: 14 failing, not yet resolved. Triaged as stale expectations, Nock request-shape mismatches, an invalid base58 test fixture, and 413 retry behavior the code doesn't implement. I have not yet confirmed these fail on the base commit, so treat them as unverified. Reviewers may want that comparison before merge.
  • Go Account burst driver was a throwaway script and is not committed.

TICKET: WCN-4893

Limit concurrent Argon2id hashes with a shared FIFO queue (16 running,
500 waiting by default). Callers beyond the waiting limit get
AsyncWorkQueueFullError instead of queueing indefinitely.

Configure via BitGoAPIOptions.argon2Concurrency in the SDK, or
--argon2concurrency / BITGO_ARGON2_CONCURRENCY in Express. Express
maps queue-full errors to the existing 500 response rather than an
incorrect-password error.

TICKET: WCN-4893

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@linear-code

linear-code Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

WCN-4893

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Compatibility checks are failing on Node.js 27-nightly (experimental, non-blocking). This does not block merge, but it signals an incompatibility to fix before this release becomes supported.

View run

@pranishnepal pranishnepal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makes sense to me

This branch has not been deployed

No deployments
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