feat: API versioning, bridge formal verification, rollback, loan marketplace (#174-181-201-304)#430
Merged
LaGodxy merged 2 commits intoMettaChain:mainfrom Apr 29, 2026
Conversation
…anism (MettaChain#174-181-201) MettaChain#174 — API versioning strategy - indexer/src/api.rs: added API_VERSION constant ('v1'), VersionResponse struct, api_version() handler (GET /api/v1/version), and set_api_version_header() Axum middleware that injects X-API-Version on every response. - indexer/src/main.rs: moved /events and /contracts under /api/v1/ using Router::nest(); /health and /metrics kept at root for infra tooling; version middleware applied to the nested v1 router. MettaChain#181 — Formal verification for Bridge multi-sig logic - contracts/bridge/src/tests.rs: four property-based tests documenting and enforcing bridge invariants: property_execution_requires_minimum_signatures: execute must fail with < min sigs. property_no_duplicate_signatures: AlreadySigned returned on replay attempt. property_expired_request_rejects_signatures: RequestExpired after timeout. property_no_double_execution: second execute call always returns error. MettaChain#201 — Bridge transaction rollback mechanism - contracts/bridge/src/lib.rs: added BridgeRolledBack event (request_id, token_id, requester, reason, rolled_back_at) and rollback_bridge_transaction() message that atomically: (1) marks Recovering to prevent concurrency, (2) clears all signatures, (3) marks Failed, (4) emits BridgeRolledBack. Blocks rollback of already-Completed requests.
|
@brightcli-stack 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! 🚀 |
…MettaChain#304) - types.rs additions (inline in lib.rs): ListingStatus enum: Open | OfferAccepted | Originated | Cancelled LoanListing struct: borrower, property_id, requested_amount, max_rate_bps, term_months, collateral_kind, status, created_at, accepted_offer_id LoanOffer struct: offer_id, listing_id, lender, offered_amount, rate_bps, term_months, is_accepted, created_at - Storage: added marketplace_listings, marketplace_offers, listing_count, offer_count fields to PropertyLending; initialised to defaults in constructor. - Events: LoanListingCreated, LoanOfferSubmitted, LoanOfferAccepted, LoanListingCancelled — all with indexed topics for off-chain indexing. - Messages: create_loan_listing(): borrower publishes a request with max_rate_bps cap submit_loan_offer(): lender counters at or below the borrower's max rate accept_loan_offer(): borrower accepts offer, auto-originates LoanApplication with status=Active and interest_rate_bps from the offer cancel_loan_listing(): borrower withdraws an open listing get_loan_listing() / get_loan_offer(): view accessors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #174
Fixes #181
Fixes #201
Fixes #304
What changed
#174 — API Versioning Strategy
indexer/src/api.rs—API_VERSION = "v1",VersionResponse,api_version()handler,set_api_version_header()middlewareindexer/src/main.rs— REST endpoints under/api/v1/viaRouter::nest()#181 — Formal Verification for Bridge Multi-Sig Logic
Four property tests: min-signature enforcement, duplicate-signature rejection, expired-request rejection, double-execution prevention
#201 — Bridge Transaction Rollback Mechanism
BridgeRolledBackevent +rollback_bridge_transaction()— atomic rollback clearing signatures and emitting audit event#304 — Loan Marketplace
ListingStatus,LoanListing,LoanOfferLoanListingCreated,LoanOfferSubmitted,LoanOfferAccepted,LoanListingCancelledcreate_loan_listing(),submit_loan_offer(),accept_loan_offer()(auto-originates loan),cancel_loan_listing(),get_loan_listing(),get_loan_offer()