The BitmaskVerifier is a customizable, low-level verifier module that enables selective call authorization using bitmask-based hashing. It allows a contract to validate whether a function call (defined by who, where, value, and data) conforms to a pre-authorized pattern.
It supports:
The BitmaskVerifier computes a hash over masked components of a transaction and compares it to a stored or expected hash.
The verification succeeds if:
calculateHash(bitmask, who, where, value, data) == expectedHash
The bitmask is a byte array with the following structure:
| Segment | Bytes | Targeted Field | Description |
|---|---|---|---|
| [0:32] | 32 bytes | who |
Mask for the caller address (left-padded to 32 bytes) |
| [32:64] | 32 bytes | where |
Mask for the target contract address (left-padded to 32 bytes) |
| [64:96] | 32 bytes | value |
Mask for ETH value (uint256) |
| [96:] | data.length |
data |
One byte per calldata byte; used to mask calldata selectively |
This structure allows the verifier to:
approve(x, anyAmount))calculateHashfunction calculateHash(
bytes calldata bitmask,
address who,
address where,
uint256 value,
bytes calldata data
) public pure returns (bytes32)
This function computes a keccak256 hash over the masked versions of each input field: