Skip to content

fix(wasm-sdk): increment address nonce and add regression tests - #3087

Merged
lklimek merged 3 commits into
fix/wasm-sdk-identity-create-nonce-off-by-onefrom
claude/add-pr-review-tests-23bHI
Feb 16, 2026
Merged

lklimek merged 3 commits into
fix/wasm-sdk-identity-create-nonce-off-by-onefrom
claude/add-pr-review-tests-23bHI

Conversation

@lklimek

@lklimek lklimek commented Feb 16, 2026 •

Copy link
Copy Markdown
Contributor

The fetch_nonces_into_address_map function was returning the current
nonce instead of the next nonce (current + 1), causing
identity_create_from_addresses to send stale nonces to the platform.

Extract merge/validation logic into a separate pure function
(merge_nonces_into_inputs) and add unit tests covering:

  • nonce increment by 1 (the core bug fix)
  • zero nonce edge case
  • multiple addresses
  • exact balance boundary
  • insufficient balance error
  • missing address error
  • empty inputs

https://claude.ai/code/session_01JeHE8B4EuVocsryg6AFZYs

Summary by CodeRabbit

  • Bug Fixes

    • Updated address nonce handling to ensure correct increment behavior.
  • Chores

    • Updated development dependencies.

The fetch_nonces_into_address_map function was returning the current
nonce instead of the next nonce (current + 1), causing
identity_create_from_addresses to send stale nonces to the platform.

Extract merge/validation logic into a separate pure function
(merge_nonces_into_inputs) and add unit tests covering:
- nonce increment by 1 (the core bug fix)
- zero nonce edge case
- multiple addresses
- exact balance boundary
- insufficient balance error
- missing address error
- empty inputs

Closes #3083

https://claude.ai/code/session_01JeHE8B4EuVocsryg6AFZYs
…test

The fetch_nonces_into_address_map function was returning the current
nonce instead of the next nonce (current + 1), causing
identity_create_from_addresses to send stale nonces to the platform.

Add an SDK mock-based test that exercises the full fetch_nonces_into_address_map
function through the mock layer, verifying that returned nonces are
incremented by 1 for each input address.

Closes #3083

https://claude.ai/code/session_01JeHE8B4EuVocsryg6AFZYs
@github-actions github-actions Bot added this to the v3.1.0 milestone Feb 16, 2026
@coderabbitai

coderabbitai Bot commented Feb 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR fixes a bug in the WASM SDK where identity_create_from_addresses was sending the current address nonce instead of the next nonce (current + 1) to the platform. The nonce increment logic in fetch_nonces_into_address_map has been corrected, and regression tests have been added to verify the behavior.

Changes

Cohort / File(s) Summary
Dependency Addition
packages/wasm-sdk/Cargo.toml
Added tokio dev-dependency (version 1.40 with macros and rt-multi-thread features) for test support.
Nonce Increment Bug Fix & Tests
packages/wasm-sdk/src/state_transitions/addresses.rs
Fixed fetch_nonces_into_address_map to increment fetched nonce by 1, aligning with rs-sdk patterns used by transfer, top_up, and withdraw operations. Added regression tests to verify each address receives incremented nonce (current + 1).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A nonce was lost, off by just one,
We hopped through the code until the fix was done,
Now nonces increment, the platform's delight,
Identity creation? Now perfectly right! 🎉

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (3 files):

⚔️ Cargo.lock (content)
⚔️ packages/wasm-sdk/Cargo.toml (content)
⚔️ packages/wasm-sdk/src/state_transitions/addresses.rs (content)

These conflicts must be resolved before merging into fix/wasm-sdk-identity-create-nonce-off-by-one.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing nonce increment in fetch_nonces_into_address_map and adding regression tests.
Linked Issues check ✅ Passed The PR addresses all requirements from issue #3083: increments nonce by 1 in fetch_nonces_into_address_map and adds comprehensive unit and regression tests verifying the nonce increment behavior.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the nonce increment bug and adding test coverage; the tokio dependency addition appears to support the new test infrastructure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/add-pr-review-tests-23bHI

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 changed the base branch from v3.1-dev to fix/wasm-sdk-identity-create-nonce-off-by-one February 16, 2026 19:13
@lklimek
lklimek merged commit 9903eb0 into fix/wasm-sdk-identity-create-nonce-off-by-one Feb 16, 2026
1 check passed
@lklimek
lklimek deleted the claude/add-pr-review-tests-23bHI branch February 16, 2026 19:24
thephez pushed a commit to thephez/platform that referenced this pull request Feb 18, 2026
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