046cd00174
* Add min_gas_price to feemarket params * Add MinGasPriceDecorators * feemarket integration tests for MinGasPrice * Restructure integration tests * Simplify integration tests context We use DeliverTx context to set up the app, otherwise not all settings are initialized. We test CheckTx with `s.app.BaseApp.CheckTx(req)`, which uses the `CheckTx` mode and context. * Update MinGasPrice spec in feemarket module * reorder ethermint module order for initializing genesis * feemarket migrations for adding MinGasPrice param * update changelog * Additional unit tests for MinGasPrice = 0, tx gas price > 0 (PR review) https://github.com/tharsis/ethermint/pull/1104#discussion_r884991661 * Use 0 MinGasPrice for transaction simulations * Fix duplicate registration of feemarket GenesisState and Params (PR review) https://github.com/tharsis/ethermint/pull/1104#issuecomment-1141893712
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package v011
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
v010types "github.com/tharsis/ethermint/x/feemarket/migrations/v010/types"
|
|
"github.com/tharsis/ethermint/x/feemarket/types"
|
|
)
|
|
|
|
// MigrateStore adds the MinGasPrice param with a value of 0
|
|
func MigrateStore(ctx sdk.Context, paramstore *paramtypes.Subspace) error {
|
|
if !paramstore.HasKeyTable() {
|
|
ps := paramstore.WithKeyTable(types.ParamKeyTable())
|
|
paramstore = &ps
|
|
}
|
|
|
|
paramstore.Set(ctx, types.ParamStoreKeyMinGasPrice, sdk.ZeroDec())
|
|
return nil
|
|
}
|
|
|
|
// MigrateJSON accepts exported v0.10 x/feemarket genesis state and migrates it to
|
|
// v0.11 x/feemarket genesis state. The migration includes:
|
|
// - add MinGasPrice param
|
|
func MigrateJSON(oldState v010types.GenesisState) types.GenesisState {
|
|
return types.GenesisState{
|
|
Params: types.Params{
|
|
NoBaseFee: oldState.Params.NoBaseFee,
|
|
BaseFeeChangeDenominator: oldState.Params.BaseFeeChangeDenominator,
|
|
ElasticityMultiplier: oldState.Params.ElasticityMultiplier,
|
|
EnableHeight: oldState.Params.EnableHeight,
|
|
BaseFee: oldState.Params.BaseFee,
|
|
MinGasPrice: sdk.ZeroDec(),
|
|
},
|
|
BlockGas: oldState.BlockGas,
|
|
}
|
|
}
|