From 6af3073d0fcdc431aced1c042b1bdf1f9b9470f1 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 09:53:34 -0400 Subject: [PATCH 01/27] add to proto --- proto/quicksilver/interchainstaking/v1/interchainstaking.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/quicksilver/interchainstaking/v1/interchainstaking.proto b/proto/quicksilver/interchainstaking/v1/interchainstaking.proto index f097a4e15..78130e81e 100644 --- a/proto/quicksilver/interchainstaking/v1/interchainstaking.proto +++ b/proto/quicksilver/interchainstaking/v1/interchainstaking.proto @@ -48,6 +48,7 @@ message Zone { bool unbonding_enabled = 25; bool deposits_enabled = 26; bool return_to_sender = 27; + bool is_118_cointype = 28; } message ICAAccount { From 537e062cbf3ae602f41b536e820eb415a66f7e0d Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 10:03:31 -0400 Subject: [PATCH 02/27] generate --- docs/swagger.yml | 4 + .../types/interchainstaking.pb.go | 268 ++++++++++-------- 2 files changed, 160 insertions(+), 112 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index 14a330df0..3fdfb5645 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -2607,6 +2607,8 @@ paths: type: boolean return_to_sender: type: boolean + is_118_cointype: + type: boolean stats: type: object properties: @@ -2888,6 +2890,8 @@ paths: type: boolean return_to_sender: type: boolean + is_118_cointype: + type: boolean stats: type: array items: diff --git a/x/interchainstaking/types/interchainstaking.pb.go b/x/interchainstaking/types/interchainstaking.pb.go index 0367bf2a3..4fe3c3bb1 100644 --- a/x/interchainstaking/types/interchainstaking.pb.go +++ b/x/interchainstaking/types/interchainstaking.pb.go @@ -58,6 +58,7 @@ type Zone struct { UnbondingEnabled bool `protobuf:"varint,25,opt,name=unbonding_enabled,json=unbondingEnabled,proto3" json:"unbonding_enabled,omitempty"` DepositsEnabled bool `protobuf:"varint,26,opt,name=deposits_enabled,json=depositsEnabled,proto3" json:"deposits_enabled,omitempty"` ReturnToSender bool `protobuf:"varint,27,opt,name=return_to_sender,json=returnToSender,proto3" json:"return_to_sender,omitempty"` + Is_118Cointype bool `protobuf:"varint,28,opt,name=is_118_cointype,json=is118Cointype,proto3" json:"is_118_cointype,omitempty"` } func (m *Zone) Reset() { *m = Zone{} } @@ -261,6 +262,13 @@ func (m *Zone) GetReturnToSender() bool { return false } +func (m *Zone) GetIs_118Cointype() bool { + if m != nil { + return m.Is_118Cointype + } + return false +} + type ICAAccount struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // balance defines the different coins this balance holds. @@ -1107,118 +1115,119 @@ func init() { } var fileDescriptor_0d755cfd37ef9fee = []byte{ - // 1769 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x41, 0x6f, 0x1b, 0xc7, - 0x15, 0xf6, 0x4a, 0x14, 0x25, 0x3e, 0x52, 0xa2, 0x34, 0x52, 0x9c, 0xb5, 0xd2, 0x52, 0x2c, 0x8b, - 0xa6, 0x6c, 0x5d, 0x91, 0x91, 0x0b, 0xb4, 0x45, 0x50, 0x14, 0x91, 0x2c, 0x23, 0x11, 0x0a, 0x1b, - 0xc2, 0x4a, 0x69, 0x00, 0x17, 0xc5, 0x62, 0xb8, 0xfb, 0x44, 0x4e, 0xbd, 0xbb, 0x43, 0xcf, 0xcc, - 0x4a, 0x72, 0x7f, 0x45, 0x7e, 0x42, 0x6f, 0x05, 0x82, 0xa2, 0x27, 0x1f, 0xfb, 0x03, 0x72, 0x6b, - 0xe0, 0x53, 0x51, 0x14, 0x76, 0x61, 0x5f, 0x9b, 0x4b, 0x7f, 0x41, 0x31, 0xb3, 0xb3, 0xcb, 0x95, - 0xa2, 0x9a, 0x92, 0x23, 0xf7, 0x44, 0xce, 0x37, 0xef, 0x7d, 0xf3, 0x66, 0xe7, 0xcd, 0xfb, 0xde, - 0x2e, 0xfc, 0xe2, 0x71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fd, 0x6f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xfd, 0x1d, 0xb1, 0x28, 0x0a, 0x15, 0x00, 0x00, + // 1792 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0x1b, 0xc7, + 0x15, 0xf7, 0x92, 0x14, 0x29, 0x3e, 0x52, 0xa2, 0x34, 0x52, 0x9c, 0xb5, 0x92, 0x52, 0x2c, 0x8b, + 0xa6, 0x6c, 0x53, 0x91, 0xa1, 0x0b, 0xb4, 0x46, 0x50, 0x14, 0x91, 0x2c, 0x23, 0x11, 0x0a, 0x1b, + 0xc2, 0x4a, 0x69, 0x00, 0x17, 0xc5, 0x62, 0xb8, 0x3b, 0x22, 0xa7, 0xde, 0xdd, 0xa1, 0x67, 0x66, + 0x25, 0xb9, 0x9f, 0x22, 0x1f, 0xa1, 0xb7, 0x02, 0x41, 0xd1, 0x93, 0x8f, 0xfd, 0x00, 0x39, 0x06, + 0x3e, 0x15, 0x45, 0x61, 0x17, 0xf6, 0xb5, 0xb9, 0xf4, 0xd2, 0x6b, 0x31, 0x7f, 0x76, 0xb9, 0x52, + 0x54, 0x53, 0x72, 0x94, 0x9e, 0xa4, 0xf9, 0xcd, 0x7b, 0xbf, 0x79, 0x33, 0xf3, 0xe6, 0xfd, 0xde, + 0x12, 0xee, 0x3c, 0x4e, 0x69, 0xf0, 0x48, 0xd0, 0xe8, 0x98, 0xf0, 0x01, 0x4d, 0x24, 0xe1, 0xc1, + 0x04, 0xd3, 0x44, 0x48, 0xfc, 0x88, 0x26, 0xe3, 0xc1, 0xf1, 0xf0, 0x9b, 0x60, 0x7f, 0xca, 0x99, + 0x64, 0xa8, 0x53, 0xf0, 0xec, 0x7f, 0xd3, 0xe8, 0x78, 0xb8, 0xd1, 0x0e, 0x98, 0x88, 0x99, 0x18, + 0x8c, 0xb0, 0x20, 0x83, 0xe3, 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xef, 0x25, 0x61, 0xf7, 0x00, 0xd6, 0xf6, 0x19, 0x97, 0x77, 0xf3, 0x5f, 0x8c, + 0x0e, 0xd3, 0x69, 0x74, 0xc9, 0x5f, 0x96, 0xde, 0x86, 0x9a, 0xee, 0xb1, 0xf3, 0x1f, 0x96, 0xaa, + 0x6a, 0xb8, 0x17, 0x76, 0xff, 0x51, 0x82, 0x9a, 0x47, 0x02, 0x42, 0xa7, 0xf2, 0x75, 0xaa, 0x3c, + 0x93, 0xa2, 0xd2, 0x25, 0xa5, 0x68, 0xd6, 0x45, 0x95, 0xcf, 0x74, 0x51, 0xb3, 0xf6, 0xb1, 0xf2, + 0xdd, 0xb5, 0x8f, 0x77, 0x01, 0x8e, 0x28, 0x17, 0xd2, 0x17, 0x84, 0x24, 0xf6, 0x07, 0xa7, 0x79, + 0x45, 0xc3, 0xd1, 0x45, 0xa3, 0xae, 0xfd, 0x0e, 0x08, 0x49, 0xd0, 0x0e, 0xd4, 0xad, 0x46, 0x93, + 0xf0, 0x92, 0xd2, 0x6e, 0x39, 0x72, 0xb7, 0x9d, 0x87, 0x5f, 0xbe, 0x6c, 0x3b, 0x5f, 0xbd, 0x6c, + 0x3b, 0xff, 0x7c, 0xd9, 0x76, 0x3e, 0x7f, 0xd5, 0xbe, 0xf1, 0xd5, 0xab, 0xf6, 0x8d, 0xbf, 0xbd, + 0x6a, 0xdf, 0x78, 0xf8, 0x51, 0x61, 0x53, 0x34, 0x19, 0x93, 0x24, 0xa5, 0xf2, 0xc9, 0xd6, 0x28, + 0xa5, 0x51, 0x38, 0x28, 0xfe, 0x04, 0x7a, 0x7a, 0xc1, 0x8f, 0xa0, 0x7a, 0xcb, 0xa3, 0xaa, 0x0e, + 0xe2, 0x67, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x4c, 0x28, 0xe9, 0x32, 0x15, 0x00, 0x00, } func (m *Zone) Marshal() (dAtA []byte, err error) { @@ -1241,6 +1250,18 @@ func (m *Zone) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Is_118Cointype { + i-- + if m.Is_118Cointype { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xe0 + } if m.ReturnToSender { i-- if m.ReturnToSender { @@ -2343,6 +2364,9 @@ func (m *Zone) Size() (n int) { if m.ReturnToSender { n += 3 } + if m.Is_118Cointype { + n += 3 + } return n } @@ -3433,6 +3457,26 @@ func (m *Zone) Unmarshal(dAtA []byte) error { } } m.ReturnToSender = bool(v != 0) + case 28: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Is_118Cointype", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterchainstaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Is_118Cointype = bool(v != 0) default: iNdEx = preIndex skippy, err := skipInterchainstaking(dAtA[iNdEx:]) From d866bedf6da869ec13aa5472cc23bb96c62dd172 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 10:31:48 -0400 Subject: [PATCH 03/27] populate field --- app/upgrades_test.go | 4 ++++ x/airdrop/keeper/keeper_test.go | 11 ++++++----- x/claimsmanager/keeper/keeper_test.go | 3 +++ x/interchainstaking/client/cli/cli_test.go | 2 ++ x/interchainstaking/keeper/callbacks_test.go | 2 +- x/interchainstaking/keeper/zones_test.go | 1 + x/interchainstaking/types/zones_test.go | 18 +++++++++--------- x/participationrewards/keeper/keeper_test.go | 5 +++++ 8 files changed, 31 insertions(+), 15 deletions(-) diff --git a/app/upgrades_test.go b/app/upgrades_test.go index 25a0c7b94..408ad3612 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -82,6 +82,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "uatom", MultiSend: false, LiquidityModule: true, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -94,6 +95,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "uatom", MultiSend: false, LiquidityModule: false, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -106,6 +108,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "uosmo", MultiSend: false, LiquidityModule: true, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) // uni-5 zone @@ -117,6 +120,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "ujunox", MultiSend: false, LiquidityModule: true, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) diff --git a/x/airdrop/keeper/keeper_test.go b/x/airdrop/keeper/keeper_test.go index 9b2ba9168..bef0f233e 100644 --- a/x/airdrop/keeper/keeper_test.go +++ b/x/airdrop/keeper/keeper_test.go @@ -76,11 +76,12 @@ func (s *KeeperTestSuite) SetupTest() { func (s *KeeperTestSuite) initTestZone() { // test zone zone := icstypes.Zone{ - ConnectionId: s.path.EndpointB.ConnectionID, - ChainId: s.chainB.ChainID, - AccountPrefix: "cosmos", - LocalDenom: "uqatom", - BaseDenom: "uatom", + ConnectionId: s.path.EndpointB.ConnectionID, + ChainId: s.chainB.ChainID, + AccountPrefix: "cosmos", + LocalDenom: "uqatom", + BaseDenom: "uatom", + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) diff --git a/x/claimsmanager/keeper/keeper_test.go b/x/claimsmanager/keeper/keeper_test.go index 5d7a8763b..424370182 100644 --- a/x/claimsmanager/keeper/keeper_test.go +++ b/x/claimsmanager/keeper/keeper_test.go @@ -79,6 +79,7 @@ func (s *KeeperTestSuite) initTestZone() { UnbondingEnabled: false, LiquidityModule: true, Decimals: 6, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -93,6 +94,7 @@ func (s *KeeperTestSuite) initTestZone() { UnbondingEnabled: false, LiquidityModule: true, Decimals: 6, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -107,6 +109,7 @@ func (s *KeeperTestSuite) initTestZone() { UnbondingEnabled: false, LiquidityModule: true, Decimals: 6, + Is_118Cointype: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) } diff --git a/x/interchainstaking/client/cli/cli_test.go b/x/interchainstaking/client/cli/cli_test.go index 567b3cb5c..3d98ce950 100644 --- a/x/interchainstaking/client/cli/cli_test.go +++ b/x/interchainstaking/client/cli/cli_test.go @@ -63,6 +63,7 @@ func (s *IntegrationTestSuite) SetupSuite() { Tvl: sdk.ZeroDec(), UnbondingPeriod: 0, MessagesPerTx: 0, + Is_118Cointype: true, } zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, @@ -163,6 +164,7 @@ func (s *IntegrationTestSuite) ZonesEqual(zoneA, zoneB types.Zone) bool { for i := range zoneA.Validators { s.Require().Equal(zoneA.Validators[i], zoneB.Validators[i]) } + s.Require().Equal(zoneA.Is_118Cointype, zoneB.Is_118Cointype) return true } diff --git a/x/interchainstaking/keeper/callbacks_test.go b/x/interchainstaking/keeper/callbacks_test.go index d6042177a..146352120 100644 --- a/x/interchainstaking/keeper/callbacks_test.go +++ b/x/interchainstaking/keeper/callbacks_test.go @@ -367,7 +367,7 @@ func (s *KeeperTestSuite) TestHandleValidatorCallbackNilValue() { func (s *KeeperTestSuite) TestHandleValidatorCallback() { newVal := utils.GenerateAccAddressForTestWithPrefix("cosmosvaloper") - zone := icstypes.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := icstypes.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetValidator(s.chainA.GetContext(), zone.ChainId, icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000)}) s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetValidator(s.chainA.GetContext(), zone.ChainId, icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000)}) s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetValidator(s.chainA.GetContext(), zone.ChainId, icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000)}) diff --git a/x/interchainstaking/keeper/zones_test.go b/x/interchainstaking/keeper/zones_test.go index 7d89bc845..a79312d57 100644 --- a/x/interchainstaking/keeper/zones_test.go +++ b/x/interchainstaking/keeper/zones_test.go @@ -88,6 +88,7 @@ func TestKeeperWithZonesRoundTrip(t *testing.T) { sdk.NewCoin("uqck", sdk.NewInt(700000)), ), }, + Is_118Cointype: true, } kpr.SetAddressZoneMapping(ctx, delegationAddr, zone.ChainId) kpr.SetZone(ctx, &zone) diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index d3c83b9eb..f17bf3efd 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -17,7 +17,7 @@ func TestIsDelegateAddress(t *testing.T) { acc2 := utils.GenerateAccAddressForTest() bech32 := utils.ConvertAccAddressForTestUsingPrefix(acc, "cosmos") bech322 := utils.ConvertAccAddressForTestUsingPrefix(acc2, "cosmos") - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}, Is_118Cointype: true} require.True(t, zone.IsDelegateAddress(bech32)) require.False(t, zone.IsDelegateAddress(bech322)) } @@ -25,8 +25,8 @@ func TestIsDelegateAddress(t *testing.T) { func TestGetDelegationAccount(t *testing.T) { acc := utils.GenerateAccAddressForTest() bech32 := utils.ConvertAccAddressForTestUsingPrefix(acc, "cosmos") - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}} - zone2 := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}, Is_118Cointype: true} + zone2 := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} delegateAccount, err := zone.GetDelegationAccount() require.NoError(t, err) @@ -38,14 +38,14 @@ func TestGetDelegationAccount(t *testing.T) { } func TestValidateCoinsForZone(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} valAddresses := []string{"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll", "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7"} require.NoError(t, zone.ValidateCoinsForZone(sdk.NewCoins(sdk.NewCoin("cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy1", sdk.OneInt())), valAddresses)) require.Errorf(t, zone.ValidateCoinsForZone(sdk.NewCoins(sdk.NewCoin("cosmosvaloper18ldc09yx4aua9g8mkl3sj526hgydzzyehcyjjr1", sdk.OneInt())), valAddresses), "invalid denom for zone: cosmosvaloper18ldc09yx4aua9g8mkl3sj526hgydzzyehcyjjr1") } func TestCoinsToIntent(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} valAddresses := []string{"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll", "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7"} testCases := []struct { @@ -101,7 +101,7 @@ func TestCoinsToIntent(t *testing.T) { } func TestBase64MemoToIntent(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -178,7 +178,7 @@ func TestBase64MemoToIntent(t *testing.T) { } func TestUpdateIntentWithMemo(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -263,7 +263,7 @@ func TestUpdateIntentWithMemo(t *testing.T) { } func TestUpdateIntentWithMemoBad(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -299,7 +299,7 @@ func TestUpdateIntentWithMemoBad(t *testing.T) { } func TestUpdateIntentWithCoins(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom"} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, diff --git a/x/participationrewards/keeper/keeper_test.go b/x/participationrewards/keeper/keeper_test.go index 5ff248f9a..e9b64895f 100644 --- a/x/participationrewards/keeper/keeper_test.go +++ b/x/participationrewards/keeper/keeper_test.go @@ -154,6 +154,7 @@ func (s *KeeperTestSuite) setupTestZones() { LiquidityModule: true, DepositsEnabled: true, UnbondingEnabled: false, + Is_118Cointype: true, } selftestzone := icstypes.Zone{ ConnectionId: s.path.EndpointB.ConnectionID, @@ -165,6 +166,7 @@ func (s *KeeperTestSuite) setupTestZones() { LiquidityModule: true, DepositsEnabled: true, UnbondingEnabled: false, + Is_118Cointype: true, } quicksilver.InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &selftestzone) @@ -199,6 +201,7 @@ func (s *KeeperTestSuite) setupTestZones() { UnbondingEnabled: false, LiquidityModule: true, DepositsEnabled: true, + Is_118Cointype: true, Decimals: 6, PerformanceAddress: performanceAccountOsmo, Validators: []*icstypes.Validator{ @@ -242,6 +245,7 @@ func (s *KeeperTestSuite) setupTestZones() { ReturnToSender: false, LiquidityModule: true, PerformanceAddress: performanceAccountCosmos, + Is_118Cointype: true, } quicksilver.InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zoneCosmos) cosmosVals := []icstypes.Validator{ @@ -285,6 +289,7 @@ func (s *KeeperTestSuite) setupTestZones() { PortName: "cosmoshub-4.performance", WithdrawalAddress: utils.GenerateAccAddressForTestWithPrefix("osmo"), }, + Is_118Cointype: true, } quicksilver.InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zoneOsmosis) } From a7ac71060b7135e6be9b343534870c1a4c1733b9 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 18 May 2023 11:50:03 -0400 Subject: [PATCH 04/27] Update proto/quicksilver/interchainstaking/v1/interchainstaking.proto Co-authored-by: Ajaz Ahmed Ansari --- proto/quicksilver/interchainstaking/v1/interchainstaking.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/quicksilver/interchainstaking/v1/interchainstaking.proto b/proto/quicksilver/interchainstaking/v1/interchainstaking.proto index 78130e81e..8cbdf9bda 100644 --- a/proto/quicksilver/interchainstaking/v1/interchainstaking.proto +++ b/proto/quicksilver/interchainstaking/v1/interchainstaking.proto @@ -48,7 +48,7 @@ message Zone { bool unbonding_enabled = 25; bool deposits_enabled = 26; bool return_to_sender = 27; - bool is_118_cointype = 28; + bool is_118 = 28; } message ICAAccount { From 0527b0f89eb601e835d98191c880994a0f337bf0 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 11:55:23 -0400 Subject: [PATCH 05/27] decode basic implementation --- x/interchainstaking/types/zones.go | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index be25fee9c..d676ff05c 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -1,7 +1,9 @@ package types import ( + "bytes" "encoding/base64" + "encoding/hex" "errors" "fmt" "strings" @@ -51,6 +53,8 @@ COINS: return nil } +// memo functionality + // this method exist to make testing easier! func (z *Zone) UpdateIntentWithCoins(intent DelegatorIntent, multiplier sdk.Dec, inAmount sdk.Coins, vals []string) DelegatorIntent { // coinIntent is ordinal @@ -133,3 +137,53 @@ func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (Valida } return out, nil } + +// decode memo +// if zone.Is_118: +// decode as we have ( up to 8 validators) +// return +// +// decode as we have (up to 6 validators) +// look for separator 0xFF +// field_id = [ +// 0x00 = map +// 0x01 = rts +//] // will scale to future fields + +func (z *Zone) DecodeMemo(memo string) (valWeights, something []byte, err error) { + separator, err := hex.DecodeString("0xFF") + if err != nil { + return valWeights, something, err + } + + if memo == "" { + return valWeights, something, errors.New("memo length unexpectedly zero") + } + + memoBytes, err := base64.StdEncoding.DecodeString(memo) + if err != nil { + return valWeights, something, fmt.Errorf("failed to decode base64 message: %w", err) + } + + parts := bytes.Split(memoBytes, separator) + valWeights = parts[0] + if len(valWeights)%21 != 0 { // memo must be one byte (1-200) weight then 20 byte valoperAddress + return valWeights, something, fmt.Errorf("unable to determine intent from memo: Message was incorrect length: %d", len(memoBytes)) + } + + switch { + case len(parts) == 1: + if len(valWeights)/21 > 8 { + return valWeights, something, errors.New("memo format not currently supported") + } + case len(parts) == 2: + something = parts[1] + if len(valWeights)/21 > 6 { + return valWeights, something, errors.New("memo format not currently supported") + } + default: + return valWeights, something, errors.New("memo format not currently supported") + } + + return valWeights, something, err +} From 7902f5b75e40c9ccbe4861f14350cbd4466cd412 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 13:51:19 -0400 Subject: [PATCH 06/27] decodememo --- app/upgrades_test.go | 8 +- docs/swagger.yml | 4 +- x/airdrop/keeper/keeper_test.go | 12 +- x/claimsmanager/keeper/keeper_test.go | 6 +- x/interchainstaking/client/cli/cli_test.go | 4 +- x/interchainstaking/keeper/callbacks_test.go | 2 +- x/interchainstaking/keeper/zones_test.go | 2 +- .../types/interchainstaking.pb.go | 242 +++++++++--------- x/interchainstaking/types/zones.go | 28 +- x/interchainstaking/types/zones_test.go | 18 +- x/participationrewards/keeper/keeper_test.go | 10 +- 11 files changed, 162 insertions(+), 174 deletions(-) diff --git a/app/upgrades_test.go b/app/upgrades_test.go index 408ad3612..b0ecaceb3 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -82,7 +82,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "uatom", MultiSend: false, LiquidityModule: true, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -95,7 +95,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "uatom", MultiSend: false, LiquidityModule: false, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -108,7 +108,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "uosmo", MultiSend: false, LiquidityModule: true, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) // uni-5 zone @@ -120,7 +120,7 @@ func (s *AppTestSuite) initTestZone() { BaseDenom: "ujunox", MultiSend: false, LiquidityModule: true, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) diff --git a/docs/swagger.yml b/docs/swagger.yml index 3fdfb5645..ac751c6f3 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -2607,7 +2607,7 @@ paths: type: boolean return_to_sender: type: boolean - is_118_cointype: + is_118: type: boolean stats: type: object @@ -2890,7 +2890,7 @@ paths: type: boolean return_to_sender: type: boolean - is_118_cointype: + is_118: type: boolean stats: type: array diff --git a/x/airdrop/keeper/keeper_test.go b/x/airdrop/keeper/keeper_test.go index bef0f233e..1954e8f51 100644 --- a/x/airdrop/keeper/keeper_test.go +++ b/x/airdrop/keeper/keeper_test.go @@ -76,12 +76,12 @@ func (s *KeeperTestSuite) SetupTest() { func (s *KeeperTestSuite) initTestZone() { // test zone zone := icstypes.Zone{ - ConnectionId: s.path.EndpointB.ConnectionID, - ChainId: s.chainB.ChainID, - AccountPrefix: "cosmos", - LocalDenom: "uqatom", - BaseDenom: "uatom", - Is_118Cointype: true, + ConnectionId: s.path.EndpointB.ConnectionID, + ChainId: s.chainB.ChainID, + AccountPrefix: "cosmos", + LocalDenom: "uqatom", + BaseDenom: "uatom", + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) diff --git a/x/claimsmanager/keeper/keeper_test.go b/x/claimsmanager/keeper/keeper_test.go index 424370182..05d531da6 100644 --- a/x/claimsmanager/keeper/keeper_test.go +++ b/x/claimsmanager/keeper/keeper_test.go @@ -79,7 +79,7 @@ func (s *KeeperTestSuite) initTestZone() { UnbondingEnabled: false, LiquidityModule: true, Decimals: 6, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -94,7 +94,7 @@ func (s *KeeperTestSuite) initTestZone() { UnbondingEnabled: false, LiquidityModule: true, Decimals: 6, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -109,7 +109,7 @@ func (s *KeeperTestSuite) initTestZone() { UnbondingEnabled: false, LiquidityModule: true, Decimals: 6, - Is_118Cointype: true, + Is_118: true, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) } diff --git a/x/interchainstaking/client/cli/cli_test.go b/x/interchainstaking/client/cli/cli_test.go index 3d98ce950..912bc74e2 100644 --- a/x/interchainstaking/client/cli/cli_test.go +++ b/x/interchainstaking/client/cli/cli_test.go @@ -63,7 +63,7 @@ func (s *IntegrationTestSuite) SetupSuite() { Tvl: sdk.ZeroDec(), UnbondingPeriod: 0, MessagesPerTx: 0, - Is_118Cointype: true, + Is_118: true, } zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000), Score: sdk.ZeroDec()}, @@ -164,7 +164,7 @@ func (s *IntegrationTestSuite) ZonesEqual(zoneA, zoneB types.Zone) bool { for i := range zoneA.Validators { s.Require().Equal(zoneA.Validators[i], zoneB.Validators[i]) } - s.Require().Equal(zoneA.Is_118Cointype, zoneB.Is_118Cointype) + s.Require().Equal(zoneA.Is_118, zoneB.Is_118) return true } diff --git a/x/interchainstaking/keeper/callbacks_test.go b/x/interchainstaking/keeper/callbacks_test.go index 146352120..8e6b31928 100644 --- a/x/interchainstaking/keeper/callbacks_test.go +++ b/x/interchainstaking/keeper/callbacks_test.go @@ -367,7 +367,7 @@ func (s *KeeperTestSuite) TestHandleValidatorCallbackNilValue() { func (s *KeeperTestSuite) TestHandleValidatorCallback() { newVal := utils.GenerateAccAddressForTestWithPrefix("cosmosvaloper") - zone := icstypes.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := icstypes.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetValidator(s.chainA.GetContext(), zone.ChainId, icstypes.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000)}) s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetValidator(s.chainA.GetContext(), zone.ChainId, icstypes.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000)}) s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetValidator(s.chainA.GetContext(), zone.ChainId, icstypes.Validator{ValoperAddress: "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), DelegatorShares: sdk.NewDec(2000)}) diff --git a/x/interchainstaking/keeper/zones_test.go b/x/interchainstaking/keeper/zones_test.go index a79312d57..f18007807 100644 --- a/x/interchainstaking/keeper/zones_test.go +++ b/x/interchainstaking/keeper/zones_test.go @@ -88,7 +88,7 @@ func TestKeeperWithZonesRoundTrip(t *testing.T) { sdk.NewCoin("uqck", sdk.NewInt(700000)), ), }, - Is_118Cointype: true, + Is_118: true, } kpr.SetAddressZoneMapping(ctx, delegationAddr, zone.ChainId) kpr.SetZone(ctx, &zone) diff --git a/x/interchainstaking/types/interchainstaking.pb.go b/x/interchainstaking/types/interchainstaking.pb.go index 4fe3c3bb1..4c665f306 100644 --- a/x/interchainstaking/types/interchainstaking.pb.go +++ b/x/interchainstaking/types/interchainstaking.pb.go @@ -58,7 +58,7 @@ type Zone struct { UnbondingEnabled bool `protobuf:"varint,25,opt,name=unbonding_enabled,json=unbondingEnabled,proto3" json:"unbonding_enabled,omitempty"` DepositsEnabled bool `protobuf:"varint,26,opt,name=deposits_enabled,json=depositsEnabled,proto3" json:"deposits_enabled,omitempty"` ReturnToSender bool `protobuf:"varint,27,opt,name=return_to_sender,json=returnToSender,proto3" json:"return_to_sender,omitempty"` - Is_118Cointype bool `protobuf:"varint,28,opt,name=is_118_cointype,json=is118Cointype,proto3" json:"is_118_cointype,omitempty"` + Is_118 bool `protobuf:"varint,28,opt,name=is_118,json=is118,proto3" json:"is_118,omitempty"` } func (m *Zone) Reset() { *m = Zone{} } @@ -262,9 +262,9 @@ func (m *Zone) GetReturnToSender() bool { return false } -func (m *Zone) GetIs_118Cointype() bool { +func (m *Zone) GetIs_118() bool { if m != nil { - return m.Is_118Cointype + return m.Is_118 } return false } @@ -1115,119 +1115,119 @@ func init() { } var fileDescriptor_0d755cfd37ef9fee = []byte{ - // 1792 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0x1b, 0xc7, - 0x15, 0xf7, 0x92, 0x14, 0x29, 0x3e, 0x52, 0xa2, 0x34, 0x52, 0x9c, 0xb5, 0x92, 0x52, 0x2c, 0x8b, - 0xa6, 0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 0x43, 0x96, 0x10, 0xf4, 0x03, 0x58, 0x0a, - 0x58, 0x92, 0x90, 0x40, 0x52, 0x96, 0xf8, 0x34, 0x74, 0x9d, 0x8e, 0xd3, 0xab, 0x7b, 0xcd, 0x19, - 0xb8, 0x17, 0xa2, 0x5b, 0xb0, 0xa8, 0x43, 0x56, 0xf3, 0x25, 0x3d, 0x5f, 0xd3, 0xe3, 0xbd, 0x10, - 0x7d, 0x0a, 0xad, 0x90, 0x4c, 0x99, 0xa0, 0xd2, 0xc7, 0x61, 0xc8, 0x89, 0x10, 0x6e, 0xb9, 0xe3, - 0xf4, 0x1a, 0xb7, 0x7f, 0xda, 0x9f, 0xb7, 0xed, 0xfe, 0xde, 0xdd, 0xed, 0xed, 0x20, 0x60, 0x69, - 0x22, 0xbd, 0x65, 0x4b, 0xb2, 0x6d, 0x38, 0xd0, 0x6f, 0x01, 0x9d, 0x50, 0x39, 0x09, 0x39, 0x3e, - 0xc1, 0x51, 0xce, 0x5c, 0x79, 0x03, 0xe6, 0xd5, 0x19, 0x4f, 0x46, 0xfe, 0x3b, 0x58, 0x9b, 0x12, - 0x7e, 0xc4, 0x78, 0x8c, 0x93, 0x80, 0xe4, 0xec, 0x0b, 0x6f, 0xc0, 0x8e, 0x0a, 0x44, 0x85, 0xd8, - 0x43, 0x12, 0x91, 0x31, 0xd6, 0x47, 0x9a, 0xb1, 0x57, 0xdf, 0x24, 0xf6, 0x19, 0x4f, 0x46, 0xfe, - 0x43, 0x58, 0xc6, 0x66, 0xd6, 0x9f, 0x72, 0x72, 0x44, 0x4f, 0xdd, 0x9a, 0xbe, 0x90, 0x25, 0x8b, - 0xee, 0x6b, 0x10, 0x6d, 0x42, 0x23, 0x62, 0x01, 0x8e, 0xfc, 0x90, 0x24, 0x2c, 0x76, 0x17, 0xb5, - 0x0d, 0x68, 0x68, 0x57, 0x21, 0xe8, 0x7b, 0x00, 0x2a, 0xdb, 0xec, 0x7c, 0x5d, 0xcf, 0xd7, 0x15, - 0x62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0x45, 0x95, 0xcf, 0x74, 0x51, 0xb3, 0xf6, 0xb1, 0xf2, - 0xdd, 0xb5, 0x8f, 0x77, 0x01, 0x8e, 0x28, 0x17, 0xd2, 0x17, 0x84, 0x24, 0xf6, 0x07, 0xa7, 0x79, - 0x45, 0xc3, 0xd1, 0x45, 0xa3, 0xae, 0xfd, 0x0e, 0x08, 0x49, 0xd0, 0x0e, 0xd4, 0xad, 0x46, 0x93, - 0xf0, 0x92, 0xd2, 0x6e, 0x39, 0x72, 0xb7, 0x9d, 0x87, 0x5f, 0xbe, 0x6c, 0x3b, 0x5f, 0xbd, 0x6c, - 0x3b, 0xff, 0x7c, 0xd9, 0x76, 0x3e, 0x7f, 0xd5, 0xbe, 0xf1, 0xd5, 0xab, 0xf6, 0x8d, 0xbf, 0xbd, - 0x6a, 0xdf, 0x78, 0xf8, 0x51, 0x61, 0x53, 0x34, 0x19, 0x93, 0x24, 0xa5, 0xf2, 0xc9, 0xd6, 0x28, - 0xa5, 0x51, 0x38, 0x28, 0xfe, 0x04, 0x7a, 0x7a, 0xc1, 0x8f, 0xa0, 0x7a, 0xcb, 0xa3, 0xaa, 0x0e, - 0xe2, 0x67, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x4c, 0x28, 0xe9, 0x32, 0x15, 0x00, 0x00, + // 1787 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x6f, 0x1b, 0xc7, + 0x11, 0xf7, 0x91, 0x14, 0x29, 0x0e, 0x29, 0x51, 0x5a, 0xcb, 0xce, 0x59, 0x49, 0x29, 0x96, 0x45, + 0x53, 0xb6, 0xae, 0xc8, 0xd0, 0x05, 0x5a, 0x23, 0x28, 0x8a, 0x48, 0x96, 0x91, 0x08, 0x85, 0x0d, + 0xe1, 0xa4, 0x34, 0x80, 0x8b, 0xe2, 0xb0, 0xbc, 0x5b, 0x91, 0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, 0x36, 0xd4, 0x6d, 0x8d, 0x26, 0xe1, 0x05, 0x4b, 0xbb, 0xe5, + 0xc8, 0xcd, 0xb6, 0x1f, 0x7d, 0xf9, 0xaa, 0xed, 0x7c, 0xf5, 0xaa, 0xed, 0xfc, 0xf3, 0x55, 0xdb, + 0xf9, 0xfc, 0x75, 0xfb, 0xda, 0x57, 0xaf, 0xdb, 0xd7, 0xfe, 0xf6, 0xba, 0x7d, 0xed, 0xd1, 0x47, + 0x85, 0x45, 0xd1, 0x64, 0x4c, 0x92, 0x94, 0xca, 0xa7, 0x9b, 0xa3, 0x94, 0x46, 0xe1, 0xa0, 0xf8, + 0xc5, 0xf3, 0xe4, 0x9c, 0x6f, 0x9e, 0x7a, 0xc9, 0xa3, 0xaa, 0x76, 0xe2, 0x67, 0xff, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x7a, 0x1a, 0xf0, 0x17, 0x21, 0x15, 0x00, 0x00, } func (m *Zone) Marshal() (dAtA []byte, err error) { @@ -1250,9 +1250,9 @@ func (m *Zone) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Is_118Cointype { + if m.Is_118 { i-- - if m.Is_118Cointype { + if m.Is_118 { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -2364,7 +2364,7 @@ func (m *Zone) Size() (n int) { if m.ReturnToSender { n += 3 } - if m.Is_118Cointype { + if m.Is_118 { n += 3 } return n @@ -3459,7 +3459,7 @@ func (m *Zone) Unmarshal(dAtA []byte) error { m.ReturnToSender = bool(v != 0) case 28: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Is_118Cointype", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Is_118", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -3476,7 +3476,7 @@ func (m *Zone) Unmarshal(dAtA []byte) error { break } } - m.Is_118Cointype = bool(v != 0) + m.Is_118 = bool(v != 0) default: iNdEx = preIndex skippy, err := skipInterchainstaking(dAtA[iNdEx:]) diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index d676ff05c..a3678335a 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -3,7 +3,6 @@ package types import ( "bytes" "encoding/base64" - "encoding/hex" "errors" "fmt" "strings" @@ -100,29 +99,21 @@ func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (Valida // should we be return DelegatorIntent here? out := make(ValidatorIntents, 0) - if memo == "" { - return out, errors.New("memo length unexpectedly zero") - } - - memoBytes, err := base64.StdEncoding.DecodeString(memo) + valWeightBytes, _, err := z.DecodeMemo(memo) if err != nil { - return out, fmt.Errorf("unable to determine intent from memo: Failed to decode base64 message: %w", err) - } - - if len(memoBytes)%21 != 0 { // memo must be one byte (1-200) weight then 20 byte valoperAddress - return out, fmt.Errorf("unable to determine intent from memo: Message was incorrect length: %d", len(memoBytes)) + return ValidatorIntents{}, fmt.Errorf("error decoding memo: %w", err) } - for index := 0; index < len(memoBytes); { + for index := 0; index < len(valWeightBytes); { // truncate weight to 200 - rawWeight := int64(memoBytes[index]) + rawWeight := int64(valWeightBytes[index]) if rawWeight > 200 { return ValidatorIntents{}, fmt.Errorf("out of bounds value received in memo intent message; expected 0-200, got %d", rawWeight) } sdkWeight := sdk.NewDecFromInt(sdk.NewInt(rawWeight)).QuoInt(sdk.NewInt(200)) coinWeight := sdkWeight.MulInt(coins.AmountOf(z.BaseDenom)) index++ - address := memoBytes[index : index+20] + address := valWeightBytes[index : index+20] index += 20 valAddr, err := bech32.ConvertAndEncode(z.AccountPrefix+"valoper", address) if err != nil { @@ -148,14 +139,11 @@ func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (Valida // field_id = [ // 0x00 = map // 0x01 = rts -//] // will scale to future fields +// ] // will scale to future fields -func (z *Zone) DecodeMemo(memo string) (valWeights, something []byte, err error) { - separator, err := hex.DecodeString("0xFF") - if err != nil { - return valWeights, something, err - } +var separator = []byte{byte(255)} +func (z *Zone) DecodeMemo(memo string) (valWeights, something []byte, err error) { if memo == "" { return valWeights, something, errors.New("memo length unexpectedly zero") } diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index f17bf3efd..ed26b4757 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -17,7 +17,7 @@ func TestIsDelegateAddress(t *testing.T) { acc2 := utils.GenerateAccAddressForTest() bech32 := utils.ConvertAccAddressForTestUsingPrefix(acc, "cosmos") bech322 := utils.ConvertAccAddressForTestUsingPrefix(acc2, "cosmos") - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}, Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}, Is_118: true} require.True(t, zone.IsDelegateAddress(bech32)) require.False(t, zone.IsDelegateAddress(bech322)) } @@ -25,8 +25,8 @@ func TestIsDelegateAddress(t *testing.T) { func TestGetDelegationAccount(t *testing.T) { acc := utils.GenerateAccAddressForTest() bech32 := utils.ConvertAccAddressForTestUsingPrefix(acc, "cosmos") - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}, Is_118Cointype: true} - zone2 := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", DelegationAddress: &types.ICAAccount{Address: bech32}, Is_118: true} + zone2 := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} delegateAccount, err := zone.GetDelegationAccount() require.NoError(t, err) @@ -38,14 +38,14 @@ func TestGetDelegationAccount(t *testing.T) { } func TestValidateCoinsForZone(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} valAddresses := []string{"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll", "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7"} require.NoError(t, zone.ValidateCoinsForZone(sdk.NewCoins(sdk.NewCoin("cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy1", sdk.OneInt())), valAddresses)) require.Errorf(t, zone.ValidateCoinsForZone(sdk.NewCoins(sdk.NewCoin("cosmosvaloper18ldc09yx4aua9g8mkl3sj526hgydzzyehcyjjr1", sdk.OneInt())), valAddresses), "invalid denom for zone: cosmosvaloper18ldc09yx4aua9g8mkl3sj526hgydzzyehcyjjr1") } func TestCoinsToIntent(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} valAddresses := []string{"cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", "cosmosvaloper14lultfckehtszvzw4ehu0apvsr77afvyju5zzy", "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll", "cosmosvaloper1z8zjv3lntpwxua0rtpvgrcwl0nm0tltgpgs6l7"} testCases := []struct { @@ -101,7 +101,7 @@ func TestCoinsToIntent(t *testing.T) { } func TestBase64MemoToIntent(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -178,7 +178,7 @@ func TestBase64MemoToIntent(t *testing.T) { } func TestUpdateIntentWithMemo(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -263,7 +263,7 @@ func TestUpdateIntentWithMemo(t *testing.T) { } func TestUpdateIntentWithMemoBad(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -299,7 +299,7 @@ func TestUpdateIntentWithMemoBad(t *testing.T) { } func TestUpdateIntentWithCoins(t *testing.T) { - zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118Cointype: true} + zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, &types.Validator{ValoperAddress: "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, diff --git a/x/participationrewards/keeper/keeper_test.go b/x/participationrewards/keeper/keeper_test.go index e9b64895f..1b4dc953d 100644 --- a/x/participationrewards/keeper/keeper_test.go +++ b/x/participationrewards/keeper/keeper_test.go @@ -154,7 +154,7 @@ func (s *KeeperTestSuite) setupTestZones() { LiquidityModule: true, DepositsEnabled: true, UnbondingEnabled: false, - Is_118Cointype: true, + Is_118: true, } selftestzone := icstypes.Zone{ ConnectionId: s.path.EndpointB.ConnectionID, @@ -166,7 +166,7 @@ func (s *KeeperTestSuite) setupTestZones() { LiquidityModule: true, DepositsEnabled: true, UnbondingEnabled: false, - Is_118Cointype: true, + Is_118: true, } quicksilver.InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &selftestzone) @@ -201,7 +201,7 @@ func (s *KeeperTestSuite) setupTestZones() { UnbondingEnabled: false, LiquidityModule: true, DepositsEnabled: true, - Is_118Cointype: true, + Is_118: true, Decimals: 6, PerformanceAddress: performanceAccountOsmo, Validators: []*icstypes.Validator{ @@ -245,7 +245,7 @@ func (s *KeeperTestSuite) setupTestZones() { ReturnToSender: false, LiquidityModule: true, PerformanceAddress: performanceAccountCosmos, - Is_118Cointype: true, + Is_118: true, } quicksilver.InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zoneCosmos) cosmosVals := []icstypes.Validator{ @@ -289,7 +289,7 @@ func (s *KeeperTestSuite) setupTestZones() { PortName: "cosmoshub-4.performance", WithdrawalAddress: utils.GenerateAccAddressForTestWithPrefix("osmo"), }, - Is_118Cointype: true, + Is_118: true, } quicksilver.InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zoneOsmosis) } From cc2e0a305befda1982c0d582c40002837a940b3a Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 15:10:39 -0400 Subject: [PATCH 07/27] fix --- x/interchainstaking/types/zones.go | 56 +++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index a3678335a..ac09b17ff 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -143,35 +143,67 @@ func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (Valida var separator = []byte{byte(255)} -func (z *Zone) DecodeMemo(memo string) (valWeights, something []byte, err error) { +type fieldType uint64 + +const ( + AccountMap fieldType = iota + ReturnToSender + // add more here +) + +type MemoField struct { + id uint32 + length uint32 + data []byte +} + +func (z *Zone) DecodeMemo(memo string) (valWeights []byte, memoFields []MemoField, err error) { + memoFields = make([]MemoField, 0) + if memo == "" { - return valWeights, something, errors.New("memo length unexpectedly zero") + return valWeights, memoFields, errors.New("memo length unexpectedly zero") } memoBytes, err := base64.StdEncoding.DecodeString(memo) if err != nil { - return valWeights, something, fmt.Errorf("failed to decode base64 message: %w", err) + return valWeights, memoFields, fmt.Errorf("failed to decode base64 message: %w", err) } parts := bytes.Split(memoBytes, separator) valWeights = parts[0] if len(valWeights)%21 != 0 { // memo must be one byte (1-200) weight then 20 byte valoperAddress - return valWeights, something, fmt.Errorf("unable to determine intent from memo: Message was incorrect length: %d", len(memoBytes)) + return valWeights, memoFields, fmt.Errorf("unable to determine intent from memo: Message was incorrect length: %d", len(memoBytes)) } switch { + case len(parts) == 0: + return valWeights, memoFields, errors.New("invalid memo format") + case len(parts) == 1: if len(valWeights)/21 > 8 { - return valWeights, something, errors.New("memo format not currently supported") - } - case len(parts) == 2: - something = parts[1] - if len(valWeights)/21 > 6 { - return valWeights, something, errors.New("memo format not currently supported") + return valWeights, memoFields, errors.New("memo format not currently supported") } + default: - return valWeights, something, errors.New("memo format not currently supported") + // iterate through all non-validator weights parts of the memo + memoFields = make([]MemoField, len(parts)-1) + for i, part := range parts[1:] { + memoFields[i], err = DecodeMemoField(part) + if err != nil { + return valWeights, memoFields, fmt.Errorf("unable to decode memo field: %w", err) + } + } + } + + return valWeights, memoFields, err +} + +func DecodeMemoField(fieldBytes []byte) (MemoField, error) { + fieldID := fieldBytes[0] + fieldLength := fieldBytes[1] + if len(fieldBytes[2:]) != int(fieldLength) { + return MemoField{}, errors.New("invalid field length for memo field") } - return valWeights, something, err + return MemoField{}, nil } From 39fe1d22574bfec93c38b4939fdaccedffd954b8 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 15:20:14 -0400 Subject: [PATCH 08/27] decode Field --- x/interchainstaking/types/zones.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index ac09b17ff..0074df300 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -205,5 +205,9 @@ func DecodeMemoField(fieldBytes []byte) (MemoField, error) { return MemoField{}, errors.New("invalid field length for memo field") } - return MemoField{}, nil + return MemoField{ + id: uint32(fieldID), + length: uint32(fieldLength), + data: fieldBytes[2:], + }, nil } From 7c7632ff5e10a8ba4b5454abf95f90da79a1d2eb Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 15:21:20 -0400 Subject: [PATCH 09/27] lint fix --- x/interchainstaking/types/zones.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index 0074df300..9d9d2e246 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -148,7 +148,7 @@ type fieldType uint64 const ( AccountMap fieldType = iota ReturnToSender - // add more here + // add more here. ) type MemoField struct { From 7624d1bb60cd122f5e15ffab0a9d0971f2c54e45 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 16:04:36 -0400 Subject: [PATCH 10/27] parse memo fields --- x/interchainstaking/types/zones.go | 65 ++++++++++++------- x/interchainstaking/types/zones_test.go | 85 +++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 22 deletions(-) diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index 9d9d2e246..4a24d857e 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -143,7 +143,7 @@ func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (Valida var separator = []byte{byte(255)} -type fieldType uint64 +type fieldType int const ( AccountMap fieldType = iota @@ -152,14 +152,13 @@ const ( ) type MemoField struct { - id uint32 - length uint32 - data []byte + ID int + Data []byte } -func (z *Zone) DecodeMemo(memo string) (valWeights []byte, memoFields []MemoField, err error) { - memoFields = make([]MemoField, 0) +type MemoFields []MemoField +func (z *Zone) DecodeMemo(memo string) (valWeights []byte, memoFields MemoFields, err error) { if memo == "" { return valWeights, memoFields, errors.New("memo length unexpectedly zero") } @@ -186,28 +185,50 @@ func (z *Zone) DecodeMemo(memo string) (valWeights []byte, memoFields []MemoFiel default: // iterate through all non-validator weights parts of the memo - memoFields = make([]MemoField, len(parts)-1) - for i, part := range parts[1:] { - memoFields[i], err = DecodeMemoField(part) - if err != nil { - return valWeights, memoFields, fmt.Errorf("unable to decode memo field: %w", err) - } + memoFields, err := ParseMemoFields(parts[1]) + if err != nil { + return valWeights, memoFields, fmt.Errorf("unable to decode memo field: %w", err) } + } return valWeights, memoFields, err } -func DecodeMemoField(fieldBytes []byte) (MemoField, error) { - fieldID := fieldBytes[0] - fieldLength := fieldBytes[1] - if len(fieldBytes[2:]) != int(fieldLength) { - return MemoField{}, errors.New("invalid field length for memo field") +func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { + if len(fieldBytes) < 3 { + return MemoFields{}, errors.New("invalid field bytes format") + } + + memoFields := make([]MemoField, 0) + + idx := 0 + for idx < len(fieldBytes) { + // prevent out of bounds + if len(fieldBytes[idx:]) < 3 { + return MemoFields{}, errors.New("invalid field bytes format") + } + + fieldID := int(fieldBytes[idx]) + idx++ + fieldLength := int(fieldBytes[idx]) + idx++ + + if len(fieldBytes[idx:]) < int(fieldLength) { + return MemoFields{}, errors.New("invalid field length for memo field") + } + + memoFields = append(memoFields, MemoField{ + ID: fieldID, + Data: fieldBytes[idx : idx+fieldLength], // add one for half-open range + }) + idx += fieldLength + } + + // secondary sanity check + if idx != len(fieldBytes) { + return MemoFields{}, errors.New("error parsing multiple fields") } - return MemoField{ - id: uint32(fieldID), - length: uint32(fieldLength), - data: fieldBytes[2:], - }, nil + return memoFields, nil } diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index ed26b4757..2196ffeba 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -504,3 +504,88 @@ func intentFromDecSlice(in map[string]sdk.Dec) types.DelegatorIntent { // } // } + +func TestParseMemoFields(t *testing.T) { + testCases := []struct { + name string + fieldBytes []byte + expectedMemoFields types.MemoFields + wantErr bool + }{ + { + name: "invalid no length data", + fieldBytes: []byte{}, + expectedMemoFields: types.MemoFields{ + { + Data: []byte{}, + }, + }, + wantErr: true, + }, + { + name: "invalid length field", + fieldBytes: []byte{0, 1, 0, 0}, + expectedMemoFields: types.MemoFields{ + { + Data: []byte{}, + }, + }, + wantErr: true, + }, + { + name: "invalid multiple", + fieldBytes: []byte{ + 0, 3, 0, 0, // should be 2 for length field + 1, 4, 1, 1, 1, 3, + }, + expectedMemoFields: types.MemoFields{ + { + Data: []byte{}, + }, + }, + wantErr: true, + }, + { + name: "valid single", + fieldBytes: []byte{0, 2, 1, 1}, + expectedMemoFields: types.MemoFields{ + { + ID: 0, + Data: []byte{1, 1}, + }, + }, + wantErr: false, + }, + { + name: "valid multiple", + fieldBytes: []byte{ + 0, 2, 1, 1, + 2, 3, 1, 2, 3, + }, + expectedMemoFields: types.MemoFields{ + { + ID: 0, + Data: []byte{1, 1}, + }, + { + ID: 2, + Data: []byte{1, 2, 3}, + }, + }, + wantErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + out, err := types.ParseMemoFields(tc.fieldBytes) + if tc.wantErr { + require.Error(t, err) + return + } + + require.NoError(t, err) + require.Equal(t, tc.expectedMemoFields, out) + }) + } +} From 038e127f58ca3f10084e472812044eea37161e16 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 18 May 2023 19:30:58 -0400 Subject: [PATCH 11/27] stub out logic --- x/interchainstaking/keeper/intent.go | 13 ++- x/interchainstaking/types/zones.go | 111 ++++++++++++++---------- x/interchainstaking/types/zones_test.go | 62 ++++++++++--- 3 files changed, 128 insertions(+), 58 deletions(-) diff --git a/x/interchainstaking/keeper/intent.go b/x/interchainstaking/keeper/intent.go index a089cedbd..1240385ba 100644 --- a/x/interchainstaking/keeper/intent.go +++ b/x/interchainstaking/keeper/intent.go @@ -201,9 +201,10 @@ func (k *Keeper) UpdateDelegatorIntent(ctx sdk.Context, delegator sdk.AccAddress delIntent = zone.UpdateIntentWithCoins(delIntent, baseBalance, inAmount, k.GetValidatorAddresses(ctx, zone.ChainId)) } + var memoUpdates []types.ZoneMemoUpdate + var err error if updateWithMemo { - var err error - delIntent, err = zone.UpdateIntentWithMemo(delIntent, memo, baseBalance, inAmount) + delIntent, memoUpdates, err = zone.UpdateZoneWithMemo(delIntent, memo, baseBalance, inAmount) if err != nil { return err } @@ -213,7 +214,15 @@ func (k *Keeper) UpdateDelegatorIntent(ctx sdk.Context, delegator sdk.AccAddress return nil } + for _, update := range memoUpdates { + err = update() + if err != nil { + return fmt.Errorf("error updating zone from memo: %w", err) + } + } + k.SetDelegatorIntent(ctx, zone, delIntent, snapshot) + return nil } diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index 4a24d857e..226075434 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -61,15 +61,31 @@ func (z *Zone) UpdateIntentWithCoins(intent DelegatorIntent, multiplier sdk.Dec, return intent } -// this method exist to make testing easier! -func (z *Zone) UpdateIntentWithMemo(intent DelegatorIntent, memo string, multiplier sdk.Dec, inAmount sdk.Coins) (DelegatorIntent, error) { - // coinIntent is ordinal - memoIntent, err := z.ConvertMemoToOrdinalIntents(inAmount, memo) +type ZoneMemoUpdate func() error + +func (z *Zone) UpdateZoneWithMemo(intent DelegatorIntent, memo string, multiplier sdk.Dec, inAmount sdk.Coins) (DelegatorIntent, []ZoneMemoUpdate, error) { + memoIntent, memoFields, err := z.DecodeMemo(inAmount, memo) if err != nil { - return DelegatorIntent{}, err + return DelegatorIntent{}, nil, fmt.Errorf("error decoding memo: %w", err) } + intent = intent.AddOrdinal(multiplier, memoIntent) - return intent, nil + + updates, err := z.memoUpdatesFromFields(memoFields) + if err != nil { + return DelegatorIntent{}, nil, fmt.Errorf("error generating memo field updates: %w", err) + } + + return intent, updates, nil +} + +func (z *Zone) memoUpdatesFromFields(memoFields MemoFields) ([]ZoneMemoUpdate, error) { + updates := make([]ZoneMemoUpdate, 0) + + _ = memoFields + // TODO ADD LOGIC FOR UPDATING BASED ON FIELDS + + return updates, nil } func (z *Zone) ConvertCoinsToOrdinalIntents(coins sdk.Coins, zoneVals []string) ValidatorIntents { @@ -97,36 +113,13 @@ COINS: func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (ValidatorIntents, error) { // should we be return DelegatorIntent here? - out := make(ValidatorIntents, 0) - valWeightBytes, _, err := z.DecodeMemo(memo) + validatorIntents, _, err := z.DecodeMemo(coins, memo) if err != nil { return ValidatorIntents{}, fmt.Errorf("error decoding memo: %w", err) } - for index := 0; index < len(valWeightBytes); { - // truncate weight to 200 - rawWeight := int64(valWeightBytes[index]) - if rawWeight > 200 { - return ValidatorIntents{}, fmt.Errorf("out of bounds value received in memo intent message; expected 0-200, got %d", rawWeight) - } - sdkWeight := sdk.NewDecFromInt(sdk.NewInt(rawWeight)).QuoInt(sdk.NewInt(200)) - coinWeight := sdkWeight.MulInt(coins.AmountOf(z.BaseDenom)) - index++ - address := valWeightBytes[index : index+20] - index += 20 - valAddr, err := bech32.ConvertAndEncode(z.AccountPrefix+"valoper", address) - if err != nil { - return ValidatorIntents{}, err - } - val, ok := out.GetForValoper(valAddr) - if !ok { - val = &ValidatorIntent{ValoperAddress: valAddr, Weight: sdk.ZeroDec()} - } - val.Weight = val.Weight.Add(coinWeight) - out = out.SetForValoper(valAddr, val) - } - return out, nil + return validatorIntents, nil } // decode memo @@ -158,41 +151,71 @@ type MemoField struct { type MemoFields []MemoField -func (z *Zone) DecodeMemo(memo string) (valWeights []byte, memoFields MemoFields, err error) { +func (z *Zone) DecodeMemo(coins sdk.Coins, memo string) (validatorIntents ValidatorIntents, memoFields MemoFields, err error) { if memo == "" { - return valWeights, memoFields, errors.New("memo length unexpectedly zero") + return validatorIntents, memoFields, errors.New("memo length unexpectedly zero") } memoBytes, err := base64.StdEncoding.DecodeString(memo) if err != nil { - return valWeights, memoFields, fmt.Errorf("failed to decode base64 message: %w", err) + return validatorIntents, memoFields, fmt.Errorf("failed to decode base64 message: %w", err) } parts := bytes.Split(memoBytes, separator) - valWeights = parts[0] - if len(valWeights)%21 != 0 { // memo must be one byte (1-200) weight then 20 byte valoperAddress - return valWeights, memoFields, fmt.Errorf("unable to determine intent from memo: Message was incorrect length: %d", len(memoBytes)) + valWeightsBytes := parts[0] + if len(valWeightsBytes)%21 != 0 { // memo must be one byte (1-200) weight then 20 byte valoperAddress + return validatorIntents, memoFields, fmt.Errorf("unable to determine intent from memo: Message was incorrect length: %d", len(memoBytes)) } switch { case len(parts) == 0: - return valWeights, memoFields, errors.New("invalid memo format") + return validatorIntents, memoFields, errors.New("invalid memo format") case len(parts) == 1: - if len(valWeights)/21 > 8 { - return valWeights, memoFields, errors.New("memo format not currently supported") + if len(valWeightsBytes)/21 > 8 { + return validatorIntents, memoFields, errors.New("memo format not currently supported") } default: // iterate through all non-validator weights parts of the memo - memoFields, err := ParseMemoFields(parts[1]) + memoFields, err = ParseMemoFields(parts[1]) if err != nil { - return valWeights, memoFields, fmt.Errorf("unable to decode memo field: %w", err) + return validatorIntents, memoFields, fmt.Errorf("unable to decode memo field: %w", err) } + } + + validatorIntents, err = z.validatorIntentsFromBytes(coins, valWeightsBytes) + return validatorIntents, memoFields, err +} + +func (z *Zone) validatorIntentsFromBytes(coins sdk.Coins, weightBytes []byte) (ValidatorIntents, error) { + validatorIntents := make(ValidatorIntents, 0) + + for index := 0; index < len(weightBytes); { + // truncate weight to 200 + rawWeight := int64(weightBytes[index]) + if rawWeight > 200 { + return validatorIntents, fmt.Errorf("out of bounds value received in memo intent message; expected 0-200, got %d", rawWeight) + } + sdkWeight := sdk.NewDecFromInt(sdk.NewInt(rawWeight)).QuoInt(sdk.NewInt(200)) + coinWeight := sdkWeight.MulInt(coins.AmountOf(z.BaseDenom)) + index++ + address := weightBytes[index : index+20] + index += 20 + valAddr, err := bech32.ConvertAndEncode(z.AccountPrefix+"valoper", address) + if err != nil { + return validatorIntents, err + } + val, ok := validatorIntents.GetForValoper(valAddr) + if !ok { + val = &ValidatorIntent{ValoperAddress: valAddr, Weight: sdk.ZeroDec()} + } + val.Weight = val.Weight.Add(coinWeight) + validatorIntents = validatorIntents.SetForValoper(valAddr, val) } - return valWeights, memoFields, err + return validatorIntents, nil } func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { @@ -214,7 +237,7 @@ func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { fieldLength := int(fieldBytes[idx]) idx++ - if len(fieldBytes[idx:]) < int(fieldLength) { + if len(fieldBytes[idx:]) < fieldLength { return MemoFields{}, errors.New("invalid field length for memo field") } diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 2196ffeba..2524c5dd4 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -1,6 +1,8 @@ package types_test import ( + "encoding/base64" + "fmt" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -100,7 +102,7 @@ func TestCoinsToIntent(t *testing.T) { } } -func TestBase64MemoToIntent(t *testing.T) { +func TestDecodeMemo(t *testing.T) { zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, &types.Validator{ValoperAddress: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0", CommissionRate: sdk.MustNewDecFromStr("0.2"), VotingPower: sdk.NewInt(2000), Status: stakingtypes.BondStatusBonded}, @@ -112,11 +114,12 @@ func TestBase64MemoToIntent(t *testing.T) { ) testCases := []struct { - name string - memo string - amount int - expectedIntent map[string]sdk.Dec - wantErr bool + name string + memo string + amount int + expectedIntent map[string]sdk.Dec + expectedMemoFields types.MemoFields + wantErr bool }{ { memo: "WoS/+Ex92tEcuMBzhukZKMVnXKS8bqaQBJTx9zza4rrxyLiP9fwLijOc", @@ -145,38 +148,73 @@ func TestBase64MemoToIntent(t *testing.T) { "cosmosvaloper1a3yjj7d3qnx4spgvjcwjq9cw9snrrrhu5h6jll": sdk.NewDecWithPrec(5, 1), }, }, + { + name: "val intents and memo fields", + memo: "WoS/+Ex92tEcuMBzhukZKMVnXKS8bqaQBJTx9zza4rrxyLiP9fwLijOc/wACAQI=", + amount: 100, + expectedIntent: map[string]sdk.Dec{ + "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0": sdk.NewDec(45), + "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf": sdk.NewDec(55), + }, + expectedMemoFields: types.MemoFields{ + { + ID: 0, + Data: []byte{1, 2}, + }, + }, + }, { name: "empty memo", memo: "", - amount: 10, wantErr: true, }, { name: "invalid length", memo: "ToS/+Ex92tEcuMBzhukZKMVnXKS8NKaQBJTx9zza4rrxyLiP9fwLijOcPK/59acWzdcBME6ub8f0LID97qWECuxJKXmxBM1YBQyWHSAXDiwmMY78K", - amount: 10, + wantErr: true, + }, + { + name: "invalid base64", + memo: "\xFF", + wantErr: true, + }, + { + name: "invalid base64", + memo: "\xFF", wantErr: true, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - out, err := zone.ConvertMemoToOrdinalIntents(sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount)))), tc.memo) + validatorIntents, memoFields, err := zone.DecodeMemo(sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount)))), tc.memo) if tc.wantErr { require.Error(t, err) return } require.NoError(t, err) - for _, v := range out { + for _, v := range validatorIntents { if !tc.expectedIntent[v.ValoperAddress].Equal(v.Weight) { t.Errorf("Got %v expected %v", v.Weight, tc.expectedIntent[v.ValoperAddress]) } } + + require.Equal(t, tc.expectedMemoFields, memoFields) }) } } +func TestGenMemos(t *testing.T) { + oldMemo := "WoS/+Ex92tEcuMBzhukZKMVnXKS8bqaQBJTx9zza4rrxyLiP9fwLijOc" + memoBytes, err := base64.StdEncoding.DecodeString(oldMemo) + require.NoError(t, err) + memoBytes = append(memoBytes, 255, 0, 2, 1, 2) + + newMemo := base64.StdEncoding.EncodeToString(memoBytes) + fmt.Println(newMemo) +} + func TestUpdateIntentWithMemo(t *testing.T) { zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, @@ -252,7 +290,7 @@ func TestUpdateIntentWithMemo(t *testing.T) { for caseidx, tc := range testCases { - intent, err := zone.UpdateIntentWithMemo(intentFromDecSlice(tc.originalIntent), tc.memo, sdk.NewDec(int64(tc.baseAmount)), sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount))))) + intent, _, err := zone.UpdateZoneWithMemo(intentFromDecSlice(tc.originalIntent), tc.memo, sdk.NewDec(int64(tc.baseAmount)), sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount))))) require.NoError(t, err) for idx, v := range intent.Intents.Sort() { if !tc.expectedIntent[v.ValoperAddress].Equal(v.Weight) { @@ -293,7 +331,7 @@ func TestUpdateIntentWithMemoBad(t *testing.T) { } for _, tc := range testCases { - _, err := zone.UpdateIntentWithMemo(intentFromDecSlice(tc.originalIntent), tc.memo, sdk.NewDec(int64(tc.baseAmount)), sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount))))) + _, _, err := zone.UpdateZoneWithMemo(intentFromDecSlice(tc.originalIntent), tc.memo, sdk.NewDec(int64(tc.baseAmount)), sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount))))) require.Errorf(t, err, tc.errorMsg) } } From 615a74eecb954055a9935dea9ab6cfd238be3e24 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 19 May 2023 12:12:02 -0400 Subject: [PATCH 12/27] address map --- x/interchainstaking/keeper/address_map.go | 45 +++++++ .../keeper/address_map_test.go | 113 ++++++++++++++++++ x/interchainstaking/types/keys.go | 12 ++ 3 files changed, 170 insertions(+) create mode 100644 x/interchainstaking/keeper/address_map.go create mode 100644 x/interchainstaking/keeper/address_map_test.go diff --git a/x/interchainstaking/keeper/address_map.go b/x/interchainstaking/keeper/address_map.go new file mode 100644 index 000000000..01dd787f1 --- /dev/null +++ b/x/interchainstaking/keeper/address_map.go @@ -0,0 +1,45 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" +) + +// GetRemoteAddress retrieves a remote address using a local address. +func (k *Keeper) GetRemoteAddress(ctx sdk.Context, localAddress []byte, chainID string) ([]byte, bool) { + store := ctx.KVStore(k.storeKey) + key := types.GetRemoteAddressKey(localAddress, chainID) + value := store.Get(key) + + return value, value != nil +} + +// SetRemoteAddress sets a remote address using a local address as a map. +func (k *Keeper) SetRemoteAddress(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { + store := ctx.KVStore(k.storeKey) + key := types.GetRemoteAddressKey(localAddress, chainID) + store.Set(key, remoteAddress) +} + +// GetLocalAddress retrieves a local address using a remote address. +func (k *Keeper) GetLocalAddress(ctx sdk.Context, remoteAddress []byte, chainID string) ([]byte, bool) { + store := ctx.KVStore(k.storeKey) + key := types.GetLocalAddressKey(remoteAddress, chainID) + value := store.Get(key) + + return value, value != nil +} + +// SetLocalAddress sets a local address using a remote address as a map. +func (k *Keeper) SetLocalAddress(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { + store := ctx.KVStore(k.storeKey) + key := types.GetLocalAddressKey(remoteAddress, chainID) + store.Set(key, localAddress) +} + +// SetAddressMapPair sets forward and reverse maps for localAddress => remoteAddress and remoteAddress => localAddress. +func (k *Keeper) SetAddressMapPair(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { + k.SetLocalAddress(ctx, localAddress, remoteAddress, chainID) + k.SetRemoteAddress(ctx, localAddress, remoteAddress, chainID) +} diff --git a/x/interchainstaking/keeper/address_map_test.go b/x/interchainstaking/keeper/address_map_test.go new file mode 100644 index 000000000..f8ea34720 --- /dev/null +++ b/x/interchainstaking/keeper/address_map_test.go @@ -0,0 +1,113 @@ +package keeper_test + +import ( + "crypto/rand" +) + +const ( + testChainID = "test-1" +) + +// generateRandomBytes returns securely generated random bytes. +// It will return an error if the system's secure random +// number generator fails to function correctly, in which +// case the caller should not continue. +func generateRandomBytes(n int) ([]byte, error) { + b := make([]byte, n) + _, err := rand.Read(b) + // Note that err == nil only if we read len(b) bytes. + if err != nil { + return nil, err + } + + return b, nil +} + +func (s *KeeperTestSuite) TestKeeper_RemoteAddressStore() { + s.SetupTest() + s.setupTestZones() + + icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper + ctx := s.chainA.GetContext() + + localAddress, err := generateRandomBytes(28) + s.Require().NoError(err) + remoteAddress, err := generateRandomBytes(40) + s.Require().NoError(err) + + s.Run("not found", func() { + _, found := icsKeeper.GetRemoteAddress(ctx, localAddress, testChainID) + s.Require().False(found) + }) + + s.Run("set", func() { + icsKeeper.SetRemoteAddress(ctx, localAddress, remoteAddress, testChainID) + }) + + s.Run("found", func() { + addr, found := icsKeeper.GetRemoteAddress(ctx, localAddress, testChainID) + s.Require().True(found) + s.Require().Equal(remoteAddress, addr) + }) +} + +func (s *KeeperTestSuite) TestKeeper_LocalAddressStore() { + s.SetupTest() + s.setupTestZones() + + icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper + ctx := s.chainA.GetContext() + + localAddress, err := generateRandomBytes(28) + s.Require().NoError(err) + remoteAddress, err := generateRandomBytes(40) + s.Require().NoError(err) + + s.Run("not found", func() { + _, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + s.Require().False(found) + }) + + s.Run("set", func() { + icsKeeper.SetLocalAddress(ctx, localAddress, remoteAddress, testChainID) + }) + + s.Run("found", func() { + addr, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + s.Require().True(found) + s.Require().Equal(localAddress, addr) + }) +} + +func (s *KeeperTestSuite) TestKeeper_AddressMapPair() { + s.SetupTest() + s.setupTestZones() + + icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper + ctx := s.chainA.GetContext() + + localAddress, err := generateRandomBytes(28) + s.Require().NoError(err) + remoteAddress, err := generateRandomBytes(40) + s.Require().NoError(err) + + s.Run("not found", func() { + _, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + s.Require().False(found) + _, found = icsKeeper.GetRemoteAddress(ctx, remoteAddress, testChainID) + s.Require().False(found) + }) + + s.Run("set", func() { + icsKeeper.SetAddressMapPair(ctx, localAddress, remoteAddress, testChainID) + }) + + s.Run("found", func() { + addr, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + s.Require().True(found) + s.Require().Equal(localAddress, addr) + addr, found = icsKeeper.GetRemoteAddress(ctx, localAddress, testChainID) + s.Require().True(found) + s.Require().Equal(remoteAddress, addr) + }) +} diff --git a/x/interchainstaking/types/keys.go b/x/interchainstaking/types/keys.go index b7b8cdfd7..452449916 100644 --- a/x/interchainstaking/types/keys.go +++ b/x/interchainstaking/types/keys.go @@ -56,6 +56,8 @@ var ( KeyPrefixRequeuedWithdrawalRecordSeq = []byte{0x0a} KeyPrefixAddressZoneMapping = []byte{0x0b} KeyPrefixValidatorsInfo = []byte{0x0c} + KeyPrefixRemoteAddress = []byte{0x0d} + KeyPrefixLocalAddress = []byte{0x0e} // fill in missing 0d - 0f before adding 0x11! KeyPrefixRedelegationRecord = []byte{0x10} @@ -87,6 +89,16 @@ func ParseStakingDelegationKey(key []byte) (sdk.AccAddress, sdk.ValAddress, erro return delAddr, valAddr, nil } +// GetRemoteAddressKey gets the prefix for a remote address mapping. +func GetRemoteAddressKey(localAddress []byte, chainID string) []byte { + return append(append(KeyPrefixRemoteAddress, localAddress...), []byte(chainID)...) +} + +// GetLocalAddressKey gets the prefix for a local address mapping. +func GetLocalAddressKey(remoteAddress []byte, chainID string) []byte { + return append(append(KeyPrefixLocalAddress, []byte(chainID)...), remoteAddress...) +} + // GetDelegationKey gets the key for delegator bond with validator. // VALUE: staking/Delegation. func GetDelegationKey(zone *Zone, delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { From 46bb436ef203f107861226ebb43b1a1647b4f1ef Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 19 May 2023 12:13:09 -0400 Subject: [PATCH 13/27] address map --- x/interchainstaking/keeper/address_map.go | 20 +++++++++---------- .../keeper/address_map_test.go | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/x/interchainstaking/keeper/address_map.go b/x/interchainstaking/keeper/address_map.go index 01dd787f1..d97474965 100644 --- a/x/interchainstaking/keeper/address_map.go +++ b/x/interchainstaking/keeper/address_map.go @@ -6,8 +6,8 @@ import ( "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" ) -// GetRemoteAddress retrieves a remote address using a local address. -func (k *Keeper) GetRemoteAddress(ctx sdk.Context, localAddress []byte, chainID string) ([]byte, bool) { +// GetRemoteAddressMap retrieves a remote address using a local address. +func (k *Keeper) GetRemoteAddressMap(ctx sdk.Context, localAddress []byte, chainID string) ([]byte, bool) { store := ctx.KVStore(k.storeKey) key := types.GetRemoteAddressKey(localAddress, chainID) value := store.Get(key) @@ -15,15 +15,15 @@ func (k *Keeper) GetRemoteAddress(ctx sdk.Context, localAddress []byte, chainID return value, value != nil } -// SetRemoteAddress sets a remote address using a local address as a map. -func (k *Keeper) SetRemoteAddress(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { +// SetRemoteAddressMap sets a remote address using a local address as a map. +func (k *Keeper) SetRemoteAddressMap(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { store := ctx.KVStore(k.storeKey) key := types.GetRemoteAddressKey(localAddress, chainID) store.Set(key, remoteAddress) } -// GetLocalAddress retrieves a local address using a remote address. -func (k *Keeper) GetLocalAddress(ctx sdk.Context, remoteAddress []byte, chainID string) ([]byte, bool) { +// GetLocalAddressMap retrieves a local address using a remote address. +func (k *Keeper) GetLocalAddressMap(ctx sdk.Context, remoteAddress []byte, chainID string) ([]byte, bool) { store := ctx.KVStore(k.storeKey) key := types.GetLocalAddressKey(remoteAddress, chainID) value := store.Get(key) @@ -31,8 +31,8 @@ func (k *Keeper) GetLocalAddress(ctx sdk.Context, remoteAddress []byte, chainID return value, value != nil } -// SetLocalAddress sets a local address using a remote address as a map. -func (k *Keeper) SetLocalAddress(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { +// SetLocalAddressMap sets a local address using a remote address as a map. +func (k *Keeper) SetLocalAddressMap(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { store := ctx.KVStore(k.storeKey) key := types.GetLocalAddressKey(remoteAddress, chainID) store.Set(key, localAddress) @@ -40,6 +40,6 @@ func (k *Keeper) SetLocalAddress(ctx sdk.Context, localAddress, remoteAddress [] // SetAddressMapPair sets forward and reverse maps for localAddress => remoteAddress and remoteAddress => localAddress. func (k *Keeper) SetAddressMapPair(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { - k.SetLocalAddress(ctx, localAddress, remoteAddress, chainID) - k.SetRemoteAddress(ctx, localAddress, remoteAddress, chainID) + k.SetLocalAddressMap(ctx, localAddress, remoteAddress, chainID) + k.SetRemoteAddressMap(ctx, localAddress, remoteAddress, chainID) } diff --git a/x/interchainstaking/keeper/address_map_test.go b/x/interchainstaking/keeper/address_map_test.go index f8ea34720..4e35455ad 100644 --- a/x/interchainstaking/keeper/address_map_test.go +++ b/x/interchainstaking/keeper/address_map_test.go @@ -36,16 +36,16 @@ func (s *KeeperTestSuite) TestKeeper_RemoteAddressStore() { s.Require().NoError(err) s.Run("not found", func() { - _, found := icsKeeper.GetRemoteAddress(ctx, localAddress, testChainID) + _, found := icsKeeper.GetRemoteAddressMap(ctx, localAddress, testChainID) s.Require().False(found) }) s.Run("set", func() { - icsKeeper.SetRemoteAddress(ctx, localAddress, remoteAddress, testChainID) + icsKeeper.SetRemoteAddressMap(ctx, localAddress, remoteAddress, testChainID) }) s.Run("found", func() { - addr, found := icsKeeper.GetRemoteAddress(ctx, localAddress, testChainID) + addr, found := icsKeeper.GetRemoteAddressMap(ctx, localAddress, testChainID) s.Require().True(found) s.Require().Equal(remoteAddress, addr) }) @@ -64,16 +64,16 @@ func (s *KeeperTestSuite) TestKeeper_LocalAddressStore() { s.Require().NoError(err) s.Run("not found", func() { - _, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + _, found := icsKeeper.GetLocalAddressMap(ctx, remoteAddress, testChainID) s.Require().False(found) }) s.Run("set", func() { - icsKeeper.SetLocalAddress(ctx, localAddress, remoteAddress, testChainID) + icsKeeper.SetLocalAddressMap(ctx, localAddress, remoteAddress, testChainID) }) s.Run("found", func() { - addr, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + addr, found := icsKeeper.GetLocalAddressMap(ctx, remoteAddress, testChainID) s.Require().True(found) s.Require().Equal(localAddress, addr) }) @@ -92,9 +92,9 @@ func (s *KeeperTestSuite) TestKeeper_AddressMapPair() { s.Require().NoError(err) s.Run("not found", func() { - _, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + _, found := icsKeeper.GetLocalAddressMap(ctx, remoteAddress, testChainID) s.Require().False(found) - _, found = icsKeeper.GetRemoteAddress(ctx, remoteAddress, testChainID) + _, found = icsKeeper.GetRemoteAddressMap(ctx, remoteAddress, testChainID) s.Require().False(found) }) @@ -103,10 +103,10 @@ func (s *KeeperTestSuite) TestKeeper_AddressMapPair() { }) s.Run("found", func() { - addr, found := icsKeeper.GetLocalAddress(ctx, remoteAddress, testChainID) + addr, found := icsKeeper.GetLocalAddressMap(ctx, remoteAddress, testChainID) s.Require().True(found) s.Require().Equal(localAddress, addr) - addr, found = icsKeeper.GetRemoteAddress(ctx, localAddress, testChainID) + addr, found = icsKeeper.GetRemoteAddressMap(ctx, localAddress, testChainID) s.Require().True(found) s.Require().Equal(remoteAddress, addr) }) From d19d0d2c440fb2e65664542f6df485c4dbfeb903 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 19 May 2023 14:14:38 -0400 Subject: [PATCH 14/27] refactor --- x/interchainstaking/keeper/intent.go | 18 +++--------------- x/interchainstaking/keeper/intent_test.go | 2 +- x/interchainstaking/keeper/receipt.go | 16 +++++++++++++++- x/interchainstaking/types/zones.go | 23 +++++------------------ x/interchainstaking/types/zones_test.go | 6 +++--- 5 files changed, 27 insertions(+), 38 deletions(-) diff --git a/x/interchainstaking/keeper/intent.go b/x/interchainstaking/keeper/intent.go index 1240385ba..d6d8cb4b2 100644 --- a/x/interchainstaking/keeper/intent.go +++ b/x/interchainstaking/keeper/intent.go @@ -167,10 +167,10 @@ func (k *Keeper) AggregateDelegatorIntents(ctx sdk.Context, zone *types.Zone) er } // UpdateDelegatorIntent updates delegator intents. -func (k *Keeper) UpdateDelegatorIntent(ctx sdk.Context, delegator sdk.AccAddress, zone *types.Zone, inAmount sdk.Coins, memo string) error { +func (k *Keeper) UpdateDelegatorIntent(ctx sdk.Context, delegator sdk.AccAddress, zone *types.Zone, inAmount sdk.Coins, memoIntent types.ValidatorIntents) error { snapshot := false updateWithCoin := inAmount.IsValid() - updateWithMemo := len(memo) > 0 + updateWithMemo := memoIntent != nil // this is here because we need access to the bankKeeper to ordinalize intent delIntent, _ := k.GetDelegatorIntent(ctx, zone, delegator.String(), snapshot) @@ -201,26 +201,14 @@ func (k *Keeper) UpdateDelegatorIntent(ctx sdk.Context, delegator sdk.AccAddress delIntent = zone.UpdateIntentWithCoins(delIntent, baseBalance, inAmount, k.GetValidatorAddresses(ctx, zone.ChainId)) } - var memoUpdates []types.ZoneMemoUpdate - var err error if updateWithMemo { - delIntent, memoUpdates, err = zone.UpdateZoneWithMemo(delIntent, memo, baseBalance, inAmount) - if err != nil { - return err - } + delIntent = zone.UpdateZoneIntentWithMemo(memoIntent, delIntent, baseBalance) } if len(delIntent.Intents) == 0 { return nil } - for _, update := range memoUpdates { - err = update() - if err != nil { - return fmt.Errorf("error updating zone from memo: %w", err) - } - } - k.SetDelegatorIntent(ctx, zone, delIntent, snapshot) return nil diff --git a/x/interchainstaking/keeper/intent_test.go b/x/interchainstaking/keeper/intent_test.go index 1e72769ca..8edbf4e0a 100644 --- a/x/interchainstaking/keeper/intent_test.go +++ b/x/interchainstaking/keeper/intent_test.go @@ -132,7 +132,7 @@ func (s *KeeperTestSuite) TestKeeper_IntentStore() { math.NewInt(7313913), ), ), - "", + nil, ) s.Require().NoError(err) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index 0c281f68f..53b628457 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -80,8 +80,22 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons k.Logger(ctx).Info("found new deposit tx", "deposit_address", zone.DepositAddress.GetAddress(), "senderAddress", senderAddress, "local", senderAccAddress.String(), "chain id", zone.ChainId, "assets", assets, "hash", hash) + var ( + memoIntent types.ValidatorIntents = nil + memoFields types.MemoFields = nil + ) + if len(memo) > 0 { + // process memo + memoIntent, memoFields, err = zone.DecodeMemo(assets, memo) + if err != nil { + // What should we do on error here? just log? + } + } + + _ = memoFields + // update state - if err := k.UpdateDelegatorIntent(ctx, senderAccAddress, zone, assets, memo); err != nil { + if err := k.UpdateDelegatorIntent(ctx, senderAccAddress, zone, assets, memoIntent); err != nil { k.Logger(ctx).Error("unable to update intent. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err.Error()) return fmt.Errorf("unable to update intent. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index 226075434..75c81a59b 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -57,28 +57,15 @@ COINS: // this method exist to make testing easier! func (z *Zone) UpdateIntentWithCoins(intent DelegatorIntent, multiplier sdk.Dec, inAmount sdk.Coins, vals []string) DelegatorIntent { // coinIntent is ordinal - intent = intent.AddOrdinal(multiplier, z.ConvertCoinsToOrdinalIntents(inAmount, vals)) - return intent + return intent.AddOrdinal(multiplier, z.ConvertCoinsToOrdinalIntents(inAmount, vals)) } -type ZoneMemoUpdate func() error - -func (z *Zone) UpdateZoneWithMemo(intent DelegatorIntent, memo string, multiplier sdk.Dec, inAmount sdk.Coins) (DelegatorIntent, []ZoneMemoUpdate, error) { - memoIntent, memoFields, err := z.DecodeMemo(inAmount, memo) - if err != nil { - return DelegatorIntent{}, nil, fmt.Errorf("error decoding memo: %w", err) - } - - intent = intent.AddOrdinal(multiplier, memoIntent) - - updates, err := z.memoUpdatesFromFields(memoFields) - if err != nil { - return DelegatorIntent{}, nil, fmt.Errorf("error generating memo field updates: %w", err) - } - - return intent, updates, nil +func (z *Zone) UpdateZoneIntentWithMemo(memoIntent ValidatorIntents, intent DelegatorIntent, multiplier sdk.Dec) DelegatorIntent { + return intent.AddOrdinal(multiplier, memoIntent) } +type ZoneMemoUpdate func() error + func (z *Zone) memoUpdatesFromFields(memoFields MemoFields) ([]ZoneMemoUpdate, error) { updates := make([]ZoneMemoUpdate, 0) diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 2524c5dd4..3782c07d9 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -289,9 +289,9 @@ func TestUpdateIntentWithMemo(t *testing.T) { } for caseidx, tc := range testCases { - - intent, _, err := zone.UpdateZoneWithMemo(intentFromDecSlice(tc.originalIntent), tc.memo, sdk.NewDec(int64(tc.baseAmount)), sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount))))) + memoIntent, _, err := zone.DecodeMemo(sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount)))), tc.memo) require.NoError(t, err) + intent := zone.UpdateZoneIntentWithMemo(memoIntent, intentFromDecSlice(tc.originalIntent), sdk.NewDec(int64(tc.baseAmount))) for idx, v := range intent.Intents.Sort() { if !tc.expectedIntent[v.ValoperAddress].Equal(v.Weight) { t.Errorf("Case [%d:%d] -> Got %v expected %v", caseidx, idx, v.Weight, tc.expectedIntent[v.ValoperAddress]) @@ -331,7 +331,7 @@ func TestUpdateIntentWithMemoBad(t *testing.T) { } for _, tc := range testCases { - _, _, err := zone.UpdateZoneWithMemo(intentFromDecSlice(tc.originalIntent), tc.memo, sdk.NewDec(int64(tc.baseAmount)), sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount))))) + _, _, err := zone.DecodeMemo(sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(int64(tc.amount)))), tc.memo) require.Errorf(t, err, tc.errorMsg) } } From cd1d2449d6131f83317222514850606cf5395e8b Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 19 May 2023 14:26:26 -0400 Subject: [PATCH 15/27] lint fix --- x/interchainstaking/keeper/receipt.go | 5 +++-- x/interchainstaking/types/zones.go | 11 ----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index 53b628457..224a3e9b1 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -81,14 +81,15 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons k.Logger(ctx).Info("found new deposit tx", "deposit_address", zone.DepositAddress.GetAddress(), "senderAddress", senderAddress, "local", senderAccAddress.String(), "chain id", zone.ChainId, "assets", assets, "hash", hash) var ( - memoIntent types.ValidatorIntents = nil - memoFields types.MemoFields = nil + memoIntent types.ValidatorIntents + memoFields types.MemoFields ) if len(memo) > 0 { // process memo memoIntent, memoFields, err = zone.DecodeMemo(assets, memo) if err != nil { // What should we do on error here? just log? + k.Logger(ctx).Error("error decoding memo", "error", err.Error(), "memo", memo) } } diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index 75c81a59b..896d9b4e7 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -64,17 +64,6 @@ func (z *Zone) UpdateZoneIntentWithMemo(memoIntent ValidatorIntents, intent Dele return intent.AddOrdinal(multiplier, memoIntent) } -type ZoneMemoUpdate func() error - -func (z *Zone) memoUpdatesFromFields(memoFields MemoFields) ([]ZoneMemoUpdate, error) { - updates := make([]ZoneMemoUpdate, 0) - - _ = memoFields - // TODO ADD LOGIC FOR UPDATING BASED ON FIELDS - - return updates, nil -} - func (z *Zone) ConvertCoinsToOrdinalIntents(coins sdk.Coins, zoneVals []string) ValidatorIntents { // should we be return DelegatorIntent here? out := make(ValidatorIntents, 0) From 7bdb13a7fdf4c518bedbc1e627ab798638d0833f Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 19 May 2023 15:20:38 -0400 Subject: [PATCH 16/27] validate memo fields --- x/interchainstaking/keeper/receipt.go | 5 ++- x/interchainstaking/types/zones.go | 48 ++++++++++++++++++++----- x/interchainstaking/types/zones_test.go | 34 +++++++++++++----- 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index 224a3e9b1..ef27a283d 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -100,11 +100,10 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons k.Logger(ctx).Error("unable to update intent. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err.Error()) return fmt.Errorf("unable to update intent. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } - if err := k.MintQAsset(ctx, senderAccAddress, senderAddress, zone, assets); err != nil { + if err := k.MintQAsset(ctx, senderAccAddress, senderAddress, zone, assets, memoFields); err != nil { k.Logger(ctx).Error("unable to mint QAsset. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err) return fmt.Errorf("unable to mint QAsset. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } - if err := k.TransferToDelegate(ctx, zone, assets, hash); err != nil { k.Logger(ctx).Error("unable to transfer to delegate. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err) return fmt.Errorf("unable to transfer to delegate. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) @@ -118,7 +117,7 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons } // MintQAsset mints qAssets based on the native asset redemption rate. Tokens are then transferred to the given user. -func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins) error { +func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoFields types.MemoFields) error { if zone.RedemptionRate.IsZero() { return errors.New("zero redemption rate") } diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index 896d9b4e7..da1e84c4b 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -112,11 +112,9 @@ func (z *Zone) ConvertMemoToOrdinalIntents(coins sdk.Coins, memo string) (Valida var separator = []byte{byte(255)} -type fieldType int - const ( - AccountMap fieldType = iota - ReturnToSender + FieldTypeAccountMap int = iota + FieldTypeReturnToSender // add more here. ) @@ -127,6 +125,26 @@ type MemoField struct { type MemoFields []MemoField +func (m *MemoField) Validate() error { + switch m.ID { + case FieldTypeAccountMap: + if len(m.Data) == 0 { + return errors.New("invalid length for account map memo field 0") + } + // check if valid address + _, err := sdk.Bech32ifyAddressBytes("test", m.Data) + if err != nil { + return fmt.Errorf("invalid address for account map memo field: address: %s", m.Data) + } + case FieldTypeReturnToSender: + // do nothing - we ignore data if RTS + default: + return fmt.Errorf("invalid field type %d", m.ID) + } + + return nil +} + func (z *Zone) DecodeMemo(coins sdk.Coins, memo string) (validatorIntents ValidatorIntents, memoFields MemoFields, err error) { if memo == "" { return validatorIntents, memoFields, errors.New("memo length unexpectedly zero") @@ -204,7 +222,7 @@ func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { idx := 0 for idx < len(fieldBytes) { // prevent out of bounds - if len(fieldBytes[idx:]) < 3 { + if len(fieldBytes[idx:]) < 2 { return MemoFields{}, errors.New("invalid field bytes format") } @@ -213,14 +231,26 @@ func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { fieldLength := int(fieldBytes[idx]) idx++ - if len(fieldBytes[idx:]) < fieldLength { + var data []byte + switch { + case fieldLength == 0: + data = nil + case len(fieldBytes[idx:]) < fieldLength: return MemoFields{}, errors.New("invalid field length for memo field") + default: + data = fieldBytes[idx : idx+fieldLength] } - memoFields = append(memoFields, MemoField{ + memoField := MemoField{ ID: fieldID, - Data: fieldBytes[idx : idx+fieldLength], // add one for half-open range - }) + Data: data, + } + err := memoField.Validate() + if err != nil { + return MemoFields{}, fmt.Errorf("invalid memo field: %w", err) + } + + memoFields = append(memoFields, memoField) idx += fieldLength } diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 3782c07d9..1c741ac4d 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -562,7 +562,7 @@ func TestParseMemoFields(t *testing.T) { }, { name: "invalid length field", - fieldBytes: []byte{0, 1, 0, 0}, + fieldBytes: []byte{byte(types.FieldTypeAccountMap), 1, 0, 0}, expectedMemoFields: types.MemoFields{ { Data: []byte{}, @@ -573,8 +573,8 @@ func TestParseMemoFields(t *testing.T) { { name: "invalid multiple", fieldBytes: []byte{ - 0, 3, 0, 0, // should be 2 for length field - 1, 4, 1, 1, 1, 3, + byte(types.FieldTypeAccountMap), 3, 0, 0, // should be 2 for length field + byte(types.FieldTypeReturnToSender), 4, 1, 1, 1, 3, }, expectedMemoFields: types.MemoFields{ { @@ -583,9 +583,25 @@ func TestParseMemoFields(t *testing.T) { }, wantErr: true, }, + { + name: "invalid address for account map", + fieldBytes: []byte{ + byte(types.FieldTypeAccountMap), 0, + byte(types.FieldTypeReturnToSender), 0, + }, + wantErr: true, + }, + { + name: "invalid field id 3", + fieldBytes: []byte{ + 3, 2, 1, 1, + byte(types.FieldTypeReturnToSender), 0, + }, + wantErr: true, + }, { name: "valid single", - fieldBytes: []byte{0, 2, 1, 1}, + fieldBytes: []byte{byte(types.FieldTypeAccountMap), 2, 1, 1}, expectedMemoFields: types.MemoFields{ { ID: 0, @@ -597,17 +613,17 @@ func TestParseMemoFields(t *testing.T) { { name: "valid multiple", fieldBytes: []byte{ - 0, 2, 1, 1, - 2, 3, 1, 2, 3, + byte(types.FieldTypeAccountMap), 2, 1, 1, + byte(types.FieldTypeReturnToSender), 0, }, expectedMemoFields: types.MemoFields{ { - ID: 0, + ID: types.FieldTypeAccountMap, Data: []byte{1, 1}, }, { - ID: 2, - Data: []byte{1, 2, 3}, + ID: types.FieldTypeReturnToSender, + Data: nil, }, }, wantErr: false, From 95e723e01d53d31397ca955884e9751ebee13315 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 19 May 2023 19:33:56 -0400 Subject: [PATCH 17/27] add logic --- x/interchainstaking/keeper/receipt.go | 26 +++++++++++++++------- x/interchainstaking/types/zones.go | 29 +++++++++++++++++++------ x/interchainstaking/types/zones_test.go | 27 +++++------------------ 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index ef27a283d..b204af06a 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -81,9 +81,12 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons k.Logger(ctx).Info("found new deposit tx", "deposit_address", zone.DepositAddress.GetAddress(), "senderAddress", senderAddress, "local", senderAccAddress.String(), "chain id", zone.ChainId, "assets", assets, "hash", hash) var ( - memoIntent types.ValidatorIntents - memoFields types.MemoFields + memoIntent types.ValidatorIntents + memoFields types.MemoFields + memoRTS bool + mappedAddress []byte ) + if len(memo) > 0 { // process memo memoIntent, memoFields, err = zone.DecodeMemo(assets, memo) @@ -91,16 +94,16 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons // What should we do on error here? just log? k.Logger(ctx).Error("error decoding memo", "error", err.Error(), "memo", memo) } + memoRTS = memoFields.RTS() + mappedAddress, _ = memoFields.AccountMap() } - _ = memoFields - // update state if err := k.UpdateDelegatorIntent(ctx, senderAccAddress, zone, assets, memoIntent); err != nil { k.Logger(ctx).Error("unable to update intent. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err.Error()) return fmt.Errorf("unable to update intent. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } - if err := k.MintQAsset(ctx, senderAccAddress, senderAddress, zone, assets, memoFields); err != nil { + if err := k.MintQAsset(ctx, senderAccAddress, senderAddress, zone, assets, memoRTS, mappedAddress); err != nil { k.Logger(ctx).Error("unable to mint QAsset. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err) return fmt.Errorf("unable to mint QAsset. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } @@ -117,7 +120,7 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons } // MintQAsset mints qAssets based on the native asset redemption rate. Tokens are then transferred to the given user. -func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoFields types.MemoFields) error { +func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoRTS bool, mappedAddress []byte) error { if zone.RedemptionRate.IsZero() { return errors.New("zero redemption rate") } @@ -134,7 +137,8 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres return err } - if zone.ReturnToSender { + switch { + case zone.ReturnToSender || memoRTS: var srcPort string var srcChannel string @@ -163,7 +167,13 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres }, uint64(ctx.BlockTime().UnixNano()+5*time.Minute.Nanoseconds()), ) - } else { + case mappedAddress != nil: + // set mapped account + k.SetAddressMapPair(ctx, sender, mappedAddress, zone.ChainId) + + // set send to mapped account + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mappedAddress, qAssets) + default: err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, qAssets) } diff --git a/x/interchainstaking/types/zones.go b/x/interchainstaking/types/zones.go index da1e84c4b..48038e767 100644 --- a/x/interchainstaking/types/zones.go +++ b/x/interchainstaking/types/zones.go @@ -123,7 +123,17 @@ type MemoField struct { Data []byte } -type MemoFields []MemoField +type MemoFields map[int]MemoField + +func (m MemoFields) RTS() bool { + _, found := m[FieldTypeReturnToSender] + return found +} + +func (m MemoFields) AccountMap() ([]byte, bool) { + field, found := m[FieldTypeAccountMap] + return field.Data, found +} func (m *MemoField) Validate() error { switch m.ID { @@ -217,13 +227,13 @@ func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { return MemoFields{}, errors.New("invalid field bytes format") } - memoFields := make([]MemoField, 0) + memoFields := make(MemoFields) idx := 0 for idx < len(fieldBytes) { // prevent out of bounds if len(fieldBytes[idx:]) < 2 { - return MemoFields{}, errors.New("invalid field bytes format") + return memoFields, errors.New("invalid field bytes format") } fieldID := int(fieldBytes[idx]) @@ -236,7 +246,7 @@ func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { case fieldLength == 0: data = nil case len(fieldBytes[idx:]) < fieldLength: - return MemoFields{}, errors.New("invalid field length for memo field") + return memoFields, errors.New("invalid field length for memo field") default: data = fieldBytes[idx : idx+fieldLength] } @@ -247,16 +257,21 @@ func ParseMemoFields(fieldBytes []byte) (MemoFields, error) { } err := memoField.Validate() if err != nil { - return MemoFields{}, fmt.Errorf("invalid memo field: %w", err) + return memoFields, fmt.Errorf("invalid memo field: %w", err) } - memoFields = append(memoFields, memoField) + if _, found := memoFields[fieldID]; found { + return memoFields, fmt.Errorf("duplicate field ID found in memo: fieldID: %d", fieldID) + } + + memoFields[fieldID] = memoField + idx += fieldLength } // secondary sanity check if idx != len(fieldBytes) { - return MemoFields{}, errors.New("error parsing multiple fields") + return memoFields, errors.New("error parsing multiple fields") } return memoFields, nil diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 1c741ac4d..945a0dd31 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -157,7 +157,7 @@ func TestDecodeMemo(t *testing.T) { "cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf": sdk.NewDec(55), }, expectedMemoFields: types.MemoFields{ - { + 0: { ID: 0, Data: []byte{1, 2}, }, @@ -553,22 +553,12 @@ func TestParseMemoFields(t *testing.T) { { name: "invalid no length data", fieldBytes: []byte{}, - expectedMemoFields: types.MemoFields{ - { - Data: []byte{}, - }, - }, - wantErr: true, + wantErr: true, }, { name: "invalid length field", fieldBytes: []byte{byte(types.FieldTypeAccountMap), 1, 0, 0}, - expectedMemoFields: types.MemoFields{ - { - Data: []byte{}, - }, - }, - wantErr: true, + wantErr: true, }, { name: "invalid multiple", @@ -576,11 +566,6 @@ func TestParseMemoFields(t *testing.T) { byte(types.FieldTypeAccountMap), 3, 0, 0, // should be 2 for length field byte(types.FieldTypeReturnToSender), 4, 1, 1, 1, 3, }, - expectedMemoFields: types.MemoFields{ - { - Data: []byte{}, - }, - }, wantErr: true, }, { @@ -603,7 +588,7 @@ func TestParseMemoFields(t *testing.T) { name: "valid single", fieldBytes: []byte{byte(types.FieldTypeAccountMap), 2, 1, 1}, expectedMemoFields: types.MemoFields{ - { + types.FieldTypeAccountMap: types.MemoField{ ID: 0, Data: []byte{1, 1}, }, @@ -617,11 +602,11 @@ func TestParseMemoFields(t *testing.T) { byte(types.FieldTypeReturnToSender), 0, }, expectedMemoFields: types.MemoFields{ - { + types.FieldTypeAccountMap: { ID: types.FieldTypeAccountMap, Data: []byte{1, 1}, }, - { + types.FieldTypeReturnToSender: { ID: types.FieldTypeReturnToSender, Data: nil, }, From e0c0614a7bc175af16ee0d302958b89021e8552a Mon Sep 17 00:00:00 2001 From: aljo242 Date: Thu, 1 Jun 2023 08:05:35 -0400 Subject: [PATCH 18/27] refactor --- utils/test.go | 15 +++++++++ .../keeper/address_map_test.go | 31 +++++-------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/utils/test.go b/utils/test.go index 44581c018..e199a5d0a 100644 --- a/utils/test.go +++ b/utils/test.go @@ -17,3 +17,18 @@ func GenerateRandomHash() []byte { func GenerateRandomHashAsHex() string { return hex.EncodeToString(GenerateRandomHash()) } + +// GenerateRandomBytes returns securely generated random bytes. +// It will return an error if the system's secure random +// number generator fails to function correctly, in which +// case the caller should not continue. +func GenerateRandomBytes(n int) ([]byte, error) { + b := make([]byte, n) + _, err := rand.Read(b) + // Note that err == nil only if we read len(b) bytes. + if err != nil { + return nil, err + } + + return b, nil +} diff --git a/x/interchainstaking/keeper/address_map_test.go b/x/interchainstaking/keeper/address_map_test.go index 4e35455ad..e0f7f9f5a 100644 --- a/x/interchainstaking/keeper/address_map_test.go +++ b/x/interchainstaking/keeper/address_map_test.go @@ -1,28 +1,11 @@ package keeper_test -import ( - "crypto/rand" -) +import "github.com/ingenuity-build/quicksilver/utils" const ( testChainID = "test-1" ) -// generateRandomBytes returns securely generated random bytes. -// It will return an error if the system's secure random -// number generator fails to function correctly, in which -// case the caller should not continue. -func generateRandomBytes(n int) ([]byte, error) { - b := make([]byte, n) - _, err := rand.Read(b) - // Note that err == nil only if we read len(b) bytes. - if err != nil { - return nil, err - } - - return b, nil -} - func (s *KeeperTestSuite) TestKeeper_RemoteAddressStore() { s.SetupTest() s.setupTestZones() @@ -30,9 +13,9 @@ func (s *KeeperTestSuite) TestKeeper_RemoteAddressStore() { icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper ctx := s.chainA.GetContext() - localAddress, err := generateRandomBytes(28) + localAddress, err := utils.GenerateRandomBytes(28) s.Require().NoError(err) - remoteAddress, err := generateRandomBytes(40) + remoteAddress, err := utils.GenerateRandomBytes(40) s.Require().NoError(err) s.Run("not found", func() { @@ -58,9 +41,9 @@ func (s *KeeperTestSuite) TestKeeper_LocalAddressStore() { icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper ctx := s.chainA.GetContext() - localAddress, err := generateRandomBytes(28) + localAddress, err := utils.GenerateRandomBytes(28) s.Require().NoError(err) - remoteAddress, err := generateRandomBytes(40) + remoteAddress, err := utils.GenerateRandomBytes(40) s.Require().NoError(err) s.Run("not found", func() { @@ -86,9 +69,9 @@ func (s *KeeperTestSuite) TestKeeper_AddressMapPair() { icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper ctx := s.chainA.GetContext() - localAddress, err := generateRandomBytes(28) + localAddress, err := utils.GenerateRandomBytes(28) s.Require().NoError(err) - remoteAddress, err := generateRandomBytes(40) + remoteAddress, err := utils.GenerateRandomBytes(40) s.Require().NoError(err) s.Run("not found", func() { From 84f6d971962d0c8a25cbf37fbb15cc022384847f Mon Sep 17 00:00:00 2001 From: Ajaz Ahmed Ansari Date: Sat, 3 Jun 2023 02:39:05 +0530 Subject: [PATCH 19/27] feat: mapped account query (#443) * add mapped account query * format * rebase * return map instead of struct * Update x/interchainstaking/client/cli/query.go Co-authored-by: Alex Johnson * Update x/interchainstaking/keeper/grpc_query.go * Update x/interchainstaking/keeper/grpc_query_test.go * fix lint * use sdkConfig --------- Co-authored-by: Alex Johnson --- docs/swagger.yml | 130 +++ .../interchainstaking/v1/query.proto | 15 + x/interchainstaking/client/cli/query.go | 35 + x/interchainstaking/keeper/address_map.go | 24 + x/interchainstaking/keeper/grpc_query.go | 22 + x/interchainstaking/keeper/grpc_query_test.go | 127 +++ x/interchainstaking/types/keys.go | 5 + x/interchainstaking/types/query.pb.go | 798 ++++++++++++++++-- x/interchainstaking/types/query.pb.gw.go | 119 +++ 9 files changed, 1189 insertions(+), 86 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index ac751c6f3..bdf552730 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -2379,6 +2379,136 @@ paths: type: string tags: - Msg + /quicksilver/interchainstaking/v1/mapped_addresses/{address}: + get: + summary: >- + MappedAccounts provides data on the mapped accounts for a given user + over different host chains. + operationId: MappedAccounts + responses: + '200': + description: A successful response. + schema: + type: object + properties: + RemoteAddressMap: + type: object + additionalProperties: + type: string + format: byte + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: address + in: path + required: true + type: string + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - QueryInterchainStaking /quicksilver/interchainstaking/v1/zone/{chain_id}: get: summary: Zone provides meta data on a specific zone. diff --git a/proto/quicksilver/interchainstaking/v1/query.proto b/proto/quicksilver/interchainstaking/v1/query.proto index 6d3d9512d..c147ee49b 100644 --- a/proto/quicksilver/interchainstaking/v1/query.proto +++ b/proto/quicksilver/interchainstaking/v1/query.proto @@ -70,6 +70,11 @@ service Query { "/quicksilver/interchainstaking/v1/zones/" "{chain_id}/redelegation_records"; } + + // MappedAccounts provides data on the mapped accounts for a given user over different host chains. + rpc MappedAccounts(QueryMappedAccountsRequest) returns (QueryMappedAccountsResponse) { + option (google.api.http).get = "/quicksilver/interchainstaking/v1/mapped_addresses/{address}"; + } } message Statistics { @@ -184,3 +189,13 @@ message QueryRedelegationRecordsResponse { repeated RedelegationRecord redelegations = 1 [(gogoproto.nullable) = false]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } + +message QueryMappedAccountsRequest { + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +message QueryMappedAccountsResponse { + map RemoteAddressMap= 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/x/interchainstaking/client/cli/query.go b/x/interchainstaking/client/cli/query.go index b662a17b4..10dd10e69 100644 --- a/x/interchainstaking/client/cli/query.go +++ b/x/interchainstaking/client/cli/query.go @@ -28,6 +28,7 @@ func GetQueryCmd() *cobra.Command { GetCmdZones(), GetDelegatorIntentCmd(), GetDepositAccountCmd(), + GetMappedAccountsCmd(), ) return cmd @@ -144,3 +145,37 @@ func GetDepositAccountCmd() *cobra.Command { return cmd } + +// GetMappedAccountsCmd returns the mapped account for the given address. +func GetMappedAccountsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "mapped-accounts [address]", + Short: "Query mapped accounts for a given address.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + // args + address := args[0] + + queryClient := types.NewQueryClient(clientCtx) + req := &types.QueryMappedAccountsRequest{ + Address: address, + } + + res, err := queryClient.MappedAccounts(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/interchainstaking/keeper/address_map.go b/x/interchainstaking/keeper/address_map.go index d97474965..b37a8a91b 100644 --- a/x/interchainstaking/keeper/address_map.go +++ b/x/interchainstaking/keeper/address_map.go @@ -15,6 +15,30 @@ func (k *Keeper) GetRemoteAddressMap(ctx sdk.Context, localAddress []byte, chain return value, value != nil } +// IterateUserMappedAccounts iterates over all the user mapped accounts. +func (k Keeper) IterateUserMappedAccounts(ctx sdk.Context, localAddress []byte, fn func(index int64, chainID string, remoteAddressBytes []byte) (stop bool)) { + // noop + if fn == nil { + return + } + + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.GetRemoteAddressPrefix(localAddress)) + defer iterator.Close() + + i := int64(0) + for ; iterator.Valid(); iterator.Next() { + value := iterator.Value() + key := iterator.Key() + chainIDBytes := key[len(types.GetRemoteAddressPrefix(localAddress)):] + stop := fn(i, string(chainIDBytes), value) + if stop { + break + } + i++ + } +} + // SetRemoteAddressMap sets a remote address using a local address as a map. func (k *Keeper) SetRemoteAddressMap(ctx sdk.Context, localAddress, remoteAddress []byte, chainID string) { store := ctx.KVStore(k.storeKey) diff --git a/x/interchainstaking/keeper/grpc_query.go b/x/interchainstaking/keeper/grpc_query.go index 650af59dd..1a64c5506 100644 --- a/x/interchainstaking/keeper/grpc_query.go +++ b/x/interchainstaking/keeper/grpc_query.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/ingenuity-build/quicksilver/utils" "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" ) @@ -254,3 +255,24 @@ func (k *Keeper) RedelegationRecords(c context.Context, req *types.QueryRedelega return &types.QueryRedelegationRecordsResponse{Redelegations: redelegations}, nil } + +func (k *Keeper) MappedAccounts(c context.Context, req *types.QueryMappedAccountsRequest) (*types.QueryMappedAccountsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + + remoteAddressMap := make(map[string][]byte) + addrBytes, err := utils.AccAddressFromBech32(req.Address, sdk.GetConfig().GetBech32AccountAddrPrefix()) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "Invalid Address") + } + + k.IterateUserMappedAccounts(ctx, addrBytes, func(index int64, chainID string, remoteAddressBytes []byte) (stop bool) { + remoteAddressMap[chainID] = remoteAddressBytes + return false + }) + + return &types.QueryMappedAccountsResponse{RemoteAddressMap: remoteAddressMap}, nil +} diff --git a/x/interchainstaking/keeper/grpc_query_test.go b/x/interchainstaking/keeper/grpc_query_test.go index b5d81934f..a160c675f 100644 --- a/x/interchainstaking/keeper/grpc_query_test.go +++ b/x/interchainstaking/keeper/grpc_query_test.go @@ -7,6 +7,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ingenuity-build/quicksilver/utils" icskeeper "github.com/ingenuity-build/quicksilver/x/interchainstaking/keeper" "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" ) @@ -832,3 +833,129 @@ func (s *KeeperTestSuite) TestKeeper_RedelegationRecords() { }) } } + +func (s *KeeperTestSuite) TestKeeper_MappedAccounts() { + icsKeeper := s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper + usrAddress1, _ := utils.AccAddressFromBech32("cosmos1vwh8mkgefn73vpsv7td68l3tynayck07engahn", "cosmos") + ctx := s.chainA.GetContext() + + tests := []struct { + name string + malleate func() + req *types.QueryMappedAccountsRequest + wantErr bool + expectLength int + }{ + { + "MappedAccounts_Nil_Request", + func() {}, + nil, + true, + 0, + }, + { + "MappedAccounts_NoRecords_Request", + func() { + // setup zones + zone := types.Zone{ + ConnectionId: "connection-77001", + ChainId: "evmos_9001-1", + AccountPrefix: "evmos", + LocalDenom: "uqevmos", + BaseDenom: "uevmos", + MultiSend: false, + LiquidityModule: false, + Is_118: false, + } + icsKeeper.SetZone(ctx, &zone) + }, + &types.QueryMappedAccountsRequest{Address: "cosmos1vwh8mkgefn73vpsv7td68l3tynayck07engahn"}, + false, + 0, + }, + { + "MappedAccounts_ValidRecord_Request", + func() { + // setup zones + s.setupTestZones() + zone := types.Zone{ + ConnectionId: "connection-77881", + ChainId: "evmos_9001-1", + AccountPrefix: "evmos", + LocalDenom: "uqevmos", + BaseDenom: "uevmos", + MultiSend: false, + LiquidityModule: false, + Is_118: false, + } + icsKeeper.SetZone(ctx, &zone) + + icsKeeper.SetRemoteAddressMap(ctx, usrAddress1, utils.GenerateRandomHash(), zone.ChainId) + }, + &types.QueryMappedAccountsRequest{Address: "cosmos1vwh8mkgefn73vpsv7td68l3tynayck07engahn"}, + false, + 1, + }, + + { + "MappedAccounts_ValidMultipleRecord_Request", + func() { + // setup zones + zone := types.Zone{ + ConnectionId: "connection-77881", + ChainId: "evmos_9001-1", + AccountPrefix: "evmos", + LocalDenom: "uqevmos", + BaseDenom: "uevmos", + MultiSend: false, + LiquidityModule: false, + Is_118: false, + } + icsKeeper.SetZone(ctx, &zone) + + icsKeeper.SetRemoteAddressMap(ctx, usrAddress1, utils.GenerateRandomHash(), zone.ChainId) + + zone2 := types.Zone{ + ConnectionId: "connection-77891", + ChainId: "injective-1", + AccountPrefix: "injective", + LocalDenom: "uqinj", + BaseDenom: "uinj", + MultiSend: false, + LiquidityModule: false, + Is_118: false, + } + icsKeeper.SetZone(ctx, &zone2) + + icsKeeper.SetRemoteAddressMap(ctx, usrAddress1, utils.GenerateRandomHash(), zone2.ChainId) + }, + &types.QueryMappedAccountsRequest{Address: "cosmos1vwh8mkgefn73vpsv7td68l3tynayck07engahn"}, + false, + 2, + }, + } + + // run tests: + for _, tt := range tests { + s.Run(tt.name, func() { + tt.malleate() + resp, err := icsKeeper.MappedAccounts( + ctx, + tt.req, + ) + if tt.wantErr { + s.T().Logf("Error:\n%v\n", err) + s.Require().Error(err) + return + } + s.Require().NoError(err) + s.Require().NotNil(resp) + s.Require().Equal(tt.expectLength, len(resp.RemoteAddressMap)) + + vstr, err := json.MarshalIndent(resp, "", "\t") + s.Require().NoError(err) + + s.T().Logf("Response:\n%s\n", vstr) + }) + } +} diff --git a/x/interchainstaking/types/keys.go b/x/interchainstaking/types/keys.go index 452449916..0e9e355a1 100644 --- a/x/interchainstaking/types/keys.go +++ b/x/interchainstaking/types/keys.go @@ -153,3 +153,8 @@ func GetUnbondingKey(chainID, validator string, epochNumber int64) []byte { func GetZoneValidatorsKey(chainID string) []byte { return append(KeyPrefixValidatorsInfo, []byte(chainID)...) } + +// GetRemoteAddressPrefix gets the prefix for a remote address mapping. +func GetRemoteAddressPrefix(locaAddress []byte) []byte { + return append(KeyPrefixRemoteAddress, locaAddress...) +} diff --git a/x/interchainstaking/types/query.pb.go b/x/interchainstaking/types/query.pb.go index f23484f7a..9159a690c 100644 --- a/x/interchainstaking/types/query.pb.go +++ b/x/interchainstaking/types/query.pb.go @@ -1159,6 +1159,110 @@ func (m *QueryRedelegationRecordsResponse) GetPagination() *query.PageResponse { return nil } +type QueryMappedAccountsRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryMappedAccountsRequest) Reset() { *m = QueryMappedAccountsRequest{} } +func (m *QueryMappedAccountsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMappedAccountsRequest) ProtoMessage() {} +func (*QueryMappedAccountsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c8e4d79429548821, []int{21} +} +func (m *QueryMappedAccountsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMappedAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMappedAccountsRequest.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 *QueryMappedAccountsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMappedAccountsRequest.Merge(m, src) +} +func (m *QueryMappedAccountsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryMappedAccountsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMappedAccountsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMappedAccountsRequest proto.InternalMessageInfo + +func (m *QueryMappedAccountsRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *QueryMappedAccountsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryMappedAccountsResponse struct { + RemoteAddressMap map[string][]byte `protobuf:"bytes,1,rep,name=RemoteAddressMap,proto3" json:"RemoteAddressMap" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryMappedAccountsResponse) Reset() { *m = QueryMappedAccountsResponse{} } +func (m *QueryMappedAccountsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMappedAccountsResponse) ProtoMessage() {} +func (*QueryMappedAccountsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c8e4d79429548821, []int{22} +} +func (m *QueryMappedAccountsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMappedAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMappedAccountsResponse.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 *QueryMappedAccountsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMappedAccountsResponse.Merge(m, src) +} +func (m *QueryMappedAccountsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMappedAccountsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMappedAccountsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMappedAccountsResponse proto.InternalMessageInfo + +func (m *QueryMappedAccountsResponse) GetRemoteAddressMap() map[string][]byte { + if m != nil { + return m.RemoteAddressMap + } + return nil +} + +func (m *QueryMappedAccountsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*Statistics)(nil), "quicksilver.interchainstaking.v1.Statistics") proto.RegisterType((*QueryZonesRequest)(nil), "quicksilver.interchainstaking.v1.QueryZonesRequest") @@ -1181,6 +1285,9 @@ func init() { proto.RegisterType((*QueryUnbondingRecordsResponse)(nil), "quicksilver.interchainstaking.v1.QueryUnbondingRecordsResponse") proto.RegisterType((*QueryRedelegationRecordsRequest)(nil), "quicksilver.interchainstaking.v1.QueryRedelegationRecordsRequest") proto.RegisterType((*QueryRedelegationRecordsResponse)(nil), "quicksilver.interchainstaking.v1.QueryRedelegationRecordsResponse") + proto.RegisterType((*QueryMappedAccountsRequest)(nil), "quicksilver.interchainstaking.v1.QueryMappedAccountsRequest") + proto.RegisterType((*QueryMappedAccountsResponse)(nil), "quicksilver.interchainstaking.v1.QueryMappedAccountsResponse") + proto.RegisterMapType((map[string][]byte)(nil), "quicksilver.interchainstaking.v1.QueryMappedAccountsResponse.RemoteAddressMapEntry") } func init() { @@ -1188,92 +1295,101 @@ func init() { } var fileDescriptor_c8e4d79429548821 = []byte{ - // 1351 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xc4, 0x49, 0x9a, 0xbe, 0x88, 0x36, 0x9d, 0xb6, 0xd4, 0x5d, 0x82, 0x13, 0x19, 0x89, - 0xb6, 0x90, 0x7a, 0xe5, 0xa4, 0x02, 0x5a, 0x48, 0x93, 0xb8, 0xf9, 0xa1, 0xf0, 0x43, 0x50, 0x37, - 0x10, 0x35, 0x3d, 0x98, 0xb5, 0x77, 0xb4, 0x59, 0xd5, 0xd9, 0x71, 0x76, 0xc7, 0x2e, 0xa1, 0xea, - 0x01, 0xfe, 0x00, 0x04, 0x02, 0x81, 0x7a, 0xe6, 0x86, 0xc4, 0x8d, 0x0b, 0x37, 0x38, 0x20, 0x55, - 0x02, 0xa4, 0x0a, 0x38, 0x70, 0x0a, 0x90, 0xd0, 0x03, 0x07, 0x0e, 0xf4, 0x8e, 0x84, 0x76, 0xf6, - 0xed, 0x7a, 0xfd, 0x2b, 0xb6, 0x37, 0x96, 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 0xec, - 0x7f, 0xa9, 0xfd, 0x35, 0xa9, 0x7d, 0x99, 0x2e, 0xf6, 0x44, 0x3b, 0xfd, 0x83, 0xc0, 0x68, 0x7d, - 0xe3, 0x46, 0x3b, 0xbd, 0x2f, 0x5a, 0xb4, 0xa2, 0xca, 0x6c, 0xe4, 0x78, 0x14, 0xf9, 0xaa, 0x14, - 0xb9, 0x44, 0x17, 0x22, 0x88, 0x0c, 0xfa, 0xc3, 0x40, 0xe3, 0xdf, 0x04, 0x8e, 0x37, 0x69, 0x9e, - 0xe8, 0x7c, 0xc7, 0x27, 0xac, 0x55, 0x53, 0xa8, 0x64, 0x0e, 0x02, 0x81, 0x62, 0x5f, 0x97, 0x62, - 0x57, 0xe8, 0x72, 0xa4, 0xf3, 0x5a, 0xc5, 0xf5, 0xf5, 0x66, 0xd6, 0xef, 0xed, 0x26, 0xc8, 0xfd, - 0xdd, 0x04, 0xf9, 0x7d, 0x37, 0x41, 0x3e, 0xdc, 0x4b, 0xf4, 0xdd, 0xdf, 0x4b, 0xf4, 0xfd, 0xba, - 0x97, 0xe8, 0x5b, 0x9f, 0x33, 0x4c, 0xb1, 0x51, 0xce, 0xa7, 0x0a, 0x7c, 0x53, 0x35, 0x2d, 0x83, - 0x59, 0x65, 0x53, 0x6c, 0x9f, 0xcf, 0x97, 0xcd, 0xa2, 0x5e, 0xb3, 0xf9, 0x3b, 0x4d, 0xb6, 0x17, - 0xdb, 0x25, 0xe6, 0xe4, 0x87, 0xe4, 0x1f, 0xe3, 0xd3, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc5, - 0xbf, 0xe4, 0xac, 0x1f, 0x18, 0x00, 0x00, + // 1490 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0x4d, 0x6c, 0x1b, 0x45, + 0x14, 0xce, 0xe4, 0xaf, 0xe9, 0x0b, 0xb4, 0xe9, 0x34, 0xa1, 0xee, 0x52, 0x9c, 0xc8, 0x48, 0xb4, + 0x85, 0xd4, 0xab, 0x24, 0x15, 0xb4, 0xa5, 0x69, 0x53, 0x37, 0x49, 0x15, 0xa0, 0x82, 0x6e, 0x03, + 0x55, 0xd3, 0x83, 0x99, 0x78, 0x47, 0xee, 0xaa, 0xce, 0xae, 0xbb, 0x3b, 0x76, 0x31, 0x55, 0x0f, + 0x20, 0x71, 0x45, 0x20, 0x10, 0xd0, 0x33, 0x37, 0x24, 0x4e, 0xc0, 0x81, 0x1b, 0x1c, 0x90, 0x2a, + 0x01, 0x52, 0x45, 0x39, 0x70, 0x8a, 0xa0, 0xa5, 0x07, 0x0e, 0x1c, 0xe8, 0x1d, 0x09, 0xed, 0xec, + 0xdb, 0xf5, 0x7a, 0x6d, 0xc7, 0xeb, 0xad, 0xa5, 0x72, 0xf3, 0xce, 0xec, 0xfb, 0xe6, 0x7d, 0xdf, + 0x7b, 0xf3, 0xf6, 0x3d, 0x19, 0xa6, 0xaf, 0x56, 0x8c, 0xc2, 0x15, 0xc7, 0x28, 0x55, 0xb9, 0xad, + 0x1a, 0xa6, 0xe0, 0x76, 0xe1, 0x32, 0x33, 0x4c, 0x47, 0xb0, 0x2b, 0x86, 0x59, 0x54, 0xab, 0x33, + 0xea, 0xd5, 0x0a, 0xb7, 0x6b, 0xd9, 0xb2, 0x6d, 0x09, 0x8b, 0x4e, 0x85, 0xde, 0xce, 0x36, 0xbd, + 0x9d, 0xad, 0xce, 0x28, 0xcf, 0x16, 0x2c, 0x67, 0xc3, 0x72, 0xd4, 0x75, 0xe6, 0x70, 0xcf, 0x54, + 0xad, 0xce, 0xac, 0x73, 0xc1, 0x66, 0xd4, 0x32, 0x2b, 0x1a, 0x26, 0x13, 0x86, 0x65, 0x7a, 0x68, + 0xca, 0x5e, 0xef, 0xdd, 0xbc, 0x7c, 0x52, 0xbd, 0x07, 0xdc, 0x1a, 0x2f, 0x5a, 0x45, 0xcb, 0x5b, + 0x77, 0x7f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xd7, 0x58, 0x91, 0xa3, 0xad, 0x16, 0xb2, 0x74, + 0x45, 0xa4, 0x61, 0x74, 0xa7, 0x6c, 0x99, 0x0e, 0xa7, 0x39, 0x18, 0x7a, 0xdb, 0x5d, 0x48, 0x91, + 0xa9, 0x01, 0x89, 0xdc, 0x29, 0x85, 0xb2, 0xae, 0x7d, 0x6e, 0xf0, 0xd6, 0xe6, 0x64, 0x9f, 0xe6, + 0x99, 0xba, 0x18, 0x8e, 0x60, 0xc2, 0x49, 0xf5, 0x4b, 0x8c, 0xe9, 0xce, 0x18, 0xf5, 0x68, 0x6a, + 0x9e, 0x29, 0x3d, 0xd3, 0x40, 0x73, 0x40, 0xd2, 0xdc, 0xdf, 0x91, 0xa6, 0x47, 0xa2, 0x81, 0x67, + 0x0e, 0xc6, 0x02, 0x9a, 0xbe, 0x86, 0xd9, 0x68, 0xc6, 0xe4, 0x76, 0x3f, 0xd8, 0x9c, 0xdc, 0x59, + 0x63, 0x1b, 0xa5, 0x63, 0x19, 0x7f, 0x27, 0x13, 0xa4, 0x51, 0xe6, 0x26, 0x09, 0x45, 0x22, 0x90, + 0x6a, 0x01, 0x06, 0x5d, 0xbe, 0x41, 0x0c, 0xba, 0x51, 0x4a, 0x5a, 0x86, 0x85, 0x22, 0x09, 0x85, + 0xca, 0x7c, 0x4a, 0x40, 0x09, 0x7c, 0x7b, 0x83, 0x95, 0x0c, 0x9d, 0xb9, 0x09, 0xea, 0x53, 0xdd, + 0xe2, 0x72, 0xb8, 0x49, 0x2a, 0x98, 0xa8, 0x78, 0xc7, 0x6f, 0xd7, 0xf0, 0x29, 0x92, 0x61, 0x03, + 0x89, 0x33, 0xec, 0x5b, 0x02, 0x4f, 0xb6, 0xf4, 0x0c, 0xf5, 0x3b, 0x07, 0x50, 0x0d, 0x56, 0x31, + 0xdf, 0x9e, 0xeb, 0x2c, 0x41, 0x80, 0x84, 0x52, 0x86, 0x40, 0x22, 0x59, 0xd3, 0x9f, 0x3c, 0x6b, + 0x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9e, 0x47, 0xc6, 0x1a, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1310,6 +1426,8 @@ type QueryClient interface { UnbondingRecords(ctx context.Context, in *QueryUnbondingRecordsRequest, opts ...grpc.CallOption) (*QueryUnbondingRecordsResponse, error) // RedelegationRecords provides data on the active unbondings. RedelegationRecords(ctx context.Context, in *QueryRedelegationRecordsRequest, opts ...grpc.CallOption) (*QueryRedelegationRecordsResponse, error) + // MappedAccounts provides data on the mapped accounts for a given user over different host chains. + MappedAccounts(ctx context.Context, in *QueryMappedAccountsRequest, opts ...grpc.CallOption) (*QueryMappedAccountsResponse, error) } type queryClient struct { @@ -1419,6 +1537,15 @@ func (c *queryClient) RedelegationRecords(ctx context.Context, in *QueryRedelega return out, nil } +func (c *queryClient) MappedAccounts(ctx context.Context, in *QueryMappedAccountsRequest, opts ...grpc.CallOption) (*QueryMappedAccountsResponse, error) { + out := new(QueryMappedAccountsResponse) + err := c.cc.Invoke(ctx, "/quicksilver.interchainstaking.v1.Query/MappedAccounts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Zones provides meta data on connected zones. @@ -1443,6 +1570,8 @@ type QueryServer interface { UnbondingRecords(context.Context, *QueryUnbondingRecordsRequest) (*QueryUnbondingRecordsResponse, error) // RedelegationRecords provides data on the active unbondings. RedelegationRecords(context.Context, *QueryRedelegationRecordsRequest) (*QueryRedelegationRecordsResponse, error) + // MappedAccounts provides data on the mapped accounts for a given user over different host chains. + MappedAccounts(context.Context, *QueryMappedAccountsRequest) (*QueryMappedAccountsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1482,6 +1611,9 @@ func (*UnimplementedQueryServer) UnbondingRecords(ctx context.Context, req *Quer func (*UnimplementedQueryServer) RedelegationRecords(ctx context.Context, req *QueryRedelegationRecordsRequest) (*QueryRedelegationRecordsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RedelegationRecords not implemented") } +func (*UnimplementedQueryServer) MappedAccounts(ctx context.Context, req *QueryMappedAccountsRequest) (*QueryMappedAccountsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MappedAccounts not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1685,6 +1817,24 @@ func _Query_RedelegationRecords_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Query_MappedAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMappedAccountsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MappedAccounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/quicksilver.interchainstaking.v1.Query/MappedAccounts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MappedAccounts(ctx, req.(*QueryMappedAccountsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "quicksilver.interchainstaking.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1733,6 +1883,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "RedelegationRecords", Handler: _Query_RedelegationRecords_Handler, }, + { + MethodName: "MappedAccounts", + Handler: _Query_MappedAccounts_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "quicksilver/interchainstaking/v1/query.proto", @@ -2670,6 +2824,104 @@ func (m *QueryRedelegationRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } +func (m *QueryMappedAccountsRequest) 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 *QueryMappedAccountsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMappedAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryMappedAccountsResponse) 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 *QueryMappedAccountsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMappedAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RemoteAddressMap) > 0 { + for k := range m.RemoteAddressMap { + v := m.RemoteAddressMap[k] + baseI := i + if len(v) > 0 { + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintQuery(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintQuery(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintQuery(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -3062,6 +3314,48 @@ func (m *QueryRedelegationRecordsResponse) Size() (n int) { return n } +func (m *QueryMappedAccountsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryMappedAccountsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RemoteAddressMap) > 0 { + for k, v := range m.RemoteAddressMap { + _ = k + _ = v + l = 0 + if len(v) > 0 { + l = 1 + len(v) + sovQuery(uint64(len(v))) + } + mapEntrySize := 1 + len(k) + sovQuery(uint64(len(k))) + l + n += mapEntrySize + 1 + sovQuery(uint64(mapEntrySize)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5593,6 +5887,338 @@ func (m *QueryRedelegationRecordsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryMappedAccountsRequest) 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 ErrIntOverflowQuery + } + 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: QueryMappedAccountsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMappedAccountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMappedAccountsResponse) 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 ErrIntOverflowQuery + } + 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: QueryMappedAccountsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMappedAccountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemoteAddressMap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RemoteAddressMap == nil { + m.RemoteAddressMap = make(map[string][]byte) + } + var mapkey string + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthQuery + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthQuery + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthQuery + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLengthQuery + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.RemoteAddressMap[mapkey] = mapvalue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/interchainstaking/types/query.pb.gw.go b/x/interchainstaking/types/query.pb.gw.go index f6c033d46..7e078dbbe 100644 --- a/x/interchainstaking/types/query.pb.gw.go +++ b/x/interchainstaking/types/query.pb.gw.go @@ -779,6 +779,78 @@ func local_request_Query_RedelegationRecords_0(ctx context.Context, marshaler ru } +var ( + filter_Query_MappedAccounts_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_MappedAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMappedAccountsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_MappedAccounts_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.MappedAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MappedAccounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMappedAccountsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_MappedAccounts_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.MappedAccounts(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1038,6 +1110,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_MappedAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_MappedAccounts_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MappedAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1299,6 +1394,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_MappedAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_MappedAccounts_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MappedAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1324,6 +1439,8 @@ var ( pattern_Query_UnbondingRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"quicksilver", "interchainstaking", "v1", "zones", "chain_id", "unbonding_records"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_RedelegationRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"quicksilver", "interchainstaking", "v1", "zones", "chain_id", "redelegation_records"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_MappedAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"quicksilver", "interchainstaking", "v1", "mapped_addresses", "address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -1348,4 +1465,6 @@ var ( forward_Query_UnbondingRecords_0 = runtime.ForwardResponseMessage forward_Query_RedelegationRecords_0 = runtime.ForwardResponseMessage + + forward_Query_MappedAccounts_0 = runtime.ForwardResponseMessage ) From be99f7d8391259c0431da2c2da1a470423c22c5a Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 5 Jun 2023 13:20:55 -0400 Subject: [PATCH 20/27] refactor to cover more cases --- x/interchainstaking/keeper/receipt.go | 78 +++++++++++++++++---------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index b204af06a..1d52d2834 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -119,6 +119,39 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons return nil } +// SendTokenIBC is a helper function that finds the zone channel and performs an ibc transfer from senderAccAddress +// to receiver. +func (k *Keeper) SendTokenIBC(ctx sdk.Context, senderAccAddress sdk.AccAddress, receiver string, zone *types.Zone, coin sdk.Coin) error { + var srcPort string + var srcChannel string + + k.IBCKeeper.ChannelKeeper.IterateChannels(ctx, func(channel channeltypes.IdentifiedChannel) bool { + if channel.ConnectionHops[0] == zone.ConnectionId && channel.PortId == types.TransferPort && channel.State == channeltypes.OPEN { + srcChannel = channel.Counterparty.ChannelId + srcPort = channel.Counterparty.PortId + return true + } + return false + }) + if srcPort == "" { + return errors.New("unable to find remote transfer connection") + } + + return k.TransferKeeper.SendTransfer( + ctx, + srcPort, + srcChannel, + coin, + senderAccAddress, + receiver, + clienttypes.Height{ + RevisionNumber: 0, + RevisionHeight: 0, + }, + uint64(ctx.BlockTime().UnixNano()+5*time.Minute.Nanoseconds()), + ) +} + // MintQAsset mints qAssets based on the native asset redemption rate. Tokens are then transferred to the given user. func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoRTS bool, mappedAddress []byte) error { if zone.RedemptionRate.IsZero() { @@ -131,6 +164,16 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres qAssets = qAssets.Add(sdk.NewCoin(zone.LocalDenom, amount)) } + // check if a remote address exists for a non 118 coin type zone + if mappedAddress == nil && !zone.Is_118 { + var found bool + mappedAddress, found = k.GetRemoteAddressMap(ctx, sender, zone.ChainId) + if !found { + // if not found, skip minting and refund assets + return k.SendTokenIBC(ctx, k.AccountKeeper.GetModuleAddress(types.ModuleName), senderAddress, zone, assets[0]) + } + } + k.Logger(ctx).Info("Minting qAssets for receipt", "assets", qAssets) err := k.BankKeeper.MintCoins(ctx, types.ModuleName, qAssets) if err != nil { @@ -139,34 +182,8 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres switch { case zone.ReturnToSender || memoRTS: - var srcPort string - var srcChannel string - - k.IBCKeeper.ChannelKeeper.IterateChannels(ctx, func(channel channeltypes.IdentifiedChannel) bool { - if channel.ConnectionHops[0] == zone.ConnectionId && channel.PortId == types.TransferPort && channel.State == channeltypes.OPEN { - srcChannel = channel.Counterparty.ChannelId - srcPort = channel.Counterparty.PortId - return true - } - return false - }) - if srcPort == "" { - return errors.New("unable to find remote transfer connection") - } + err = k.SendTokenIBC(ctx, k.AccountKeeper.GetModuleAddress(types.ModuleName), senderAddress, zone, qAssets[0]) - err = k.TransferKeeper.SendTransfer( - ctx, - srcPort, - srcChannel, - qAssets[0], - k.AccountKeeper.GetModuleAddress(types.ModuleName), - senderAddress, - clienttypes.Height{ - RevisionNumber: 0, - RevisionHeight: 0, - }, - uint64(ctx.BlockTime().UnixNano()+5*time.Minute.Nanoseconds()), - ) case mappedAddress != nil: // set mapped account k.SetAddressMapPair(ctx, sender, mappedAddress, zone.ChainId) @@ -174,7 +191,12 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres // set send to mapped account err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mappedAddress, qAssets) default: - err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, qAssets) + if !zone.Is_118 { + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mappedAddress, qAssets) + } else { + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, qAssets) + } + } if err != nil { From 73e36c52c38a67ee0dce548c9322b40a0e15ea8a Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 5 Jun 2023 13:41:48 -0400 Subject: [PATCH 21/27] update --- x/interchainstaking/keeper/receipt.go | 32 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index 1d52d2834..cd99327b1 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -103,7 +103,7 @@ func (k *Keeper) HandleReceiptForTransaction(ctx sdk.Context, txr *sdk.TxRespons k.Logger(ctx).Error("unable to update intent. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err.Error()) return fmt.Errorf("unable to update intent. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } - if err := k.MintQAsset(ctx, senderAccAddress, senderAddress, zone, assets, memoRTS, mappedAddress); err != nil { + if err := k.MintAndSendQAsset(ctx, senderAccAddress, senderAddress, zone, assets, memoRTS, mappedAddress); err != nil { k.Logger(ctx).Error("unable to mint QAsset. Ignoring.", "senderAddress", senderAddress, "zone", zone.ChainId, "err", err) return fmt.Errorf("unable to mint QAsset. Ignoring. senderAddress=%q zone=%q err: %w", senderAddress, zone.ChainId, err) } @@ -152,8 +152,19 @@ func (k *Keeper) SendTokenIBC(ctx sdk.Context, senderAccAddress sdk.AccAddress, ) } -// MintQAsset mints qAssets based on the native asset redemption rate. Tokens are then transferred to the given user. -func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoRTS bool, mappedAddress []byte) error { +// MintAndSendQAsset mints qAssets based on the native asset redemption rate. Tokens are then transferred to the given user. +// The function handles the following cases: +// 1. If the zone is labeled "return to sender" or the Tx memo contains "return to sender" flag: +// - Mint QAssets and IBC transfer to the corresponding zone acc +// 2. If there is no mapped account but the zone is labeled as non-118 coin type: +// - Do not mint QAssets and refund assets +// 3. If a mapped account is set for a non-118 coin type zone: +// - Mint QAssets and send to corresponding mapped address +// 4. If a new mapped account is provided to the function and the zone is labeled as non-118 coin type: +// - Mint QAssets, set new mapping for the mapped account in the keeper, and send to corresponding mapped account. +// 5. If the zone is non-118 and no other flags are set: +// - Mint QAssets and transfer to send to msg creator. +func (k *Keeper) MintAndSendQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoRTS bool, mappedAddress []byte) error { if zone.RedemptionRate.IsZero() { return errors.New("zero redemption rate") } @@ -165,6 +176,7 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres } // check if a remote address exists for a non 118 coin type zone + setMappedAddress := true if mappedAddress == nil && !zone.Is_118 { var found bool mappedAddress, found = k.GetRemoteAddressMap(ctx, sender, zone.ChainId) @@ -172,6 +184,8 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres // if not found, skip minting and refund assets return k.SendTokenIBC(ctx, k.AccountKeeper.GetModuleAddress(types.ModuleName), senderAddress, zone, assets[0]) } + // do not set, since mapped address already exists + setMappedAddress = false } k.Logger(ctx).Info("Minting qAssets for receipt", "assets", qAssets) @@ -184,18 +198,16 @@ func (k *Keeper) MintQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddres case zone.ReturnToSender || memoRTS: err = k.SendTokenIBC(ctx, k.AccountKeeper.GetModuleAddress(types.ModuleName), senderAddress, zone, qAssets[0]) - case mappedAddress != nil: + case mappedAddress != nil && !zone.Is_118: // set mapped account - k.SetAddressMapPair(ctx, sender, mappedAddress, zone.ChainId) + if setMappedAddress { + k.SetAddressMapPair(ctx, sender, mappedAddress, zone.ChainId) + } // set send to mapped account err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mappedAddress, qAssets) default: - if !zone.Is_118 { - err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mappedAddress, qAssets) - } else { - err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, qAssets) - } + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, qAssets) } From ea207727ace094c626f688cb8a8041e8ce585a8a Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 6 Jun 2023 12:38:18 -0400 Subject: [PATCH 22/27] send on remote zone --- x/interchainstaking/keeper/receipt.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index cd99327b1..06a3d72eb 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -162,7 +162,7 @@ func (k *Keeper) SendTokenIBC(ctx sdk.Context, senderAccAddress sdk.AccAddress, // - Mint QAssets and send to corresponding mapped address // 4. If a new mapped account is provided to the function and the zone is labeled as non-118 coin type: // - Mint QAssets, set new mapping for the mapped account in the keeper, and send to corresponding mapped account. -// 5. If the zone is non-118 and no other flags are set: +// 5. If the zone is 118 and no other flags are set: // - Mint QAssets and transfer to send to msg creator. func (k *Keeper) MintAndSendQAsset(ctx sdk.Context, sender sdk.AccAddress, senderAddress string, zone *types.Zone, assets sdk.Coins, memoRTS bool, mappedAddress []byte) error { if zone.RedemptionRate.IsZero() { @@ -182,7 +182,8 @@ func (k *Keeper) MintAndSendQAsset(ctx sdk.Context, sender sdk.AccAddress, sende mappedAddress, found = k.GetRemoteAddressMap(ctx, sender, zone.ChainId) if !found { // if not found, skip minting and refund assets - return k.SendTokenIBC(ctx, k.AccountKeeper.GetModuleAddress(types.ModuleName), senderAddress, zone, assets[0]) + msg := &bankTypes.MsgSend{FromAddress: zone.DepositAddress.GetAddress(), ToAddress: senderAddress, Amount: assets} + return k.SubmitTx(ctx, []sdk.Msg{msg}, zone.DepositAddress, "", zone.MessagesPerTx) } // do not set, since mapped address already exists setMappedAddress = false From 5f1b9076d22aa282ce64808f2f3dce8cded8e0e2 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 6 Jun 2023 12:41:21 -0400 Subject: [PATCH 23/27] add condition --- x/interchainstaking/keeper/receipt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index 06a3d72eb..da69242d5 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -177,7 +177,7 @@ func (k *Keeper) MintAndSendQAsset(ctx sdk.Context, sender sdk.AccAddress, sende // check if a remote address exists for a non 118 coin type zone setMappedAddress := true - if mappedAddress == nil && !zone.Is_118 { + if mappedAddress == nil && !zone.Is_118 && !zone.ReturnToSender && !memoRTS { var found bool mappedAddress, found = k.GetRemoteAddressMap(ctx, sender, zone.ChainId) if !found { From 6f2efe8e146150cdfd064fb452969fce393e8074 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Wed, 7 Jun 2023 11:21:22 +0100 Subject: [PATCH 24/27] Update x/interchainstaking/types/zones_test.go --- x/interchainstaking/types/zones_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 945a0dd31..1515e9560 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -178,11 +178,6 @@ func TestDecodeMemo(t *testing.T) { memo: "\xFF", wantErr: true, }, - { - name: "invalid base64", - memo: "\xFF", - wantErr: true, - }, } for _, tc := range testCases { From 072da5b35c63a392dfb1aa215b718c475b6dfb0c Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Wed, 7 Jun 2023 11:23:37 +0100 Subject: [PATCH 25/27] Update x/interchainstaking/types/zones_test.go --- x/interchainstaking/types/zones_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 1515e9560..bc2dd93ab 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -200,16 +200,6 @@ func TestDecodeMemo(t *testing.T) { } } -func TestGenMemos(t *testing.T) { - oldMemo := "WoS/+Ex92tEcuMBzhukZKMVnXKS8bqaQBJTx9zza4rrxyLiP9fwLijOc" - memoBytes, err := base64.StdEncoding.DecodeString(oldMemo) - require.NoError(t, err) - memoBytes = append(memoBytes, 255, 0, 2, 1, 2) - - newMemo := base64.StdEncoding.EncodeToString(memoBytes) - fmt.Println(newMemo) -} - func TestUpdateIntentWithMemo(t *testing.T) { zone := types.Zone{ConnectionId: "connection-0", ChainId: "cosmoshub-4", AccountPrefix: "cosmos", LocalDenom: "uqatom", BaseDenom: "uatom", Is_118: true} zone.Validators = append(zone.Validators, From 6ab8c5bd6ccebb7553b3b6eb539143f7099d7704 Mon Sep 17 00:00:00 2001 From: Ajaz Ahmed Ansari Date: Wed, 7 Jun 2023 16:05:52 +0530 Subject: [PATCH 26/27] Update x/interchainstaking/types/zones_test.go remove unused import --- x/interchainstaking/types/zones_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index bc2dd93ab..45696058f 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -2,7 +2,6 @@ package types_test import ( "encoding/base64" - "fmt" "testing" sdk "github.com/cosmos/cosmos-sdk/types" From b8781bdc98aa252c0f16672e3ec8c597daaa8468 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Wed, 7 Jun 2023 11:39:17 +0100 Subject: [PATCH 27/27] Update x/interchainstaking/types/zones_test.go --- x/interchainstaking/types/zones_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/interchainstaking/types/zones_test.go b/x/interchainstaking/types/zones_test.go index 45696058f..21143b920 100644 --- a/x/interchainstaking/types/zones_test.go +++ b/x/interchainstaking/types/zones_test.go @@ -1,7 +1,6 @@ package types_test import ( - "encoding/base64" "testing" sdk "github.com/cosmos/cosmos-sdk/types"