Skip to content

vault: finalize request_id event encoding and fix revenue pool logic#215

Closed
Kanasjnr wants to merge 2 commits intoCalloraOrg:mainfrom
Kanasjnr:docs/vault-request-id-events
Closed

vault: finalize request_id event encoding and fix revenue pool logic#215
Kanasjnr wants to merge 2 commits intoCalloraOrg:mainfrom
Kanasjnr:docs/vault-request-id-events

Conversation

@Kanasjnr
Copy link
Copy Markdown
Contributor

Description

This PR addresses several critical issues in the callora-vault contract, focusing on event schema consistencynand achieving 100% test coverage.
Closes #115

Key Changes

  • Event Schema Standardization: Implemented the mandatory 3-topic structure for deduct events. When request_id is not provided, an empty symbol ("") is now emitted as the third topic to ensure indexer stability.
  • Revenue Pool Logic Fix: Corrected the logic in deduct and batch_deduct to properly verify and transfer USDC to the revenue_pool address set during initialization. Previously, the contract was incorrectly looking for a settlement key that was not yet configured.
  • Storage Key Harmonization: Refactored internal state management to use the StorageKey enum across all functions, preventing runtime failures caused by inconsistent raw string keys.
  • Test Suite Updates:
    • Updated all client.init calls to match the new 7-argument signature.
    • Added batch_deduct_events_contains_empty_request_id to verify the new event convention.
    • Fixed authorization in deduct_exceeds_balance_panics to ensure the balance check takes precedence over permission errors.
  • Code Optimization: Removed unused imports (IntoVal), legacy constants (META_KEY, ALLOWED_KEY), and redundant balance checks in the deposit function.
  • Documentation: Resolved merge conflicts in README.md and updated EVENT_SCHEMA.md and UPGRADE.md with the new event encoding standards.

Verification Results

All 59 tests in the callora-vault suite are passing:

cargo test -p callora-vault
# Result: 59 passed; 0 failed

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@Kanasjnr 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

@Kanasjnr
Copy link
Copy Markdown
Contributor Author

@greatest0fallt1me ready for review

@Kanasjnr Kanasjnr closed this by deleting the head repository Mar 30, 2026
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: request_id event encoding (empty symbol convention)

1 participant