Skip to content

Commit

Permalink
fix: allow GasParams fixedtype's gas is zero (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi committed May 16, 2023
1 parent 3bbfbc6 commit d875244
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -race -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock'
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -race -timeout 60m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock'
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
Expand Down Expand Up @@ -256,9 +256,9 @@ jobs:
if: env.GIT_DIFF
run: |
cd simapp
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
go test -mod=readonly -timeout 60m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
- name: tests simapp v1
if: env.GIT_DIFF
run: |
cd simapp
go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./...
go test -mod=readonly -timeout 60m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./...
3 changes: 0 additions & 3 deletions x/gashub/types/gas_calculator.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ func GetGasCalculatorGen(mgp MsgGasParams) (GasCalculatorGenerator, error) {

func FixedGasCalculator(amount uint64) GasCalculator {
return func(msg types.Msg) (uint64, error) {
if amount == 0 {
return 0, errorsmod.Wrapf(errors.ErrInvalidMsgGasParams, "msg type: %s", types.MsgTypeURL(msg))
}
return amount, nil
}
}
Expand Down
4 changes: 1 addition & 3 deletions x/gashub/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ func (mgp MsgGasParams) Validate() error {

switch p := mgp.GasParams.(type) {
case *MsgGasParams_FixedType:
if p.FixedType.FixedGas == 0 {
return fmt.Errorf("invalid gas. cannot be zero")
}
return nil
case *MsgGasParams_GrantType:
if p.GrantType.FixedGas == 0 || p.GrantType.GasPerItem == 0 {
return fmt.Errorf("invalid gas. cannot be zero")
Expand Down

0 comments on commit d875244

Please sign in to comment.