Infernet
SDK
Reference
Consumers
BaseConsumer

BaseConsumer

Git Source (opens in a new tab)

Handles receiving container compute responses from Infernet coordinator

Contains a single public entrypoint rawReceiveCompute callable by only the Infernet coordinator. Once call origin is verified, parameters are proxied to internal function _receiveCompute

State Variables

COORDINATOR

Infernet Coordinator

Internal visibility since COORDINATOR is consumed by inheriting contracts

Coordinator internal immutable COORDINATOR;

Functions

constructor

Initialize new BaseConsumer

constructor(address coordinator);

Parameters

NameTypeDescription
coordinatoraddresscoordinator address

_receiveCompute

Callback entrypoint to receive container compute responses from validated Coordinator source

Called by rawReceiveCompute once validated that msg.sender == address(COORDINATOR)

Same function parameters as rawReceiveCompute

function _receiveCompute(
    uint32 subscriptionId,
    uint32 interval,
    uint16 redundancy,
    address node,
    bytes calldata input,
    bytes calldata output,
    bytes calldata proof
) internal virtual;

Parameters

NameTypeDescription
subscriptionIduint32id of subscription being responded to
intervaluint32subscription interval
redundancyuint16after this call succeeds, how many nodes will have delivered a response for this interval
nodeaddressaddress of responding Infernet node
inputbytesoptional off-chain container input recorded by Infernet node (empty, hashed input, processed input, or both)
outputbytesoptional off-chain container output (empty, hashed output, processed output, both, or fallback: all encodeable data)
proofbytesoptional off-chain container execution proof (or arbitrary metadata)

rawReceiveCompute

Callback entrypoint called by Infernet Coordinator to return container compute responses

Callable only by address(COORDINATOR), else throws NotCoordinator() error

function rawReceiveCompute(
    uint32 subscriptionId,
    uint32 interval,
    uint16 redundancy,
    address node,
    bytes calldata input,
    bytes calldata output,
    bytes calldata proof
) external;

Parameters

NameTypeDescription
subscriptionIduint32id of subscription being responded to
intervaluint32subscription interval
redundancyuint16after this call succeeds, how many nodes will have delivered a response for this interval
nodeaddressaddress of responding Infernet node
inputbytesoptional off-chain container input recorded by Infernet node (empty, hashed input, processed input, or both)
outputbytesoptional off-chain container output (empty, hashed output, processed output, both, or fallback: all encodeable data)
proofbytesoptional off-chain container execution proof (or arbitrary metadata)

Errors

NotCoordinator

Thrown if attempting to call rawReceiveCompute from a msg.sender != address(COORDINATOR)

4-byte signature: 0x9ec853e6

error NotCoordinator();