Do not ignore revertOnFailure flag when validating Address/Contract

This commit is contained in:
Alex Beregszaszi 2019-01-17 23:41:13 +00:00
parent 0ecafe032a
commit 3f2898ea47

View File

@ -216,7 +216,7 @@ string ABIFunctions::cleanupFunction(Type const& _type, bool _revertOnFailure)
switch (_type.category()) switch (_type.category())
{ {
case Type::Category::Address: case Type::Category::Address:
templ("body", "cleaned := " + cleanupFunction(IntegerType(160)) + "(value)"); templ("body", "cleaned := " + cleanupFunction(IntegerType(160), _revertOnFailure) + "(value)");
break; break;
case Type::Category::Integer: case Type::Category::Integer:
{ {
@ -265,7 +265,7 @@ string ABIFunctions::cleanupFunction(Type const& _type, bool _revertOnFailure)
StateMutability::Payable : StateMutability::Payable :
StateMutability::NonPayable StateMutability::NonPayable
); );
templ("body", "cleaned := " + cleanupFunction(addressType) + "(value)"); templ("body", "cleaned := " + cleanupFunction(addressType, _revertOnFailure) + "(value)");
break; break;
} }
case Type::Category::Enum: case Type::Category::Enum:
@ -341,7 +341,7 @@ string ABIFunctions::conversionFunction(Type const& _from, Type const& _to)
solAssert(_from.mobileType(), ""); solAssert(_from.mobileType(), "");
body = body =
Whiskers("converted := <cleanEnum>(<cleanInt>(value))") Whiskers("converted := <cleanEnum>(<cleanInt>(value))")
("cleanEnum", cleanupFunction(_to, false)) ("cleanEnum", cleanupFunction(_to))
// "mobileType()" returns integer type for rational // "mobileType()" returns integer type for rational
("cleanInt", cleanupFunction(*_from.mobileType())) ("cleanInt", cleanupFunction(*_from.mobileType()))
.render(); .render();