Skip to content

Commit

Permalink
FinalizePacketsUntilHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
anhductn2001 committed Sep 24, 2024
1 parent 559cf44 commit fa97fda
Show file tree
Hide file tree
Showing 26 changed files with 878 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ replace (

require (
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869
github.com/decentrio/rollup-e2e-testing v0.0.0-20240923073446-c62503e5e95f
github.com/decentrio/rollup-e2e-testing v0.0.0-20240924040733-5e3a48a16228
github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240911123104-4782bc4e587f
github.com/dymensionxyz/dymint v1.2.0-rc01
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U=
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869 h1:qWpUYGOsrSC+1Vmd2TjhbsSpntvvx9PsX3AoeMunFxc=
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869/go.mod h1:HZNYnPwmSxkwTPjSD5yolauc1Vx1ZzKL4FFMxTq4H5Y=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240923073446-c62503e5e95f h1:YH0RDGXosZHVaxFJ+Q4Kh0782yQq5ZcK5jQNN/RQUgU=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240923073446-c62503e5e95f/go.mod h1:QmBrZgZplhtgHRWC0Z7LC7TDsKuC8sDyQvZyXXaqw/c=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240924040733-5e3a48a16228 h1:dXy0HiXfQFKZLp4zG2DxFESYiN3lH5nKhv0mGudROAM=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240924040733-5e3a48a16228/go.mod h1:QmBrZgZplhtgHRWC0Z7LC7TDsKuC8sDyQvZyXXaqw/c=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
Expand Down
86 changes: 86 additions & 0 deletions tests/admc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func TestADMC_Originates_HubtoRA_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -153,6 +156,11 @@ func TestADMC_Originates_HubtoRA_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -317,6 +325,9 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -328,6 +339,11 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -396,6 +412,9 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err = rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -407,6 +426,11 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -547,6 +571,9 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -558,6 +585,11 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -635,6 +667,9 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{Memo: memo})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err = rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -646,6 +681,11 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -779,6 +819,9 @@ func TestADMC_Originates_HubtoRA_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -790,6 +833,11 @@ func TestADMC_Originates_HubtoRA_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -954,6 +1002,9 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -965,6 +1016,11 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

fmt.Println(txhash)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1030,6 +1086,9 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err = rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1041,6 +1100,9 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1181,6 +1243,9 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1192,6 +1257,9 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1264,6 +1332,9 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{Memo: memo})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err = rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1275,6 +1346,9 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1438,6 +1512,9 @@ func TestADMC_MetaData_NotFound_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1449,6 +1526,9 @@ func TestADMC_MetaData_NotFound_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1639,6 +1719,9 @@ func TestADMC_MetaData_NotFound_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1650,6 +1733,9 @@ func TestADMC_MetaData_NotFound_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down
35 changes: 34 additions & 1 deletion tests/automated_denommetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ func TestADMC_Hub_to_RA_reserved_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channsRollApp1[0].ChannelID, rollapp1UserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -259,6 +262,9 @@ func TestADMC_Hub_to_RA_reserved_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -513,6 +519,9 @@ func TestADMC_Hub_to_RA_3rd_Party_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channsRollApp1[0].ChannelID, rollapp1UserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -524,6 +533,9 @@ func TestADMC_Hub_to_RA_3rd_Party_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -820,6 +832,9 @@ func TestADMC_Hub_to_RA_reserved_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channsRollApp1[0].ChannelID, rollapp1UserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -831,6 +846,9 @@ func TestADMC_Hub_to_RA_reserved_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1135,6 +1153,9 @@ func TestADMC_Hub_to_RA_3rd_Party_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channsRollApp1[0].ChannelID, rollapp1UserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1146,6 +1167,9 @@ func TestADMC_Hub_to_RA_3rd_Party_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down Expand Up @@ -1348,6 +1372,9 @@ func TestADMC_Hub_to_RA_Migrate_Dym_EVM(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1359,7 +1386,7 @@ func TestADMC_Hub_to_RA_Migrate_Dym_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
Expand Down Expand Up @@ -1547,6 +1574,9 @@ func TestADMC_Hub_to_RA_Migrate_Dym_Wasm(t *testing.T) {
_, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{})
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

rollappHeight, err := rollapp1.GetNode().Height(ctx)
require.NoError(t, err)

Expand All @@ -1558,6 +1588,9 @@ func TestADMC_Hub_to_RA_Migrate_Dym_Wasm(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

_, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight))
require.NoError(t, err)

err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1)
require.NoError(t, err)

Expand Down
Loading

0 comments on commit fa97fda

Please sign in to comment.