Callcium
API

PolicyEnforcer

Evaluation of ABI-encoded data against policy blobs.

Git Source

Functions

enforce

Reverts when callData violates policy.

Requires a structurally validated policy blob. Behavior on an unvalidated blob is undefined.

Git Source

function enforce(bytes memory policy, bytes calldata callData) internal view;

Parameters

NameTypeDescription
policybytesThe policy blob with embedded descriptor.
callDatabytesThe calldata to validate.

check

Returns true if callData complies with policy.

Requires a structurally validated policy blob. Behavior on an unvalidated blob is undefined. Reverts on abort violations and integrity errors. Returns false for group-local violations.

Git Source

function check(bytes memory policy, bytes calldata callData) internal view returns (bool ok);

Parameters

NameTypeDescription
policybytesThe policy blob with embedded descriptor.
callDatabytesThe calldata to validate.

Returns

NameTypeDescription
okboolTrue if calldata complies with the policy.

Errors

PolicyViolation

Thrown when calldata violates the policy.

Git Source

error PolicyViolation(uint32 groupIndex, uint32 ruleIndex);

SelectorMismatch

Thrown when the function selector does not match the policy header.

Git Source

error SelectorMismatch(bytes4 expected, bytes4 actual);

MissingSelector

Thrown when calldata is too short to contain a selector.

Git Source

error MissingSelector();

UnsupportedMinor

Thrown when the policy's minor version is above the highest one this release implements.

Git Source

error UnsupportedMinor(uint8 minor);

Parameters

NameTypeDescription
minoruint8The declared minor version.

QuantifierLimitExceeded

Thrown when array exceeds max length for quantified iteration.

Git Source

error QuantifierLimitExceeded(uint256 length, uint256 maxLength);

NonCanonicalValue

Thrown when a resolved word is not the canonical encoding of its declared type.

Git Source

error NonCanonicalValue(uint8 typeCode, bytes32 value);

Parameters

NameTypeDescription
typeCodeuint8The declared type of the target.
valuebytes32The raw 32-byte word.

On this page