laconicd/x/feemarket/types/genesis.go
Tomas Tauber e91ec58aa1
evm: fixed commented out simulations, pubsub, and handler tests (#655)
* evm: fixed commented out simulations, pubsub, and handler tests

fixes #640

simulations are very basic: they can be built and executed,
but they don't generate any EVM-related transactions yet.
(It should be a matter of adding simulation-related code to the
modules + potentially extra helpers to the simulation.)
handler tests miss some extra assertions due to changes
in the return values snapshotting logic (ADR-001 and ADR-002).

Besides the test suites identified in the audit,
there's also "importer_test.go" which wasn't yet fixed.
(it'd require major rewriting + extra test resources)

* gofumpt
2021-10-11 13:09:53 +02:00

36 lines
774 B
Go

package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// DefaultGenesisState sets default fee market genesis state.
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
BaseFee: sdk.ZeroInt(),
BlockGas: 0,
}
}
// NewGenesisState creates a new genesis state.
func NewGenesisState(params Params, baseFee sdk.Int, blockGas uint64) *GenesisState {
return &GenesisState{
Params: params,
BaseFee: baseFee,
BlockGas: blockGas,
}
}
// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs GenesisState) Validate() error {
if gs.BaseFee.IsNegative() {
return fmt.Errorf("base fee cannot be negative: %s", gs.BaseFee)
}
return gs.Params.Validate()
}