Skip to content

fix(wasm-sdk): increment address nonce in identity_create_from_addresses#3084

Open
lklimek wants to merge 1 commit intov3.1-devfrom
fix/wasm-sdk-identity-create-nonce-off-by-one
Open

fix(wasm-sdk): increment address nonce in identity_create_from_addresses#3084
lklimek wants to merge 1 commit intov3.1-devfrom
fix/wasm-sdk-identity-create-nonce-off-by-one

Conversation

@lklimek
Copy link
Contributor

@lklimek lklimek commented Feb 13, 2026

Summary

  • Fixes off-by-one nonce bug in identity_create_from_addresses: the WASM SDK was sending the current address nonce, but the platform expects current + 1
  • Aligns fetch_nonces_into_address_map with the nonce_inc() pattern already used by rs-sdk's transfer_address_funds, top_up_from_addresses, and withdraw_address_funds

Closes #3083

Test plan

  • Verify identity_create_from_addresses no longer gets rejected with a nonce mismatch error
  • Confirm existing address-based state transitions (transfer, top-up, withdraw) still work correctly
  • Run cargo check -p wasm-sdk — passes cleanly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed nonce computation for addresses to correctly align with platform expectations, ensuring consistent behavior across transfer, top-up, and withdrawal operations.

The WASM SDK's fetch_nonces_into_address_map was sending the current
address nonce, but the platform expects current + 1. This matches the
nonce_inc() pattern already used by rs-sdk's transfer_address_funds,
top_up_from_addresses, and withdraw_address_funds.

Closes #3083

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added this to the v3.1.0 milestone Feb 13, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

A bug fix increments the fetched nonce by 1 in fetch_nonces_into_address_map, aligning it with platform expectations. This change mirrors the pattern used in related address-based state transitions like transfer, top-up, and withdrawal functions.

Changes

Cohort / File(s) Summary
Nonce Increment Fix
packages/wasm-sdk/src/state_transitions/addresses.rs
Updated fetch_nonces_into_address_map to return nonce + 1 instead of current nonce, aligning with platform requirements and matching the behavior of transfer_address_funds, top_up_from_addresses, and withdraw_address_funds functions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A nonce was lost, one number too small,
Now +1 fixes identities' protocol call,
The WASM SDK hops with aligned grace,
Platform and wallet now synced in one place! 🎉

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: incrementing the address nonce in identity_create_from_addresses to fix an off-by-one bug.
Linked Issues check ✅ Passed The PR addresses the core fix from issue #3083 by incrementing the nonce in fetch_nonces_into_address_map, aligning with rs-sdk patterns.
Out of Scope Changes check ✅ Passed The PR only modifies nonce computation in addresses.rs; all changes directly relate to fixing the identified off-by-one bug.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into v3.1-dev

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/wasm-sdk-identity-create-nonce-off-by-one

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lklimek lklimek requested a review from thephez February 13, 2026 10:02
Copy link
Collaborator

@thephez thephez left a comment

Choose a reason for hiding this comment

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

We should have some tests to avoid future regressions probably

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.

Bug: identity_create_from_addresses sends current nonce instead of next nonce (missing +1)

2 participants