Skip to content

Backport v1.0.0 delayed fix - #247

Merged
bidzyyys merged 20 commits into
mainfrom
backport/release-v1.0.0-delayed-fix
Mar 10, 2026
Merged

Backport v1.0.0 delayed fix#247
bidzyyys merged 20 commits into
mainfrom
backport/release-v1.0.0-delayed-fix

Conversation

@ericnordelo

@ericnordelo ericnordelo commented Mar 9, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • API Changes

    • Updated delayed transfer wrap function to accept a recipient address parameter and transfer the wrapper directly to the recipient instead of returning it to the caller.
  • Documentation

    • Updated delayed transfer documentation to reflect the new function signature and ownership transfer flow.
  • Chores

    • Added published version metadata for mainnet environments.
    • Updated audit reference links to use new directory naming conventions.

Bridgerz and others added 20 commits December 18, 2025 09:32
* Add test flah to test files

* Add #[test_only] tag in test modules

---------

Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com>
* 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>
* 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
* 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

* 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>
)

* 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

* ref: apply suggestions from code review

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

---------

Co-authored-by: Nenad <nenad.misic@openzeppelin.com>
Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
* 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 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: 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: doc comments consistency

* feat: apply review suggestions

* fix: coderabbit suggestions

* feat: remove double empty lines

* feat: update doc comment
* 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

* feat: apply review uppdates

* feat: update version

* feat: update SECURITY
* 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
@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown

Walkthrough

This pull request updates the delayed transfer API to require an explicit recipient parameter in the wrap function, transferring the wrapper directly to that recipient instead of returning it. Corresponding test infrastructure is refactored from manual TxContext handling to test_scenario pattern, and documentation is updated accordingly. Auto-generated published metadata files are added for two modules.

Changes

Cohort / File(s) Summary
Delayed Transfer API
contracts/access/sources/ownership_transfer/delayed.move
wrap function signature changed to accept recipient: address parameter and transfer the wrapper to that address instead of returning DelayedTransferWrapper<T>; WrapExecuted event updated to report recipient as owner instead of ctx.sender().
Test Infrastructure Refactoring
contracts/access/tests/delayed_tests.move
Migrated test framework from manual TxContext construction to test_scenario workflow; removed dummy_ctx_with_sender helper; replaced mutable context operations with test_scenario::begin(), test.ctx(), test.next_tx(), and test.take_from_sender() patterns throughout test suite.
Documentation Updates
CHANGELOG.md, contracts/access/README.md
Updated documentation to reflect new wrap function signature, ownership flow, and event emissions in delayed transfer module.
Published Metadata
contracts/access/Published.toml, math/core/Published.toml
Auto-generated published version metadata files for mainnet containing chain-id, published-at, original-id, version, toolchain-version, build-config, and upgrade-capability.
Audit Directory References
audits/README.md
Updated link targets to use 2026-03 directory naming instead of 2026-3 in two rows (v1.0.0 and PR183 entries).
Math Test Optimization
math/core/tests/macros/math_ops.move
Replaced 512-bit division helper (u512::div_rem_u256) with direct u256-space arithmetic for computing baseline and remainder values in mul_div_wide test cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Backport release v1.0.0 to main #211: Directly modifies wrap function in the same file to return DelayedTransferWrapper<T>, while this PR alters the same function to accept recipient and transfer the wrapper—opposite directional changes to the same API.
  • ref: ownership transfer wrappers #47: Introduces the initial DelayedTransferWrapper and wrap implementation; this PR significantly alters that API to change ownership transfer semantics.
  • ref: naming and receiver syntax #123: Also modifies delayed transfer wrapper API and related test patterns, affecting wrapper operations and custody transfer logic.

Suggested reviewers

  • 0xNeshi
  • immrsd
  • bidzyyys

🐰 A wrapper finds its home with care,
No longer waiting in the air,
Direct to recipient it goes,
While tests now dance through scenarios,
A cleaner flow, the code now knows! 🎀

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, missing required sections like context, purpose, and PR checklist items. Add a comprehensive description covering the changes (delayed_transfer wrap API change), the reason for the backport, and complete the PR checklist with information about tests and documentation updates.
Title check ❓ Inconclusive The title 'Backport v1.0.0 delayed fix' is vague and generic, using non-descriptive terms that don't clearly convey the specific nature of the changes. Provide a more specific title that describes the main API change, such as 'Update wrap function to accept recipient parameter and transfer wrapper' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 backport/release-v1.0.0-delayed-fix

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

@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.74%. Comparing base (0087566) to head (de28655).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #247   +/-   ##
=======================================
  Coverage   89.74%   89.74%           
=======================================
  Files          19       19           
  Lines        1785     1785           
  Branches      484      484           
=======================================
  Hits         1602     1602           
  Misses        168      168           
  Partials       15       15           
Flag Coverage Δ
contracts/access 44.87% <100.00%> (ø)
math/core 86.12% <ø> (ø)
math/fixed_point 57.96% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
contracts/access/tests/delayed_tests.move (1)

492-519: ⚠️ Potential issue | 🟡 Minor

Make the fallback cleanup path actually reachable.

These helpers still try to unwrap at t = 1 even though the wrappers were created with a 5ms delay. If the expected return_val abort ever regresses, the test will fail with EDelayNotElapsed instead of the invariant you're trying to check.

Proposed fix
 fun expect_return_wrong_wrapper(
     mut first: delayed_transfer::DelayedTransferWrapper<DummyCap>,
     mut second: delayed_transfer::DelayedTransferWrapper<DummyCap>,
     ctx: &mut TxContext,
 ) {
     let (obj, token) = first.borrow_val();
     second.return_val(obj, token);

     let mut clk = clock::create_for_testing(ctx);
     clk.set_for_testing(1);
     first.schedule_unwrap(&clk, ctx);
     second.schedule_unwrap(&clk, ctx);
+    clk.set_for_testing(6);
     let cap_first = first.unwrap(&clk, ctx);
     let DummyCap { id } = cap_first;
     id.delete();
     let cap_second = second.unwrap(&clk, ctx);
     let DummyCap { id } = cap_second;
@@
 fun expect_return_wrong_object(
     mut wrapper: delayed_transfer::DelayedTransferWrapper<DummyCap>,
     ctx: &mut TxContext,
 ) {
     let (borrowed, token) = wrapper.borrow_val();
@@
     let mut clk = clock::create_for_testing(ctx);
     clk.set_for_testing(1);
     wrapper.schedule_unwrap(&clk, ctx);
+    clk.set_for_testing(6);
     let obj = wrapper.unwrap(&clk, ctx);
     let DummyCap { id } = obj;
     id.delete();
     clock::destroy_for_testing(clk);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@contracts/access/tests/delayed_tests.move` around lines 492 - 519, The test
sets the test clock to 1ms but the DelayedTransferWrapper instances were created
with a 5ms delay, so the fallback cleanup path is never reached and the test can
abort with EDelayNotElapsed; update the test's clock advances (calls to
clock::create_for_testing(...); clk.set_for_testing(...)) in
expect_return_wrong_object (and similar places in the file where you call
schedule_unwrap/unwrap on delayed_transfer::DelayedTransferWrapper<DummyCap>) to
a value >= the configured 5ms delay (e.g., 5 or 6) so schedule_unwrap and unwrap
run the fallback path and the intended invariant is exercised.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@contracts/access/tests/delayed_tests.move`:
- Around line 492-519: The test sets the test clock to 1ms but the
DelayedTransferWrapper instances were created with a 5ms delay, so the fallback
cleanup path is never reached and the test can abort with EDelayNotElapsed;
update the test's clock advances (calls to clock::create_for_testing(...);
clk.set_for_testing(...)) in expect_return_wrong_object (and similar places in
the file where you call schedule_unwrap/unwrap on
delayed_transfer::DelayedTransferWrapper<DummyCap>) to a value >= the configured
5ms delay (e.g., 5 or 6) so schedule_unwrap and unwrap run the fallback path and
the intended invariant is exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2d5086e5-4fd5-4821-ae67-41b503e97ff7

📥 Commits

Reviewing files that changed from the base of the PR and between 0087566 and de28655.

⛔ Files ignored due to path filters (4)
  • audits/2026-03-PR183.pdf is excluded by !**/*.pdf
  • audits/2026-03-v1.0.0.pdf is excluded by !**/*.pdf
  • contracts/access/Move.lock is excluded by !**/*.lock
  • math/core/Move.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • CHANGELOG.md
  • audits/README.md
  • contracts/access/Published.toml
  • contracts/access/README.md
  • contracts/access/sources/ownership_transfer/delayed.move
  • contracts/access/tests/delayed_tests.move
  • math/core/Published.toml
  • math/core/tests/macros/math_ops.move

@immrsd immrsd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@bidzyyys
bidzyyys merged commit 1426e0a into main Mar 10, 2026
14 checks passed
@bidzyyys
bidzyyys deleted the backport/release-v1.0.0-delayed-fix branch March 10, 2026 00:27
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.

6 participants