Now that we have blobs, we also have some root public inputs in the form of BigNums. The numbers are too big to fit into a field, and we don't yet hash all public inputs, so for now we convert bytes32 to and from these numbers:
function _bytes32ToBigNum(bytes32 _input)
internal
pure
returns (bytes32 firstLimb, bytes32 secondLimb, bytes32 thirdLimb)
{
firstLimb = bytes32(uint256(uint120(bytes15(_input << 136))));
secondLimb = bytes32(uint256(uint120(bytes15(_input << 16))));
thirdLimb = bytes32(uint256(uint16(bytes2(_input))));
}
Another public input is a 48-byte compressed point, which (to fit into 2 fields) is encoded as a 31 byte and 17 byte pair:
// To fit into 2 fields, the commitment is split into 31 and 17 byte numbers
// TODO: The below left pads, possibly inefficiently
// c[0]
publicInputs[offset++] = bytes32(
uint256(uint248(bytes31(_submitArgs.blobPublicInputs[blobOffset:blobOffset += 31])))
);
// c[1]
publicInputs[offset++] = bytes32(
uint256(uint136(bytes17(_submitArgs.blobPublicInputs[blobOffset:blobOffset += 17])))
);
The padding/conversions may be ineffecient and should be reviewed.
Now that we have blobs, we also have some root public inputs in the form of
BigNums. The numbers are too big to fit into a field, and we don't yet hash all public inputs, so for now we convertbytes32to and from these numbers:Another public input is a 48-byte compressed point, which (to fit into 2 fields) is encoded as a 31 byte and 17 byte pair:
The padding/conversions may be ineffecient and should be reviewed.