Skip to content

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

Open
lklimek wants to merge 2 commits 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 2 commits 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
    • Corrected nonce computation for addresses so subsequent transfers, top-ups, and withdrawals use the expected next nonce, preventing out-of-order or replay issues.
  • Tests
    • Added regression tests to verify nonces are incremented as expected across address 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

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

fetch_nonces_into_address_map in the WASM SDK now returns the fetched nonce incremented by 1. Tests were added to assert the incremented nonce behavior. A dev-dependency on tokio was added for test support.

Changes

Cohort / File(s) Summary
Nonce increment & tests
packages/wasm-sdk/src/state_transitions/addresses.rs
Changed nonce returned by fetch_nonces_into_address_map from info_received.nonce to info_received.nonce + 1. Added regression/unit tests (under cfg(test)) to verify returned nonces are incremented.
Test dev-dependency
packages/wasm-sdk/Cargo.toml
Added tokio = { version = "1.40", features = ["macros", "rt-multi-thread"], optional = false } to dev-dependencies to support async tests.

Sequence Diagram(s)

(Skipped — change is a targeted nonce adjustment and local tests; does not introduce a new multi-component flow requiring sequence diagrams.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • QuantumExplorer

Poem

"I nibble logs beneath the moonlight bright,
A nonce was off — I fixed its tiny plight.
+1 hops in, the ledgers sing,
Tests cheer loud — a carrot for spring! 🥕🐇"

🚥 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 fix: incrementing the address nonce in the identity_create_from_addresses flow within the wasm-sdk package.
Linked Issues check ✅ Passed The PR fully addresses issue #3083 objectives: changes fetch_nonces_into_address_map to use nonce+1, aligns with rs-sdk patterns, and adds regression tests to verify the fix.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the nonce increment bug: modifying nonce calculation, adding tokio dev-dependency for tests, and including regression test coverage.
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

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

@lklimek lklimek requested a review from thephez February 16, 2026 19:24
@lklimek
Copy link
Contributor Author

lklimek commented Feb 16, 2026

@thephez please confirm that this has solved your issue

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