From ea3c16ed7a3af89ea5ba9af2071a54b2cfb0a551 Mon Sep 17 00:00:00 2001 From: Nick DeLuca Date: Tue, 5 Apr 2022 08:51:56 -0700 Subject: [PATCH] fix: remove proto message registration from legacy v09 types to fix conflict (#1023) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with existing types Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> --- x/feemarket/migrations/v010/migrate_test.go | 23 +++++++++++++++++++ .../migrations/v09/types/feemarket.pb copy.go | 8 ------- .../migrations/v09/types/genesis.pb copy.go | 8 ------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/x/feemarket/migrations/v010/migrate_test.go b/x/feemarket/migrations/v010/migrate_test.go index 13ee56bca6..30be7813cb 100644 --- a/x/feemarket/migrations/v010/migrate_test.go +++ b/x/feemarket/migrations/v010/migrate_test.go @@ -15,6 +15,7 @@ import ( "github.com/tharsis/ethermint/app" feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper" 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" 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()) } + +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()) +} diff --git a/x/feemarket/migrations/v09/types/feemarket.pb copy.go b/x/feemarket/migrations/v09/types/feemarket.pb copy.go index 0ec4ef3b21..b5eb23bf73 100644 --- a/x/feemarket/migrations/v09/types/feemarket.pb copy.go +++ b/x/feemarket/migrations/v09/types/feemarket.pb copy.go @@ -106,14 +106,6 @@ func (m *Params) GetEnableHeight() int64 { 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{ // 286 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xc1, 0x4a, 0x03, 0x31, diff --git a/x/feemarket/migrations/v09/types/genesis.pb copy.go b/x/feemarket/migrations/v09/types/genesis.pb copy.go index e3be5d55d4..0b49475e18 100644 --- a/x/feemarket/migrations/v09/types/genesis.pb copy.go +++ b/x/feemarket/migrations/v09/types/genesis.pb copy.go @@ -83,14 +83,6 @@ func (m *GenesisState) GetBlockGas() uint64 { 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{ // 286 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x31, 0x4b, 0xc3, 0x40,