LibLeafProof
Functions
proveIflagsY
Prove the value of the iflags_Y register of a machine.
May raise InvalidSiblingsArrayLength or InvalidMachineMerkleProof.
function proveIflagsY(LeafProof calldata v, bytes32 machineMerkleRoot)
internal
pure
returns (uint64 iflagsY);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof for the iflags_Y register |
machineMerkleRoot | bytes32 | The machine Merkle root |
Returns
| Name | Type | Description |
|---|---|---|
iflagsY | uint64 | The iflags_Y register |
proveHtifTohost
Prove the value of the HTIF tohost register of a machine.
May raise InvalidSiblingsArrayLength or InvalidMachineMerkleProof.
function proveHtifTohost(LeafProof calldata v, bytes32 machineMerkleRoot)
internal
pure
returns (uint64 htifTohost);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof for the HTIF tohost register |
machineMerkleRoot | bytes32 | The machine Merkle root |
Returns
| Name | Type | Description |
|---|---|---|
htifTohost | uint64 | The HTIF tohost register |
proveTxBuffer
Prove the first data block of the CMIO tx buffer of a machine.
May raise InvalidSiblingsArrayLength or InvalidMachineMerkleProof.
function proveTxBuffer(LeafProof calldata v, bytes32 machineMerkleRoot)
internal
pure
returns (bytes32 txBuffer);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof for the first data block of the CMIO tx buffer |
machineMerkleRoot | bytes32 | The machine Merkle root |
Returns
| Name | Type | Description |
|---|---|---|
txBuffer | bytes32 | The first data block of the CMIO tx buffer |
proveWord
Prove a word at a given address in the machine.
May raise InvalidSiblingsArrayLength or InvalidMachineMerkleProof.
function proveWord(
LeafProof calldata v,
bytes32 machineMerkleRoot,
uint64 wordAddress
) internal pure returns (uint64 word);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof |
machineMerkleRoot | bytes32 | The machine Merkle root |
wordAddress | uint64 | The word address |
Returns
| Name | Type | Description |
|---|---|---|
word | uint64 | The proven word |
proveDataBlock
Prove the value of a data block at a given address in the machine.
May raise InvalidSiblingsArrayLength or InvalidMachineMerkleProof.
function proveDataBlock(
LeafProof calldata v,
bytes32 machineMerkleRoot,
uint64 dataBlockAddress
) internal pure returns (bytes32 dataBlock);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof |
machineMerkleRoot | bytes32 | The machine Merkle root |
dataBlockAddress | uint64 | The data block address |
Returns
| Name | Type | Description |
|---|---|---|
dataBlock | bytes32 | The proven data block |
proveDataBlock
Prove the value of a data block at a given leaf index in the machine.
May raise InvalidSiblingsArrayLength or InvalidMachineMerkleProof.
function proveDataBlock(
LeafProof calldata v,
bytes32 machineMerkleRoot,
LeafIndex leafIndex
) internal pure returns (bytes32 dataBlock);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof |
machineMerkleRoot | bytes32 | The machine Merkle root |
leafIndex | LeafIndex | The leaf index |
Returns
| Name | Type | Description |
|---|---|---|
dataBlock | bytes32 | The proven data block |
computeMachineMerkleRoot
Compute the machine Merkle root from a leaf proof.
May raise InvalidSiblingsArrayLength.
function computeMachineMerkleRoot(LeafProof calldata v, LeafIndex leafIndex)
internal
pure
returns (bytes32 machineMerkleRoot);
Parameters
| Name | Type | Description |
|---|---|---|
v | LeafProof | The leaf proof |
leafIndex | LeafIndex | The leaf index |
Returns
| Name | Type | Description |
|---|---|---|
machineMerkleRoot | bytes32 | The computed machine Merkle root |
truncateToLeaf
Truncate a word address into leaf index and word offset.
function truncateToLeaf(uint64 wordAddress)
internal
pure
returns (LeafIndex leafIndex, WordOffset wordOffset);
Parameters
| Name | Type | Description |
|---|---|---|
wordAddress | uint64 | The word address |
Returns
| Name | Type | Description |
|---|---|---|
leafIndex | LeafIndex | The leaf index |
wordOffset | WordOffset | The word offset within the data block |
getUint64WordFromDataBlock
Get uint64 word at offset from data block.
Converts word from little-endian to big-endian order.
function getUint64WordFromDataBlock(bytes32 dataBlock, WordOffset wordOffset)
internal
pure
returns (uint64 word);
Parameters
| Name | Type | Description |
|---|---|---|
dataBlock | bytes32 | The data block |
wordOffset | WordOffset | The word offset within the data block |
Returns
| Name | Type | Description |
|---|---|---|
word | uint64 | The uint64 word |