mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add missing checks for parameter compatibilty with ABIEncoderV1 in calls
This commit is contained in:
@@ -2178,6 +2178,52 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
m_errorReporter.typeError(errorId, paramArgMap[i]->location(), description);
|
||||
}
|
||||
}
|
||||
|
||||
TypePointers const& returnParameterTypes = _functionType->returnParameterTypes();
|
||||
bool isLibraryCall = (_functionType->kind() == FunctionType::Kind::DelegateCall);
|
||||
bool callRequiresABIEncoding =
|
||||
// ABIEncode/ABIDecode calls not included because they should have been already validated
|
||||
// at this point and they have variadic arguments so they need special handling.
|
||||
_functionType->kind() == FunctionType::Kind::DelegateCall ||
|
||||
_functionType->kind() == FunctionType::Kind::External ||
|
||||
_functionType->kind() == FunctionType::Kind::Creation ||
|
||||
_functionType->kind() == FunctionType::Kind::Event;
|
||||
|
||||
if (callRequiresABIEncoding && !experimentalFeatureActive(ExperimentalFeature::ABIEncoderV2))
|
||||
{
|
||||
solAssert(!isVariadic, "");
|
||||
solAssert(parameterTypes.size() == arguments.size(), "");
|
||||
solAssert(!_functionType->isBareCall(), "");
|
||||
solAssert(*_functionCall.annotation().kind == FunctionCallKind::FunctionCall, "");
|
||||
|
||||
for (size_t i = 0; i < parameterTypes.size(); ++i)
|
||||
{
|
||||
solAssert(parameterTypes[i], "");
|
||||
|
||||
if (!typeSupportedByOldABIEncoder(*parameterTypes[i], isLibraryCall))
|
||||
m_errorReporter.typeError(
|
||||
2443_error,
|
||||
paramArgMap[i]->location(),
|
||||
"The type of this parameter, " + parameterTypes[i]->toString(true) + ", "
|
||||
"is only supported in ABIEncoderV2. "
|
||||
"Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
|
||||
);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < returnParameterTypes.size(); ++i)
|
||||
{
|
||||
solAssert(returnParameterTypes[i], "");
|
||||
|
||||
if (!typeSupportedByOldABIEncoder(*returnParameterTypes[i], isLibraryCall))
|
||||
m_errorReporter.typeError(
|
||||
2428_error,
|
||||
_functionCall.location(),
|
||||
"The type of return parameter " + toString(i + 1) + ", " + returnParameterTypes[i]->toString(true) + ", "
|
||||
"is only supported in ABIEncoderV2. "
|
||||
"Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TypeChecker::visit(FunctionCall const& _functionCall)
|
||||
|
||||
Reference in New Issue
Block a user