Skip to content

Commit 7e7a3d2

Browse files
authored
Merge pull request #591 from iotaledger/fix-minfee-check
fix(vm): skip min fee check for governance requests
2 parents d710334 + 7c5d71c commit 7e7a3d2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/vm/vmimpl/runreq.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ func (reqctx *requestContext) consumeRequest() {
110110

111111
senderBaseTokens := req.Assets().BaseTokens() + reqctx.GetBaseTokensBalanceDiscardRemainder(sender)
112112

113-
minReqCost := reqctx.ChainInfo().GasFeePolicy.MinFee(isc.RequestGasPrice(reqctx.req), parameters.BaseTokenDecimals)
114-
if senderBaseTokens < minReqCost {
115-
panic(vmexceptions.ErrNotEnoughFundsForMinFee)
113+
// check if the sender has enough balance to cover the minimum gas fee
114+
if reqctx.shouldChargeGasFee() {
115+
minReqCost := reqctx.ChainInfo().GasFeePolicy.MinFee(isc.RequestGasPrice(reqctx.req), parameters.BaseTokenDecimals)
116+
if senderBaseTokens < minReqCost {
117+
// TODO: this should probably not skip the request, and also the check
118+
// should be done in L1 so the request is rejected before it reaches the mempool
119+
panic(vmexceptions.ErrNotEnoughFundsForMinFee)
120+
}
116121
}
117122

118123
reqctx.creditObjectsToAccount(sender, req.Assets().Objects.Sorted())

0 commit comments

Comments
 (0)