Skip to content

Commit

Permalink
Merge pull request #3395 from jorgemmsilva/fix/zero-fee-misc
Browse files Browse the repository at this point in the history
fix: edge cases for chains set for 0 fees
  • Loading branch information
jorgemmsilva authored May 7, 2024
2 parents 130d8ca + 1916126 commit 8e6c918
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/chain/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func (mpi *mempoolImpl) shouldAddOffledgerRequest(req isc.OffLedgerRequest) erro
governanceState := governance.NewStateAccess(mpi.chainHeadState)
chainOwner := governanceState.ChainOwnerID()
isGovRequest := req.SenderAccount().Equals(chainOwner) && req.CallTarget().Contract == governance.Contract.Hname()
if !isGovRequest {
if !isGovRequest || governanceState.DefaultGasPrice().Cmp(util.Big0) == 0 {
return fmt.Errorf("no funds on chain")
}
}
Expand Down
3 changes: 3 additions & 0 deletions tools/wasp-cli/chain/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func baseTokensForDepositFee(client *apiclient.APIClient, chain string) uint64 {

feePolicyBytes := callGovView(governance.ViewGetFeePolicy.Name).Get(governance.ParamFeePolicyBytes)
feePolicy := gas.MustFeePolicyFromBytes(feePolicyBytes)
if feePolicy.GasPerToken.HasZeroComponent() {
return 0
}

gasLimitsBytes := callGovView(governance.ViewGetGasLimits.Name).Get(governance.ParamGasLimitsBytes)
gasLimits, err := gas.LimitsFromBytes(gasLimitsBytes)
Expand Down

0 comments on commit 8e6c918

Please sign in to comment.