Skip to content

fix: use Fr.fromString for CLI wallet claim params to handle decimal values#22197

Merged
Thunkar merged 1 commit into
nextfrom
claudebox/7737b856f8012542-2
Apr 1, 2026
Merged

fix: use Fr.fromString for CLI wallet claim params to handle decimal values#22197
Thunkar merged 1 commit into
nextfrom
claudebox/7737b856f8012542-2

Conversation

@AztecBot

Copy link
Copy Markdown
Collaborator

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

@Thunkar Thunkar marked this pull request as ready for review April 1, 2026 06:00
@Thunkar Thunkar enabled auto-merge April 1, 2026 06:00
@Thunkar Thunkar added this pull request to the merge queue Apr 1, 2026
Merged via the queue into next with commit e041f09 Apr 1, 2026
39 checks passed
@Thunkar Thunkar deleted the claudebox/7737b856f8012542-2 branch April 1, 2026 07:12
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
@AztecBot

AztecBot commented Apr 1, 2026

Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants