Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow GasParams fixedtype's gas is zero #204

Merged
merged 4 commits into from
May 16, 2023
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
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