Patcha is pre-audit software. These notes describe the controls already in the program and the assumptions an integrator should hold.
- Every PDA is derived from fixed seeds and a stored bump; the bump is recorded
at
initand re-checked on later access so a caller cannot substitute an off-curve address. Paramscarries a back-reference to itsInstallationand is validated with Anchor'shas_oneso a params account cannot be paired with the wrong installation.update_paramsanduninstall_hookrequire the originalinstaller(has_one = installer); a third party cannot retune or remove a hook.
- All counters (
hook_count,install_count,trigger_count) usechecked_addand returnOverflowrather than wrapping. - The release profile sets
overflow-checks = trueso arithmetic is checked in the built artifact, not only in debug. - Fee and price-impact math runs in
u128before narrowing, so theu64inputs cannot overflow the intermediate product.
- A params blob is schema-checked at install and update time
(
validate_params); a malformed non-empty blob is rejected before it is ever stored, so a bad install can never be silently coerced. - An empty blob decodes to the hook's documented defaults.
- The blob is bounded by
MAX_PARAMS_LEN(256 bytes).
trigger_hookchecks the callback tag is in range and the installation is active before dispatching.- A veto in a
before*callback returnsHookVetoed, which reverts the calling transaction;after*callbacks cannot revert. - The caller is the integration boundary (router/keeper). Gating hooks in this reference path treat the caller as the acting sender; a production integration should pass the true end-user as the gated identity.
- WhitelistGate and KYCGate ship with a materialized address set for parity with the simulator. A production deployment should verify a Merkle proof against the committed root (WhitelistGate) or an attestation account issued by the authority (KYCGate).
- The program has not been through a third-party audit. Do not use it to custody funds without one.
Report suspected vulnerabilities privately to the maintainers via the contact on the project website rather than opening a public issue.