mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Support selfdestruct
This commit is contained in:
parent
88573dbe03
commit
fc957ee59b
@ -602,6 +602,7 @@ void CHC::endVisit(FunctionCall const& _funCall)
|
||||
case FunctionType::Kind::MulMod:
|
||||
case FunctionType::Kind::Unwrap:
|
||||
case FunctionType::Kind::Wrap:
|
||||
case FunctionType::Kind::Selfdestruct:
|
||||
[[fallthrough]];
|
||||
default:
|
||||
SMTEncoder::endVisit(_funCall);
|
||||
|
||||
@ -714,6 +714,9 @@ void SMTEncoder::endVisit(FunctionCall const& _funCall)
|
||||
" with the CHC engine."
|
||||
);
|
||||
break;
|
||||
case FunctionType::Kind::Selfdestruct:
|
||||
visitSelfDestruct(_funCall);
|
||||
break;
|
||||
case FunctionType::Kind::DelegateCall:
|
||||
case FunctionType::Kind::BareCallCode:
|
||||
case FunctionType::Kind::BareDelegateCall:
|
||||
@ -917,6 +920,15 @@ void SMTEncoder::visitObjectCreation(FunctionCall const& _funCall)
|
||||
m_context.addAssertion(symbArray->elements() == zeroElements);
|
||||
}
|
||||
|
||||
void SMTEncoder::visitSelfDestruct(FunctionCall const& _funCall)
|
||||
{
|
||||
auto const& args = _funCall.arguments();
|
||||
solAssert(args.size() == 1);
|
||||
solAssert(args.at(0));
|
||||
|
||||
state().transfer(state().thisAddress(), expr(*args.at(0)), state().balance(state().thisAddress()));
|
||||
}
|
||||
|
||||
void SMTEncoder::endVisit(Identifier const& _identifier)
|
||||
{
|
||||
if (auto decl = identifierToVariable(_identifier))
|
||||
|
||||
@ -216,6 +216,7 @@ protected:
|
||||
virtual void visitAddMulMod(FunctionCall const& _funCall);
|
||||
void visitWrapUnwrap(FunctionCall const& _funCall);
|
||||
void visitObjectCreation(FunctionCall const& _funCall);
|
||||
void visitSelfDestruct(FunctionCall const& _funCall);
|
||||
void visitTypeConversion(FunctionCall const& _funCall);
|
||||
void visitStructConstructorCall(FunctionCall const& _funCall);
|
||||
void visitFunctionIdentifier(Identifier const& _identifier);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user