Skip to content

Commit

Permalink
fixes for audit
Browse files Browse the repository at this point in the history
* fix typo in external node definition
* emit parameter error when bytes32 arrays dont match up
  • Loading branch information
dbeal-eth committed Aug 7, 2023
1 parent 4a02874 commit 3db1995
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IExternalNode is IERC165 {
NodeOutput.Data[] memory parentNodeOutputs,
bytes memory parameters,
bytes32[] memory runtimeKeys,
bytes32[] memory runtimeValuess
bytes32[] memory runtimeValues
) external view returns (NodeOutput.Data memory);

function isValid(NodeDefinition.Data memory nodeDefinition) external returns (bool);
Expand Down
9 changes: 9 additions & 0 deletions protocol/oracle-manager/contracts/modules/NodeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import "../nodes/ConstantNode.sol";
import "../storage/NodeOutput.sol";
import "../storage/NodeDefinition.sol";

import "@synthetixio/core-contracts/contracts/errors/ParameterError.sol";

/**
* @title Module for managing nodes
* @dev See INodeModule.
Expand Down Expand Up @@ -151,6 +153,13 @@ contract NodeModule is INodeModule {
bytes32[] memory runtimeKeys,
bytes32[] memory runtimeValues
) internal view returns (NodeOutput.Data memory price) {
if (runtimeKeys.length != runtimeValues.length) {
revert ParameterError.InvalidParameter(
"runtimeValues",
"must be same length as runtimeKeys"
);
}

NodeDefinition.Data memory nodeDefinition = NodeDefinition.load(nodeId);

if (nodeDefinition.nodeType == NodeDefinition.NodeType.REDUCER) {
Expand Down

0 comments on commit 3db1995

Please sign in to comment.