fix: use Fr.fromString for CLI wallet claim params to handle decimal values#22197
Merged
Conversation
Thunkar
approved these changes
Apr 1, 2026
AztecBot
pushed a commit
that referenced
this pull request
Apr 1, 2026
…values (#22197) ## Summary Fixes incorrect parsing of `--payment` claim parameters in the CLI wallet when using the explicit long form: ``` --payment method=fee_juice,claimAmount=123,claimSecret=0xabc,messageLeafIndex=42 ``` **Bug**: `Fr.fromHexString()` was used to parse `claimAmount`, which interprets bare numeric strings as hex. When a user copy-pastes the output of `bridge-fee-juice` (which prints `claimAmount` as a decimal bigint like `1000000000000000000`), it would be silently misinterpreted as a hex value, resulting in a completely wrong claim amount. **Fix**: Switch to `Fr.fromString()` which correctly auto-detects decimal vs hex (0x-prefixed) input. Also adds a type guard for `claimSecret` to handle both the DB path (which returns a string) and the direct CLI path uniformly. ## Changes - `Fr.fromHexString(claimAmount)` → `Fr.fromString(claimAmount)` — handles decimal amounts correctly - `Fr.fromHexString(claimSecret)` → `Fr.fromString(claimSecret)` with type guard — consistent handling for both DB and CLI paths ## Test plan - Verify `deploy-account --payment method=fee_juice,claimAmount=1000000000000000000,claimSecret=0xabc...,messageLeafIndex=42` correctly parses the decimal amount - Verify `deploy-account --payment method=fee_juice,claim` (DB-backed short form) still works unchanged - Verify hex-prefixed values like `claimAmount=0x1234` still work correctly ClaudeBox log: https://claudebox.work/s/7737b856f8012542?run=2
Collaborator
Author
|
✅ Successfully backported to backport-to-v4-next-staging #22205. |
AztecBot
added a commit
that referenced
this pull request
Apr 1, 2026
BEGIN_COMMIT_OVERRIDE cherry-pick: feat: move event size check from declaration to private emission (#22168) fix: prevent oracle failure on tag computation for invalid recipient (#22163) feat: move event size check from declaration to private emission (#22168) [v4-next backport] (#22182) fix(cli-wallet): peek claim stack instead of popping for estimate-gas-only (#22196) fix: use Fr.fromString for CLI wallet claim params to handle decimal values (#22197) fix: indefinite retry for prover node and agent broker communication (#22202) END_COMMIT_OVERRIDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes incorrect parsing of
--paymentclaim parameters in the CLI wallet when using the explicit long form:Bug:
Fr.fromHexString()was used to parseclaimAmount, which interprets bare numeric strings as hex. When a user copy-pastes the output ofbridge-fee-juice(which printsclaimAmountas a decimal bigint like1000000000000000000), it would be silently misinterpreted as a hex value, resulting in a completely wrong claim amount.Fix: Switch to
Fr.fromString()which correctly auto-detects decimal vs hex (0x-prefixed) input. Also adds a type guard forclaimSecretto handle both the DB path (which returns a string) and the direct CLI path uniformly.Changes
Fr.fromHexString(claimAmount)→Fr.fromString(claimAmount)— handles decimal amounts correctlyFr.fromHexString(claimSecret)→Fr.fromString(claimSecret)with type guard — consistent handling for both DB and CLI pathsTest plan
deploy-account --payment method=fee_juice,claimAmount=1000000000000000000,claimSecret=0xabc...,messageLeafIndex=42correctly parses the decimal amountdeploy-account --payment method=fee_juice,claim(DB-backed short form) still works unchangedclaimAmount=0x1234still work correctlyClaudeBox log: https://claudebox.work/s/7737b856f8012542?run=2