Skip to content

[Feature]: Add unit tests for accumulator-dependent spend_vault paths once an AccumulatorRoot test constructor is available #405

Description

@kosedogus

Background

The openzeppelin_allowance::spend_vault module's fund-egress and root-reading paths depend on the Sui funds accumulator. The Move unit-test VM currently cannot construct an AccumulatorRoot, so those paths can't be exercised in the unit suite. This is disclosed in the test suite's testability note; the rest of the module (ledger / cap / event / expiry / exact-value-delivery) is covered.

What unblocks this

create_for_testing for AccumulatorRoot has landed on Sui's sui-v1.74.0-release branch. It ships with 1.74 (not a 1.73 patch). Once we bump SUI_VERSION to 1.74, we can add unit tests for the paths that only need a constructible root:

  • balance_value
  • spendable_now
  • withdraw_all: empty-pool (amount == 0) and owner-gate branches

Remaining gap (separate dependency)

withdraw_all's funded drain reads settled_funds_value, which is only written by the system settlement step that test_scenario does not run, so a unit test can only reach the empty case. That branch stays non-unit-testable until a test-only setter for the settled balance exists. Tracking an upstream request for it:

  • Raise a request for a test-only settled-balance setter, then cover the funded withdraw_all drain

Follow-up

  • Update the testability note in the test suite once the above land

Introduced in #402.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions