Skip to content

chore(contracts): remove duplicated init definitions and reconcile signature to docs - #302

Merged
greatest0fallt1me merged 5 commits into
CalloraOrg:mainfrom
Ayomisco:fix/vault-duplicate-init
Apr 24, 2026
Merged

chore(contracts): remove duplicated init definitions and reconcile signature to docs#302
greatest0fallt1me merged 5 commits into
CalloraOrg:mainfrom
Ayomisco:fix/vault-duplicate-init

Conversation

@Ayomisco

@Ayomisco Ayomisco commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves the duplicated init definition in the vault contract and reconciles all related signatures, storage keys, and tests to match the documented spec.

Changes

contracts/vault/src/lib.rs

  • Replace all StorageKey::MetaKey with StorageKey::Meta (5 sites) — MetaKey variant does not exist in the enum; this was the root compile-breaking bug
  • Restore get_max_deduct as a private internal helper; it was accidentally removed when deduplicating the entrypoint declarations, but is still called by deduct() and batch_deduct()
  • Add require_not_paused guard to deduct()deposit and batch_deduct both had it; deduct was missing it
  • Remove duplicate require_not_paused call from batch_deduct() (was called twice)
  • Fix deposit event to emit caller as topic1 per EVENT_SCHEMA.md (was emitting only 1 topic; schema specifies 2)

contracts/vault/src/test.rs

  • Flip deduct_while_paused_succeedsdeduct_while_paused_fails with #[should_panic(expected = "vault is paused")]
  • Flip batch_deduct_while_paused_succeedsbatch_deduct_while_paused_fails with #[should_panic(expected = "vault is paused")]
  • Fix duplicate } else { syntax error in property-based fuzz test
  • Update deposit_event_schema_alignment and owner_deposit_increases_balance_and_emits_event to assert 2 topics and verify topic1 is the depositor address
  • Prefix unused variables _settlement, _step_cap (clippy -D warnings clean)

README.md

  • Reconcile init signature to include the initial_balance parameter with description

SECURITY.md

  • Tick [x] on init-guard checklist items
  • Clarify get_max_deduct note: retained as private helper, not removed

Test Results

Closes #243

Ayomisco and others added 5 commits April 23, 2026 21:51
…signature to docs

- Replace all StorageKey::MetaKey references with StorageKey::Meta (5 sites)
- Restore get_max_deduct as private helper (was accidentally removed)
- Add require_not_paused guard to deduct() per pause circuit-breaker spec
- Remove duplicate require_not_paused call from batch_deduct()
- Fix deposit event to emit caller as topic1 per EVENT_SCHEMA.md
- Flip deduct/batch_deduct_while_paused tests to should_panic
- Fix duplicate else block syntax error in property-based test
- Update deposit_event_schema_alignment and owner_deposit tests (1→2 topics)
- Prefix unused variables _settlement, _step_cap (clippy -D warnings clean)
- Reconcile README init signature to include initial_balance param
- Update SECURITY.md: tick init guard checklist items, clarify get_max_deduct
@greatest0fallt1me
greatest0fallt1me merged commit 24eb949 into CalloraOrg:main Apr 24, 2026
0 of 3 checks passed
@Ayomisco
Ayomisco deleted the fix/vault-duplicate-init branch April 25, 2026 15:31
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: remove duplicated init definitions and reconcile signature to docs

2 participants