diff --git a/go.mod b/go.mod index b0b6a0ce..12c92faf 100644 --- a/go.mod +++ b/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869 + github.com/decentrio/rollup-e2e-testing v0.0.0-20241107030935-0ab2fee3053f github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20241016085626-2b8c8898058b github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241015102238-a827c3784461 - github.com/decentrio/rollup-e2e-testing v0.0.0-20241101042254-a87404cf9897 ) require ( diff --git a/go.sum b/go.sum index a70345c8..7af99e81 100644 --- a/go.sum +++ b/go.sum @@ -774,8 +774,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-20241101042254-a87404cf9897 h1:kpYvC4h6tzWz4Q2XQ11/E53DIpur9zvnVmRDoExhWgw= -github.com/decentrio/rollup-e2e-testing v0.0.0-20241101042254-a87404cf9897/go.mod h1:QmBrZgZplhtgHRWC0Z7LC7TDsKuC8sDyQvZyXXaqw/c= +github.com/decentrio/rollup-e2e-testing v0.0.0-20241107030935-0ab2fee3053f h1:5/3Zqa7aBRMMdVL9XuNf8eyumxxK6P67aiDezjYcvlM= +github.com/decentrio/rollup-e2e-testing v0.0.0-20241107030935-0ab2fee3053f/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= diff --git a/tests/admc_test.go b/tests/admc_test.go index 709105e4..d6fd32a0 100644 --- a/tests/admc_test.go +++ b/tests/admc_test.go @@ -110,7 +110,7 @@ func TestADMC_Originates_HubtoRA_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -156,10 +156,16 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -289,7 +295,7 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -339,10 +345,16 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -426,10 +438,16 @@ 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)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -535,7 +553,7 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -585,10 +603,16 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -681,10 +705,16 @@ 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)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -787,7 +817,7 @@ func TestADMC_Originates_HubtoRA_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -833,10 +863,16 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -966,7 +1002,7 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1016,10 +1052,16 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1100,9 +1142,17 @@ 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)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1207,7 +1257,7 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1257,9 +1307,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1346,9 +1404,17 @@ 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)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1480,7 +1546,7 @@ func TestADMC_MetaData_NotFound_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1526,9 +1592,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1687,7 +1761,7 @@ func TestADMC_MetaData_NotFound_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1733,9 +1807,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/automated_denommetadata_test.go b/tests/automated_denommetadata_test.go index 1bdaa002..a5f993fc 100644 --- a/tests/automated_denommetadata_test.go +++ b/tests/automated_denommetadata_test.go @@ -174,7 +174,7 @@ func TestADMC_Hub_to_RA_reserved_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -262,9 +262,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -460,7 +468,7 @@ func TestADMC_Hub_to_RA_3rd_Party_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -533,9 +541,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -758,7 +774,7 @@ func TestADMC_Hub_to_RA_reserved_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -846,9 +862,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1084,7 +1108,7 @@ func TestADMC_Hub_to_RA_3rd_Party_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1167,9 +1191,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1340,7 +1372,7 @@ func TestADMC_Hub_to_RA_Migrate_Dym_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1386,9 +1418,17 @@ func TestADMC_Hub_to_RA_Migrate_Dym_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1542,7 +1582,7 @@ func TestADMC_Hub_to_RA_Migrate_Dym_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1588,9 +1628,17 @@ 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)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/bridging_fee_test.go b/tests/bridging_fee_test.go index 62c93242..59d5483a 100644 --- a/tests/bridging_fee_test.go +++ b/tests/bridging_fee_test.go @@ -85,7 +85,7 @@ func Test_Non_Rollappchain_Unaffected_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, gaia1, ibcPath) @@ -307,7 +307,7 @@ func TestChangeBridgeFeeParam_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -364,9 +364,17 @@ func TestChangeBridgeFeeParam_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -414,9 +422,17 @@ func TestChangeBridgeFeeParam_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/canonical_light_client_test.go b/tests/canonical_light_client_test.go index 9415c5c5..00d75054 100644 --- a/tests/canonical_light_client_test.go +++ b/tests/canonical_light_client_test.go @@ -121,7 +121,7 @@ func TestIBCTransferBetweenHub3rd_EVM(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) t.Cleanup(func() { @@ -342,7 +342,7 @@ func TestIBCTransferRA_3rdSameChainID_EVM(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) t.Cleanup(func() { @@ -498,9 +498,16 @@ func TestIBCTransferRA_3rdSameChainID_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferAmount)) testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, firstHopIBCDenom, transferAmount.Sub(bridgingFee)) @@ -634,7 +641,7 @@ func TestIBCTransfer_NoLightClient_EVM(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) t.Cleanup(func() { diff --git a/tests/disconnection_test.go b/tests/disconnection_test.go index 285505ce..04746fd9 100644 --- a/tests/disconnection_test.go +++ b/tests/disconnection_test.go @@ -190,7 +190,7 @@ func TestDisconnection_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Wait for rollapp finalized @@ -316,7 +316,7 @@ func TestDisconnection_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Wait for rollapp finalized diff --git a/tests/eibc_ack_error_test.go b/tests/eibc_ack_error_test.go index 4a38be71..f0de6d8b 100644 --- a/tests/eibc_ack_error_test.go +++ b/tests/eibc_ack_error_test.go @@ -169,7 +169,7 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -252,9 +252,17 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -282,9 +290,17 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) @@ -365,9 +381,17 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + ack, err := testutil.PollForAck(ctx, rollapp1, rollappHeight, rollappHeight+80, ibcTx.Packet) require.NoError(t, err) @@ -385,6 +409,7 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { balance, err = rollapp1.GetBalance(ctx, erc20MAccAddr, dymensionIBCDenom) require.NoError(t, err) fmt.Println("Balance of moduleAccAddr right before sending eIBC transfer (that fulfilled):", balance) + _, err = rollapp1.SendIBCTransfer(ctx, channRollApp1Dym.ChannelID, rollappUserAddr, transferData, options) require.NoError(t, err) @@ -433,9 +458,17 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -606,7 +639,7 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -692,9 +725,17 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + valAddr, err := dymension.Validators[0].AccountKeyBech32(ctx, "validator") require.NoError(t, err) @@ -718,9 +759,17 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -794,9 +843,17 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + ack, err := testutil.PollForAck(ctx, rollapp1, rollappHeight, rollappHeight+30, ibcTx.Packet) require.NoError(t, err) @@ -850,9 +907,17 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1014,7 +1079,7 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1111,9 +1176,17 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1140,9 +1213,17 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) @@ -1276,9 +1357,17 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + ack, err := testutil.PollForAck(ctx, rollapp1, rollappHeight, rollappHeight+30, ibcTx.Packet) require.NoError(t, err) @@ -1331,9 +1420,17 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1495,7 +1592,7 @@ func TestEIBC_AckError_Dym_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1577,9 +1674,17 @@ func TestEIBC_AckError_Dym_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1607,9 +1712,17 @@ func TestEIBC_AckError_Dym_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) @@ -1686,9 +1799,17 @@ func TestEIBC_AckError_Dym_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + ack, err := testutil.PollForAck(ctx, rollapp1, rollappHeight, rollappHeight+30, ibcTx.Packet) require.NoError(t, err) @@ -1747,9 +1868,17 @@ func TestEIBC_AckError_Dym_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1920,7 +2049,7 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2006,9 +2135,17 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + valAddr, err := dymension.Validators[0].AccountKeyBech32(ctx, "validator") require.NoError(t, err) @@ -2032,9 +2169,17 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2106,9 +2251,17 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + ack, err := testutil.PollForAck(ctx, rollapp1, rollappHeight, rollappHeight+30, ibcTx.Packet) require.NoError(t, err) @@ -2162,9 +2315,17 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2326,7 +2487,7 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2423,9 +2584,17 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2452,9 +2621,17 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) @@ -2551,9 +2728,17 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + ack, err := testutil.PollForAck(ctx, rollapp1, rollappHeight, rollappHeight+30, ibcTx.Packet) require.NoError(t, err) @@ -2606,9 +2791,17 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_client_test.go b/tests/eibc_client_test.go index f138650f..0bd79fd2 100644 --- a/tests/eibc_client_test.go +++ b/tests/eibc_client_test.go @@ -267,7 +267,7 @@ func Test_EIBC_Client_Success_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -449,7 +449,7 @@ func Test_EIBC_Client_Success_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -471,7 +471,7 @@ func Test_EIBC_Client_Success_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -596,10 +596,16 @@ func Test_EIBC_Client_Success_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) @@ -723,9 +729,17 @@ func Test_EIBC_Client_Success_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) @@ -833,7 +847,7 @@ func Test_EIBC_Client_NoFulfillRollapp_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -1015,7 +1029,7 @@ func Test_EIBC_Client_NoFulfillRollapp_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -1037,7 +1051,7 @@ func Test_EIBC_Client_NoFulfillRollapp_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -1162,10 +1176,16 @@ func Test_EIBC_Client_NoFulfillRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) @@ -1289,9 +1309,17 @@ func Test_EIBC_Client_NoFulfillRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_corrupted_memo_test.go b/tests/eibc_corrupted_memo_test.go index 2fd34ad7..53af0587 100644 --- a/tests/eibc_corrupted_memo_test.go +++ b/tests/eibc_corrupted_memo_test.go @@ -127,7 +127,7 @@ func TestEIBCCorruptedMemoNegative_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -181,9 +181,17 @@ func TestEIBCCorruptedMemoNegative_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -239,9 +247,17 @@ func TestEIBCCorruptedMemoNegative_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_fee_market_test.go b/tests/eibc_fee_market_test.go index d6d843b4..377e79a4 100644 --- a/tests/eibc_fee_market_test.go +++ b/tests/eibc_fee_market_test.go @@ -151,7 +151,7 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -213,9 +213,17 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -245,9 +253,17 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -307,9 +323,9 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { // attempt to update the fee amount required by demand order that has already been fulfilled txhash, err := dymension.UpdateDemandOrder(ctx, demand_order_id, dymensionUserAddr, eibcFee.MulRaw(2)) require.NoError(t, err) - res, err := dymension.GetTransaction(txhash) + resp, err := dymension.GetTransaction(txhash) require.NoError(t, err) - require.Equal(t, uint32(10), res.Code) + require.Equal(t, uint32(10), resp.Code) // require.True(t, (res.Code == uint32(10)) || (res.Code == uint32(5))) // wait a few blocks and verify sender received funds on the hub err = testutil.WaitForBlocks(ctx, 5, dymension) @@ -329,9 +345,17 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -488,7 +512,7 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -550,9 +574,17 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -582,9 +614,17 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -644,9 +684,9 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { // attempt to update the fee amount required by demand order that has already been fulfilled txhash, err := dymension.UpdateDemandOrder(ctx, demand_order_id, dymensionUserAddr, eibcFee.MulRaw(2)) require.NoError(t, err) - res, err := dymension.GetTransaction(txhash) + resp, err := dymension.GetTransaction(txhash) require.NoError(t, err) - require.Equal(t, uint32(10), res.Code) + require.Equal(t, uint32(10), resp.Code) // wait a few blocks and verify sender received funds on the hub err = testutil.WaitForBlocks(ctx, 5, dymension) @@ -666,9 +706,17 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) @@ -822,7 +870,7 @@ func TestEIBCUnallowedSigner_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -898,9 +946,17 @@ func TestEIBCUnallowedSigner_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1093,7 +1149,7 @@ func TestEIBCUnallowedSigner_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1169,9 +1225,17 @@ func TestEIBCUnallowedSigner_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_fee_test.go b/tests/eibc_fee_test.go index b725ddd4..bb0308c1 100644 --- a/tests/eibc_fee_test.go +++ b/tests/eibc_fee_test.go @@ -127,7 +127,7 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -179,9 +179,17 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -219,9 +227,17 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_feemarket_test.go b/tests/eibc_feemarket_test.go index b491ad42..a9826c17 100644 --- a/tests/eibc_feemarket_test.go +++ b/tests/eibc_feemarket_test.go @@ -163,7 +163,7 @@ func TestEIBC_Fee_Market_Success_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -223,9 +223,17 @@ func TestEIBC_Fee_Market_Success_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -298,9 +306,17 @@ func TestEIBC_Fee_Market_Success_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // verify funds were deducted from market maker's wallet address balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) @@ -465,7 +481,7 @@ func TestEIBC_Fee_Market_Success_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -535,9 +551,17 @@ func TestEIBC_Fee_Market_Success_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -613,9 +637,17 @@ func TestEIBC_Fee_Market_Success_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -781,7 +813,7 @@ func TestEIBC_Fee_Market_Auto_Created_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -843,9 +875,17 @@ func TestEIBC_Fee_Market_Auto_Created_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -915,9 +955,17 @@ func TestEIBC_Fee_Market_Auto_Created_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) @@ -1081,7 +1129,7 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1152,9 +1200,17 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1223,9 +1279,17 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) @@ -1349,7 +1413,7 @@ func TestEIBCUpdateOnAckErrAndTimeout_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1402,9 +1466,17 @@ func TestEIBCUpdateOnAckErrAndTimeout_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1) require.NoError(t, err) @@ -1606,7 +1678,7 @@ func TestEIBCUpdateOnAckErrAndTimeout_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1659,9 +1731,17 @@ func TestEIBCUpdateOnAckErrAndTimeout_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -1743,9 +1823,17 @@ func TestEIBCUpdateOnAckErrAndTimeout_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1872,7 +1960,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1925,9 +2013,17 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1979,9 +2075,9 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) - res, err := dymension.GetTransaction(txhash) + resp, err := dymension.GetTransaction(txhash) require.NoError(t, err) - require.True(t, (res.Code == uint32(4)) || (res.Code == uint32(5))) + require.True(t, (resp.Code == uint32(4)) || (resp.Code == uint32(5))) t.Cleanup( func() { @@ -2103,7 +2199,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2156,9 +2252,17 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1) require.NoError(t, err) @@ -2210,9 +2314,9 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) { txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) - res, err := dymension.GetTransaction(txhash) + resp, err := dymension.GetTransaction(txhash) require.NoError(t, err) - require.True(t, (res.Code == uint32(4)) || (res.Code == uint32(5))) + require.True(t, (resp.Code == uint32(4)) || (resp.Code == uint32(5))) t.Cleanup( func() { diff --git a/tests/eibc_fulfillment_test.go b/tests/eibc_fulfillment_test.go index 1e8f5016..e3fac83a 100644 --- a/tests/eibc_fulfillment_test.go +++ b/tests/eibc_fulfillment_test.go @@ -168,7 +168,7 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -252,12 +252,28 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -291,9 +307,17 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -379,9 +403,17 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + rollappHeight, err = rollapp2.GetNode().Height(ctx) require.NoError(t, err) @@ -390,9 +422,17 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollapp2UserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // verify correct funds were deducted from market maker's wallet address balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) @@ -409,13 +449,13 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { require.True(t, balance.Equal((transferDataRollapp2.Amount.Sub(bridgingFee)).MulRaw(2)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", (transferDataRollapp2.Amount.Sub(bridgingFee)).MulRaw(2), balance)) // No packet commitments left - res, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra1[0].ChannelID) + resp, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra1[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, false, "packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, false, "packet commitments exist") - res, err = rollapp2.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra2[0].ChannelID) + resp, err = rollapp2.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra2[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, false, "packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, false, "packet commitments exist") t.Cleanup( func() { @@ -581,7 +621,7 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -665,12 +705,28 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -704,9 +760,17 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -797,9 +861,17 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -818,9 +890,17 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) @@ -830,13 +910,13 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { require.True(t, balance.Equal((transferDataRollapp2.Amount.Sub(bridgingFee)).MulRaw(2)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", (transferDataRollapp2.Amount.Sub(bridgingFee)).MulRaw(2), balance)) // No packet commitments left - res, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra1[0].ChannelID) + resp, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra1[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, false, "packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, false, "packet commitments exist") - res, err = rollapp2.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra2[0].ChannelID) + resp, err = rollapp2.GetNode().QueryPacketCommitments(ctx, "transfer", dymChannel_ra2[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, false, "packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, false, "packet commitments exist") t.Cleanup( func() { @@ -1001,7 +1081,7 @@ func TestEIBCFulfillment_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1064,9 +1144,17 @@ func TestEIBCFulfillment_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -1133,9 +1221,17 @@ func TestEIBCFulfillment_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) @@ -1299,7 +1395,7 @@ func TestEIBCFulfillment_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1370,9 +1466,17 @@ func TestEIBCFulfillment_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1440,9 +1544,17 @@ func TestEIBCFulfillment_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) @@ -1608,7 +1720,7 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1696,11 +1808,28 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1812,12 +1941,28 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollapp2UserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) @@ -2025,7 +2170,7 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2109,9 +2254,17 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2178,9 +2331,17 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2234,9 +2395,17 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2438,7 +2607,7 @@ func TestEIBCFulfillment_ThirdParty_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2523,9 +2692,17 @@ func TestEIBCFulfillment_ThirdParty_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2592,9 +2769,17 @@ func TestEIBCFulfillment_ThirdParty_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2649,9 +2834,17 @@ func TestEIBCFulfillment_ThirdParty_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, gaiaIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) @@ -2825,7 +3018,7 @@ func TestEIBCFulfillment_ignore_hub_to_RA_EVM(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2897,9 +3090,17 @@ func TestEIBCFulfillment_ignore_hub_to_RA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -3084,7 +3285,7 @@ func TestEIBCFulfillment_ignore_hub_to_RA_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -3155,9 +3356,17 @@ func TestEIBCFulfillment_ignore_hub_to_RA_Wasm(t *testing.T) { require.True(t, isFinalized) // end of preconditions - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_invariant_test.go b/tests/eibc_invariant_test.go index f53c1837..bf710252 100644 --- a/tests/eibc_invariant_test.go +++ b/tests/eibc_invariant_test.go @@ -132,7 +132,7 @@ func TestEIBCInvariant_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -210,9 +210,17 @@ func TestEIBCInvariant_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension) require.NoError(t, err) @@ -293,9 +301,17 @@ func TestEIBCInvariant_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMakerAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -491,7 +507,7 @@ func TestEIBCInvariant_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -579,9 +595,17 @@ func TestEIBCInvariant_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -651,9 +675,17 @@ func TestEIBCInvariant_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) diff --git a/tests/eibc_nobalance_test.go b/tests/eibc_nobalance_test.go index 0b6f818a..be186c31 100644 --- a/tests/eibc_nobalance_test.go +++ b/tests/eibc_nobalance_test.go @@ -128,7 +128,7 @@ func TestEIBCNoBalanceToFulfillOrder_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -203,9 +203,17 @@ func TestEIBCNoBalanceToFulfillOrder_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // verify funds were transferred to dymensionUserAddr testutil.AssertBalance(t, ctx, dymension, marketMakerAddr, rollappIBCDenom, zeroBal) // Minus 0.1% of transfer amount for bridge fee diff --git a/tests/eibc_not_fulfillment_test.go b/tests/eibc_not_fulfillment_test.go index 9144e1bd..4c806740 100644 --- a/tests/eibc_not_fulfillment_test.go +++ b/tests/eibc_not_fulfillment_test.go @@ -165,7 +165,7 @@ func TestEIBCNotFulfillment_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -235,9 +235,17 @@ func TestEIBCNotFulfillment_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -285,9 +293,17 @@ func TestEIBCNotFulfillment_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, dymensionUserAddr, rollappIBCDenom) require.NoError(t, err) @@ -450,7 +466,7 @@ func TestEIBCNotFulfillment_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -520,9 +536,17 @@ func TestEIBCNotFulfillment_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -573,9 +597,17 @@ func TestEIBCNotFulfillment_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + balance, err = dymension.GetBalance(ctx, dymensionUserAddr, rollappIBCDenom) require.NoError(t, err) diff --git a/tests/eibc_pfm_test.go b/tests/eibc_pfm_test.go index c4720267..56ca2509 100644 --- a/tests/eibc_pfm_test.go +++ b/tests/eibc_pfm_test.go @@ -166,7 +166,7 @@ func TestEIBCPFM_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -279,9 +279,17 @@ func TestEIBCPFM_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollapp1Height)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -449,7 +457,7 @@ func TestEIBCPFM_Wasm(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -562,9 +570,17 @@ func TestEIBCPFM_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollapp1Height)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/eibc_timeout_test.go b/tests/eibc_timeout_test.go index 44b1adef..9c362170 100644 --- a/tests/eibc_timeout_test.go +++ b/tests/eibc_timeout_test.go @@ -127,7 +127,7 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -180,9 +180,17 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1) require.NoError(t, err) @@ -262,9 +270,17 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension) require.NoError(t, err) @@ -458,7 +474,7 @@ func TestEIBCTimeoutFulFillDymToRollapp_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -555,9 +571,17 @@ func TestEIBCTimeoutFulFillDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -658,9 +682,17 @@ func TestEIBCTimeoutFulFillDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMakerAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension) require.NoError(t, err) @@ -854,7 +886,7 @@ func TestEIBCTimeoutFulFillDymToRollapp_Wasm(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -966,9 +998,17 @@ func TestEIBCTimeoutFulFillDymToRollapp_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + gaiaToDymTransferData := ibc.WalletData{ Address: dymensionUserAddr, Denom: gaia.Config().Denom, @@ -1053,9 +1093,17 @@ func TestEIBCTimeoutFulFillDymToRollapp_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) diff --git a/tests/erc20_ibc_transfer_test.go b/tests/erc20_ibc_transfer_test.go index ca485a00..e43dfe0e 100644 --- a/tests/erc20_ibc_transfer_test.go +++ b/tests/erc20_ibc_transfer_test.go @@ -127,7 +127,7 @@ func TestERC20HubToRollAppWithoutRegister_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -188,9 +188,17 @@ func TestERC20HubToRollAppWithoutRegister_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + transferData = ibc.WalletData{ Address: rollappUserAddr, Denom: dymension.Config().Denom, @@ -356,7 +364,7 @@ func TestERC20RollAppToHubWithRegister_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -405,9 +413,17 @@ func TestERC20RollAppToHubWithRegister_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -524,9 +540,17 @@ func TestERC20RollAppToHubWithRegister_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/frozen_test.go b/tests/frozen_test.go index af80d7a1..1aeeaa1c 100644 --- a/tests/frozen_test.go +++ b/tests/frozen_test.go @@ -172,7 +172,7 @@ func TestRollAppFreeze_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -266,9 +266,17 @@ func TestRollAppFreeze_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -522,7 +530,7 @@ func TestRollAppFreeze_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -621,9 +629,17 @@ func TestRollAppFreeze_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -900,7 +916,7 @@ func TestOtherRollappNotAffected_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1021,11 +1037,27 @@ func TestOtherRollappNotAffected_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -1186,9 +1218,17 @@ func TestOtherRollappNotAffected_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) // Get updated dym hub ibc denom balance @@ -1355,7 +1395,7 @@ func TestOtherRollappNotAffected_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1476,12 +1516,28 @@ func TestOtherRollappNotAffected_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -1643,9 +1699,17 @@ func TestOtherRollappNotAffected_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get updated dym hub ibc denom balance dymUserUpdateBal2, err := dymension.GetBalance(ctx, dymensionUserAddr, rollapp2IbcDenom) require.NoError(t, err) @@ -1761,7 +1825,7 @@ func TestPacketRollbacked_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1825,9 +1889,17 @@ func TestPacketRollbacked_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollapp1IbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -1970,9 +2042,17 @@ func TestPacketRollbacked_EVM(t *testing.T) { latestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension) require.NoError(t, err) @@ -2104,7 +2184,7 @@ func TestPacketRollbacked_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2182,9 +2262,17 @@ func TestPacketRollbacked_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollapp1IbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -2325,9 +2413,17 @@ func TestPacketRollbacked_Wasm(t *testing.T) { latestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension) require.NoError(t, err) @@ -2499,7 +2595,7 @@ func TestRollAppFreezeNoBrokenInvariants_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2620,12 +2716,28 @@ func TestRollAppFreezeNoBrokenInvariants_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -2846,7 +2958,7 @@ func TestRollAppFreezeNoBrokenInvariants_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -2967,12 +3079,28 @@ func TestRollAppFreezeNoBrokenInvariants_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + oldLatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -3193,7 +3321,7 @@ func TestRollAppSqcSlashedJailed_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -3316,12 +3444,28 @@ func TestRollAppSqcSlashedJailed_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollapp1IbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -3615,7 +3759,7 @@ func TestRollAppSqcSlashedJailed_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -3738,11 +3882,27 @@ func TestRollAppSqcSlashedJailed_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollapp1IbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -3999,7 +4159,7 @@ func TestRollAppFreezeStateNotProgressing_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -4080,9 +4240,17 @@ func TestRollAppFreezeStateNotProgressing_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollappIbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -4328,7 +4496,7 @@ func TestRollAppFreezeStateNotProgressing_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -4409,9 +4577,17 @@ func TestRollAppFreezeStateNotProgressing_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollappIbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -4657,7 +4833,7 @@ func TestRollAppFreezeEibcPending_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -4738,9 +4914,17 @@ func TestRollAppFreezeEibcPending_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollappIbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) @@ -5007,7 +5191,7 @@ func TestRollAppFreezeEibcPending_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -5088,9 +5272,17 @@ func TestRollAppFreezeEibcPending_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Confirm previous ibc transfers were successful (dymension -> rollapp1) // Get the IBC denom rollappIbcDenom := GetIBCDenom(channsRollApp1Dym.Counterparty.PortID, channsRollApp1Dym.Counterparty.ChannelID, rollapp1.Config().Denom) diff --git a/tests/fullnode_sync_block_sync_test.go b/tests/fullnode_sync_block_sync_test.go index c4f6ed79..e728c523 100644 --- a/tests/fullnode_sync_block_sync_test.go +++ b/tests/fullnode_sync_block_sync_test.go @@ -33,8 +33,6 @@ func TestSync_BlockSync_EVM(t *testing.T) { ctx := context.Background() - go StartDA() - // setup config for rollapp 1 dymintTomlOverrides := make(testutil.Toml) dymintTomlOverrides["settlement_layer"] = "dymension" @@ -128,7 +126,7 @@ func TestSync_BlockSync_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -268,7 +266,7 @@ func TestSync_BlockSync_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // require.Error(t, err) @@ -291,7 +289,7 @@ func TestSync_BlockSync_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -380,8 +378,6 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { ctx := context.Background() - go StartDA() - // setup config for rollapp 1 dymintTomlOverrides := make(testutil.Toml) dymintTomlOverrides["settlement_layer"] = "dymension" @@ -475,7 +471,7 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -615,7 +611,7 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -637,7 +633,7 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) diff --git a/tests/fullnode_sync_gossip_test.go b/tests/fullnode_sync_gossip_test.go index 8dc4a2f6..168af92c 100644 --- a/tests/fullnode_sync_gossip_test.go +++ b/tests/fullnode_sync_gossip_test.go @@ -125,7 +125,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -265,7 +265,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -287,7 +287,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -448,7 +448,7 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -601,7 +601,7 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -623,7 +623,7 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -785,7 +785,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -925,7 +925,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -947,7 +947,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -1136,7 +1136,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -1276,7 +1276,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -1298,7 +1298,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -1487,7 +1487,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -1627,7 +1627,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -1649,7 +1649,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -1839,7 +1839,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -1979,7 +1979,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID = fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -2001,7 +2001,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) diff --git a/tests/fullnode_sync_test.go b/tests/fullnode_sync_test.go index fe27772e..b8ccb590 100644 --- a/tests/fullnode_sync_test.go +++ b/tests/fullnode_sync_test.go @@ -148,7 +148,7 @@ func TestFullnodeSync_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Wait for rollapp finalized @@ -284,7 +284,7 @@ func TestFullnodeSync_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Wait for rollapp finalized @@ -431,7 +431,7 @@ func TestFullnodeSync_Celestia_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -572,7 +572,7 @@ func TestFullnodeSync_Celestia_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) rollappHeight, err := rollapp1.Validators[0].Height(ctx) @@ -706,7 +706,7 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") @@ -849,7 +849,7 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) rollappHeight, err := rollapp1.Validators[0].Height(ctx) diff --git a/tests/genesis_bridge_test.go b/tests/genesis_bridge_test.go index fa333495..75f89e12 100644 --- a/tests/genesis_bridge_test.go +++ b/tests/genesis_bridge_test.go @@ -111,7 +111,7 @@ func TestGenesisTransferBridgeBlocking_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -264,7 +264,7 @@ func TestGenesisTransferBridgeBlocking_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -417,7 +417,7 @@ func TestGenesisTransferConnectionBlock_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -463,9 +463,17 @@ func TestGenesisTransferConnectionBlock_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -588,7 +596,7 @@ func TestGenesisTransferConnectionBlock_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -634,9 +642,17 @@ func TestGenesisTransferConnectionBlock_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -773,7 +789,7 @@ func TestGenesisBridgeInvalid_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.Error(t, err) } @@ -881,7 +897,7 @@ func TestGenesisBridgeInvalid_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.Error(t, err) } @@ -976,7 +992,7 @@ func TestGenesisBridgeNoRelayAck_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1127,7 +1143,7 @@ func TestGenesisBridgeNoRelayAck_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1279,7 +1295,7 @@ func TestGenesisBridgeBeforeChannelSet_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Create some user accounts on both chains diff --git a/tests/hardfork_test.go b/tests/hardfork_test.go index 50cbff00..d20924d6 100644 --- a/tests/hardfork_test.go +++ b/tests/hardfork_test.go @@ -126,7 +126,7 @@ func TestHardFork_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -207,9 +207,17 @@ func TestHardFork_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -434,7 +442,7 @@ func TestHardFork_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, dymension, new_rollapp_id, []byte(genesis), false, 780) + }, dymension, new_rollapp_id, []byte(genesis), false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r2, eRep, dymension.CosmosChain, newRollApp.CosmosChain, anotherIbcPath) @@ -666,7 +674,7 @@ func TestHardFork_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -747,9 +755,17 @@ func TestHardFork_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -974,7 +990,7 @@ func TestHardFork_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, dymension, new_rollapp_id, []byte(genesis), false, 780) + }, dymension, new_rollapp_id, []byte(genesis), false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r2, eRep, dymension.CosmosChain, newRollApp.CosmosChain, anotherIbcPath) @@ -1201,7 +1217,7 @@ func TestHardForkRecoverIbcClient_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1282,9 +1298,17 @@ func TestHardForkRecoverIbcClient_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1514,7 +1538,7 @@ func TestHardForkRecoverIbcClient_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, dymension, new_rollapp_id, []byte(genesis), false, 780) + }, dymension, new_rollapp_id, []byte(genesis), false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r2, eRep, dymension.CosmosChain, newRollApp.CosmosChain, anotherIbcPath) diff --git a/tests/ibc_finalize_block_test.go b/tests/ibc_finalize_block_test.go index 69d5a22e..c5cb81c1 100644 --- a/tests/ibc_finalize_block_test.go +++ b/tests/ibc_finalize_block_test.go @@ -114,7 +114,7 @@ func TestDymFinalizeBlock_OnRecvPacket_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -173,9 +173,17 @@ func TestDymFinalizeBlock_OnRecvPacket_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom dymensionTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, dymension.Config().Denom) dymensionIBCDenom := transfertypes.ParseDenomTrace(dymensionTokenDenom).IBCDenom() @@ -211,9 +219,17 @@ func TestDymFinalizeBlock_OnRecvPacket_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, walletAmount) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount)) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, dymensionIBCDenom, zeroBal) @@ -336,7 +352,7 @@ func TestDymFinalizeBlock_OnAckPacket_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Create some user accounts on both chains @@ -405,9 +421,17 @@ func TestDymFinalizeBlock_OnAckPacket_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + transferData = ibc.WalletData{ Address: rollappUserAddr, Denom: dymension.Config().Denom, @@ -521,7 +545,7 @@ func TestDymFinalizeBlock_OnTimeOutPacket_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -584,9 +608,17 @@ func TestDymFinalizeBlock_OnTimeOutPacket_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom dymensionTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, dymension.Config().Denom) dymensionIBCDenom := transfertypes.ParseDenomTrace(dymensionTokenDenom).IBCDenom() @@ -620,9 +652,17 @@ func TestDymFinalizeBlock_OnTimeOutPacket_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, walletAmount) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount)) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, dymensionIBCDenom, zeroBal) @@ -727,7 +767,7 @@ func TestDymFinalizeBlock_OnRecvPacket_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -790,9 +830,17 @@ func TestDymFinalizeBlock_OnRecvPacket_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom dymensionTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, dymension.Config().Denom) dymensionIBCDenom := transfertypes.ParseDenomTrace(dymensionTokenDenom).IBCDenom() @@ -829,9 +877,17 @@ func TestDymFinalizeBlock_OnRecvPacket_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, walletAmount) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount)) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, dymensionIBCDenom, zeroBal) @@ -954,7 +1010,7 @@ func TestDymFinalizeBlock_OnAckPacket_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Create some user accounts on both chains @@ -1023,9 +1079,17 @@ func TestDymFinalizeBlock_OnAckPacket_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + transferData = ibc.WalletData{ Address: rollappUserAddr, Denom: dymension.Config().Denom, @@ -1140,7 +1204,7 @@ func TestDymFinalizeBlock_OnTimeOutPacket_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1200,9 +1264,17 @@ func TestDymFinalizeBlock_OnTimeOutPacket_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom dymensionTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, dymension.Config().Denom) dymensionIBCDenom := transfertypes.ParseDenomTrace(dymensionTokenDenom).IBCDenom() @@ -1238,9 +1310,17 @@ func TestDymFinalizeBlock_OnTimeOutPacket_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, walletAmount) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount)) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, dymensionIBCDenom, zeroBal) diff --git a/tests/ibc_grace_period_test.go b/tests/ibc_grace_period_test.go index 840bf4e9..1d8b7d0a 100644 --- a/tests/ibc_grace_period_test.go +++ b/tests/ibc_grace_period_test.go @@ -164,7 +164,7 @@ func TestIBCGracePeriodCompliance_EVM(t *testing.T) { SkipPathCreation: true, // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -224,9 +224,17 @@ func TestIBCGracePeriodCompliance_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -283,18 +291,26 @@ func TestIBCGracePeriodCompliance_EVM(t *testing.T) { require.NoError(t, err) // Packet commitments exist - res, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, true, "no packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, true, "no packet commitments exist") // wait until the packet is finalized isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 40, dymension, rollapp1) require.NoError(t, err) @@ -305,9 +321,9 @@ func TestIBCGracePeriodCompliance_EVM(t *testing.T) { require.NoError(t, err) // No packet commitments should exist on rollapp anymore - res, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) == 0, true, "packet commitments still exist") + require.Equal(t, len(resp.Commitments) == 0, true, "packet commitments still exist") t.Cleanup( func() { @@ -467,7 +483,7 @@ func TestIBCGracePeriodCompliance_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -533,9 +549,17 @@ func TestIBCGracePeriodCompliance_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -582,18 +606,26 @@ func TestIBCGracePeriodCompliance_Wasm(t *testing.T) { require.NoError(t, err) // Packet commitments exist - res, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, true, "no packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, true, "no packet commitments exist") // wait until the packet is finalized isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -604,9 +636,9 @@ func TestIBCGracePeriodCompliance_Wasm(t *testing.T) { require.NoError(t, err) // No packet commitments should exist on rollapp anymore - res, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) == 0, true, "packet commitments still exist") + require.Equal(t, len(resp.Commitments) == 0, true, "packet commitments still exist") t.Cleanup( func() { @@ -773,7 +805,7 @@ func TestDelayedAck_NoFinalizedStates_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -839,9 +871,9 @@ func TestDelayedAck_NoFinalizedStates_EVM(t *testing.T) { require.NoError(t, err) // Packet commitments exist - res, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, true, "no packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, true, "no packet commitments exist") rollappHeight, err := rollapp1.GetNode().Height(ctx) require.NoError(t, err) @@ -851,9 +883,17 @@ func TestDelayedAck_NoFinalizedStates_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -866,9 +906,9 @@ func TestDelayedAck_NoFinalizedStates_EVM(t *testing.T) { require.NoError(t, err) // No packet commitments should exist on rollapp anymore - res, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) == 0, true, "packet commitments still exist") + require.Equal(t, len(resp.Commitments) == 0, true, "packet commitments still exist") t.Cleanup( func() { @@ -1036,7 +1076,7 @@ func TestDelayedAck_NoFinalizedStates_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1108,18 +1148,26 @@ func TestDelayedAck_NoFinalizedStates_Wasm(t *testing.T) { require.NoError(t, err) // Packet commitments exist - res, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err := rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, true, "no packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, true, "no packet commitments exist") // wait until the packet is finalized isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 600) require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -1131,9 +1179,9 @@ func TestDelayedAck_NoFinalizedStates_Wasm(t *testing.T) { require.NoError(t, err) // No packet commitments should exist on rollapp anymore - res, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) == 0, true, "packet commitments still exist") + require.Equal(t, len(resp.Commitments) == 0, true, "packet commitments still exist") t.Cleanup( func() { @@ -1292,7 +1340,7 @@ func TestDelayedAck_RelayerDown_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1362,9 +1410,17 @@ func TestDelayedAck_RelayerDown_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -1401,9 +1457,9 @@ func TestDelayedAck_RelayerDown_EVM(t *testing.T) { require.NoError(t, err) // Packet commitments exist - res, err := dymension.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err := dymension.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, true, "no packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, true, "no packet commitments exist") // Restart Relayer r1.UpdateClients(ctx, eRep, ibcPath) @@ -1439,9 +1495,9 @@ func TestDelayedAck_RelayerDown_EVM(t *testing.T) { require.NoError(t, err) // No packet commitments should exist on rollapp anymore - res, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) == 0, true, "packet commitments still exist") + require.Equal(t, len(resp.Commitments) == 0, true, "packet commitments still exist") t.Cleanup( func() { @@ -1605,7 +1661,7 @@ func TestDelayedAck_RelayerDown_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -1668,9 +1724,17 @@ func TestDelayedAck_RelayerDown_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) @@ -1707,9 +1771,9 @@ func TestDelayedAck_RelayerDown_Wasm(t *testing.T) { require.NoError(t, err) // Packet commitments exist - res, err := dymension.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err := dymension.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) > 0, true, "no packet commitments exist") + require.Equal(t, len(resp.Commitments) > 0, true, "no packet commitments exist") // Restart Relayer r1.UpdateClients(ctx, eRep, ibcPath) @@ -1739,9 +1803,9 @@ func TestDelayedAck_RelayerDown_Wasm(t *testing.T) { require.NoError(t, err) // No packet commitments should exist on rollapp anymore - res, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) + resp, err = rollapp1.GetNode().QueryPacketCommitments(ctx, "transfer", rollApp1Channel[0].ChannelID) require.NoError(t, err) - require.Equal(t, len(res.Commitments) == 0, true, "packet commitments still exist") + require.Equal(t, len(resp.Commitments) == 0, true, "packet commitments still exist") t.Cleanup( func() { diff --git a/tests/ibc_timeout_test.go b/tests/ibc_timeout_test.go index 2ab76d63..03472948 100644 --- a/tests/ibc_timeout_test.go +++ b/tests/ibc_timeout_test.go @@ -126,7 +126,7 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -177,9 +177,17 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + transferData = ibc.WalletData{ Address: dymensionUserAddr, Denom: rollapp1.Config().Denom, @@ -207,9 +215,17 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + rollappHeight, err = rollapp1.GetNode().Height(ctx) require.NoError(t, err) @@ -261,9 +277,17 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + rollappHeight, err = rollapp1.GetNode().Height(ctx) require.NoError(t, err) @@ -395,7 +419,7 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -446,9 +470,17 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + transferData = ibc.WalletData{ Address: dymensionUserAddr, Denom: rollapp1.Config().Denom, @@ -478,9 +510,17 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, rollappUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + rollappHeight, err = rollapp1.GetNode().Height(ctx) require.NoError(t, err) @@ -532,9 +572,17 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + rollappHeight, err = rollapp1.GetNode().Height(ctx) require.NoError(t, err) diff --git a/tests/ibc_transfer_test.go b/tests/ibc_transfer_test.go index 946addfa..71f83f87 100644 --- a/tests/ibc_transfer_test.go +++ b/tests/ibc_transfer_test.go @@ -98,7 +98,7 @@ func TestSpinUp(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) } @@ -194,7 +194,7 @@ func TestIBCTransferSuccess_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -240,10 +240,16 @@ func TestIBCTransferSuccess_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) @@ -381,7 +387,7 @@ func TestIBCTransferSuccess_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -429,9 +435,17 @@ func TestIBCTransferSuccess_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -564,7 +578,7 @@ func TestIBCTransferSuccess_Wasm(t *testing.T) { // // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), -// }, nil, "", nil, false, 780) +// }, nil, "", nil, false, 1179360) // require.NoError(t, err) // CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -744,7 +758,7 @@ func TestIBCTransferSuccess_Wasm(t *testing.T) { // // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), -// }, nil, "", nil, false, 780) +// }, nil, "", nil, false, 1179360) // require.NoError(t, err) // CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) diff --git a/tests/rollapp_invariant_test.go b/tests/rollapp_invariant_test.go index dd862717..5dfa10cf 100644 --- a/tests/rollapp_invariant_test.go +++ b/tests/rollapp_invariant_test.go @@ -160,7 +160,7 @@ func TestRollappInvariant_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -415,7 +415,7 @@ func TestRollappInvariant_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r1, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) diff --git a/tests/rollapp_upgrade_test.go b/tests/rollapp_upgrade_test.go index d425d6ba..2209ec3a 100644 --- a/tests/rollapp_upgrade_test.go +++ b/tests/rollapp_upgrade_test.go @@ -111,7 +111,7 @@ func TestRollappUpgradeNonStateBreaking_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -166,9 +166,17 @@ func TestRollappUpgradeNonStateBreaking_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Switch to a new binary err = rollapp1.StopAllNodes(ctx) require.NoError(t, err, "error stopping node(s)") @@ -226,9 +234,17 @@ func TestRollappUpgradeNonStateBreaking_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -335,7 +351,7 @@ func TestRollappUpgradeNonStateBreaking_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -390,9 +406,17 @@ func TestRollappUpgradeNonStateBreaking_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Switch to a new binary err = rollapp1.StopAllNodes(ctx) require.NoError(t, err, "error stopping node(s)") @@ -432,9 +456,17 @@ func TestRollappUpgradeNonStateBreaking_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -569,7 +601,7 @@ func TestRollapp_EVM_Upgrade(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -719,9 +751,17 @@ func TestRollapp_EVM_Upgrade(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -833,7 +873,7 @@ func TestRollapp_Wasm_Upgrade(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) CreateChannel(ctx, t, r, eRep, dymension.CosmosChain, rollapp1.CosmosChain, ibcPath) @@ -983,9 +1023,17 @@ func TestRollapp_Wasm_Upgrade(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) diff --git a/tests/sequencer_invariant_test.go b/tests/sequencer_invariant_test.go index b5b0a97a..1cdc1993 100644 --- a/tests/sequencer_invariant_test.go +++ b/tests/sequencer_invariant_test.go @@ -160,7 +160,7 @@ func TestSequencerInvariant_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) _, _, err = rollapp1.GetNode().ExecInit(ctx, "sequencer1", "/var/cosmos-chain/sequencer1") @@ -418,7 +418,7 @@ func TestSequencerInvariant_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) _, _, err = rollapp1.GetNode().ExecInit(ctx, "sequencer1", "/var/cosmos-chain/sequencer1") diff --git a/tests/sequencer_rotation_test.go b/tests/sequencer_rotation_test.go index caa285e6..0005eaf0 100644 --- a/tests/sequencer_rotation_test.go +++ b/tests/sequencer_rotation_test.go @@ -156,7 +156,7 @@ func Test_SeqRotation_OneSeq_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -205,9 +205,17 @@ func Test_SeqRotation_OneSeq_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -273,9 +281,9 @@ func Test_SeqRotation_OneSeq_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -296,6 +304,14 @@ func Test_SeqRotation_OneSeq_DA_EVM(t *testing.T) { time.Sleep(60 * time.Second) + rollappHeight, err = rollapp1.GetNode().Height(ctx) + require.NoError(t, err) + + // wait until the packet is finalized + isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) + require.NoError(t, err) + require.True(t, isFinalized) + queryGetSequencerResponse, err = dymension.QueryShowSequencer(ctx, seqAddr) require.NoError(t, err) require.Equal(t, "OPERATING_STATUS_UNBONDING", queryGetSequencerResponse.Sequencer.Status) @@ -340,9 +356,17 @@ func Test_SeqRotation_OneSeq_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -513,7 +537,7 @@ func Test_SeqRotation_OneSeq_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -630,9 +654,9 @@ func Test_SeqRotation_OneSeq_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -870,7 +894,7 @@ func Test_SeqRotation_NoSeq_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -919,9 +943,17 @@ func Test_SeqRotation_NoSeq_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -1020,9 +1052,9 @@ func Test_SeqRotation_NoSeq_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -1054,9 +1086,17 @@ func Test_SeqRotation_NoSeq_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -1227,7 +1267,7 @@ func Test_SeqRotation_NoSeq_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -1377,9 +1417,9 @@ func Test_SeqRotation_NoSeq_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -1583,7 +1623,7 @@ func Test_SeqRotation_NoSeq_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -1605,7 +1645,7 @@ func Test_SeqRotation_NoSeq_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -1805,9 +1845,9 @@ func Test_SeqRotation_NoSeq_P2P_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // err = rollapp1.StopAllNodes(ctx) // require.NoError(t, err) @@ -2020,7 +2060,7 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -2042,7 +2082,7 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -2138,9 +2178,17 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2253,9 +2301,9 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -2287,9 +2335,17 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2473,7 +2529,7 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -2495,7 +2551,7 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -2579,9 +2635,9 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses dymensionUser, rollappUser := users[0], users[1] @@ -2623,9 +2679,17 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2734,9 +2798,17 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -2908,7 +2980,7 @@ func Test_SqcRotation_OneSqc_P2P_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -2930,7 +3002,7 @@ func Test_SqcRotation_OneSqc_P2P_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -3014,9 +3086,9 @@ func Test_SqcRotation_OneSqc_P2P_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses // dymensionUser, rollappUser := users[0], users[1] @@ -3321,7 +3393,7 @@ func Test_SqcRotation_MulSqc_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -3343,7 +3415,7 @@ func Test_SqcRotation_MulSqc_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -3813,7 +3885,7 @@ func Test_SqcRotation_MulSqc_P2P_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -3835,7 +3907,7 @@ func Test_SqcRotation_MulSqc_P2P_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -4288,7 +4360,7 @@ func Test_SeqRotation_MulSeq_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -4337,9 +4409,17 @@ func Test_SeqRotation_MulSeq_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -4433,9 +4513,9 @@ func Test_SeqRotation_MulSeq_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 3, "should have 3 sequences") + require.Equal(t, len(resp.Sequencers), 3, "should have 3 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -4500,9 +4580,17 @@ func Test_SeqRotation_MulSeq_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.FullNodes[0].FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.FullNodes[0].QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.FullNodes[0].FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -4672,7 +4760,7 @@ func Test_SeqRotation_MulSeq_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -5057,7 +5145,7 @@ func Test_SeqRotation_Unbond_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -5106,9 +5194,17 @@ func Test_SeqRotation_Unbond_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -5174,9 +5270,9 @@ func Test_SeqRotation_Unbond_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -5366,7 +5462,7 @@ func Test_SeqRotation_Unbond_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -5415,9 +5511,17 @@ func Test_SeqRotation_Unbond_DA_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -5486,9 +5590,9 @@ func Test_SeqRotation_Unbond_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -5677,7 +5781,7 @@ func Test_SqcRotation_Unbond_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -5699,7 +5803,7 @@ func Test_SqcRotation_Unbond_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -5783,9 +5887,9 @@ func Test_SqcRotation_Unbond_P2P_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses dymensionUser, rollappUser := users[0], users[1] @@ -5827,9 +5931,17 @@ func Test_SqcRotation_Unbond_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -6057,7 +6169,7 @@ func Test_SqcRotation_Unbond_P2P_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -6079,7 +6191,7 @@ func Test_SqcRotation_Unbond_P2P_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -6163,9 +6275,9 @@ func Test_SqcRotation_Unbond_P2P_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses dymensionUser, rollappUser := users[0], users[1] @@ -6207,9 +6319,17 @@ func Test_SqcRotation_Unbond_P2P_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -6445,7 +6565,7 @@ func Test_SeqRotation_AccumData_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -6494,9 +6614,17 @@ func Test_SeqRotation_AccumData_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -6562,9 +6690,9 @@ func Test_SeqRotation_AccumData_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -6629,9 +6757,17 @@ func Test_SeqRotation_AccumData_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -6809,7 +6945,7 @@ func Test_SeqRotation_AccumData_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -6926,9 +7062,9 @@ func Test_SeqRotation_AccumData_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -7166,7 +7302,7 @@ func Test_SqcRotation_AccumData_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -7188,7 +7324,7 @@ func Test_SqcRotation_AccumData_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -7272,9 +7408,9 @@ func Test_SqcRotation_AccumData_P2P_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses dymensionUser, rollappUser := users[0], users[1] @@ -7316,9 +7452,17 @@ func Test_SqcRotation_AccumData_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -7422,9 +7566,17 @@ func Test_SqcRotation_AccumData_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -7598,7 +7750,7 @@ func Test_SqcRotation_AccumData_P2P_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -7620,7 +7772,7 @@ func Test_SqcRotation_AccumData_P2P_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -7704,9 +7856,9 @@ func Test_SqcRotation_AccumData_P2P_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses // dymensionUser, rollappUser := users[0], users[1] @@ -8016,7 +8168,7 @@ func Test_SqcRotation_StateUpd_Fail_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -8065,9 +8217,17 @@ func Test_SqcRotation_StateUpd_Fail_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -8133,9 +8293,9 @@ func Test_SqcRotation_StateUpd_Fail_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -8206,9 +8366,17 @@ func Test_SqcRotation_StateUpd_Fail_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -8383,7 +8551,7 @@ func Test_SqcRotation_StateUpd_Fail_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -8500,9 +8668,9 @@ func Test_SqcRotation_StateUpd_Fail_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -8745,7 +8913,7 @@ func Test_SeqRotation_HisSync_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -8794,9 +8962,17 @@ func Test_SeqRotation_HisSync_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -8865,9 +9041,9 @@ func Test_SeqRotation_HisSync_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -8932,9 +9108,17 @@ func Test_SeqRotation_HisSync_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -9105,7 +9289,7 @@ func Test_SeqRotation_HisSync_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -9222,9 +9406,9 @@ func Test_SeqRotation_HisSync_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Unbond sequencer1 err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir()) @@ -9461,7 +9645,7 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -9483,7 +9667,7 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -9567,9 +9751,9 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") // Get our Bech32 encoded user addresses dymensionUser, rollappUser := users[0], users[1] @@ -9611,9 +9795,17 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -9717,9 +9909,17 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -9893,7 +10093,7 @@ func Test_SqcRotation_HisSync_Unbond_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -9942,9 +10142,17 @@ func Test_SqcRotation_HisSync_Unbond_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -10043,9 +10251,9 @@ func Test_SqcRotation_HisSync_Unbond_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -10077,9 +10285,17 @@ func Test_SqcRotation_HisSync_Unbond_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -10250,7 +10466,7 @@ func Test_SqcRotation_HisSync_Unbond_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -10400,9 +10616,9 @@ func Test_SqcRotation_HisSync_Unbond_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -10606,7 +10822,7 @@ func Test_SqcRotation_HisSync_Unbond_P2P_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -10628,7 +10844,7 @@ func Test_SqcRotation_HisSync_Unbond_P2P_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -10724,9 +10940,17 @@ func Test_SqcRotation_HisSync_Unbond_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -10828,9 +11052,9 @@ func Test_SqcRotation_HisSync_Unbond_P2P_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -10868,9 +11092,17 @@ func Test_SqcRotation_HisSync_Unbond_P2P_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -11043,7 +11275,7 @@ func Test_SqcRotation_HisSync_Unbond_P2P_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappwasm_1234-1-val-0-%s", t.Name()) @@ -11065,7 +11297,7 @@ func Test_SqcRotation_HisSync_Unbond_P2P_Wasm(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -11161,9 +11393,17 @@ func Test_SqcRotation_HisSync_Unbond_P2P_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -11262,9 +11502,9 @@ func Test_SqcRotation_HisSync_Unbond_P2P_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -11296,9 +11536,17 @@ func Test_SqcRotation_HisSync_Unbond_P2P_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -11474,7 +11722,7 @@ func Test_SeqRot_RotReq_No_DA_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -11523,9 +11771,17 @@ func Test_SeqRot_RotReq_No_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -11626,9 +11882,9 @@ func Test_SeqRot_RotReq_No_DA_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -11660,9 +11916,17 @@ func Test_SeqRot_RotReq_No_DA_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -11838,7 +12102,7 @@ func Test_SeqRot_RotReq_No_DA_Wasm(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, false, 195) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Check IBC Transfer before switch @@ -11887,9 +12151,17 @@ func Test_SeqRot_RotReq_No_DA_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom := transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() @@ -11990,9 +12262,9 @@ func Test_SeqRot_RotReq_No_DA_Wasm(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") err = rollapp1.StopAllNodes(ctx) require.NoError(t, err) @@ -12024,9 +12296,17 @@ func Test_SeqRot_RotReq_No_DA_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + // Get the IBC denom for urax on Hub rollappTokenDenom = transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, rollapp1.Config().Denom) rollappIBCDenom = transfertypes.ParseDenomTrace(rollappTokenDenom).IBCDenom() diff --git a/tests/sequencer_test.go b/tests/sequencer_test.go index c9d52e81..8014fbca 100644 --- a/tests/sequencer_test.go +++ b/tests/sequencer_test.go @@ -129,7 +129,7 @@ func TestSequencerCelestia_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) validator, err := celestia.GetNode().AccountKeyBech32(ctx, "validator") @@ -277,7 +277,7 @@ func TestSequencerCelestia_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) celestia.StopAllNodes(ctx) @@ -416,7 +416,7 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) validator, err := celestia.GetNode().AccountKeyBech32(ctx, "validator") @@ -574,7 +574,7 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) rollappHeight, err := rollapp1.GetNode().Height(ctx) diff --git a/tests/setup.go b/tests/setup.go index 8295962f..06e07d65 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -122,7 +122,7 @@ var ( dymensionImage = ibc.DockerImage{ Repository: DymensionMainRepo, - Version: dymensionVersion, + Version: "debug-m", UidGid: "1025:1025", } @@ -208,14 +208,14 @@ var ( } rollappEVMGenesisKV = []cosmos.GenesisKV{ - { - Key: "app_state.sequencers.params.unbonding_time", - Value: "1200s", - }, - { - Key: "app_state.staking.params.unbonding_time", - Value: "1200s", - }, + // { + // Key: "app_state.sequencers.params.unbonding_time", + // Value: "1200s", + // }, + // { + // Key: "app_state.staking.params.unbonding_time", + // Value: "1200s", + // }, { Key: "app_state.mint.params.mint_denom", Value: "urax", @@ -284,14 +284,14 @@ var ( } rollappWasmGenesisKV = []cosmos.GenesisKV{ - { - Key: "app_state.sequencers.params.unbonding_time", - Value: "1200s", - }, - { - Key: "app_state.staking.params.unbonding_time", - Value: "1200s", - }, + // { + // Key: "app_state.sequencers.params.unbonding_time", + // Value: "1200s", + // }, + // { + // Key: "app_state.staking.params.unbonding_time", + // Value: "1200s", + // }, // Bank denom metadata { Key: "app_state.bank.denom_metadata", @@ -328,14 +328,10 @@ var ( Key: "app_state.rollapp.params.dispute_period_in_blocks", Value: fmt.Sprint(BLOCK_FINALITY_PERIOD), }, - { - Key: "app_state.sequencer.params.unbonding_time", - Value: "1200s", - }, - { - Key: "app_state.staking.params.unbonding_time", - Value: "1200s", - }, + // { + // Key: "app_state.staking.params.unbonding_time", + // Value: "1200s", + // }, // gov params { Key: "app_state.gov.params.voting_period", diff --git a/tests/time_upgrade_test.go b/tests/time_upgrade_test.go index e56e7b80..6609d416 100644 --- a/tests/time_upgrade_test.go +++ b/tests/time_upgrade_test.go @@ -115,7 +115,7 @@ func Test_TimeBaseUpgrade_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -137,7 +137,7 @@ func Test_TimeBaseUpgrade_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -430,7 +430,7 @@ func Test_TimeBaseUpgradeInPast_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, true, 780) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -452,7 +452,7 @@ func Test_TimeBaseUpgradeInPast_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) diff --git a/tests/tx_batch_finalization_test.go b/tests/tx_batch_finalization_test.go index 5e9e8744..aac35dd4 100644 --- a/tests/tx_batch_finalization_test.go +++ b/tests/tx_batch_finalization_test.go @@ -121,7 +121,7 @@ func TestBatchFinalization_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Create some user accounts on both chains @@ -252,7 +252,7 @@ func TestBatchFinalization_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // Create some user accounts on both chains diff --git a/tests/upgrade_hub_test.go b/tests/upgrade_hub_test.go index 34d2cb32..a3e23d4e 100644 --- a/tests/upgrade_hub_test.go +++ b/tests/upgrade_hub_test.go @@ -179,7 +179,7 @@ func TestHubUpgrade(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) // err = dymension.StopAllNodes(ctx) @@ -401,9 +401,17 @@ func TestHubUpgrade(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUser1Addr, rollapp1.GetChainID(), fmt.Sprint(rollapp1Height)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUser1Addr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUser1Addr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -467,9 +475,17 @@ func TestHubUpgrade(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUser1Addr, rollapp1.GetChainID(), fmt.Sprint(rollapp1Height)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUser1Addr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUser1Addr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) @@ -537,9 +553,17 @@ func TestHubUpgrade(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, marketMaker2Addr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, marketMaker2Addr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, marketMaker2Addr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) @@ -602,9 +626,17 @@ func TestHubUpgrade(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - _, err = dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUser2Addr, rollapp2.GetChainID(), fmt.Sprint(rollapp2Height)) + res, err = dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUser2Addr) + fmt.Println(res) require.NoError(t, err) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUser2Addr, rollapp2.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp2) require.NoError(t, err) diff --git a/tests/zero_fee_relay_test.go b/tests/zero_fee_relay_test.go index 0775e066..b88c4495 100644 --- a/tests/zero_fee_relay_test.go +++ b/tests/zero_fee_relay_test.go @@ -114,7 +114,7 @@ func TestZeroFee_RelaySuccess_EVM(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) wallet, found := r.GetWallet(rollapp1.Config().ChainID) require.True(t, found) @@ -169,10 +169,16 @@ func TestZeroFee_RelaySuccess_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) @@ -310,7 +316,7 @@ func TestZeroFee_RelaySuccess_Wasm(t *testing.T) { // This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc. // BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(), - }, nil, "", nil, false, 780) + }, nil, "", nil, false, 1179360) require.NoError(t, err) wallet, found := r.GetWallet(rollapp1.Config().ChainID) require.True(t, found) @@ -365,10 +371,16 @@ func TestZeroFee_RelaySuccess_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err) @@ -546,7 +558,7 @@ func TestZeroFee_RotatedSequencer_EVM(t *testing.T) { Client: client, NetworkID: network, SkipPathCreation: true, - }, nil, "", nil, true, 195) + }, nil, "", nil, true, 1179360) require.NoError(t, err) containerID := fmt.Sprintf("ra-rollappevm_1234-1-val-0-%s", t.Name()) @@ -568,7 +580,7 @@ func TestZeroFee_RotatedSequencer_EVM(t *testing.T) { nodeId = strings.TrimRight(nodeId, "\n") p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) - rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1HomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] file, err := os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) @@ -664,10 +676,10 @@ func TestZeroFee_RotatedSequencer_EVM(t *testing.T) { _, err = dymension.FullNodes[0].ExecTx(ctx, "sequencer", command...) require.NoError(t, err) - res, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) + resp, err := dymension.QueryShowSequencerByRollapp(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - require.Equal(t, len(res.Sequencers), 2, "should have 2 sequences") - fmt.Printf("Sequencer check: %v\n", res.Sequencers) + require.Equal(t, len(resp.Sequencers), 2, "should have 2 sequences") + fmt.Printf("Sequencer check: %v\n", resp.Sequencers) //Update white listed relayers _, err = dymension.GetNode().UpdateWhitelistedRelayers(ctx, sequencerAddr, []string{wallet.FormattedAddress()}) @@ -705,10 +717,16 @@ func TestZeroFee_RotatedSequencer_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - txhash, err := dymension.GetNode().FinalizePacketsUntilHeight(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(rollappHeight)) + res, err := dymension.GetNode().QueryPendingPacketsByAddress(ctx, dymensionUserAddr) + fmt.Println(res) require.NoError(t, err) - fmt.Println(txhash) + for _, packet := range res.RollappPackets { + txhash, err := dymension.GetNode().FinalizePacket(ctx, dymensionUserAddr, rollapp1.GetChainID(), fmt.Sprint(packet.ProofHeight), fmt.Sprint(packet.Type), packet.Packet.SourceChannel, fmt.Sprint(packet.Packet.Sequence)) + require.NoError(t, err) + + fmt.Println(txhash) + } err = testutil.WaitForBlocks(ctx, 5, dymension, rollapp1) require.NoError(t, err)