Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions libsolidity/codegen/ExpressionCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,6 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
}
case FunctionType::Kind::WithdrawReward:
{
_functionCall.expression().accept(*this);
m_context << Instruction::NATIVEWITHDRAWREWARD;
break;
}
Expand Down Expand Up @@ -1720,13 +1719,11 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
}
case FunctionType::Kind::CancelAllUnfreezeV2:
{
_functionCall.expression().accept(*this);
m_context << Instruction::NATIVECANCELALLUNFREEZEV2;
break;
}
case FunctionType::Kind::WithdrawExpireUnfreeze:
{
_functionCall.expression().accept(*this);
m_context << Instruction::NATIVEWITHDRAWEXPIREUNFREEZE;
break;
}
Expand Down Expand Up @@ -2180,7 +2177,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
);
}
else if ((std::set<std::string>{"tokenBalance", "call", "callcode", "delegatecall", "staticcall",
"freezeExpireTime", "totalFrozenBalance", "frozenBalance", "frozenBalanceUsage"}).count(member))
"freezeExpireTime"}).count(member))
utils().convertType(
*_memberAccess.expression().annotation().type,
*TypeProvider::address(),
Expand Down
17 changes: 16 additions & 1 deletion libsolidity/codegen/ir/IRGeneratorForStatements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,22 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
solAssert(!_functionCall.annotation().tryCall);
solAssert(!functionType->valueSet());
solAssert(!functionType->gasSet());
if (functionType->kind() < FunctionType::Kind::AvailableUnfreezeV2Size)
// Only the address-member reads in this block carry a bound first argument (the address).
// Match them by kind rather than by enum ordering so that reordering FunctionType::Kind
// in Types.h cannot silently invalidate this consistency check.
static std::set<FunctionType::Kind> const boundFirstArgumentKinds = {
FunctionType::Kind::AvailableUnfreezeV2Size,
FunctionType::Kind::UnfreezableBalanceV2,
FunctionType::Kind::ExpireUnfreezeBalanceV2,
FunctionType::Kind::DelegatableResource,
FunctionType::Kind::ResourceV2,
FunctionType::Kind::CheckUnDelegateResource,
FunctionType::Kind::ResourceUsage,
FunctionType::Kind::TotalResource,
FunctionType::Kind::TotalDelegatedResource,
FunctionType::Kind::TotalAcquiredResource,
};
if (!boundFirstArgumentKinds.count(functionType->kind()))
solAssert(!functionType->hasBoundFirstArgument());

static std::map<FunctionType::Kind, u256> precompiles = {
Expand Down