Skip to content

Jobsunday002 fixes - #572

Merged
legend-esc merged 4 commits into
legend-esc:mainfrom
josunday002:jobsunday002-fixes
Jul 26, 2026
Merged

Jobsunday002 fixes#572
legend-esc merged 4 commits into
legend-esc:mainfrom
josunday002:jobsunday002-fixes

Conversation

@josunday002

Copy link
Copy Markdown
Contributor

closes #531
closes #532
closes #533
closes #534
Why this matters now: DataKey::CreditApprovals(credit_id) stores Vec of all verifiers who approved. With 50 registered verifiers and 3 approvals required, this Vec grows to 50 addresses (1.6KB) per credit. Iterating and checking membership in approve_and_mint wastes gas. A bitmap (50 bits = 8 bytes) is 200x smaller.

Problem / What: contracts/credit_registry/src/storage.rs — get_credit_approvals returns Vec. The approvals.contains(&verifier) check in approve_and_mint is O(n).

Why this matters now: Frontend receives 400 Bad Request with { message: "Invalid tonnes" } but has no way to distinguish this from other validation errors. Can't show localized error messages or context-specific retry guidance. Structured errors enable better UX.

Problem / What: api/src/ uses NestJS's default exception handling which returns unstructured error messages. Need standardized error response: { code: string, message: string, details?: object }.

Additive helper module for O(1) approval checks and 8-byte storage
instead of a 1.6KB Vec<Address> for 50 verifiers. Not yet wired into
approve_and_mint.
Verifies admin initialization and credit_registry->retirement wiring
via the Soroban CLI, complementing the existing HTTP-only smoke test.
Standalone shimmer skeleton to show while GET /api/v1/credits is in
flight, avoiding a blank screen during the 1-2s initial fetch.
Additive NestJS ExceptionFilter returning { code, message, details }
instead of the default unstructured body, enabling localized/
context-specific frontend error handling.
@josunday002
josunday002 requested a review from legend-esc as a code owner July 25, 2026 00:58
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

@legend-esc
legend-esc merged commit 15d51a5 into legend-esc:main Jul 26, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment