diff --git a/README.md b/README.md index d46e2ed..d618b24 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,15 @@ A configurable escrow program for Solana that enables receipt-based token deposi - **Configurable timelocks** - Set lock durations that must pass before withdrawals - **Custom hook programs** - Invoke external programs pre/post deposit and withdrawal +## Hook Warning + +If a hook is configured and the escrow is later made immutable, that hook configuration becomes permanent. + +- The hook cannot be changed or removed after immutability is set. +- Hook callbacks run at all four hook points: PreDeposit, PostDeposit, PreWithdraw, PostWithdraw. +- Any hook revert aborts the escrow instruction. +- A buggy or malicious hook can permanently block deposit and/or withdraw flows. + ## Account Types | Account | PDA Seeds | Description | diff --git a/apps/web/src/components/instructions/SetHook.tsx b/apps/web/src/components/instructions/SetHook.tsx index f0e7598..691f2c2 100644 --- a/apps/web/src/components/instructions/SetHook.tsx +++ b/apps/web/src/components/instructions/SetHook.tsx @@ -75,6 +75,7 @@ export function SetHook() { value={hookProgram} onChange={setHookProgram} placeholder="Program ID implementing the transfer hook" + hint="Warning: if this escrow is later set immutable, this hook dependency becomes permanent and hook reverts will block operations." required /> diff --git a/apps/web/src/components/instructions/SetImmutable.tsx b/apps/web/src/components/instructions/SetImmutable.tsx index 2229c9e..1b84f13 100644 --- a/apps/web/src/components/instructions/SetImmutable.tsx +++ b/apps/web/src/components/instructions/SetImmutable.tsx @@ -59,7 +59,8 @@ export function SetImmutable() { >
- This action is one-way. Escrow configuration becomes permanently immutable. + This action is one-way. Escrow configuration becomes permanently immutable. Any configured hook also + becomes permanent, and hook reverts will block escrow operations.
(&instruction, &all_accounts).map_err(|_| EscrowProgramError::HookRejected.into()) } }