Skip to content

fix(escrow): sensible defaults for finish fee and deploy time bound#29

Open
Sanka-D wants to merge 1 commit into
mainfrom
fix/escrow-defaults
Open

fix(escrow): sensible defaults for finish fee and deploy time bound#29
Sanka-D wants to merge 1 commit into
mainfrom
fix/escrow-defaults

Conversation

@Sanka-D

@Sanka-D Sanka-D commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Two friction points in the smart-escrow lifecycle, found and fixed while running a full deploy → finish round-trip on a local rippled node with the WASM-escrow amendment enabled.

Fixes (internal/cli/escrow.go)

  • escrow finish fee default is too low. With the default (empty --fee), the JS module falls back to a flat 1 XRP, which the ledger rejects with telINSUF_FEE_P — the required fee scales with ComputationAllowance (the WASM gas). Now, when --fee is omitted, the default is derived from the gas allowance (gas * 10 drops, the value that succeeded on-chain). Passing --fee still overrides.
  • escrow deploy hard-fails without a time bound. XRPL rejects EscrowCreate unless CancelAfter or FinishAfter is set — even for a smart escrow whose release is governed by the WASM FinishFunction (client-side error: "Either CancelAfter or FinishAfter must be specified"). When neither flag is given, deploy now defaults CancelAfter to +24h so it works out of the box; the WASM finish() still governs when the escrow can be released.

Verification (local node, WASM-escrow amendment)

Before:

  • escrow deploy --destination … --amount … (no time flags) → EscrowCreate: Either CancelAfter or FinishAfter must be specified
  • escrow finish … (no --fee) → telINSUF_FEE_P - Fee insufficient

After (this branch, rebuilt binary):

  • escrow deploy with no time flags → ✓ Smart escrow created! (auto CancelAfter +24h), validated
  • escrow finish with no --feetesSUCCESS, "Escrow released"; funds delivered to the destination and the Escrow object consumed

Scope is limited to defaulting when the flags are omitted; explicit --fee / --cancel-after / --finish-after behave as before. go build and go vet ./... pass.

🤖 Generated with Claude Code

Verified with a local smart-escrow round-trip (deploy → finish) on a rippled
node with the WASM-escrow amendment.

- escrow finish: default --fee scaled with the gas allowance (gas * 10 drops)
  when omitted. A flat 1 XRP fee is rejected on-chain with telINSUF_FEE_P
  because the required fee grows with ComputationAllowance.
- escrow deploy: XRPL rejects EscrowCreate without CancelAfter/FinishAfter even
  for a smart (WASM) escrow. When neither flag is given, default CancelAfter to
  +24h so deploy works out of the box; the WASM FinishFunction still governs
  when the escrow can be finished.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant