Skip to content

Implement cross-chain bridge payment relay for invoices #343

Description

@Kingsman-99

Overview

Add support for accepting invoice payments relayed from other chains (e.g. Ethereum, Solana) via a trusted bridge contract. The StellarSplit contract must verify a signed relay proof before crediting the payment, so no funds can be injected without a valid cross-chain attestation.

Requirements

  • Define a bridge_pay entry point that accepts a relay proof struct (BridgeProof) containing: source chain ID, source tx hash, sender address bytes, amount, and a bridge authority signature
  • Verify the signature against a stored bridge_authority admin key before crediting
  • Emit a BridgePaymentReceived event with full proof metadata
  • Integrate with the existing payment flow — trigger auto-release if the invoice becomes fully funded
  • Reject replayed proofs (store consumed tx hashes)
  • Write unit tests covering: valid relay, invalid signature, replayed proof, wrong invoice, wrong amount

Acceptance Criteria

  • bridge_pay entry point implemented and callable
  • Signature verification passes for valid proofs and rejects tampered ones
  • Replay protection: second call with same tx hash panics with AlreadyConsumed
  • Auto-release triggers correctly when bridge payment fully funds an invoice
  • All existing tests continue to pass
  • New tests cover all acceptance criteria above
  • cargo test --workspace passes with zero failures
  • cargo clippy --all-targets -- -D warnings produces zero warnings

Definition of Done

All CI checks must pass before the PR is reviewed. PRs with failing tests or clippy warnings will not be merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaigncomplexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operationgrantfoxIssue for GrantFox program

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions