Skip to content

fix(N-01): Missing Event Emission on State Change#159

Merged
0xNeshi merged 26 commits intorelease-v1.0.0from
fix/audit-n-01-v2
Feb 18, 2026
Merged

fix(N-01): Missing Event Emission on State Change#159
0xNeshi merged 26 commits intorelease-v1.0.0from
fix/audit-n-01-v2

Conversation

@0xNeshi
Copy link
Copy Markdown
Collaborator

@0xNeshi 0xNeshi commented Feb 16, 2026

Resolves #141

PR Checklist

  • Tests
  • Documentation
  • Changelog

@0xNeshi 0xNeshi self-assigned this Feb 16, 2026
Copilot AI review requested due to automatic review settings February 16, 2026 08:43
@0xNeshi 0xNeshi linked an issue Feb 16, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 16, 2026

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
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/audit-n-01-v2

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses issue #141 by adding missing event emissions for state-changing operations in the two-step transfer module. The changes enhance observability and auditability by ensuring all significant state changes emit corresponding events.

Changes:

  • Added three new event structs: OwnershipTransferRejected, ObjectWrapped, and ObjectUnwrapped
  • Updated wrap(), unwrap(), and reject() functions to emit events on state changes
  • Modified function signatures to accept TxContext parameter where needed for event emission
  • Updated all test cases and helper functions to accommodate the new signatures
  • Added test coverage for ObjectWrapped and ObjectUnwrapped event emissions

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
contracts/access/sources/ownership_transfer/two_step.move Added event structs for reject/wrap/unwrap operations, added event emissions in respective functions, updated function signatures to accept TxContext, added test helpers for new events
contracts/access/tests/two_step_tests.move Updated all function calls to pass TxContext parameter, added comprehensive test for wrap/unwrap event emissions, renamed test function for clarity
contracts/access/Move.lock Automatic lock file regeneration with updated Move toolchain version (v3 to v4) and dependency revisions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contracts/access/sources/ownership_transfer/two_step.move Outdated
Comment thread contracts/access/sources/ownership_transfer/two_step.move Outdated
Comment thread contracts/access/tests/two_step_tests.move
Copilot AI review requested due to automatic review settings February 16, 2026 11:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contracts/access/tests/delayed_tests.move Outdated
Comment thread contracts/access/tests/delayed_tests.move
@0xNeshi 0xNeshi changed the title Fix/audit n 01 v2 N-01: Missing Event Emission on State Change Feb 16, 2026
Comment thread contracts/access/sources/ownership_transfer/delayed.move
Copilot AI review requested due to automatic review settings February 16, 2026 12:25
@0xNeshi 0xNeshi marked this pull request as ready for review February 16, 2026 12:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contracts/access/sources/ownership_transfer/two_step.move
Comment thread contracts/access/sources/ownership_transfer/two_step.move Outdated
Comment thread contracts/access/tests/delayed_tests.move
@bidzyyys bidzyyys changed the title N-01: Missing Event Emission on State Change fix(N-01): Missing Event Emission on State Change Feb 16, 2026
Copy link
Copy Markdown
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Looking good @0xNeshi. Left a couple of comments.

Comment thread contracts/access/sources/ownership_transfer/delayed.move
Comment thread contracts/access/sources/ownership_transfer/delayed.move
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

LGTM!

Copilot AI review requested due to automatic review settings February 17, 2026 15:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md
Copy link
Copy Markdown
Collaborator

@immrsd immrsd left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread contracts/access/sources/ownership_transfer/delayed.move
@0xNeshi 0xNeshi merged commit 94d9795 into release-v1.0.0 Feb 18, 2026
10 checks passed
@0xNeshi 0xNeshi deleted the fix/audit-n-01-v2 branch February 18, 2026 10:45
ericnordelo added a commit that referenced this pull request Mar 5, 2026
* ref: naming and receiver syntax (#123)

* Add test flag to test files (#122)

* Add test flah to test files

* Add #[test_only] tag in test modules

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>

* fix(H-01): reminder issue in div_rem (#151)

* fix: reminder issue in div_rem

* fix: docstring

* ref: apply suggestions from code review

Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>

* fix: fmt

* ref: apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>

* Remove explicit u256 type

* feat: update CHANGELOG

---------

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>
Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: immrsd <immrsd.eth@gmail.com>

* fix(N-01): Missing Event Emission on State Change (#159)

* emit objectwrapped on wrap

* emit objectunwrapped on unwrap

* requester to owner

* emit OwnershipTransferRejected on reject

* call uid_to_inner on id directly

* tests: fix

* test: add ObjectUnwrapped assertions

* test: include wrap flow in unwrap test

* test: corrent event in reject_destroys_request

* ref: remove Published.toml

* feat: emit PendingTransferCancelled on cancel_schedule

* fix: new event doc

* feat: emit ObjectWrapped on delayed_transfer::wrap

* ref: formatting

* doc: fix comment above OwnershipTransferRejected

* test: assert exact PendingTransferCancelled event data in cancel_allows_reschedule

* ref: move ObjectWrapped to events section

* test: add ObjectWrapped data assertion to wrap_emits_events

* test: extract inlined code into local variable expected_event

* ref: reorder objectwrapped events

* feat: remove current_owner from OwnershipTransferRejected

* test: ref wrap_emits_events

* feat: remove ctx from two_step_transfer::reject

* chore: update changelog

* fix: rename ObjectWrapped->WrapExecuted & ObjectUnwrapped->UnwrapExecuted

* fix: use &mut TxContext in two_step_transfer::unwrap (#169)

* build: set explicit default prettier move values

* build: gitignore .vscode

* build: add comment about why vscode is ignored

* test: rename test_new_object_wrapped->test_new_wrap_executed

* test: rename test_new_object_unwrapped->test_new_unwrap_executed

* build: add missing newline to .prettierrc

* Revert "build: add missing newline to .prettierrc"

This reverts commit 2f84812.

* Revert "build: add comment about why vscode is ignored"

This reverts commit 37948ab.

* Revert "build: gitignore .vscode"

This reverts commit c5e1c30.

* Revert "build: set explicit default prettier move values"

This reverts commit 1674a18.

* fix: use &mut TxContext in unwrap

* build: revert .prettierrc

* chore: add missing changelog entry

* build(ci): trigger CI jobs on release branches (#173)

* build(ci): trigger CI jobs on release branches

* fix: lint after N-01 fix

* build(ci): update Sui version in CI jobs

* fix: apply linter suggestions

* ref: Update math/core/tests/macros_tests.move

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci: triggers no longer apply to v* branches (#176)

* fix(L-01): inaccurate data emitted in events (#174)

* fix(L-02): Emit Dedicated UnwrapExecuted Event on delayed > unwrap (#168)

* feat: emit UnwrapExecuted on delayed > unwrap

* test: rename test_new_object_wrapped->test_new_wrap_executed

* Revert "test: rename test_new_object_wrapped->test_new_wrap_executed"

This reverts commit 7b3129a.

* chore: changelog

* feat: add object_id to UnwrapExecuted

* ref: revert change to prettierrc

* fix: linter

* chore: Move changelog entry to Breaking Changes

* chore: Update CHANGELOG title name for breaking change

Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>

* ref: invoke uid_to_inner as a method on struct

---------

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>

* fix(N-08): unhandled overflow in safe_downcast_balance (#172)

* fix(N-08): unhandled overflow in safe_downcast_balance

* ref: apply suggestions from code review

Co-authored-by: Nenad <nenad.misic@openzeppelin.com>

---------

Co-authored-by: Nenad <nenad.misic@openzeppelin.com>

* Fix N-09 audit issue (#161)

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>

* Remove unnecessary destroy_none call (#162)

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>

* fix(N-06): Incorrect Documentation (#187)

* fix: doc comments

* Update math/core/sources/u512.move

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(N-03): code convention improvements (#163)

* Fix function params order in delayed module

* Fix error codes in two_step module

* Support function params order changes in tests

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>

* docs(N-04): add missing docs + fix existing docs (#175)

* docs: add missing docs + fix existing

* docs: add missing doc update to u256::mul_div

* build: revert prettier change

* docs: align u16 module docs

* docs: align all inv_mod docs

* docs: remove term 'helper' for math functions

* docs: align formatting in u16.move

---------

Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>
Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>

* fix(N-05): Code and Documentation Inconsistencies (#188)

* fix: doc comments consistency

* feat: apply review suggestions

* fix: coderabbit suggestions

* feat: remove double empty lines

* feat: update doc comment

* ref: Two Step Transfer (and Delayed) improvements (#183)

* feat: add main logic and doc entries

* feat: update wording around caps

* feat: use string literals

* fix: typos

* feat: apply review updates

* feat: rename struct member

* feat: use doc comment format for the library

* feat: add ability constraints to pending request

* feat: add security notes for shared object missue

* feat: format files

* feat: apply review updates

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>

* feat: add relase info

* Add v1.0.0 release info (#210)

* feat: add relase info

* feat: apply review uppdates

* feat: update version

* feat: update SECURITY

* docs: unify docs for math library (#212)

* feat: update locks

* feat: apply coderabbit suggestions

---------

Co-authored-by: Bridgerz <bridgerzoske@gmail.com>
Co-authored-by: Cove Marquis-Bortoli <44323490+CoveMB@users.noreply.github.com>
Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: immrsd <immrsd.eth@gmail.com>
Co-authored-by: Nenad <nenad.misic@openzeppelin.com>
bidzyyys added a commit that referenced this pull request Mar 10, 2026
* ref: naming and receiver syntax (#123)

* Add test flag to test files (#122)

* Add test flah to test files

* Add #[test_only] tag in test modules

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>

* fix(H-01): reminder issue in div_rem (#151)

* fix: reminder issue in div_rem

* fix: docstring

* ref: apply suggestions from code review

Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>

* fix: fmt

* ref: apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>

* Remove explicit u256 type

* feat: update CHANGELOG

---------

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>
Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: immrsd <immrsd.eth@gmail.com>

* fix(N-01): Missing Event Emission on State Change (#159)

* emit objectwrapped on wrap

* emit objectunwrapped on unwrap

* requester to owner

* emit OwnershipTransferRejected on reject

* call uid_to_inner on id directly

* tests: fix

* test: add ObjectUnwrapped assertions

* test: include wrap flow in unwrap test

* test: corrent event in reject_destroys_request

* ref: remove Published.toml

* feat: emit PendingTransferCancelled on cancel_schedule

* fix: new event doc

* feat: emit ObjectWrapped on delayed_transfer::wrap

* ref: formatting

* doc: fix comment above OwnershipTransferRejected

* test: assert exact PendingTransferCancelled event data in cancel_allows_reschedule

* ref: move ObjectWrapped to events section

* test: add ObjectWrapped data assertion to wrap_emits_events

* test: extract inlined code into local variable expected_event

* ref: reorder objectwrapped events

* feat: remove current_owner from OwnershipTransferRejected

* test: ref wrap_emits_events

* feat: remove ctx from two_step_transfer::reject

* chore: update changelog

* fix: rename ObjectWrapped->WrapExecuted & ObjectUnwrapped->UnwrapExecuted

* fix: use &mut TxContext in two_step_transfer::unwrap (#169)

* build: set explicit default prettier move values

* build: gitignore .vscode

* build: add comment about why vscode is ignored

* test: rename test_new_object_wrapped->test_new_wrap_executed

* test: rename test_new_object_unwrapped->test_new_unwrap_executed

* build: add missing newline to .prettierrc

* Revert "build: add missing newline to .prettierrc"

This reverts commit 2f84812.

* Revert "build: add comment about why vscode is ignored"

This reverts commit 37948ab.

* Revert "build: gitignore .vscode"

This reverts commit c5e1c30.

* Revert "build: set explicit default prettier move values"

This reverts commit 1674a18.

* fix: use &mut TxContext in unwrap

* build: revert .prettierrc

* chore: add missing changelog entry

* build(ci): trigger CI jobs on release branches (#173)

* build(ci): trigger CI jobs on release branches

* fix: lint after N-01 fix

* build(ci): update Sui version in CI jobs

* fix: apply linter suggestions

* ref: Update math/core/tests/macros_tests.move

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci: triggers no longer apply to v* branches (#176)

* fix(L-01): inaccurate data emitted in events (#174)

* fix(L-02): Emit Dedicated UnwrapExecuted Event on delayed > unwrap (#168)

* feat: emit UnwrapExecuted on delayed > unwrap

* test: rename test_new_object_wrapped->test_new_wrap_executed

* Revert "test: rename test_new_object_wrapped->test_new_wrap_executed"

This reverts commit 7b3129a.

* chore: changelog

* feat: add object_id to UnwrapExecuted

* ref: revert change to prettierrc

* fix: linter

* chore: Move changelog entry to Breaking Changes

* chore: Update CHANGELOG title name for breaking change

Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>

* ref: invoke uid_to_inner as a method on struct

---------

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>

* fix(N-08): unhandled overflow in safe_downcast_balance (#172)

* fix(N-08): unhandled overflow in safe_downcast_balance

* ref: apply suggestions from code review

Co-authored-by: Nenad <nenad.misic@openzeppelin.com>

---------

Co-authored-by: Nenad <nenad.misic@openzeppelin.com>

* Fix N-09 audit issue (#161)

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>

* Remove unnecessary destroy_none call (#162)

Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>

* fix(N-06): Incorrect Documentation (#187)

* fix: doc comments

* Update math/core/sources/u512.move

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(N-03): code convention improvements (#163)

* Fix function params order in delayed module

* Fix error codes in two_step module

* Support function params order changes in tests

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>

* docs(N-04): add missing docs + fix existing docs (#175)

* docs: add missing docs + fix existing

* docs: add missing doc update to u256::mul_div

* build: revert prettier change

* docs: align u16 module docs

* docs: align all inv_mod docs

* docs: remove term 'helper' for math functions

* docs: align formatting in u16.move

---------

Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>
Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>

* fix(N-05): Code and Documentation Inconsistencies (#188)

* fix: doc comments consistency

* feat: apply review suggestions

* fix: coderabbit suggestions

* feat: remove double empty lines

* feat: update doc comment

* ref: Two Step Transfer (and Delayed) improvements (#183)

* feat: add main logic and doc entries

* feat: update wording around caps

* feat: use string literals

* fix: typos

* feat: apply review updates

* feat: rename struct member

* feat: use doc comment format for the library

* feat: add ability constraints to pending request

* feat: add security notes for shared object missue

* feat: format files

* feat: apply review updates

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>

* Add v1.0.0 release info (#210)

* feat: add relase info

* feat: apply review uppdates

* feat: update version

* feat: update SECURITY

* Add target to delayed wrapping (#238)

* feat: add relase info

* feat: add target to wrapping

* feat: update comment

* feat: add another test

* feat: add new reports

* feat: add published info

* feat: update CHANGELOG

---------

Co-authored-by: Bridgerz <bridgerzoske@gmail.com>
Co-authored-by: Cove Marquis-Bortoli <44323490+CoveMB@users.noreply.github.com>
Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: immrsd <immrsd.eth@gmail.com>
Co-authored-by: Nenad <nenad.misic@openzeppelin.com>
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.

N-01: Missing Event Emission on State Change

5 participants