Constants

Git Source

FINGERPRINT_MASK

0xFFFFFF = 3 byte fingerprint The fingerprint is 3 bytes because we're targetting the same collision resistance on words as solidity functions. As we already use a fully byte to map words across the expander, we only need 3 bytes for the fingerprint to achieve 4 bytes of collision resistance, which is the same as a solidity selector. This assumes that the byte selected to expand is uncorrelated with the fingerprint bytes, which is a reasonable assumption as long as we use different bytes from a keccak256 hash for each. This assumes a single expander, if there are multiple expanders, then the collision resistance only improves, so this is still safe.

uint256 constant FINGERPRINT_MASK = 0xFFFFFF;

META_ITEM_SIZE

4 = 1 byte opcode index + 3 byte fingerprint

uint256 constant META_ITEM_SIZE = 4;

META_ITEM_MASK

uint256 constant META_ITEM_MASK = (1 << META_ITEM_SIZE) - 1;

META_EXPANSION_SIZE

33 = 32 bytes for expansion + 1 byte for seed

uint256 constant META_EXPANSION_SIZE = 0x21;

META_PREFIX_SIZE

1 = 1 byte for depth

uint256 constant META_PREFIX_SIZE = 1;