diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c44d716c7f..f51d927816c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,7 +57,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#4891](https://github.com/osmosis-labs/osmosis/pull/4891) Enable CORS by default on localosmosis * [#4892](https://github.com/osmosis-labs/osmosis/pull/4847) Update Golang to 1.20 * [#4893](https://github.com/osmosis-labs/osmosis/pull/4893) Update alpine docker base image to `alpine:3.17` - + * [#4912](https://github.com/osmosis-labs/osmosis/pull/4912) Export Position_lock_id mappings to GenesisState + ### API breaks * [#4336](https://github.com/osmosis-labs/osmosis/pull/4336) Move epochs module into its own go.mod diff --git a/proto/osmosis/concentrated-liquidity/genesis.proto b/proto/osmosis/concentrated-liquidity/genesis.proto index 9ad7e880552..0b4715b21ab 100644 --- a/proto/osmosis/concentrated-liquidity/genesis.proto +++ b/proto/osmosis/concentrated-liquidity/genesis.proto @@ -48,6 +48,11 @@ message PoolData { [ (gogoproto.nullable) = false ]; } +message PositionData { + Position position = 1; + uint64 lock_id = 2 [ (gogoproto.moretags) = "yaml:\"lock_id\"" ]; +} + // GenesisState defines the concentrated liquidity module's genesis state. message GenesisState { // params are all the parameters of the module @@ -55,7 +60,7 @@ message GenesisState { // pool data containining serialized pool struct and ticks. repeated PoolData pool_data = 2 [ (gogoproto.nullable) = false ]; - repeated Position positions = 3 [ (gogoproto.nullable) = false ]; + repeated PositionData position_data = 3 [ (gogoproto.nullable) = false ]; uint64 next_position_id = 4 [ (gogoproto.moretags) = "yaml:\"next_position_id\"" ]; diff --git a/x/concentrated-liquidity/genesis.go b/x/concentrated-liquidity/genesis.go index 4cfb11cc575..9970e3209b7 100644 --- a/x/concentrated-liquidity/genesis.go +++ b/x/concentrated-liquidity/genesis.go @@ -59,13 +59,12 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState genesis.GenesisState) { } // set positions for pool - for _, position := range genState.Positions { - if _, ok := seenPoolIds[position.PoolId]; !ok { - panic(fmt.Sprintf("found position with pool id (%d) but there is no pool with such id that exists", position.PoolId)) + for _, positionWrapper := range genState.PositionData { + if _, ok := seenPoolIds[positionWrapper.Position.PoolId]; !ok { + panic(fmt.Sprintf("found position with pool id (%d) but there is no pool with such id that exists", positionWrapper.Position.PoolId)) } - // We hardcode the underlying lock id to 0, because genesisState should already hold the positionId to lockId connections - err := k.SetPosition(ctx, position.PoolId, sdk.MustAccAddressFromBech32(position.Address), position.LowerTick, position.UpperTick, position.JoinTime, position.Liquidity, position.PositionId, 0) + err := k.SetPosition(ctx, positionWrapper.Position.PoolId, sdk.MustAccAddressFromBech32(positionWrapper.Position.Address), positionWrapper.Position.LowerTick, positionWrapper.Position.UpperTick, positionWrapper.Position.JoinTime, positionWrapper.Position.Liquidity, positionWrapper.Position.PositionId, positionWrapper.LockId) if err != nil { panic(err) } @@ -152,10 +151,28 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *genesis.GenesisState { panic(err) } + positionData := make([]genesis.PositionData, 0, len(positions)) + for _, position := range positions { + getPosition, err := k.GetPosition(ctx, position.PositionId) + if err != nil { + panic(err) + } + + lockId, err := k.GetPositionIdToLock(ctx, position.PositionId) + if err != nil { + panic(err) + } + + positionData = append(positionData, genesis.PositionData{ + LockId: lockId, + Position: &getPosition, + }) + } + return &genesis.GenesisState{ Params: k.GetParams(ctx), PoolData: poolData, - Positions: positions, + PositionData: positionData, NextPositionId: k.GetNextPositionId(ctx), } } diff --git a/x/concentrated-liquidity/genesis_test.go b/x/concentrated-liquidity/genesis_test.go index 9790bc17b8d..6c63595eeef 100644 --- a/x/concentrated-liquidity/genesis_test.go +++ b/x/concentrated-liquidity/genesis_test.go @@ -22,7 +22,7 @@ import ( type singlePoolGenesisEntry struct { pool model.Pool tick []genesis.FullTick - positions []model.Position + positionData []genesis.PositionData feeAccumValues genesis.AccumObject incentiveAccumulators []genesis.AccumObject incentiveRecords []types.IncentiveRecord @@ -62,14 +62,14 @@ var ( } ) -func positionWithPoolId(position model.Position, poolId uint64) model.Position { +func positionWithPoolId(position model.Position, poolId uint64) *model.Position { position.PoolId = poolId - return position + return &position } -func withPositionId(position model.Position, positionId uint64) model.Position { +func withPositionId(position model.Position, positionId uint64) *model.Position { position.PositionId = positionId - return position + return &position } func incentiveAccumsWithPoolId(poolId uint64) []genesis.AccumObject { @@ -137,9 +137,8 @@ func setupGenesis(baseGenesis genesis.GenesisState, poolGenesisEntries []singleP IncentivesAccumulators: poolGenesisEntry.incentiveAccumulators, IncentiveRecords: poolGenesisEntry.incentiveRecords, }) - baseGenesis.Positions = append(baseGenesis.Positions, poolGenesisEntry.positions...) - baseGenesis.NextPositionId = uint64(len(poolGenesisEntry.positions)) - + baseGenesis.PositionData = append(baseGenesis.PositionData, poolGenesisEntry.positionData...) + baseGenesis.NextPositionId = uint64(len(poolGenesisEntry.positionData)) } return baseGenesis } @@ -164,7 +163,7 @@ func (s *KeeperTestSuite) TestInitGenesis() { genesis genesis.GenesisState expectedPools []model.Pool expectedTicksPerPoolId map[uint64][]genesis.FullTick - expectedPositions []model.Position + expectedPositionData []genesis.PositionData expectedfeeAccumValues []genesis.AccumObject expectedIncentiveRecords []types.IncentiveRecord }{ @@ -177,7 +176,12 @@ func (s *KeeperTestSuite) TestInitGenesis() { withTickIndex(withPoolId(defaultFullTick, poolOne.Id), -10), withTickIndex(withPoolId(defaultFullTick, poolOne.Id), 10), }, - positions: []model.Position{testPositionModel}, + positionData: []genesis.PositionData{ + { + LockId: 1, + Position: &testPositionModel, + }, + }, feeAccumValues: genesis.AccumObject{ Name: types.KeyFeePoolAccumulator(1), AccumContent: &accum.AccumulatorContent{ @@ -221,7 +225,12 @@ func (s *KeeperTestSuite) TestInitGenesis() { withTickIndex(withPoolId(defaultFullTick, poolOne.Id), 10), }, }, - expectedPositions: []model.Position{testPositionModel}, + expectedPositionData: []genesis.PositionData{ + { + LockId: 1, + Position: &testPositionModel, + }, + }, expectedfeeAccumValues: []genesis.AccumObject{ { Name: types.KeyFeePoolAccumulator(1), @@ -264,7 +273,12 @@ func (s *KeeperTestSuite) TestInitGenesis() { tick: []genesis.FullTick{ withTickIndex(withPoolId(defaultFullTick, poolOne.Id), -1234), }, - positions: []model.Position{testPositionModel}, + positionData: []genesis.PositionData{ + { + LockId: 1, + Position: &testPositionModel, + }, + }, feeAccumValues: genesis.AccumObject{ Name: types.KeyFeePoolAccumulator(1), AccumContent: &accum.AccumulatorContent{ @@ -293,7 +307,13 @@ func (s *KeeperTestSuite) TestInitGenesis() { withTickIndex(withPoolId(defaultFullTick, poolOne.Id), 0), withTickIndex(withPoolId(defaultFullTick, poolOne.Id), 999), }, - positions: []model.Position{withPositionId(positionWithPoolId(testPositionModel, 2), DefaultPositionId+1)}, + positionData: []genesis.PositionData{ + { + LockId: 2, + Position: withPositionId(*positionWithPoolId(testPositionModel, 2), DefaultPositionId+1), + }, + }, + feeAccumValues: genesis.AccumObject{ Name: types.KeyFeePoolAccumulator(2), AccumContent: &accum.AccumulatorContent{ @@ -370,7 +390,16 @@ func (s *KeeperTestSuite) TestInitGenesis() { MinUptime: testUptimeOne, }, }, - expectedPositions: []model.Position{testPositionModel, withPositionId(positionWithPoolId(testPositionModel, 2), DefaultPositionId+1)}, + expectedPositionData: []genesis.PositionData{ + { + LockId: 1, + Position: &testPositionModel, + }, + { + LockId: 2, + Position: withPositionId(*positionWithPoolId(testPositionModel, 2), DefaultPositionId+1), + }, + }, }, } @@ -438,9 +467,22 @@ func (s *KeeperTestSuite) TestInitGenesis() { // get all positions. positions, err := clKeeper.GetAllPositions(ctx) s.Require().NoError(err) + var positionData []genesis.PositionData + for _, position := range positions { + getPosition, err := clKeeper.GetPosition(ctx, position.PositionId) + s.Require().NoError(err) + + lockId, err := clKeeper.GetPositionIdToLock(ctx, position.PositionId) + s.Require().NoError(err) + + positionData = append(positionData, genesis.PositionData{ + LockId: lockId, + Position: &getPosition, + }) + } // Validate positions - s.Require().Equal(tc.expectedPositions, positions) + s.Require().Equal(tc.expectedPositionData, positionData) // Validate accum objects s.Require().Equal(len(feeAccums), len(tc.expectedfeeAccumValues)) @@ -498,7 +540,12 @@ func (s *KeeperTestSuite) TestExportGenesis() { withTickIndex(withPoolId(defaultFullTick, poolOne.Id), -10), withTickIndex(withPoolId(defaultFullTick, poolOne.Id), 10), }, - positions: []model.Position{testPositionModel}, + positionData: []genesis.PositionData{ + { + LockId: 1, + Position: &testPositionModel, + }, + }, feeAccumValues: genesis.AccumObject{ Name: types.KeyFeePoolAccumulator(poolOne.Id), AccumContent: &accum.AccumulatorContent{ @@ -542,7 +589,12 @@ func (s *KeeperTestSuite) TestExportGenesis() { tick: []genesis.FullTick{ withTickIndex(withPoolId(defaultFullTick, poolOne.Id), -1234), }, - positions: []model.Position{testPositionModel}, + positionData: []genesis.PositionData{ + { + LockId: 1, + Position: &testPositionModel, + }, + }, feeAccumValues: genesis.AccumObject{ Name: types.KeyFeePoolAccumulator(poolOne.Id), AccumContent: &accum.AccumulatorContent{ @@ -592,7 +644,12 @@ func (s *KeeperTestSuite) TestExportGenesis() { MinUptime: testUptimeOne, }, }, - positions: []model.Position{withPositionId(positionWithPoolId(testPositionModel, 2), DefaultPositionId+1)}, + positionData: []genesis.PositionData{ + { + LockId: 2, + Position: withPositionId(*positionWithPoolId(testPositionModel, 2), DefaultPositionId+1), + }, + }, }, }), }, @@ -648,7 +705,7 @@ func (s *KeeperTestSuite) TestExportGenesis() { } // Validate positions. - s.Require().Equal(tc.genesis.Positions, actualExported.Positions) + s.Require().Equal(tc.genesis.PositionData, actualExported.PositionData) // Validate next position id. s.Require().Equal(tc.genesis.NextPositionId, actualExported.NextPositionId) diff --git a/x/concentrated-liquidity/types/genesis/genesis.pb.go b/x/concentrated-liquidity/types/genesis/genesis.pb.go index 0b1227d0fa4..b19ceff75c2 100644 --- a/x/concentrated-liquidity/types/genesis/genesis.pb.go +++ b/x/concentrated-liquidity/types/genesis/genesis.pb.go @@ -175,21 +175,73 @@ func (m *PoolData) GetIncentiveRecords() []types1.IncentiveRecord { return nil } +type PositionData struct { + Position *model.Position `protobuf:"bytes,1,opt,name=position,proto3" json:"position,omitempty"` + LockId uint64 `protobuf:"varint,2,opt,name=lock_id,json=lockId,proto3" json:"lock_id,omitempty" yaml:"lock_id"` +} + +func (m *PositionData) Reset() { *m = PositionData{} } +func (m *PositionData) String() string { return proto.CompactTextString(m) } +func (*PositionData) ProtoMessage() {} +func (*PositionData) Descriptor() ([]byte, []int) { + return fileDescriptor_5c140d686ee6724a, []int{2} +} +func (m *PositionData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PositionData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PositionData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PositionData) XXX_Merge(src proto.Message) { + xxx_messageInfo_PositionData.Merge(m, src) +} +func (m *PositionData) XXX_Size() int { + return m.Size() +} +func (m *PositionData) XXX_DiscardUnknown() { + xxx_messageInfo_PositionData.DiscardUnknown(m) +} + +var xxx_messageInfo_PositionData proto.InternalMessageInfo + +func (m *PositionData) GetPosition() *model.Position { + if m != nil { + return m.Position + } + return nil +} + +func (m *PositionData) GetLockId() uint64 { + if m != nil { + return m.LockId + } + return 0 +} + // GenesisState defines the concentrated liquidity module's genesis state. type GenesisState struct { // params are all the parameters of the module Params types1.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // pool data containining serialized pool struct and ticks. - PoolData []PoolData `protobuf:"bytes,2,rep,name=pool_data,json=poolData,proto3" json:"pool_data"` - Positions []model.Position `protobuf:"bytes,3,rep,name=positions,proto3" json:"positions"` - NextPositionId uint64 `protobuf:"varint,4,opt,name=next_position_id,json=nextPositionId,proto3" json:"next_position_id,omitempty" yaml:"next_position_id"` + PoolData []PoolData `protobuf:"bytes,2,rep,name=pool_data,json=poolData,proto3" json:"pool_data"` + PositionData []PositionData `protobuf:"bytes,3,rep,name=position_data,json=positionData,proto3" json:"position_data"` + NextPositionId uint64 `protobuf:"varint,4,opt,name=next_position_id,json=nextPositionId,proto3" json:"next_position_id,omitempty" yaml:"next_position_id"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_5c140d686ee6724a, []int{2} + return fileDescriptor_5c140d686ee6724a, []int{3} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -232,9 +284,9 @@ func (m *GenesisState) GetPoolData() []PoolData { return nil } -func (m *GenesisState) GetPositions() []model.Position { +func (m *GenesisState) GetPositionData() []PositionData { if m != nil { - return m.Positions + return m.PositionData } return nil } @@ -256,7 +308,7 @@ func (m *AccumObject) Reset() { *m = AccumObject{} } func (m *AccumObject) String() string { return proto.CompactTextString(m) } func (*AccumObject) ProtoMessage() {} func (*AccumObject) Descriptor() ([]byte, []int) { - return fileDescriptor_5c140d686ee6724a, []int{3} + return fileDescriptor_5c140d686ee6724a, []int{4} } func (m *AccumObject) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -302,6 +354,7 @@ func (m *AccumObject) GetAccumContent() *accum.AccumulatorContent { func init() { proto.RegisterType((*FullTick)(nil), "osmosis.concentratedliquidity.v1beta1.FullTick") proto.RegisterType((*PoolData)(nil), "osmosis.concentratedliquidity.v1beta1.PoolData") + proto.RegisterType((*PositionData)(nil), "osmosis.concentratedliquidity.v1beta1.PositionData") proto.RegisterType((*GenesisState)(nil), "osmosis.concentratedliquidity.v1beta1.GenesisState") proto.RegisterType((*AccumObject)(nil), "osmosis.concentratedliquidity.v1beta1.AccumObject") } @@ -311,54 +364,57 @@ func init() { } var fileDescriptor_5c140d686ee6724a = []byte{ - // 740 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x6e, 0x13, 0x3b, - 0x14, 0xce, 0x34, 0xd3, 0xde, 0xc6, 0xe9, 0xed, 0x8f, 0xd5, 0xdb, 0xce, 0xed, 0xd5, 0x9d, 0x84, - 0x41, 0x95, 0x8a, 0x4a, 0x66, 0xd4, 0x94, 0xb2, 0x60, 0xd7, 0x29, 0x3f, 0x0a, 0x0b, 0xa8, 0xa6, - 0x5d, 0x81, 0x50, 0xe4, 0xcc, 0x38, 0xc1, 0x74, 0x62, 0x87, 0xd8, 0xa9, 0x12, 0xb1, 0xe3, 0x09, - 0x10, 0x3b, 0xde, 0x83, 0x37, 0x60, 0x53, 0x21, 0x16, 0x5d, 0xb2, 0x8a, 0x50, 0xfb, 0x06, 0x79, - 0x02, 0x34, 0xb6, 0x27, 0x49, 0x2b, 0x50, 0x52, 0x76, 0x63, 0x9f, 0xef, 0xfb, 0xce, 0x77, 0xec, - 0xe3, 0x33, 0xe0, 0x2e, 0xe3, 0x4d, 0xc6, 0x09, 0xf7, 0x42, 0x46, 0x43, 0x4c, 0x45, 0x1b, 0x09, - 0x1c, 0x95, 0x62, 0xf2, 0xb6, 0x43, 0x22, 0x22, 0x7a, 0x5e, 0x03, 0x53, 0xcc, 0x09, 0x77, 0x5b, - 0x6d, 0x26, 0x18, 0xdc, 0xd4, 0x68, 0x77, 0x1c, 0x3d, 0x04, 0xbb, 0xa7, 0x3b, 0x35, 0x2c, 0xd0, - 0xce, 0xc6, 0x6a, 0x83, 0x35, 0x98, 0x64, 0x78, 0xc9, 0x97, 0x22, 0x6f, 0xfc, 0x1b, 0x4a, 0x76, - 0x55, 0x05, 0xd4, 0x42, 0x87, 0x6c, 0xb5, 0xf2, 0x6a, 0x88, 0x63, 0x4f, 0xab, 0x78, 0x21, 0x23, - 0x34, 0xa5, 0x36, 0x18, 0x6b, 0xc4, 0xd8, 0x93, 0xab, 0x5a, 0xa7, 0xee, 0x21,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, 0x06, 0x00, 0x00, + // 787 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0xdb, 0x38, + 0x14, 0xb5, 0x62, 0xc5, 0x63, 0xd3, 0xce, 0x4b, 0xc8, 0x24, 0x9a, 0x0c, 0x46, 0xf6, 0x68, 0x10, + 0x20, 0x83, 0x8c, 0x25, 0xc4, 0x99, 0xcc, 0x62, 0x76, 0x51, 0xfa, 0x80, 0x5b, 0xa0, 0x0d, 0xd4, + 0xac, 0x5a, 0xb4, 0x06, 0x2d, 0xd1, 0x2e, 0x1b, 0x59, 0x74, 0x4d, 0x3a, 0xb0, 0xd1, 0x5d, 0x57, + 0x5d, 0x16, 0xdd, 0xf5, 0x3f, 0xfa, 0x11, 0x41, 0x51, 0x14, 0x59, 0x76, 0x65, 0x14, 0xc9, 0x1f, + 0xf8, 0x0b, 0x0a, 0xf1, 0xe1, 0x47, 0xd0, 0xc2, 0x4e, 0x77, 0x22, 0xef, 0x39, 0x87, 0xe7, 0x5e, + 0xde, 0x4b, 0x81, 0x7f, 0x08, 0x6d, 0x11, 0x8a, 0xa9, 0x1b, 0x90, 0x38, 0x40, 0x31, 0xeb, 0x40, + 0x86, 0xc2, 0x72, 0x84, 0x5f, 0x76, 0x71, 0x88, 0x59, 0xdf, 0x6d, 0xa2, 0x18, 0x51, 0x4c, 0x9d, + 0x76, 0x87, 0x30, 0x62, 0x6c, 0x4b, 0xb4, 0x33, 0x89, 0x1e, 0x81, 0x9d, 0xb3, 0xbd, 0x3a, 0x62, + 0x70, 0x6f, 0x6b, 0xbd, 0x49, 0x9a, 0x84, 0x33, 0xdc, 0xe4, 0x4b, 0x90, 0xb7, 0x7e, 0x0b, 0x38, + 0xbb, 0x26, 0x02, 0x62, 0x21, 0x43, 0x96, 0x58, 0xb9, 0x75, 0x48, 0x91, 0x2b, 0x55, 0xdc, 0x80, + 0xe0, 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 0xb4, 0xb7, 0x57, 0x56, 0xea, 0xe2, 0xca, 0x4a, 0x7d, 0xb9, 0xb2, 0x52, + 0x8f, 0xef, 0x35, 0x31, 0x7b, 0xde, 0xad, 0x3b, 0x01, 0x69, 0xb9, 0x52, 0xbc, 0x1c, 0xc1, 0x3a, + 0x55, 0x0b, 0xf7, 0x6c, 0xef, 0xc0, 0xed, 0xfd, 0xf0, 0xa5, 0xef, 0xb7, 0x11, 0x55, 0xff, 0xcb, + 0x7a, 0x86, 0xbf, 0x5f, 0xfb, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x77, 0x9b, 0x18, 0x08, 0x60, + 0x07, 0x00, 0x00, } func (m *FullTick) Marshal() (dAtA []byte, err error) { @@ -491,6 +547,46 @@ func (m *PoolData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PositionData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PositionData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PositionData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LockId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.LockId)) + i-- + dAtA[i] = 0x10 + } + if m.Position != nil { + { + size, err := m.Position.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *GenesisState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -516,10 +612,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.Positions) > 0 { - for iNdEx := len(m.Positions) - 1; iNdEx >= 0; iNdEx-- { + if len(m.PositionData) > 0 { + for iNdEx := len(m.PositionData) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Positions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PositionData[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -660,6 +756,22 @@ func (m *PoolData) Size() (n int) { return n } +func (m *PositionData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Position != nil { + l = m.Position.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.LockId != 0 { + n += 1 + sovGenesis(uint64(m.LockId)) + } + return n +} + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -674,8 +786,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.Positions) > 0 { - for _, e := range m.Positions { + if len(m.PositionData) > 0 { + for _, e := range m.PositionData { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -1051,6 +1163,111 @@ func (m *PoolData) Unmarshal(dAtA []byte) error { } return nil } +func (m *PositionData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PositionData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PositionData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Position == nil { + m.Position = &model.Position{} + } + if err := m.Position.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockId", wireType) + } + m.LockId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LockId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1149,7 +1366,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Positions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionData", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1176,8 +1393,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Positions = append(m.Positions, model.Position{}) - if err := m.Positions[len(m.Positions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PositionData = append(m.PositionData, PositionData{}) + if err := m.PositionData[len(m.PositionData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex