Skip to main content

Output Endpoints

executeVoucher

function executeVoucher(address _destination, bytes _payload, struct OutputValidityProof _v) external returns (bool)

Executes a voucher

vouchers can only be successfully executed one time, and only if the provided proof is valid

Parameters

NameTypeDescription
_destinationaddressaddress of the target contract that will execute the payload
_payloadbytespayload to be executed by the destination contract, containing a method signature and ABI-encoded parameters
_vstruct OutputValidityProofvalidity proof for the voucher

Return Values

NameTypeDescription
[0]booltrue if voucher was executed successfully

validateNotice

function validateNotice(bytes _notice, struct OutputValidityProof _v) external view returns (bool)

Validates a notice

Parameters

NameTypeDescription
_noticebytesnotice to be validated
_vstruct OutputValidityProofvalidity proof for the notice

Return Values

NameTypeDescription
[0]booltrue if notice is valid

getNumberOfFinalizedEpochs

function getNumberOfFinalizedEpochs() external view returns (uint256)

Get number of finalized epochs

getVoucherMetadataLog2Size

function getVoucherMetadataLog2Size() external pure returns (uint256)

Get log2 size of voucher metadata memory range

getEpochVoucherLog2Size

function getEpochVoucherLog2Size() external pure returns (uint256)

Get log2 size of epoch voucher memory range

getNoticeMetadataLog2Size

function getNoticeMetadataLog2Size() external pure returns (uint256)

Get log2 size of notice metadata memory range

getEpochNoticeLog2Size

function getEpochNoticeLog2Size() external pure returns (uint256)

Get log2 size of epoch notice memory range

VoucherExecuted

event VoucherExecuted(uint256 voucherPosition)

Indicates that a voucher was executed

Parameters

NameTypeDescription
voucherPositionuint256voucher unique identifier considering epoch, input and output indices

OutputValidityProof

Data used to prove the validity of an output (notices and vouchers)

struct OutputValidityProof {
uint256 epochIndex;
uint256 inputIndex;
uint256 outputIndex;
bytes32 outputHashesRootHash;
bytes32 vouchersEpochRootHash;
bytes32 noticesEpochRootHash;
bytes32 machineStateHash;
bytes32[] keccakInHashesSiblings;
bytes32[] outputHashesInEpochSiblings;
}

Members

NameTypeDescription
epochIndexuint256which epoch the output belongs to
inputIndexuint256which input, inside the epoch, the output belongs to
outputIndexuint256index of output inside the input
outputHashesRootHashbytes32merkle root of all output metadata hashes of the related input
vouchersEpochRootHashbytes32merkle root of all voucher metadata hashes of the related epoch
noticesEpochRootHashbytes32merkle root of all notice metadata hashes of the related epoch
machineStateHashbytes32hash of the machine state claimed for the related epoch
keccakInHashesSiblingsbytes32[]proof that this output metadata is in metadata memory range
outputHashesInEpochSiblingsbytes32[]proof that this output metadata is in epoch's output memory range

On this page

© 2024 Cartesi Foundation Ltd. All rights reserved.

The Cartesi Project is commissioned by the Cartesi Foundation.

We use cookies to ensure that we give you the best experience on our website. By using the website, you agree to the use of cookies.