Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Apr 24, 2024
1 parent 0bc0fdd commit 3a4a09e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/upgrades/v6_6_0/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (s *UpgradeTestSuite) TestForMigratingNewPrefix() {
checkUpgradeICAHostModule(s)
checkUpgradeMintModule(s)
checkUpgradeTransferMiddlewareModule(s)
checkUpgradePfmMiddlewareModule(s)
}

func prepareForTestingGovModule(s *UpgradeTestSuite) (sdk.AccAddress, govtypes.Proposal) {
Expand Down Expand Up @@ -220,7 +221,7 @@ func prepareForTestingPfmMiddlewareModule(s *UpgradeTestSuite) {
store := s.Ctx.KVStore(s.App.GetKey(routertypes.StoreKey))
inFlightPacket := routertypes.InFlightPacket{
PacketData: []byte("{\"amount\":\"10000\",\"denom\":\"transfer/channel-6660/ppica\",\"memo\":\"{\\\"forward\\\":{\\\"receiver\\\":\\\"osmo1wkjvpgkuchq0r8425g4z4sf6n85zj5wth3u77y\\\",\\\"port\\\":\\\"transfer\\\",\\\"channel\\\":\\\"channel-9\\\",\\\"timeout\\\":600000000000,\\\"retries\\\":0}}\",\"receiver\":\"centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9\",\"sender\":\"osmo1wkjvpgkuchq0r8425g4z4sf6n85zj5wth3u77y\"}"),
OriginalSenderAddress: "osmo1wkjvpgkuchq0r8425g4z4sf6n85zj5wth3u77y",
OriginalSenderAddress: "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9",
RefundChannelId: "channel-9",
RefundPortId: "transfer",
RefundSequence: 18,
Expand All @@ -242,6 +243,7 @@ func prepareForTestingPfmMiddlewareModule(s *UpgradeTestSuite) {
store.Set(key, bz)

key = routertypes.RefundPacketKey("channel-9", "transfer", 2)
inFlightPacket.OriginalSenderAddress = "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs"
bz = encCdc.Amino.MustMarshal(&inFlightPacket)
store.Set(key, bz)
}
Expand Down Expand Up @@ -441,6 +443,14 @@ func checkUpgradeTransferMiddlewareModule(s *UpgradeTestSuite) {
s.Suite.Equal(found, true)
}

func checkUpgradePfmMiddlewareModule(s *UpgradeTestSuite) {
data := s.App.RouterKeeper.GetAndClearInFlightPacket(s.Ctx, "channel-9", "transfer", 0)
s.Suite.Equal("pica1wkjvpgkuchq0r8425g4z4sf6n85zj5wtykvtv3", data.OriginalSenderAddress)

data = s.App.RouterKeeper.GetAndClearInFlightPacket(s.Ctx, "channel-9", "transfer", 2)
s.Suite.Equal("pica1hj5fveer5cjtn4wd6wstzugjfdxzl0xpas3hgy", data.OriginalSenderAddress)
}

func CreateVestingAccount(s *UpgradeTestSuite,
) vestingtypes.ContinuousVestingAccount {
str := `{"@type":"/cosmos.vesting.v1beta1.ContinuousVestingAccount","base_vesting_account":{"base_account":{"address":"centauri1alga5e8vr6ccr9yrg0kgxevpt5xgmgrvfkc5p8","pub_key":{"@type":"/cosmos.crypto.multisig.LegacyAminoPubKey","threshold":4,"public_keys":[{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AlnzK22KrkylnvTCvZZc8eZnydtQuzCWLjJJSMFUvVHf"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Aiw2Ftg+fnoHDU7M3b0VMRsI0qurXlerW0ahtfzSDZA4"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AvEHv+MVYRVau8FbBcJyG0ql85Tbbn7yhSA0VGmAY4ku"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Az5VHWqi3zMJu1rLGcu2EgNXLLN+al4Dy/lj6UZTzTCl"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ai4GlSH3uG+joMnAFbQC3jQeHl9FPvVTlRmwIFt7d7TI"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A2kAzH2bZr530jmFq/bRFrT2q8SRqdnfIebba+YIBqI1"}]},"account_number":46,"sequence":27},"original_vesting":[{"denom":"stake","amount":"22165200000000"}],"delegated_free":[{"denom":"stake","amount":"443382497453"}],"delegated_vesting":[{"denom":"stake","amount":"22129422502547"}],"end_time":1770994800},"start_time":1676300400}`
Expand Down

0 comments on commit 3a4a09e

Please sign in to comment.