mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #13354 from ethereum/fuzz-calldata-to-calldata-coding
Place calldata to calldata coder sanity checks.
This commit is contained in:
commit
5b0f4a724a
@ -66,9 +66,16 @@ DEFINE_PROTO_FUZZER(Contract const& _input)
|
|||||||
// We don't care about EVM One failures other than EVMC_REVERT
|
// We don't care about EVM One failures other than EVMC_REVERT
|
||||||
solAssert(result->status_code != EVMC_REVERT, "Proto ABIv2 fuzzer: EVM One reverted");
|
solAssert(result->status_code != EVMC_REVERT, "Proto ABIv2 fuzzer: EVM One reverted");
|
||||||
if (result->status_code == EVMC_SUCCESS)
|
if (result->status_code == EVMC_SUCCESS)
|
||||||
solAssert(
|
if (!EvmoneUtility::zeroWord(result->output_data, result->output_size))
|
||||||
EvmoneUtility::zeroWord(result->output_data, result->output_size),
|
{
|
||||||
"Proto ABIv2 fuzzer: ABIv2 coding failure found"
|
solidity::bytes resultAsBytes;
|
||||||
);
|
for (size_t i = 0; i < result->output_size; i++)
|
||||||
|
resultAsBytes.push_back(result->output_data[i]);
|
||||||
|
cout << solidity::util::toHex(resultAsBytes) << endl;
|
||||||
|
solAssert(
|
||||||
|
false,
|
||||||
|
"Proto ABIv2 fuzzer: ABIv2 coding failure found"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,6 +426,10 @@ void ProtoConverter::appendTypedParamsExternal(
|
|||||||
("type", qualifiedTypeString)
|
("type", qualifiedTypeString)
|
||||||
("varName", _varName)
|
("varName", _varName)
|
||||||
.render();
|
.render();
|
||||||
|
m_untypedParamsExternal << Whiskers(R"(<delimiter><varName>)")
|
||||||
|
("delimiter", delimiterToString(_delimiter))
|
||||||
|
("varName", _varName)
|
||||||
|
.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds the qualifier "memory" to non-value parameter of an external function.
|
// Adds the qualifier "memory" to non-value parameter of an external function.
|
||||||
@ -671,7 +675,11 @@ string ProtoConverter::calldataHelperFunctions()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function coder_calldata_external(<parameters_calldata>) external pure returns (uint) {
|
function coder_calldata_external(<parameters_calldata>) external view returns (uint) {
|
||||||
|
return this.coder_calldata_external_indirection(<untyped_parameters>);
|
||||||
|
}
|
||||||
|
|
||||||
|
function coder_calldata_external_indirection(<parameters_calldata>) external pure returns (uint) {
|
||||||
<equality_checks>
|
<equality_checks>
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -679,6 +687,7 @@ string ProtoConverter::calldataHelperFunctions()
|
|||||||
("parameters_memory", typedParametersAsString(CalleeType::PUBLIC))
|
("parameters_memory", typedParametersAsString(CalleeType::PUBLIC))
|
||||||
("equality_checks", equalityChecksAsString())
|
("equality_checks", equalityChecksAsString())
|
||||||
("parameters_calldata", typedParametersAsString(CalleeType::EXTERNAL))
|
("parameters_calldata", typedParametersAsString(CalleeType::EXTERNAL))
|
||||||
|
("untyped_parameters", m_untypedParamsExternal.str())
|
||||||
.render();
|
.render();
|
||||||
|
|
||||||
return calldataHelperFuncs.str();
|
return calldataHelperFuncs.str();
|
||||||
|
@ -390,6 +390,8 @@ private:
|
|||||||
/// Contains typed parameter list to be passed to callee functions
|
/// Contains typed parameter list to be passed to callee functions
|
||||||
std::ostringstream m_typedParamsExternal;
|
std::ostringstream m_typedParamsExternal;
|
||||||
std::ostringstream m_typedParamsPublic;
|
std::ostringstream m_typedParamsPublic;
|
||||||
|
/// Contains parameter list to be passed to callee functions
|
||||||
|
std::ostringstream m_untypedParamsExternal;
|
||||||
/// Contains type string to be passed to Isabelle API
|
/// Contains type string to be passed to Isabelle API
|
||||||
std::ostringstream m_isabelleTypeString;
|
std::ostringstream m_isabelleTypeString;
|
||||||
/// Contains values to be encoded in the format accepted
|
/// Contains values to be encoded in the format accepted
|
||||||
|
Loading…
Reference in New Issue
Block a user