mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make an assert less strict
Even though one can convert from, say, a pure function to a function without a state mutability specified, in ABIFunctions.cpp, there was an assert that checked if the types were exactly equal. This assert had to be loosened up.
This commit is contained in:
parent
b385b41fa0
commit
2608c56d32
@ -1028,8 +1028,12 @@ string ABIFunctions::abiEncodingFunctionFunctionType(
|
|||||||
EncodingOptions const& _options
|
EncodingOptions const& _options
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
solAssert(_from.kind() == FunctionType::Kind::External, "");
|
solAssert(
|
||||||
solAssert(_from == _to, "");
|
_from.kind() == FunctionType::Kind::External &&
|
||||||
|
_from.isImplicitlyConvertibleTo(_to) &&
|
||||||
|
_from.sizeOnStack() == _to.sizeOnStack(),
|
||||||
|
"Invalid function type conversion requested"
|
||||||
|
);
|
||||||
|
|
||||||
string functionName =
|
string functionName =
|
||||||
"abi_encode_" +
|
"abi_encode_" +
|
||||||
@ -1042,11 +1046,13 @@ string ABIFunctions::abiEncodingFunctionFunctionType(
|
|||||||
return createFunction(functionName, [&]() {
|
return createFunction(functionName, [&]() {
|
||||||
return Whiskers(R"(
|
return Whiskers(R"(
|
||||||
function <functionName>(addr, function_id, pos) {
|
function <functionName>(addr, function_id, pos) {
|
||||||
|
addr, function_id := <convert>(addr, function_id)
|
||||||
mstore(pos, <combineExtFun>(addr, function_id))
|
mstore(pos, <combineExtFun>(addr, function_id))
|
||||||
}
|
}
|
||||||
)")
|
)")
|
||||||
("functionName", functionName)
|
("functionName", functionName)
|
||||||
("combineExtFun", m_utils.combineExternalFunctionIdFunction())
|
("combineExtFun", m_utils.combineExternalFunctionIdFunction())
|
||||||
|
("convert", m_utils.conversionFunction(_from, _to))
|
||||||
.render();
|
.render();
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user