Skip to content

feat(fx-engine): add cross-rate batch-ID validation - #433

Merged
therealjhay merged 2 commits into
Betta-Pay:mainfrom
lightnoor890:feat/cross-rate-batch-validation
Jul 30, 2026
Merged

feat(fx-engine): add cross-rate batch-ID validation#433
therealjhay merged 2 commits into
Betta-Pay:mainfrom
lightnoor890:feat/cross-rate-batch-validation

Conversation

@lightnoor890

Copy link
Copy Markdown
Contributor
  • Attach rateBatchId (UUID) to every rate from a fetch cycle
  • Validate both source rates share same batch ID when computing cross-rates
  • Log warning when mixed batches used; error if one rate missing
  • Include rateBatchId in quote response, stored quote, and fxQuoteSchema
  • Add 3 tests: same batch, different batches, missing rate

Description

Please include a clear, concise summary of the changes introduced by this pull request. Explain the rationale behind the solution, any design trade-offs made, and context on how the changes achieve the goal.

Fixes / Closes: # (issue number)


Type of Change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring / Performance (clean-up or performance optimization without behavioral changes)
  • Documentation / CI (changes to docs, workflows, config files)

Verification & Test Plan

Please outline how you verified these changes. Include steps to reproduce, test scripts, or command logs where applicable.

Automated Tests

For example: cargo test in contract package, pnpm test in backend.

# Provide the commands run to test the code

Manual Verification


Sub-System Checklist

1. Smart Contracts (BettaPay-Contract)

  • Code compiles without warnings (cargo build --release --target wasm32-unknown-unknown)
  • Cargo test suite passes locally (cargo test)
  • Emits events for state changes
  • Implemented proper authorization controls (auth.require_auth())

2. Backend Services (BettaPay-Backend)

  • Prisma models updated and migrated (if database schema changes)
  • Zod validation checks added/updated
  • API routes and services build successfully (pnpm build)
  • Local env variables updated in .env.example

3. Frontend Dashboard (BettaPay-Frontend)

  • Local build completes successfully (pnpm build)
  • Focus states, labels, and aria attributes tested for accessibility
  • No regression on styling or components
  • Env parameters documented in .env.local

Checklist

- Attach rateBatchId (UUID) to every rate from a fetch cycle
- Validate both source rates share same batch ID when computing cross-rates
- Log warning when mixed batches used; error if one rate missing
- Include rateBatchId in quote response, stored quote, and fxQuoteSchema
- Add 3 tests: same batch, different batches, missing rate
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

@therealjhay

Copy link
Copy Markdown
Contributor

kindly resolve conflicts

@therealjhay
therealjhay merged commit d495345 into Betta-Pay:main Jul 30, 2026
1 of 2 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.

Add cross-rate batch-ID validation to prevent mixed-cycle rate computation

2 participants