feat: delego build#272
Conversation
📝 WalkthroughWalkthroughAdds a new ChangesEscrowReceipt Getter
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/lib.rs`:
- Around line 220-237: `EscrowReceipt` in the escrow contract does not match the
requested receipt shape, so `get_receipt` still returns the wrong public
contract. Update the receipt type and the related `deposit`/storage flow so the
contract persists enough creation metadata to return `escrow_id: BytesN<32>`,
`buyer`, `merchant`, `amount`, and `created_at_ledger`. Use the existing
`EscrowReceipt` and `get_receipt` symbols to align the getter output with issue
`#170`, and remove or replace fields like `seller`, `order_id`, and `status` if
they are not part of the wire contract.
In
`@contracts/escrow/test_snapshots/test/test/test_set_create_paused_success.1.json`:
- Around line 6-56: Regenerate the snapshot from the complete success flow
exercised by escrow test setup so it matches the actual behavior of
set_create_paused in contracts/escrow/src/test.rs. The fixture currently mixes
two separate executions by showing only one auth tree for the pair of calls
(true then false), and it must also include the escrow.paused event emitted by
contracts/escrow/src/lib.rs instead of ending with an empty events array. Use
the set_create_paused flow and the escrow.paused emission as the anchors when
updating the fixture so the auth and events reflect the full run.
🪄 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: 224f34db-a51d-41dc-a5c0-4b2fdfa6192b
📒 Files selected for processing (19)
contracts/escrow/src/integration_tests.rscontracts/escrow/src/lib.rscontracts/escrow/test_snapshots/integration_tests/test_get_receipt_disputed_state.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_get_receipt_funded_state.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_get_receipt_not_found.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_get_receipt_refunded_state.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_get_receipt_released_state.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_admin_always_eligible.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_already_refunded.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_already_released.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_buyer_after_timeout.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_buyer_before_timeout.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_disputed.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_not_found.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_seller_always_eligible.1.jsoncontracts/escrow/test_snapshots/integration_tests/test_refund_eligibility_unauthorized_stranger.1.jsoncontracts/escrow/test_snapshots/test/test/test_get_token_not_found.1.jsoncontracts/escrow/test_snapshots/test/test/test_set_create_paused_success.1.jsoncontracts/escrow/test_snapshots/test/test/test_set_create_paused_unauthorized.1.json
| /// Compact receipt returned to buyers after escrow creation via `get_receipt`. | ||
| /// | ||
| /// Fields are a purposeful subset of `EscrowRecord` — callers that need the | ||
| /// full record (amount, token, timeout, …) should use `get_escrow` instead. | ||
| #[contracttype] | ||
| #[derive(Clone, Debug, Eq, PartialEq)] | ||
| pub struct EscrowReceipt { | ||
| /// Numeric escrow identifier (matches the value returned by `deposit`). | ||
| pub escrow_id: u64, | ||
| /// Address of the buyer who funded the escrow. | ||
| pub buyer: Address, | ||
| /// Address of the seller (merchant) who will receive the released funds. | ||
| pub seller: Address, | ||
| /// Merchant-facing order reference embedded at deposit time. | ||
| pub order_id: BytesN<32>, | ||
| /// Current lifecycle status of the escrow. | ||
| pub status: EscrowStatus, | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Align EscrowReceipt with the requested wire contract.
The linked requirement calls for EscrowReceipt { escrow_id: BytesN<32>, buyer, merchant, amount, created_at_ledger }, but this adds { escrow_id: u64, buyer, seller, order_id, status } instead. That means the new public getter still cannot serve the buyer/backend receipt shape requested by issue #170, and deposit only persists created_at as a timestamp, so get_receipt has no way to populate created_at_ledger later. Please adjust the stored creation metadata and return the requested fields here.
Also applies to: 942-965
🤖 Prompt for 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.
In `@contracts/escrow/src/lib.rs` around lines 220 - 237, `EscrowReceipt` in the
escrow contract does not match the requested receipt shape, so `get_receipt`
still returns the wrong public contract. Update the receipt type and the related
`deposit`/storage flow so the contract persists enough creation metadata to
return `escrow_id: BytesN<32>`, `buyer`, `merchant`, `amount`, and
`created_at_ledger`. Use the existing `EscrowReceipt` and `get_receipt` symbols
to align the getter output with issue `#170`, and remove or replace fields like
`seller`, `order_id`, and `status` if they are not part of the wire contract.
| "auth": [ | ||
| [], | ||
| [], | ||
| [], | ||
| [ | ||
| [ | ||
| "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", | ||
| { | ||
| "function": { | ||
| "contract_fn": { | ||
| "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", | ||
| "function_name": "set_create_paused", | ||
| "args": [ | ||
| { | ||
| "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" | ||
| }, | ||
| { | ||
| "bool": true | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "sub_invocations": [] | ||
| } | ||
| ] | ||
| ], | ||
| [], | ||
| [ | ||
| [ | ||
| "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", | ||
| { | ||
| "function": { | ||
| "contract_fn": { | ||
| "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", | ||
| "function_name": "set_create_paused", | ||
| "args": [ | ||
| { | ||
| "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" | ||
| }, | ||
| { | ||
| "bool": false | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "sub_invocations": [] | ||
| } | ||
| ] | ||
| ], | ||
| [] | ||
| ], |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Regenerate this fixture from the full success flow.
contracts/escrow/src/test.rs calls set_create_paused twice (true, then false), but this snapshot only records one auth tree and still ends with "events": [] even though contracts/escrow/src/lib.rs emits escrow.paused on success. The fixture is mixing two executions and no longer matches the exercised behavior.
Also applies to: 314-315
🤖 Prompt for 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.
In
`@contracts/escrow/test_snapshots/test/test/test_set_create_paused_success.1.json`
around lines 6 - 56, Regenerate the snapshot from the complete success flow
exercised by escrow test setup so it matches the actual behavior of
set_create_paused in contracts/escrow/src/test.rs. The fixture currently mixes
two separate executions by showing only one auth tree for the pair of calls
(true then false), and it must also include the escrow.paused event emitted by
contracts/escrow/src/lib.rs instead of ending with an empty events array. Use
the set_create_paused flow and the escrow.paused emission as the anchors when
updating the fixture so the auth and events reflect the full run.
|
Fix failing ci |
|
Please resolve conflicts |
closes #170
Summary by CodeRabbit