Contract patterns checklist
Use this checklist before deploying a production PoD contract. For conceptual background, see Architecture and main components and Async private operations.
Recommended contract shape
Inherit from
PodLib(primitive path) orInboxUser(custom path).Add a network preset mixin such as
PodUserSepoliaorPodUserFuji— presets auto-wire inbox and COTI routing in their constructor.Accept private values as
it*on EVM entrypoints.Submit via
PodLibhelpers (e.g.add64,gt256) orIInbox.sendTwoWayMessage{value: ...}(..., callbackFeeLocalWei).Store
requestIdcorrelation state.Implement success and error callbacks with
onlyInbox.Decode callback data into
ct*and persist.Expose status/result readers for async UX.
Preset wiring (PodLib + PodUserSepolia / PodUserFuji): Reference: PodLib primitives.
Fee and gas checklist
Expose payable entrypoints when using two-way sends; forward
msg.valueas the total fee and pass explicitcallbackFeeLocalWei.Call
calculateTwoWayFeeRequiredInLocalTokenon the deployed Inbox before production sends (see How do PoA fees work?).Test too-low total and too-low callback reverts in addition to the happy path.
Critical security controls
Access-control any method that changes routing or configuration.
Gate any call path that invokes
configureCoti(...).Keep callback handlers
onlyInbox.In custom COTI flows, verify
inboxMsgSender()matches the expected peer contract.Avoid external calls before state updates inside callback handlers.
ABI correctness checklist
Selector in
MpcAbiCodec.create(...)matches the COTI-side target function..addArgument(...)order matches COTI parameter order.Callback
abi.decode(...)tuple matches COTIabi.encode(...)exactly.Add regression tests when callback tuple schema changes.
Async robustness checklist
Request starts as
PENDINGand transitions to a terminal state.Unknown or duplicate callback handling is defined.
Errors are observable (
requestId, error code, message).Frontend can query status by request ID (see
PodRequest).
Privacy and type checklist
No plaintext sensitive values in EVM storage.
No
gt*in EVM public interfaces.ct*used for user-decryptable outputs.Type width consistency preserved through the full flow (see Reference: data types).
Observability checklist
Emit request-created event with indexed
requestId.Emit completion and failure events.
Index
MessageSenton the Inbox for off-chain correlation (compact event carriesrequestIdin indexed topics).
Testing checklist
Success callback updates expected state.
Non-Inbox callback call reverts.
Error callback updates failure state.
Request ID mapping is deterministic.
Frontend integration decrypts returned ciphertext correctly.
Fee sufficiency: success with estimated fees plus buffer; reverts when under-funded.
See also
Last updated
Was this helpful?