Repository navigation
Conversation
Builds balances.transfer_all(dest, keep_alive): true leaves the existential deposit so the sender survives (the sweep for deposit addresses), false empties and reaps it. Mnemonic variant included; keepAlive has no default.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
Verdict (advisory): Approve
Reviewed base 04174ffca2e385ca64d45ee0c9523cc1dd36707d through head f10e79ea32901f0065b31d5c0a5d16e1ad728e72. No blocking findings. The new call matches the Quantus runtime encoding, both entry points reuse the existing hedged signing/context path, and the shared-prefix refactor preserves fixed-amount balances and assets transfers.
Non-blocking documentation note: README.md:143 says keepAlive: false always empties and reaps the account. The runtime transfers only the reducible balance; locks, reserves, or other account references can prevent reaping. Describe this as allowing reaping rather than guaranteeing it, and qualify the matching API comments.
Validation passed:
git diff --check.cargo test --locked: 11 tests.npm run buildandnpm run test:js: 21 tests, including npm package contents.npm run example.- Additional checks: 24 signing cases across both schemes/flags, recipient formats, mnemonic indices/passphrase and scheme precedence; 38 rejection cases covering missing/non-boolean flags at both JS/WASM entry points and missing mortal block hashes. Generated TypeScript declarations reject omitted
keepAlivefor both APIs. - GitHub CI passed for this exact head.
Validation was offline; no transaction was submitted to a live node.
transfer_all moves only the reducible balance. Locks, reserves or other references to the account can keep it alive even with keep_alive false, so the README, API comments, error message and changelog no longer claim the sender is always emptied and reaped.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
Verdict (advisory): Approve
Reviewed base 04174ffca2e385ca64d45ee0c9523cc1dd36707d through current head 094c3893851ccb9d227aa9d422f8dd7c2a241626. No blocking findings.
Both new entry points encode balances.transfer_all(dest, keep_alive) correctly and reuse the existing hedged signing, mortality and mnemonic derivation paths. The shared-prefix refactor preserves fixed-amount balances and assets transfers. Encoding was checked against the Quantus pallet index and transfer_all implementation. The documentation correctly qualifies that allowing reaping does not guarantee it.
Validation passed in an isolated detached worktree:
git diff --check.cargo test --locked: 11 tests.npm run buildwith an isolated ARM-compatiblewasm-pack0.15.0;npm run test:js: 21 tests, including package contents.npm run example.- 28 additional signing cases covering both schemes/flags, recipient formats, mnemonic indices/passphrase and scheme precedence; 46 rejection cases covering omitted/non-boolean
keepAliveat both JS/WASM entry points and missing mortal block hashes at the JS entry points. - GitHub CI passed for this exact head.
Validation was offline; no transaction was submitted to a live node.
Why
Exchanges sweeping deposit addresses need
balances.transfer_all: it moves whatever the balance is at execution time, and withkeep_alive: trueit leaves the existential deposit behind so the address survives and its nonce keeps counting. Until now the package only offered fixed-amount transfers, so a sweep had to be hand-encoded and signed throughsignCall.What changes
signTransferAll(seed, params)andsignTransferAllFromMnemonic(mnemonic, params, opts)build and signbalances.transfer_all(dest, keep_alive)(pallet 2, call 4, then a bool).keepAliveis required, same rule assignTransfer: no default, omitting it is a TypeScript error and a runtimeTypeError, and the wasm layer rejects a missing field too.true= sweep keeping the existential deposit,false= full drain that reaps the sender.TransferAllParams,sign_transfer_all,sign_transfer_all_with_keypair; the balances call prefix is built by one helper shared withencode_call.lib.rsgains a smallfrom_jshelper so the three param parsers share the same error mapping.Tests
transfer_all_call_and_extrinsic: exact call bytes for both flags and envelope equality withsign_callfor both schemes.signCall, missing or non-booleankeepAlivethrows for both the seed and mnemonic entry points, and the mnemonic variant signs with the derived ML-DSA-65 key.cargo test11 passed,npm run build && npm run test:js21 passed,npm run exampleruns.