mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Place calldata to calldata coder sanity checks.
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
parent
19ad8b115e
commit
53947404e4
@ -66,9 +66,16 @@ DEFINE_PROTO_FUZZER(Contract const& _input)
|
||||
// We don't care about EVM One failures other than EVMC_REVERT
|
||||
solAssert(result->status_code != EVMC_REVERT, "Proto ABIv2 fuzzer: EVM One reverted");
|
||||
if (result->status_code == EVMC_SUCCESS)
|
||||
solAssert(
|
||||
EvmoneUtility::zeroWord(result->output_data, result->output_size),
|
||||
"Proto ABIv2 fuzzer: ABIv2 coding failure found"
|
||||
);
|
||||
if (!EvmoneUtility::zeroWord(result->output_data, result->output_size))
|
||||
{
|
||||
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)
|
||||
("varName", _varName)
|
||||
.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.
|
||||
@ -671,7 +675,11 @@ string ProtoConverter::calldataHelperFunctions()
|
||||
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>
|
||||
return 0;
|
||||
}
|
||||
@ -679,6 +687,7 @@ string ProtoConverter::calldataHelperFunctions()
|
||||
("parameters_memory", typedParametersAsString(CalleeType::PUBLIC))
|
||||
("equality_checks", equalityChecksAsString())
|
||||
("parameters_calldata", typedParametersAsString(CalleeType::EXTERNAL))
|
||||
("untyped_parameters", m_untypedParamsExternal.str())
|
||||
.render();
|
||||
|
||||
return calldataHelperFuncs.str();
|
||||
|
@ -390,6 +390,8 @@ private:
|
||||
/// Contains typed parameter list to be passed to callee functions
|
||||
std::ostringstream m_typedParamsExternal;
|
||||
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
|
||||
std::ostringstream m_isabelleTypeString;
|
||||
/// Contains values to be encoded in the format accepted
|
||||
|
Loading…
Reference in New Issue
Block a user