Merge pull request #5843 from ethereum/abi-typos

Do not ignore revertOnFailure flag when validating Address/Contract
This commit is contained in:
chriseth 2019-01-22 18:44:09 +01:00 committed by GitHub
commit 628d665474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();