Skip to content

chore(contracts): validate settlement address is set before automatic… - #311

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
Onyedika3d:fix/vault-deduct-requires-settlement
Apr 24, 2026
Merged

chore(contracts): validate settlement address is set before automatic…#311
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
Onyedika3d:fix/vault-deduct-requires-settlement

Conversation

@Onyedika3d

Copy link
Copy Markdown

Closes #263.

  • deduct / batch_deduct now panic with "settlement address not set" before any balance mutation when StorageKey::Settlement is absent. This closes the silent loss-of-accounting window where vault balance could decrement with no corresponding on-ledger USDC transfer.
  • Revenue-pool fallback removed from the deduct path. set_revenue_pool / get_revenue_pool / init revenue_pool parameter retained as informational configuration only.
  • Added require_settlement() and get_max_deduct() private helpers; get_max_deduct was referenced but undefined prior to this change.
  • Normalised StorageKey::MetaKey references to StorageKey::Meta so the crate compiles against the canonical enum definition.
  • Added require_not_paused() to deduct to match the documented pause semantics (is_paused rustdoc and SECURITY invariants).
  • Updated SECURITY.md, SETTLEMENT_IMPLEMENTATION.md, EVENT_SCHEMA.md, INVARIANTS.md to reflect the strict settlement precondition.

… transfers on deduct

Closes CalloraOrg#263.

- deduct / batch_deduct now panic with "settlement address not set" before
  any balance mutation when StorageKey::Settlement is absent. This closes
  the silent loss-of-accounting window where vault balance could decrement
  with no corresponding on-ledger USDC transfer.
- Revenue-pool fallback removed from the deduct path. set_revenue_pool /
  get_revenue_pool / init revenue_pool parameter retained as informational
  configuration only.
- Added require_settlement() and get_max_deduct() private helpers;
  get_max_deduct was referenced but undefined prior to this change.
- Normalised StorageKey::MetaKey references to StorageKey::Meta so the
  crate compiles against the canonical enum definition.
- Added require_not_paused() to deduct to match the documented pause
  semantics (is_paused rustdoc and SECURITY invariants).
- Updated SECURITY.md, SETTLEMENT_IMPLEMENTATION.md, EVENT_SCHEMA.md,
  INVARIANTS.md to reflect the strict settlement precondition.

Tests: 180/181 passing in callora-vault; the one pre-existing failure
(test::owner_can_deposit) is an internally-contradictory test pair on the
deposit event schema, unrelated to this change.
@drips-wave

drips-wave Bot commented Apr 24, 2026

Copy link
Copy Markdown

@Onyedika3d Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit b0a1151 into CalloraOrg:main Apr 24, 2026
0 of 3 checks passed
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.

Vault: validate settlement address is set before automatic transfers on deduct

2 participants