Allowlist
Git Source (opens in a new tab)
Exposes an onlyAllowedNode
modifier that restricts unallowed nodes from calling permissioned contract functions
To be used with BaseConsumer._receiveCompute
to restrict responding nodes
In the future, this list can be abstracted out to a contract that enables dynamic list declarations (registry)
State Variables
allowedNodes
node address => is allowed node
Access list applied via onlyAllowedNode
modifier
Forced private
visibility to disallow modifications outside of _updateAllowlist
Read getter exposed via isAllowedNode()
mapping(address => bool) private allowedNodes;
Functions
onlyAllowedNode
Allow only nodes in the allowedNodes
set
modifier onlyAllowedNode(address node);
Parameters
Name | Type | Description |
---|---|---|
node | address | calling node to checkin allowedNodes set |
constructor
Initializes new Allowlist
constructor(address[] memory initialAllowed);
Parameters
Name | Type | Description |
---|---|---|
initialAllowed | address[] | array of initially-allowed node addresses |
_updateAllowlist
Update allowedNodes
Does not validate nodes.length == status.length
function _updateAllowlist(address[] memory nodes, bool[] memory statuses) internal;
Parameters
Name | Type | Description |
---|---|---|
nodes | address[] | array of node addresses to update |
statuses | bool[] | array of status(es) to update where index corresponds to index in nodes array |
isAllowedNode
Check whether a node
is allowed
function isAllowedNode(address node) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
node | address | address to check for set inclusion |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true if node is in Allowlist & its status is set to true (allowed), else false |
Errors
NodeNotAllowed
Thrown by onlyAllowedNode()
if node address is not in allowedNodes
set
4-byte signature: 0x42764946
error NodeNotAllowed();