Sanity checks for `paramData` and `returnData` length in `_validateConstraints` method
- Dominant language
- Solidity
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
```
if (param.fetcherType == InputParamFetcherType.RAW_BYTES) {
_validateConstraints(param.paramData, param.constraints);
return param.paramData;
} else if (param.fetcherType == InputParamFetcherType.STATIC_CALL) {
// ...
(bool success, bytes memory returnData) = contractAddr.staticcall(callData);
// ...
_validateConstraints(returnData, param.constraints);
return returnData;
```
```
function _validateConstraints(bytes memory rawValue, Constraint[] calldata constraints)
private
pure
{
if (constraints.length > 0) {
for (uint256 i; i < constraints.length; i++) {
Constraint memory constraint = constraints[i];
bytes32 returnValue;
assembly {
returnValue := mload(add(rawValue, add(0x20, mul(i, 0x20))))
}
if (constraint.constraintType == ConstraintType.EQ) {
require(returnValue == bytes32(constraint.referenceData), ConstraintNotMet(ConstraintType.EQ));
} else if (constraint.constraintType == ConstraintType.GTE) {
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.