[Soroban/Escrow] Add merchant cancellation before funding#168
[Soroban/Escrow] Add merchant cancellation before funding#168chiemezie1 wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe escrow contract adds a cancelled lifecycle state, a cancellation event, and new entrypoints for creating, funding, and canceling pending escrows. Integration tests cover merchant cancellation before funding and rejection after funding. ChangesEscrow lifecycle extension
Sequence Diagram(s)sequenceDiagram
participant Seller
participant Buyer
participant Merchant
participant EscrowContract
Seller->>EscrowContract: create_escrow(...)
EscrowContract-->>Seller: escrow_id
Buyer->>EscrowContract: fund_escrow(escrow_id, buyer)
EscrowContract-->>Buyer: status = Funded
Merchant->>EscrowContract: cancel_before_funding(escrow_id, reason)
alt EscrowStatus::Created
EscrowContract-->>Merchant: status = Cancelled + EscrowCancelledEvent
else EscrowStatus::Funded
EscrowContract-->>Merchant: EscrowError::InvalidStatus
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contracts/escrow/src/integration_tests.rs`:
- Around line 137-141: The escrow integration tests use `symbol_short!` with the
reason string `merchant_cancelled`, which exceeds the short-symbol length limit
and will fail to compile. Update the affected `cancel_before_funding` call sites
in `integration_tests.rs` to use `Symbol::new(&t.env, ...)` for the full reason
string, or shorten the reason to a valid short symbol consistently at all three
occurrences so the test code compiles.
In `@contracts/escrow/src/lib.rs`:
- Around line 75-78: The EscrowCancelledEvent schema is inconsistent with the
other escrow events because escrow_id uses BytesN<32> instead of the standard
u64. Update EscrowCancelledEvent to match the existing event schema used by the
other escrow event structs and ensure any construction/emission sites in the
escrow module use the same escrow_id type and value shape so downstream
consumers can treat cancellation events uniformly.
- Around line 525-526: The pending escrow timeout is being fixed too early in
create_escrow, so a buyer can later fund an already-expired escrow and
immediately hit the refund path. Update the escrow flow around create_escrow and
deposit so the timeout is anchored when funds are actually deposited, or
validate and reject expired pending escrows before any transfer happens. Use the
existing EscrowRecord, timeout_ledger, and deposit logic to keep the current
behavior while preventing stale pending escrows from being funded.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: acc6ed60-c772-482e-b014-d06a9fe604ff
📒 Files selected for processing (2)
contracts/escrow/src/integration_tests.rscontracts/escrow/src/lib.rs
|
make the ci checks pass and fix all critical and major issues from code rabit |
|
Fix the failing ci |
|
Please resolve conflicts |
[Soroban/Escrow] Add Admin Getter for Current Arbiter
Description
AdminViewcontract type to lib.rsget_admin_viewgetter to return:Closes: [Soroban/Escrow] Add Admin Getter for Current Arbiter #94
Summary by CodeRabbit
New Features
Bug Fixes
Tests