From 991461155e0c763e24d09e9d2f867050cfa1178d Mon Sep 17 00:00:00 2001 From: sampocs Date: Thu, 11 Jan 2024 14:41:40 -0600 Subject: [PATCH] rename native amount and host zone unbonding status (#1071) --- app/upgrades/v17/upgrades.go | 2 +- app/upgrades/v17/upgrades_test.go | 4 +- app/upgrades/v5/upgrades_test.go | 2 +- dockernet/tests/integration_tests.bats | 14 +- proto/stride/records/records.proto | 2 +- readme-docs/md/records_README.md | 2 +- x/records/README.md | 2 +- .../cli/query_user_redemption_record_test.go | 6 +- x/records/keeper/epoch_unbonding_record.go | 3 +- .../keeper/epoch_unbonding_record_test.go | 4 +- .../keeper/user_redemption_record_test.go | 2 +- x/records/migrations/v2/convert.go | 12 +- x/records/migrations/v2/convert_test.go | 10 +- x/records/types/records.pb.go | 154 +++++++++--------- .../keeper/grpc_query_address_unbondings.go | 2 +- x/stakeibc/keeper/icacallbacks_claim.go | 2 +- x/stakeibc/keeper/icacallbacks_claim_test.go | 8 +- x/stakeibc/keeper/icacallbacks_redemption.go | 4 +- x/stakeibc/keeper/icacallbacks_undelegate.go | 4 +- .../msg_server_claim_undelegated_tokens.go | 2 +- ...sg_server_claim_undelegated_tokens_test.go | 16 +- x/stakeibc/keeper/msg_server_redeem_stake.go | 16 +- .../keeper/msg_server_redeem_stake_test.go | 2 +- .../msg_server_restore_interchain_account.go | 4 +- x/stakeibc/keeper/unbonding_records.go | 6 +- ...ords_get_host_zone_unbondings_msgs_test.go | 12 +- 26 files changed, 146 insertions(+), 151 deletions(-) diff --git a/app/upgrades/v17/upgrades.go b/app/upgrades/v17/upgrades.go index 4b60520926..430d08cfa9 100644 --- a/app/upgrades/v17/upgrades.go +++ b/app/upgrades/v17/upgrades.go @@ -178,7 +178,7 @@ func MigrateUnbondingRecords(ctx sdk.Context, k stakeibckeeper.Keeper) error { continue } - userRedemptionRecord.StTokenAmount = estimatedStTokenConversionRate.Mul(sdk.NewDecFromInt(userRedemptionRecord.Amount)).RoundInt() + userRedemptionRecord.StTokenAmount = estimatedStTokenConversionRate.Mul(sdk.NewDecFromInt(userRedemptionRecord.NativeTokenAmount)).RoundInt() k.RecordsKeeper.SetUserRedemptionRecord(ctx, userRedemptionRecord) } } diff --git a/app/upgrades/v17/upgrades_test.go b/app/upgrades/v17/upgrades_test.go index 5d5922684d..bca0a6baaf 100644 --- a/app/upgrades/v17/upgrades_test.go +++ b/app/upgrades/v17/upgrades_test.go @@ -220,8 +220,8 @@ func (s *UpgradeTestSuite) SetupMigrateUnbondingRecords() func() { for i := 1; i <= 6; i++ { mockURRId := strconv.Itoa(i) mockURR := recordtypes.UserRedemptionRecord{ - Id: mockURRId, - Amount: sdkmath.NewInt(URRAmount), + Id: mockURRId, + NativeTokenAmount: sdkmath.NewInt(URRAmount), } s.App.RecordsKeeper.SetUserRedemptionRecord(s.Ctx, mockURR) } diff --git a/app/upgrades/v5/upgrades_test.go b/app/upgrades/v5/upgrades_test.go index d9d56a7a07..d31967dc94 100644 --- a/app/upgrades/v5/upgrades_test.go +++ b/app/upgrades/v5/upgrades_test.go @@ -329,7 +329,7 @@ func (s *UpgradeTestSuite) SetupOldRecordStore(codec codec.Codec) func() { userRedemptionRecord, found := s.App.RecordsKeeper.GetUserRedemptionRecord(s.Ctx, userRedemptionRecordId) s.Require().True(found, "redemption record found") s.Require().Equal(userRedemptionRecord.Id, userRedemptionRecordId, "redemption record id") - s.Require().Equal(userRedemptionRecord.Amount, sdkmath.NewInt(1000000), "redemption record amount") + s.Require().Equal(userRedemptionRecord.NativeTokenAmount, sdkmath.NewInt(1000000), "redemption record amount") epochUnbondingRecord, found := s.App.RecordsKeeper.GetEpochUnbondingRecord(s.Ctx, epochNumber) s.Require().True(found, "epoch unbonding record found") diff --git a/dockernet/tests/integration_tests.bats b/dockernet/tests/integration_tests.bats index 612dec816f..c9751e57b7 100644 --- a/dockernet/tests/integration_tests.bats +++ b/dockernet/tests/integration_tests.bats @@ -371,8 +371,8 @@ setup_file() { WAIT_FOR_BLOCK $STRIDE_LOGS 5 # check that a user redemption record was created - redemption_record_amount=$($STRIDE_MAIN_CMD q records list-user-redemption-record | grep -Fiw 'amount' | head -n 1 | grep -o -E '[0-9]+') - amount_positive=$(($redemption_record_amount > 0)) + redemption_record_native_amount=$($STRIDE_MAIN_CMD q records list-user-redemption-record | grep -Fiw 'native_token_amount' | head -n 1 | grep -o -E '[0-9]+') + amount_positive=$(($redemption_record_native_amount > 0)) assert_equal "$amount_positive" "1" # attempt to redeem with an invalid receiver address to invoke a failure @@ -397,16 +397,12 @@ setup_file() { # Check that the redemption record created from the autopilot redeem above was incremented # and that there is still only one record - num_records=$($STRIDE_MAIN_CMD q records list-user-redemption-record | grep -c "amount") + num_records=$($STRIDE_MAIN_CMD q records list-user-redemption-record | grep -c "native_token_amount") assert_equal "$num_records" "1" - # The amount in the redemption record is denominated in native tokens, but amount in the - # redeem message is denominated in stTokens (and the redemption rate may be greater than 1) - # So when checking the amount, we make sure the amount in the record is greater than or - # equal to 2 * REDEEM_AMOUNT (since there were two redemptions - one from autopilot, one here) - redemption_record_amount=$($STRIDE_MAIN_CMD q records list-user-redemption-record | grep -Fiw 'amount' | head -n 1 | grep -o -E '[0-9]+') + redemption_record_st_amount=$($STRIDE_MAIN_CMD q records list-user-redemption-record | grep -Fiw 'st_token_amount' | head -n 1 | grep -o -E '[0-9]+') expected_record_minimum=$(echo "$REDEEM_AMOUNT * 2" | bc) - assert_equal "$(($redemption_record_amount >= $expected_record_minimum))" "1" + assert_equal "$redemption_record_st_amount" "$expected_record_minimum" WAIT_FOR_STRING $STRIDE_LOGS "\[REDEMPTION] completed on $HOST_CHAIN_ID" WAIT_FOR_BLOCK $STRIDE_LOGS 2 diff --git a/proto/stride/records/records.proto b/proto/stride/records/records.proto index d1fce38976..07439d7b10 100644 --- a/proto/stride/records/records.proto +++ b/proto/stride/records/records.proto @@ -9,7 +9,7 @@ option go_package = "github.com/Stride-Labs/stride/v17/x/records/types"; message UserRedemptionRecord { string id = 1; // {chain_id}.{epoch}.{receiver} string receiver = 3; - string amount = 4 [ + string native_token_amount = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; diff --git a/readme-docs/md/records_README.md b/readme-docs/md/records_README.md index d5b9bffea0..af99ec6052 100644 --- a/readme-docs/md/records_README.md +++ b/readme-docs/md/records_README.md @@ -34,7 +34,7 @@ Epoch Unbonding Records - `GetAllPreviousEpochUnbondingRecords()` - `GetHostZoneUnbondingByChainId()` - `AddHostZoneToEpochUnbondingRecord()` -- `SetHostZoneUnbondings()` +- `SetHostZoneUnbondingStatus()` User Redemption Records - `SetUserRedemptionRecord()` diff --git a/x/records/README.md b/x/records/README.md index f3ec678ec5..3bcc8669f7 100644 --- a/x/records/README.md +++ b/x/records/README.md @@ -37,7 +37,7 @@ Epoch Unbonding Records - `GetAllPreviousEpochUnbondingRecords()` - `GetHostZoneUnbondingByChainId()` - `AddHostZoneToEpochUnbondingRecord()` -- `SetHostZoneUnbondings()` +- `SetHostZoneUnbondingStatus()` User Redemption Records diff --git a/x/records/client/cli/query_user_redemption_record_test.go b/x/records/client/cli/query_user_redemption_record_test.go index 025a32919d..38f96c91ac 100644 --- a/x/records/client/cli/query_user_redemption_record_test.go +++ b/x/records/client/cli/query_user_redemption_record_test.go @@ -29,9 +29,9 @@ func networkWithUserRedemptionRecordObjects(t *testing.T, n int) (*network.Netwo for i := 0; i < n; i++ { userRedemptionRecord := types.UserRedemptionRecord{ - Id: strconv.Itoa(i), - Amount: sdkmath.NewInt(int64(i)), - StTokenAmount: sdkmath.NewInt(int64(i)), + Id: strconv.Itoa(i), + NativeTokenAmount: sdkmath.NewInt(int64(i)), + StTokenAmount: sdkmath.NewInt(int64(i)), } nullify.Fill(&userRedemptionRecord) state.UserRedemptionRecordList = append(state.UserRedemptionRecordList, userRedemptionRecord) diff --git a/x/records/keeper/epoch_unbonding_record.go b/x/records/keeper/epoch_unbonding_record.go index a1af8f8f46..c0727f91a8 100644 --- a/x/records/keeper/epoch_unbonding_record.go +++ b/x/records/keeper/epoch_unbonding_record.go @@ -133,8 +133,7 @@ func (k Keeper) SetHostZoneUnbondingRecord(ctx sdk.Context, epochNumber uint64, } // Updates the status for a given host zone across relevant epoch unbonding record IDs -// TODO [cleanup]: Rename to SetHostZoneUnbondingStatus -func (k Keeper) SetHostZoneUnbondings(ctx sdk.Context, chainId string, epochUnbondingRecordIds []uint64, status types.HostZoneUnbonding_Status) error { +func (k Keeper) SetHostZoneUnbondingStatus(ctx sdk.Context, chainId string, epochUnbondingRecordIds []uint64, status types.HostZoneUnbonding_Status) error { for _, epochUnbondingRecordId := range epochUnbondingRecordIds { k.Logger(ctx).Info(fmt.Sprintf("Updating host zone unbondings on EpochUnbondingRecord %d to status %s", epochUnbondingRecordId, status.String())) // fetch the host zone unbonding diff --git a/x/records/keeper/epoch_unbonding_record_test.go b/x/records/keeper/epoch_unbonding_record_test.go index 4ec3e28723..e2b14c13bf 100644 --- a/x/records/keeper/epoch_unbonding_record_test.go +++ b/x/records/keeper/epoch_unbonding_record_test.go @@ -137,7 +137,7 @@ func TestAddHostZoneToEpochUnbondingRecord(t *testing.T) { ) } -func TestSetHostZoneUnbondings(t *testing.T) { +func TestSetHostZoneUnbondingStatus(t *testing.T) { keeper, ctx := keepertest.RecordsKeeper(t) initialEpochUnbondingRecords, _ := createNEpochUnbondingRecord(keeper, ctx, 4) @@ -161,7 +161,7 @@ func TestSetHostZoneUnbondings(t *testing.T) { } } - err := keeper.SetHostZoneUnbondings(ctx, hostIdToUpdate, epochsToUpdate, newStatus) + err := keeper.SetHostZoneUnbondingStatus(ctx, hostIdToUpdate, epochsToUpdate, newStatus) require.Nil(t, err) actualEpochUnbondingRecord := keeper.GetAllEpochUnbondingRecord(ctx) diff --git a/x/records/keeper/user_redemption_record_test.go b/x/records/keeper/user_redemption_record_test.go index a75549d769..12e1c74176 100644 --- a/x/records/keeper/user_redemption_record_test.go +++ b/x/records/keeper/user_redemption_record_test.go @@ -20,7 +20,7 @@ func createNUserRedemptionRecord(keeper *keeper.Keeper, ctx sdk.Context, n int) items := make([]types.UserRedemptionRecord, n) for i := range items { items[i].Id = strconv.Itoa(i) - items[i].Amount = sdkmath.NewInt(int64(i)) + items[i].NativeTokenAmount = sdkmath.NewInt(int64(i)) items[i].StTokenAmount = sdkmath.NewInt(int64(i)) keeper.SetUserRedemptionRecord(ctx, items[i]) } diff --git a/x/records/migrations/v2/convert.go b/x/records/migrations/v2/convert.go index f51f1d05df..d903ed7863 100644 --- a/x/records/migrations/v2/convert.go +++ b/x/records/migrations/v2/convert.go @@ -44,11 +44,11 @@ func convertToNewUserRedemptionRecord(oldRedemptionRecord oldrecordstypes.UserRe return recordstypes.UserRedemptionRecord{ Id: oldRedemptionRecord.Id, // Sender: oldRedemptionRecord.Sender, - Receiver: oldRedemptionRecord.Receiver, - Amount: sdkmath.NewIntFromUint64(oldRedemptionRecord.Amount), - Denom: oldRedemptionRecord.Denom, - HostZoneId: oldRedemptionRecord.HostZoneId, - EpochNumber: oldRedemptionRecord.EpochNumber, - ClaimIsPending: oldRedemptionRecord.ClaimIsPending, + Receiver: oldRedemptionRecord.Receiver, + NativeTokenAmount: sdkmath.NewIntFromUint64(oldRedemptionRecord.Amount), + Denom: oldRedemptionRecord.Denom, + HostZoneId: oldRedemptionRecord.HostZoneId, + EpochNumber: oldRedemptionRecord.EpochNumber, + ClaimIsPending: oldRedemptionRecord.ClaimIsPending, } } diff --git a/x/records/migrations/v2/convert_test.go b/x/records/migrations/v2/convert_test.go index ef8023422a..fc2231596e 100644 --- a/x/records/migrations/v2/convert_test.go +++ b/x/records/migrations/v2/convert_test.go @@ -123,11 +123,11 @@ func TestConvertUserRedemptionRecord(t *testing.T) { Id: id, Receiver: receiver, // Sender: sender, - Amount: sdkmath.NewInt(1), - Denom: denom, - HostZoneId: hostZoneId, - EpochNumber: epochNumber, - ClaimIsPending: claimIsPending, + NativeTokenAmount: sdkmath.NewInt(1), + Denom: denom, + HostZoneId: hostZoneId, + EpochNumber: epochNumber, + ClaimIsPending: claimIsPending, } actualNewUserRedemptionRecord := convertToNewUserRedemptionRecord(oldUserRedemptionRecord) diff --git a/x/records/types/records.pb.go b/x/records/types/records.pb.go index d37c238904..37b3304fba 100644 --- a/x/records/types/records.pb.go +++ b/x/records/types/records.pb.go @@ -163,14 +163,14 @@ func (LSMTokenDeposit_Status) EnumDescriptor() ([]byte, []int) { } type UserRedemptionRecord struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` - Denom string `protobuf:"bytes,5,opt,name=denom,proto3" json:"denom,omitempty"` - HostZoneId string `protobuf:"bytes,6,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` - EpochNumber uint64 `protobuf:"varint,7,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` - ClaimIsPending bool `protobuf:"varint,8,opt,name=claim_is_pending,json=claimIsPending,proto3" json:"claim_is_pending,omitempty"` - StTokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=st_token_amount,json=stTokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"st_token_amount"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + NativeTokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=native_token_amount,json=nativeTokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"native_token_amount"` + Denom string `protobuf:"bytes,5,opt,name=denom,proto3" json:"denom,omitempty"` + HostZoneId string `protobuf:"bytes,6,opt,name=host_zone_id,json=hostZoneId,proto3" json:"host_zone_id,omitempty"` + EpochNumber uint64 `protobuf:"varint,7,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + ClaimIsPending bool `protobuf:"varint,8,opt,name=claim_is_pending,json=claimIsPending,proto3" json:"claim_is_pending,omitempty"` + StTokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=st_token_amount,json=stTokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"st_token_amount"` } func (m *UserRedemptionRecord) Reset() { *m = UserRedemptionRecord{} } @@ -579,70 +579,70 @@ func init() { func init() { proto.RegisterFile("stride/records/records.proto", fileDescriptor_295ee594cc85d8ca) } var fileDescriptor_295ee594cc85d8ca = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x8e, 0xdb, 0x44, - 0x14, 0x8e, 0x13, 0x6f, 0x7e, 0xce, 0x36, 0x59, 0xef, 0x6c, 0x4a, 0xbd, 0x81, 0xa6, 0x69, 0x44, - 0xab, 0x48, 0xa8, 0x0e, 0xbb, 0x48, 0x20, 0x21, 0x84, 0x70, 0x36, 0xde, 0xad, 0xdb, 0x34, 0x59, - 0x9c, 0x84, 0xa2, 0xbd, 0xc0, 0x72, 0xec, 0xd1, 0x66, 0xb4, 0x8d, 0x27, 0xf2, 0x38, 0x11, 0x70, - 0xc3, 0x2b, 0x70, 0xc1, 0x2b, 0xf0, 0x08, 0xbc, 0x43, 0xaf, 0x50, 0x2f, 0x11, 0x17, 0x15, 0xda, - 0xbd, 0xe0, 0x8a, 0x77, 0x40, 0x1e, 0x3b, 0x4e, 0xe2, 0x74, 0xa9, 0xb4, 0xf4, 0x2a, 0xf1, 0xf7, - 0x9d, 0x73, 0xc6, 0xf3, 0xcd, 0x77, 0xce, 0x18, 0x3e, 0x60, 0xbe, 0x47, 0x1c, 0xdc, 0xf4, 0xb0, - 0x4d, 0x3d, 0x87, 0x2d, 0x7e, 0x95, 0xa9, 0x47, 0x7d, 0x8a, 0x4a, 0x21, 0xab, 0x44, 0x68, 0xa5, - 0x6a, 0x53, 0x36, 0xa1, 0xac, 0x39, 0xb2, 0x18, 0x6e, 0xce, 0x0f, 0x46, 0xd8, 0xb7, 0x0e, 0x9a, - 0x36, 0x25, 0x6e, 0x18, 0x5f, 0x29, 0x9f, 0xd3, 0x73, 0xca, 0xff, 0x36, 0x83, 0x7f, 0x21, 0x5a, - 0xff, 0x27, 0x0d, 0xe5, 0x21, 0xc3, 0x9e, 0x81, 0x1d, 0x3c, 0x99, 0xfa, 0x84, 0xba, 0x06, 0xaf, - 0x87, 0x4a, 0x90, 0x26, 0x8e, 0x2c, 0xd4, 0x84, 0x46, 0xc1, 0x48, 0x13, 0x07, 0x55, 0x20, 0xef, - 0x61, 0x1b, 0x93, 0x39, 0xf6, 0xe4, 0x0c, 0x47, 0xe3, 0x67, 0x74, 0x0c, 0x59, 0x6b, 0x42, 0x67, - 0xae, 0x2f, 0x8b, 0x01, 0xd3, 0x52, 0x5e, 0xbe, 0xbe, 0x97, 0xfa, 0xf3, 0xf5, 0xbd, 0x87, 0xe7, - 0xc4, 0x1f, 0xcf, 0x46, 0x8a, 0x4d, 0x27, 0xcd, 0xe8, 0xed, 0xc2, 0x9f, 0x47, 0xcc, 0xb9, 0x68, - 0xfa, 0x3f, 0x4c, 0x31, 0x53, 0x74, 0xd7, 0x37, 0xa2, 0x6c, 0x54, 0x86, 0x2d, 0x07, 0xbb, 0x74, - 0x22, 0x6f, 0xf1, 0x05, 0xc2, 0x07, 0x54, 0x83, 0x5b, 0x63, 0xca, 0x7c, 0xf3, 0x47, 0xea, 0x62, - 0x93, 0x38, 0x72, 0x96, 0x93, 0x10, 0x60, 0x67, 0xd4, 0xc5, 0xba, 0x83, 0xee, 0xc3, 0x2d, 0x3c, - 0xa5, 0xf6, 0xd8, 0x74, 0x67, 0x93, 0x11, 0xf6, 0xe4, 0x5c, 0x4d, 0x68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, 0x88, 0x91, 0x8b, - 0xfa, 0x15, 0x7d, 0x19, 0x5b, 0xbd, 0xc0, 0xad, 0xfe, 0x30, 0x79, 0x4a, 0x09, 0xd5, 0x13, 0x46, - 0xaf, 0xff, 0x26, 0xac, 0x3a, 0xb6, 0xad, 0x9d, 0xf6, 0xfa, 0xfa, 0xc0, 0x3c, 0xd5, 0xb8, 0x45, - 0xc3, 0x89, 0xb4, 0xe1, 0xc8, 0xeb, 0xe7, 0xe0, 0x1e, 0xec, 0xc4, 0xcc, 0xb1, 0xaa, 0x77, 0xb4, - 0xb6, 0x94, 0x09, 0xc2, 0xdb, 0xda, 0xa0, 0xf7, 0x54, 0xeb, 0xea, 0x67, 0xab, 0x03, 0x52, 0x44, - 0x55, 0xa8, 0x24, 0x98, 0xd5, 0x72, 0x5b, 0x41, 0xbb, 0x24, 0xf8, 0xa8, 0x68, 0xb6, 0xf5, 0xf4, - 0xe5, 0x65, 0x55, 0x78, 0x75, 0x59, 0x15, 0xfe, 0xba, 0xac, 0x0a, 0x3f, 0x5f, 0x55, 0x53, 0xaf, - 0xae, 0xaa, 0xa9, 0x3f, 0xae, 0xaa, 0xa9, 0xb3, 0x83, 0x15, 0xf5, 0xfb, 0x5c, 0x8b, 0x47, 0x1d, - 0x6b, 0xc4, 0x9a, 0xd1, 0xe7, 0xcf, 0xfc, 0xe0, 0xb3, 0xe6, 0xf7, 0xf1, 0x47, 0x10, 0x3f, 0x8c, - 0x51, 0x96, 0x7f, 0xbd, 0x7c, 0xf2, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x90, 0xc9, 0x22, - 0x23, 0x09, 0x00, 0x00, + // 999 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xc1, 0x6e, 0xdb, 0x46, + 0x10, 0x35, 0x45, 0x5a, 0x96, 0xc6, 0x91, 0x4c, 0xaf, 0x95, 0x86, 0x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11, 0xfe, 0xbe, 0xac, 0x08, 0xbf, 0x5c, + 0x55, 0x36, 0x5e, 0x5c, 0x55, 0x36, 0xfe, 0xbc, 0xaa, 0x6c, 0x9c, 0x1d, 0x2c, 0x55, 0xbf, 0xc7, + 0x6b, 0xf1, 0xa0, 0x6d, 0x0f, 0x59, 0x23, 0xbe, 0x16, 0xcd, 0x0e, 0x3e, 0x6b, 0x7c, 0x9f, 0x5c, + 0x8e, 0x78, 0x33, 0x86, 0x59, 0x7e, 0xab, 0xf9, 0xe4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, + 0xf5, 0x30, 0xab, 0x3b, 0x09, 0x00, 0x00, } func (m *UserRedemptionRecord) Marshal() (dAtA []byte, err error) { @@ -705,9 +705,9 @@ func (m *UserRedemptionRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x2a } { - size := m.Amount.Size() + size := m.NativeTokenAmount.Size() i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.NativeTokenAmount.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintRecords(dAtA, i, uint64(size)) @@ -1031,7 +1031,7 @@ func (m *UserRedemptionRecord) Size() (n int) { if l > 0 { n += 1 + l + sovRecords(uint64(l)) } - l = m.Amount.Size() + l = m.NativeTokenAmount.Size() n += 1 + l + sovRecords(uint64(l)) l = len(m.Denom) if l > 0 { @@ -1275,7 +1275,7 @@ func (m *UserRedemptionRecord) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NativeTokenAmount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1303,7 +1303,7 @@ func (m *UserRedemptionRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NativeTokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/stakeibc/keeper/grpc_query_address_unbondings.go b/x/stakeibc/keeper/grpc_query_address_unbondings.go index c649c7265d..fcb7494853 100644 --- a/x/stakeibc/keeper/grpc_query_address_unbondings.go +++ b/x/stakeibc/keeper/grpc_query_address_unbondings.go @@ -73,7 +73,7 @@ func (k Keeper) AddressUnbondings(c context.Context, req *types.QueryAddressUnbo Address: req.Address, Receiver: userRedemptionRecord.Receiver, UnbondingEstimatedTime: unbondingTimeStr, - Amount: userRedemptionRecord.Amount, + Amount: userRedemptionRecord.NativeTokenAmount, Denom: userRedemptionRecord.Denom, ClaimIsPending: userRedemptionRecord.ClaimIsPending, EpochNumber: userRedemptionRecord.EpochNumber, diff --git a/x/stakeibc/keeper/icacallbacks_claim.go b/x/stakeibc/keeper/icacallbacks_claim.go index 6eac0179c9..c3d84e3437 100644 --- a/x/stakeibc/keeper/icacallbacks_claim.go +++ b/x/stakeibc/keeper/icacallbacks_claim.go @@ -100,7 +100,7 @@ func (k Keeper) DecrementHostZoneUnbonding(ctx sdk.Context, userRedemptionRecord } // decrement the hzu by the amount claimed - hostZoneUnbonding.NativeTokenAmount = hostZoneUnbonding.NativeTokenAmount.Sub(userRedemptionRecord.Amount) + hostZoneUnbonding.NativeTokenAmount = hostZoneUnbonding.NativeTokenAmount.Sub(userRedemptionRecord.NativeTokenAmount) // save the updated hzu on the epoch unbonding record epochUnbondingRecord, success := k.RecordsKeeper.AddHostZoneToEpochUnbondingRecord(ctx, callbackArgs.EpochNumber, callbackArgs.ChainId, hostZoneUnbonding) diff --git a/x/stakeibc/keeper/icacallbacks_claim_test.go b/x/stakeibc/keeper/icacallbacks_claim_test.go index f1da996d7e..e8da2b2139 100644 --- a/x/stakeibc/keeper/icacallbacks_claim_test.go +++ b/x/stakeibc/keeper/icacallbacks_claim_test.go @@ -37,8 +37,8 @@ func (s *KeeperTestSuite) SetupClaimCallback() ClaimCallbackTestCase { Id: recordId1, // after a user calls ClaimUndelegatedTokens, the record is set to claimIsPending = true // to prevent double claims - ClaimIsPending: true, - Amount: sdkmath.ZeroInt(), + ClaimIsPending: true, + NativeTokenAmount: sdkmath.ZeroInt(), } recordId2 := recordtypes.UserRedemptionRecordKeyFormatter(HostChainId, epochNumber, "other_recevier") userRedemptionRecord2 := recordtypes.UserRedemptionRecord{ @@ -99,7 +99,7 @@ func (s *KeeperTestSuite) SetupClaimCallback() ClaimCallbackTestCase { callbackArgsBz, err := s.App.StakeibcKeeper.MarshalClaimCallbackArgs(s.Ctx, callbackArgs) s.Require().NoError(err) - decrementAmount := userRedemptionRecord1.Amount + decrementAmount := userRedemptionRecord1.NativeTokenAmount return ClaimCallbackTestCase{ initialState: ClaimCallbackState{ @@ -220,7 +220,7 @@ func (s *KeeperTestSuite) TestDecrementHostZoneUnbonding_Success() { hzu1 := epochUnbondingRecord1.HostZoneUnbondings[0] // check that hzu1 has a decremented amount - s.Require().Equal(hzu1.NativeTokenAmount.Sub(userRedemptionRecord.Amount), hzu1.NativeTokenAmount, "hzu1 amount decremented") + s.Require().Equal(hzu1.NativeTokenAmount.Sub(userRedemptionRecord.NativeTokenAmount), hzu1.NativeTokenAmount, "hzu1 amount decremented") } func (s *KeeperTestSuite) TestDecrementHostZoneUnbonding_HzuNotFound() { diff --git a/x/stakeibc/keeper/icacallbacks_redemption.go b/x/stakeibc/keeper/icacallbacks_redemption.go index cc7bb0ebdb..53fd2c357f 100644 --- a/x/stakeibc/keeper/icacallbacks_redemption.go +++ b/x/stakeibc/keeper/icacallbacks_redemption.go @@ -64,7 +64,7 @@ func (k Keeper) RedemptionCallback(ctx sdk.Context, packet channeltypes.Packet, icacallbackstypes.AckResponseStatus_FAILURE, packet)) // Reset unbondings record status - err = k.RecordsKeeper.SetHostZoneUnbondings(ctx, chainId, redemptionCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE) + err = k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, chainId, redemptionCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE) if err != nil { return err } @@ -81,7 +81,7 @@ func (k Keeper) RedemptionCallback(ctx sdk.Context, packet channeltypes.Packet, } // Upon success, update the unbonding record status to CLAIMABLE - err = k.RecordsKeeper.SetHostZoneUnbondings(ctx, chainId, redemptionCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_CLAIMABLE) + err = k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, chainId, redemptionCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_CLAIMABLE) if err != nil { return err } diff --git a/x/stakeibc/keeper/icacallbacks_undelegate.go b/x/stakeibc/keeper/icacallbacks_undelegate.go index 03b328b9c7..f530afa7ba 100644 --- a/x/stakeibc/keeper/icacallbacks_undelegate.go +++ b/x/stakeibc/keeper/icacallbacks_undelegate.go @@ -67,7 +67,7 @@ func (k Keeper) UndelegateCallback(ctx sdk.Context, packet channeltypes.Packet, icacallbackstypes.AckResponseStatus_FAILURE, packet)) // Reset unbondings record status - if err := k.RecordsKeeper.SetHostZoneUnbondings( + if err := k.RecordsKeeper.SetHostZoneUnbondingStatus( ctx, chainId, undelegateCallback.EpochUnbondingRecordIds, @@ -108,7 +108,7 @@ func (k Keeper) UndelegateCallback(ctx sdk.Context, packet channeltypes.Packet, } // Upon success, add host zone unbondings to the exit transfer queue - err = k.RecordsKeeper.SetHostZoneUnbondings(ctx, chainId, undelegateCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE) + err = k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, chainId, undelegateCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE) if err != nil { return err } diff --git a/x/stakeibc/keeper/msg_server_claim_undelegated_tokens.go b/x/stakeibc/keeper/msg_server_claim_undelegated_tokens.go index 00b141fb6c..69cf67b1ed 100644 --- a/x/stakeibc/keeper/msg_server_claim_undelegated_tokens.go +++ b/x/stakeibc/keeper/msg_server_claim_undelegated_tokens.go @@ -113,7 +113,7 @@ func (k Keeper) GetRedemptionTransferMsg(ctx sdk.Context, userRedemptionRecord * } var msgs []proto.Message - rrAmt := userRedemptionRecord.Amount + rrAmt := userRedemptionRecord.NativeTokenAmount msgs = append(msgs, &bankTypes.MsgSend{ FromAddress: hostZone.RedemptionIcaAddress, ToAddress: userRedemptionRecord.Receiver, diff --git a/x/stakeibc/keeper/msg_server_claim_undelegated_tokens_test.go b/x/stakeibc/keeper/msg_server_claim_undelegated_tokens_test.go index 96498fbf30..bfd8d778aa 100644 --- a/x/stakeibc/keeper/msg_server_claim_undelegated_tokens_test.go +++ b/x/stakeibc/keeper/msg_server_claim_undelegated_tokens_test.go @@ -45,13 +45,13 @@ func (s *KeeperTestSuite) SetupClaimUndelegatedTokens() ClaimUndelegatedTestCase } redemptionRecord := recordtypes.UserRedemptionRecord{ - Id: redemptionRecordId, - HostZoneId: HostChainId, - EpochNumber: epochNumber, - Receiver: receiverAddr, - Denom: "uatom", - ClaimIsPending: false, - Amount: sdkmath.NewInt(1000), + Id: redemptionRecordId, + HostZoneId: HostChainId, + EpochNumber: epochNumber, + Receiver: receiverAddr, + Denom: "uatom", + ClaimIsPending: false, + NativeTokenAmount: sdkmath.NewInt(1000), } redemptionAmount := sdk.NewCoins(sdk.NewCoin(redemptionRecord.Denom, sdkmath.NewInt(1000))) @@ -112,7 +112,7 @@ func (s *KeeperTestSuite) TestClaimUndelegatedTokens_Successful() { actualRedemptionRecord, found := s.App.RecordsKeeper.GetUserRedemptionRecord(s.Ctx, redemptionRecordId) s.Require().True(found, "redemption record found") s.Require().True(actualRedemptionRecord.ClaimIsPending, "redemption record should be pending") - s.Require().Equal(expectedRedemptionRecord.Amount, actualRedemptionRecord.Amount, "record has expected amount") + s.Require().Equal(expectedRedemptionRecord.NativeTokenAmount, actualRedemptionRecord.NativeTokenAmount, "record has expected amount") // TODO: check callback data here } diff --git a/x/stakeibc/keeper/msg_server_redeem_stake.go b/x/stakeibc/keeper/msg_server_redeem_stake.go index b7f4dd5bb8..e0982e8ba1 100644 --- a/x/stakeibc/keeper/msg_server_redeem_stake.go +++ b/x/stakeibc/keeper/msg_server_redeem_stake.go @@ -82,17 +82,17 @@ func (k msgServer) RedeemStake(goCtx context.Context, msg *types.MsgRedeemStake) // Add the unbonded amount to the UserRedemptionRecord // The record is set below userRedemptionRecord.StTokenAmount = userRedemptionRecord.StTokenAmount.Add(msg.Amount) - userRedemptionRecord.Amount = userRedemptionRecord.Amount.Add(nativeAmount) + userRedemptionRecord.NativeTokenAmount = userRedemptionRecord.NativeTokenAmount.Add(nativeAmount) } else { // First time a user is redeeming this epoch userRedemptionRecord = recordstypes.UserRedemptionRecord{ - Id: redemptionId, - Receiver: msg.Receiver, - Amount: nativeAmount, - Denom: hostZone.HostDenom, - HostZoneId: hostZone.ChainId, - EpochNumber: epochTracker.EpochNumber, - StTokenAmount: msg.Amount, + Id: redemptionId, + Receiver: msg.Receiver, + NativeTokenAmount: nativeAmount, + Denom: hostZone.HostDenom, + HostZoneId: hostZone.ChainId, + EpochNumber: epochTracker.EpochNumber, + StTokenAmount: msg.Amount, // claimIsPending represents whether a redemption is currently being claimed, // contingent on the host zone unbonding having status CLAIMABLE ClaimIsPending: false, diff --git a/x/stakeibc/keeper/msg_server_redeem_stake_test.go b/x/stakeibc/keeper/msg_server_redeem_stake_test.go index 5a950b4cea..1480bfa3d7 100644 --- a/x/stakeibc/keeper/msg_server_redeem_stake_test.go +++ b/x/stakeibc/keeper/msg_server_redeem_stake_test.go @@ -151,7 +151,7 @@ func (s *KeeperTestSuite) TestRedeemStake_Successful() { s.Require().True(found) s.Require().Equal(msg.Amount, userRedemptionRecord.StTokenAmount, "redemption record sttoken amount") - s.Require().Equal(tc.expectedNativeAmount, userRedemptionRecord.Amount, "redemption record native amount") + s.Require().Equal(tc.expectedNativeAmount, userRedemptionRecord.NativeTokenAmount, "redemption record native amount") s.Require().Equal(msg.Receiver, userRedemptionRecord.Receiver, "redemption record receiver") s.Require().Equal(msg.HostZone, userRedemptionRecord.HostZoneId, "redemption record host zone") s.Require().False(userRedemptionRecord.ClaimIsPending, "redemption record is not claimable") diff --git a/x/stakeibc/keeper/msg_server_restore_interchain_account.go b/x/stakeibc/keeper/msg_server_restore_interchain_account.go index b95db99c8d..11fe02ff38 100644 --- a/x/stakeibc/keeper/msg_server_restore_interchain_account.go +++ b/x/stakeibc/keeper/msg_server_restore_interchain_account.go @@ -91,7 +91,7 @@ func (k msgServer) RestoreInterchainAccount(goCtx context.Context, msg *types.Ms } } // Revert UNBONDING_IN_PROGRESS records to UNBONDING_QUEUE - err := k.RecordsKeeper.SetHostZoneUnbondings(ctx, hostZone.ChainId, epochNumberForPendingUnbondingRecords, recordtypes.HostZoneUnbonding_UNBONDING_QUEUE) + err := k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, hostZone.ChainId, epochNumberForPendingUnbondingRecords, recordtypes.HostZoneUnbonding_UNBONDING_QUEUE) if err != nil { errMsg := fmt.Sprintf("unable to update host zone unbonding record status to %s for chainId: %s and epochUnbondingRecordIds: %v, err: %s", recordtypes.HostZoneUnbonding_UNBONDING_QUEUE.String(), hostZone.ChainId, epochNumberForPendingUnbondingRecords, err) @@ -100,7 +100,7 @@ func (k msgServer) RestoreInterchainAccount(goCtx context.Context, msg *types.Ms } // Revert EXIT_TRANSFER_IN_PROGRESS records to EXIT_TRANSFER_QUEUE - err = k.RecordsKeeper.SetHostZoneUnbondings(ctx, hostZone.ChainId, epochNumberForPendingTransferRecords, recordtypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE) + err = k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, hostZone.ChainId, epochNumberForPendingTransferRecords, recordtypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE) if err != nil { errMsg := fmt.Sprintf("unable to update host zone unbonding record status to %s for chainId: %s and epochUnbondingRecordIds: %v, err: %s", recordtypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE.String(), hostZone.ChainId, epochNumberForPendingTransferRecords, err) diff --git a/x/stakeibc/keeper/unbonding_records.go b/x/stakeibc/keeper/unbonding_records.go index 74e5068a4b..ba85253ea4 100644 --- a/x/stakeibc/keeper/unbonding_records.go +++ b/x/stakeibc/keeper/unbonding_records.go @@ -131,7 +131,7 @@ func (k Keeper) RefreshUserRedemptionRecordNativeAmounts( totalNativeAmount = totalNativeAmount.Add(nativeAmount) // Set the native amount on the record - userRedemptionRecord.Amount = nativeAmount + userRedemptionRecord.NativeTokenAmount = nativeAmount k.RecordsKeeper.SetUserRedemptionRecord(ctx, userRedemptionRecord) } return totalNativeAmount @@ -553,7 +553,7 @@ func (k Keeper) UnbondFromHostZone(ctx sdk.Context, hostZone types.HostZone) err } // Update the epoch unbonding record status - if err := k.RecordsKeeper.SetHostZoneUnbondings( + if err := k.RecordsKeeper.SetHostZoneUnbondingStatus( ctx, hostZone.ChainId, epochUnbondingRecordIds, @@ -715,7 +715,7 @@ func (k Keeper) SweepAllUnbondedTokensForHostZone(ctx sdk.Context, hostZone type k.Logger(ctx).Info(utils.LogWithHostZone(hostZone.ChainId, "ICA MsgSend Successfully Sent")) // Update the host zone unbonding records to status IN_PROGRESS - err = k.RecordsKeeper.SetHostZoneUnbondings(ctx, hostZone.ChainId, epochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_IN_PROGRESS) + err = k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, hostZone.ChainId, epochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_IN_PROGRESS) if err != nil { k.Logger(ctx).Error(err.Error()) return false, sdkmath.ZeroInt() diff --git a/x/stakeibc/keeper/unbonding_records_get_host_zone_unbondings_msgs_test.go b/x/stakeibc/keeper/unbonding_records_get_host_zone_unbondings_msgs_test.go index c8df885b8f..9478864ac9 100644 --- a/x/stakeibc/keeper/unbonding_records_get_host_zone_unbondings_msgs_test.go +++ b/x/stakeibc/keeper/unbonding_records_get_host_zone_unbondings_msgs_test.go @@ -599,18 +599,18 @@ func (s *KeeperTestSuite) TestRefreshUserRedemptionRecordNativeAmounts() { redemptionRate := sdk.MustNewDecFromStr("1.999") expectedUserRedemptionRecords := []recordtypes.UserRedemptionRecord{ // StTokenAmount: 1000 * 1.999 = 1999 Native - {Id: "A", StTokenAmount: sdkmath.NewInt(1000), Amount: sdkmath.NewInt(1999)}, + {Id: "A", StTokenAmount: sdkmath.NewInt(1000), NativeTokenAmount: sdkmath.NewInt(1999)}, // StTokenAmount: 999 * 1.999 = 1997.001, Rounded down to 1997 Native - {Id: "B", StTokenAmount: sdkmath.NewInt(999), Amount: sdkmath.NewInt(1997)}, + {Id: "B", StTokenAmount: sdkmath.NewInt(999), NativeTokenAmount: sdkmath.NewInt(1997)}, // StTokenAmount: 100 * 1.999 = 199.9, Rounded up to 200 Native - {Id: "C", StTokenAmount: sdkmath.NewInt(100), Amount: sdkmath.NewInt(200)}, + {Id: "C", StTokenAmount: sdkmath.NewInt(100), NativeTokenAmount: sdkmath.NewInt(200)}, } expectedTotalNativeAmount := sdkmath.NewInt(1999 + 1997 + 200) // Create the initial records which do not have the end native amount for _, expectedUserRedemptionRecord := range expectedUserRedemptionRecords { initialUserRedemptionRecord := expectedUserRedemptionRecord - initialUserRedemptionRecord.Amount = sdkmath.ZeroInt() + initialUserRedemptionRecord.NativeTokenAmount = sdkmath.ZeroInt() s.App.RecordsKeeper.SetUserRedemptionRecord(s.Ctx, initialUserRedemptionRecord) } @@ -630,7 +630,7 @@ func (s *KeeperTestSuite) TestRefreshUserRedemptionRecordNativeAmounts() { for _, expectedRecord := range expectedUserRedemptionRecords { actualRecord, found := s.App.RecordsKeeper.GetUserRedemptionRecord(s.Ctx, expectedRecord.Id) s.Require().True(found, "record %s should have been found", expectedRecord.Id) - s.Require().Equal(expectedRecord.Amount.Int64(), actualRecord.Amount.Int64(), + s.Require().Equal(expectedRecord.NativeTokenAmount.Int64(), actualRecord.NativeTokenAmount.Int64(), "record %s native amount", expectedRecord.Id) } } @@ -718,7 +718,7 @@ func (s *KeeperTestSuite) TestRefreshUnbondingNativeTokenAmounts() { for id, expectedNativeAmount := range expectedUserNativeAmounts { record, found := s.App.RecordsKeeper.GetUserRedemptionRecord(s.Ctx, id) s.Require().True(found, "user redemption record for %s should have been found", id) - s.Require().Equal(expectedNativeAmount, record.Amount, "user redemption record %s native amount", id) + s.Require().Equal(expectedNativeAmount, record.NativeTokenAmount, "user redemption record %s native amount", id) } // Remove one of the host zones and confirm it errors