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
Name | Type | Description |
---|---|---|
coordinator | address | coordinator 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
Name | Type | Description |
---|---|---|
subscriptionId | uint32 | id of subscription being responded to |
interval | uint32 | subscription interval |
redundancy | uint16 | after this call succeeds, how many nodes will have delivered a response for this interval |
node | address | address of responding Infernet node |
input | bytes | optional off-chain container input recorded by Infernet node (empty, hashed input, processed input, or both) |
output | bytes | optional off-chain container output (empty, hashed output, processed output, both, or fallback: all encodeable data) |
proof | bytes | optional 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
Name | Type | Description |
---|---|---|
subscriptionId | uint32 | id of subscription being responded to |
interval | uint32 | subscription interval |
redundancy | uint16 | after this call succeeds, how many nodes will have delivered a response for this interval |
node | address | address of responding Infernet node |
input | bytes | optional off-chain container input recorded by Infernet node (empty, hashed input, processed input, or both) |
output | bytes | optional off-chain container output (empty, hashed output, processed output, both, or fallback: all encodeable data) |
proof | bytes | optional 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();