fix: remove proto message registration from legacy v09 types to fix conflict (#1023)

with existing types

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Nick DeLuca 2022-04-05 08:51:56 -07:00 committed by GitHub
parent 56c4a31f10
commit ea3c16ed7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 16 deletions

View File

@ -15,6 +15,7 @@ import (
"github.com/tharsis/ethermint/app" "github.com/tharsis/ethermint/app"
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper" feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
v010 "github.com/tharsis/ethermint/x/feemarket/migrations/v010" v010 "github.com/tharsis/ethermint/x/feemarket/migrations/v010"
v09types "github.com/tharsis/ethermint/x/feemarket/migrations/v09/types"
"github.com/tharsis/ethermint/x/feemarket/types" "github.com/tharsis/ethermint/x/feemarket/types"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types" feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
) )
@ -44,3 +45,25 @@ func TestMigrateStore(t *testing.T) {
require.Equal(t, baseFee.Int64(), params.BaseFee.Int64()) require.Equal(t, baseFee.Int64(), params.BaseFee.Int64())
} }
func TestMigrateJSON(t *testing.T) {
rawJson := `{
"base_fee": "669921875",
"block_gas": "0",
"params": {
"base_fee_change_denominator": 8,
"elasticity_multiplier": 2,
"enable_height": "0",
"initial_base_fee": "1000000000",
"no_base_fee": false
}
}`
encCfg := encoding.MakeConfig(app.ModuleBasics)
var genState v09types.GenesisState
err := encCfg.Marshaler.UnmarshalJSON([]byte(rawJson), &genState)
require.NoError(t, err)
migratedGenState := v010.MigrateJSON(genState)
require.Equal(t, int64(669921875), migratedGenState.Params.BaseFee.Int64())
}

View File

@ -106,14 +106,6 @@ func (m *Params) GetEnableHeight() int64 {
return 0 return 0
} }
func init() {
proto.RegisterType((*Params)(nil), "ethermint.feemarket.v1.Params")
}
func init() {
proto.RegisterFile("ethermint/feemarket/v1/feemarket.proto", fileDescriptor_4feb8b20cf98e6e1)
}
var fileDescriptor_4feb8b20cf98e6e1 = []byte{ var fileDescriptor_4feb8b20cf98e6e1 = []byte{
// 286 bytes of a gzipped FileDescriptorProto // 286 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xc1, 0x4a, 0x03, 0x31, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xc1, 0x4a, 0x03, 0x31,

View File

@ -83,14 +83,6 @@ func (m *GenesisState) GetBlockGas() uint64 {
return 0 return 0
} }
func init() {
proto.RegisterType((*GenesisState)(nil), "ethermint.feemarket.v1.GenesisState")
}
func init() {
proto.RegisterFile("ethermint/feemarket/v1/genesis.proto", fileDescriptor_6241c21661288629)
}
var fileDescriptor_6241c21661288629 = []byte{ var fileDescriptor_6241c21661288629 = []byte{
// 286 bytes of a gzipped FileDescriptorProto // 286 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x31, 0x4b, 0xc3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x31, 0x4b, 0xc3, 0x40,