defineComposite(...) reads the deployed NewtonPolicy.getPolicyData() list, aligns your modules to that onchain oracle set, and returns the pack passed to createShield(...).
Onchain Manifest
shield.setParams(...) writes the full manifest envelope to NewtonPolicy.PolicyConfig.policyParams. Operators validate this exact byte shape; they do not unwrap params before schema validation.
params_schema.json must describe this envelope: required root fields are _manifest, modules, and params; pack params live under params.<short-id>.
Per-Call Options
shield.sendCall(...) and typed vendor overlays accept prepareQueryOptions, keyed by short pack id. The composite routes each entry to the matching module’s prepareQuery.
wasmArgs is validated against that module’s schema before the intent is built. A rejected module fails closed.
Params and Secrets
Params and secrets are both keyed by short pack id:Depositor Verification
A depositor or monitoring service can verify a deployed Shield contract without trusting offchain docs:- Read
Shield.getPolicyAddress(). - Read
INewtonPolicy(policy).getPolicyData()for the constituent oracles. - Read each oracle’s
getWasmCid(). - Read
Shield.getPolicyConfig().policyParamsand decode the manifest. - Compare manifest
modules[]andwasmCidvalues against the onchain reads.
@newton-xyz/policy-pack-shared exposes introspectComposite({ publicClient, shieldAddress }) for this path. It returns a report with booleans such as onChainPolicyDataMatches and per-module wasmCidsMatch; it throws only when the manifest bytes cannot be decoded.
Recovery Flag
createShield({ skipPolicyBindingCheck: true }) attaches without validating the onchain manifest. Use it only for first-time or interrupted setup recovery so the next call can write setParams(...); remove it for production runs.
Composite-Specific Errors
| Error | When |
|---|---|
PolicyMismatchError | createShield attached to a clone whose policy address, oracle set, wasm CID, or params do not match the composite. |
CompositeModuleSetMismatchError | defineComposite could not match the deployed getPolicyData() oracle set to the modules passed in. |
CompositePrepareQueryError | A module’s prepareQuery failed during composite intent build. |
UnknownPackIdError | A module short id is not in the published pack registry. Use allowUnknownPackIds: true only for bespoke packs. |
MalformedManifestError / BadManifestMagicError / NotAManifestError | Manifest bytes could not be decoded. |