Backport v1.0.0 delayed fix - #247
Conversation
* 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
…i into backport/release-v1.0.0-delayed-fix
WalkthroughThis pull request updates the delayed transfer API to require an explicit recipient parameter in the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 | 🟡 MinorMake the fallback cleanup path actually reachable.
These helpers still try to unwrap at
t = 1even though the wrappers were created with a5msdelay. If the expectedreturn_valabort ever regresses, the test will fail withEDelayNotElapsedinstead 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
⛔ Files ignored due to path filters (4)
audits/2026-03-PR183.pdfis excluded by!**/*.pdfaudits/2026-03-v1.0.0.pdfis excluded by!**/*.pdfcontracts/access/Move.lockis excluded by!**/*.lockmath/core/Move.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
CHANGELOG.mdaudits/README.mdcontracts/access/Published.tomlcontracts/access/README.mdcontracts/access/sources/ownership_transfer/delayed.movecontracts/access/tests/delayed_tests.movemath/core/Published.tomlmath/core/tests/macros/math_ops.move
Summary by CodeRabbit
API Changes
Documentation
Chores