From 50998cc2908db5733f94db35e81c44d7991622f1 Mon Sep 17 00:00:00 2001 From: ducnt131 <62016666+anhductn2001@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:07:40 +0700 Subject: [PATCH] chore: fix fullnode sync and hardfork tests (#420) --- go.mod | 2 +- go.sum | 4 +- tests/disconnection_test.go | 2 + tests/eibc_ack_error_test.go | 12 +- tests/eibc_fee_market_test.go | 27 +-- tests/eibc_fee_test.go | 5 +- tests/eibc_feemarket_test.go | 23 +- tests/eibc_fulfillment_test.go | 20 +- tests/eibc_timeout_test.go | 8 +- tests/frozen_test.go | 10 +- tests/fullnode_sync_block_sync_test.go | 105 +++++---- tests/fullnode_sync_gossip_test.go | 295 ++++++++++++++++--------- tests/fullnode_sync_test.go | 53 +++-- tests/hardfork_test.go | 6 +- tests/ibc_grace_period_test.go | 6 +- tests/sequencer_test.go | 29 ++- tests/setup.go | 5 +- 17 files changed, 362 insertions(+), 250 deletions(-) diff --git a/go.mod b/go.mod index 026584ec..51d542ee 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ replace ( require ( github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869 - github.com/decentrio/rollup-e2e-testing v0.0.0-20240916050430-2e0921df7103 + github.com/decentrio/rollup-e2e-testing v0.0.0-20240919024619-0f39bd77d29b github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240911123104-4782bc4e587f github.com/dymensionxyz/dymint v1.2.0-rc01 ) diff --git a/go.sum b/go.sum index 57a98ba6..35958d19 100644 --- a/go.sum +++ b/go.sum @@ -770,8 +770,8 @@ github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869 h1:qWpUYGOsrSC+1Vmd2TjhbsSpntvvx9PsX3AoeMunFxc= github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869/go.mod h1:HZNYnPwmSxkwTPjSD5yolauc1Vx1ZzKL4FFMxTq4H5Y= -github.com/decentrio/rollup-e2e-testing v0.0.0-20240916050430-2e0921df7103 h1:Oe4PR5yoyB1ALwi5CkN38M9VKHIIxWvvMbk/BORvMpQ= -github.com/decentrio/rollup-e2e-testing v0.0.0-20240916050430-2e0921df7103/go.mod h1:QmBrZgZplhtgHRWC0Z7LC7TDsKuC8sDyQvZyXXaqw/c= +github.com/decentrio/rollup-e2e-testing v0.0.0-20240919024619-0f39bd77d29b h1:nbWJnJo1ZDXqplqgQAkBJYIFE6+9eEfHeNFpMa46sZw= +github.com/decentrio/rollup-e2e-testing v0.0.0-20240919024619-0f39bd77d29b/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/disconnection_test.go b/tests/disconnection_test.go index 478300a7..4abcd5e0 100644 --- a/tests/disconnection_test.go +++ b/tests/disconnection_test.go @@ -122,6 +122,7 @@ func TestDisconnection_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_time"] = "50s" + dymintTomlOverrides["batch_submit_bytes"] = "1000" dymintTomlOverrides["block_batch_max_size_bytes"] = "1000" dymintTomlOverrides["max_batch_skew"] = "1" dymintTomlOverrides["batch_acceptance_attempts"] = "1" @@ -251,6 +252,7 @@ func TestDisconnection_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_time"] = "5s" + dymintTomlOverrides["batch_submit_bytes"] = "1000" dymintTomlOverrides["block_batch_max_size_bytes"] = "1000" dymintTomlOverrides["max_batch_skew"] = "1" dymintTomlOverrides["batch_acceptance_attempts"] = "1" diff --git a/tests/eibc_ack_error_test.go b/tests/eibc_ack_error_test.go index e8a095ae..e31241a7 100644 --- a/tests/eibc_ack_error_test.go +++ b/tests/eibc_ack_error_test.go @@ -370,7 +370,7 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) fmt.Println(eibcEvents) - require.Equal(t, eibcEvents[1].PacketStatus, "PENDING") + require.Equal(t, eibcEvents[0].PacketStatus, "PENDING") // Get the balance of dymensionUserAddr and marketMakerAddr before fulfill the demand order dymensionUserBalance, err := dymension.GetBalance(ctx, dymensionUserAddr, dymension.Config().Denom) @@ -379,7 +379,7 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -766,10 +766,10 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) fmt.Println(eibcEvents) - require.Equal(t, eibcEvents[1].PacketStatus, "PENDING") + require.Equal(t, eibcEvents[0].PacketStatus, "PENDING") // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1220,10 +1220,10 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) fmt.Println(eibcEvents) - require.Equal(t, eibcEvents[1].PacketStatus, "PENDING") + require.Equal(t, eibcEvents[0].PacketStatus, "PENDING") // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) diff --git a/tests/eibc_fee_market_test.go b/tests/eibc_fee_market_test.go index 60ab14db..a2880e45 100644 --- a/tests/eibc_fee_market_test.go +++ b/tests/eibc_fee_market_test.go @@ -309,13 +309,6 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { fmt.Println("Balance of dymensionUserAddr after fulfilling the order:", balance) require.True(t, balance.Equal(transferAmountWithoutFee.Add(transferAmount.Sub(bridgingFee)).Sub(bridgingFee)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", transferAmountWithoutFee.Add(transferAmount.Sub(bridgingFee)).Sub(bridgingFee), balance)) - // verify correct funds were deducted from market maker's wallet address - balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) - require.NoError(t, err) - fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Sub((transferAmount)).Add(eibcFee).Add(bridgingFee) - require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance)) - // wait until packet finalization and verify funds + fee were added to market maker's wallet address isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 200) require.NoError(t, err) @@ -327,8 +320,7 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Add(transferDataRollapp1.Amount) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Sub(bridgingFee) + expMmBalanceRollappDenom = expMmBalanceRollappDenom.Add(eibcFee) require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance)) t.Cleanup( @@ -582,8 +574,7 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { _, err = rollapp1.SendIBCTransfer(ctx, dymChannel_ra1[0].ChannelID, rollappUserAddr, transferDataRollapp1, options) require.NoError(t, err) - rollappHeight, err = rollapp1.GetNode().Height(ctx) - require.NoError(t, err) + balance, err = dymension.GetBalance(ctx, dymensionUserAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of dymensionUserAddr right after sending eIBC transfer from rollapp 1 to dym hub:", balance) @@ -634,26 +625,18 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { fmt.Println("Balance of dymensionUserAddr after fulfilling the order:", balance) require.True(t, balance.Equal(transferAmountWithoutFee.Add(transferAmount.Sub(bridgingFee)).Sub(bridgingFee)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", transferAmountWithoutFee.Add(transferAmount.Sub(bridgingFee)).Sub(bridgingFee), balance)) - // verify correct funds were deducted from market maker's wallet address - balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) + // wait until packet finalization and verify funds + fee were added to market maker's wallet address + rollappHeight, err = rollapp1.GetNode().Height(ctx) require.NoError(t, err) - fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Sub((transferAmount)).Add(eibcFee).Add(bridgingFee) - require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance)) - // wait until packet finalization and verify funds + fee were added to market maker's wallet address isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 200) require.NoError(t, err) require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) - require.NoError(t, err) - balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Add(transferDataRollapp1.Amount) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Sub(bridgingFee) + expMmBalanceRollappDenom = expMmBalanceRollappDenom.Add(eibcFee) require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance)) t.Cleanup( diff --git a/tests/eibc_fee_test.go b/tests/eibc_fee_test.go index 422dae5e..b2e817c0 100644 --- a/tests/eibc_fee_test.go +++ b/tests/eibc_fee_test.go @@ -197,8 +197,6 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { _, err = rollapp1.SendIBCTransfer(ctx, channel.ChannelID, rollappUserAddr, transferData, options) require.NoError(t, err) - rollappHeight, err = rollapp1.GetNode().Height(ctx) - require.NoError(t, err) // balance right after sending IBC transfer testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, rollapp1.Config().Denom, walletAmount.Sub(transferData.Amount).Sub(transferData.Amount)) testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, rollappIBCDenom, transferData.Amount.Sub(bridgingFee)) @@ -208,6 +206,9 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { fmt.Println(eibcEvents) require.True(t, len(eibcEvents) == 0) // verify there were no eibc events registered on the hub + rollappHeight, err = rollapp1.GetNode().Height(ctx) + require.NoError(t, err) + isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) require.NoError(t, err) require.True(t, isFinalized) diff --git a/tests/eibc_feemarket_test.go b/tests/eibc_feemarket_test.go index 010e0a65..a4375184 100644 --- a/tests/eibc_feemarket_test.go +++ b/tests/eibc_feemarket_test.go @@ -1139,9 +1139,6 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { _, err = rollapp1.SendIBCTransfer(ctx, channsRollApp1[0].ChannelID, rollappUserAddr, transferData, ibc.TransferOptions{}) require.NoError(t, err) - rollappHeight, err = rollapp1.GetNode().Height(ctx) - require.NoError(t, err) - balance, err = dymension.GetBalance(ctx, dymensionUserAddr, rollappIBCDenom) require.NoError(t, err) @@ -1149,7 +1146,7 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { require.True(t, balance.Equal(zeroBal), fmt.Sprintf("Value mismatch. Expected %s, actual %s", zeroBal, balance)) // get eIbc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 5, false) require.NoError(t, err) fmt.Println("Event:", eibcEvents[0]) @@ -1179,12 +1176,12 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { require.True(t, balance.Equal(transferAmountWithoutFee.Sub(bridgingFee).Sub(eibcFee)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", transferAmountWithoutFee.Sub(bridgingFee).Sub(eibcFee), balance)) // wait until packet finalization and verify funds + fee were added to market maker's wallet address - isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) + rollappHeight, err = rollapp1.GetNode().Height(ctx) require.NoError(t, err) - require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) + isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) require.NoError(t, err) + require.True(t, isFinalized) balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) @@ -1720,7 +1717,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { dymintTomlOverrides["settlement_gas_prices"] = "0adym" dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" - dymintTomlOverrides["batch_submit_time"] = "50s" + dymintTomlOverrides["batch_submit_time"] = "10s" dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1860,7 +1857,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1) + err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) require.NoError(t, err) // Compose an IBC transfer and send from hub to rollapp @@ -1901,7 +1898,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { require.NoError(t, err) // get eibc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 60, true) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 60, false) require.NoError(t, err) fmt.Println("Event:", eibcEvents) require.Equal(t, eibcEvents[0].Price, fmt.Sprintf("%s%s", transferAmountWithoutFee, dymension.Config().Denom)) @@ -1913,7 +1910,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { res, err := dymension.GetTransaction(txhash) require.NoError(t, err) - require.Equal(t, uint32(4), res.Code) + require.True(t, (res.Code == uint32(4)) || (res.Code == uint32(5))) t.Cleanup( func() { @@ -2124,7 +2121,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) { require.NoError(t, err) // get eibc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 60, true) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 80, false) require.NoError(t, err) fmt.Println("Event:", eibcEvents) require.Equal(t, eibcEvents[0].Price, fmt.Sprintf("%s%s", transferAmountWithoutFee, dymension.Config().Denom)) @@ -2136,7 +2133,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) { res, err := dymension.GetTransaction(txhash) require.NoError(t, err) - require.Equal(t, uint32(4), res.Code) + require.True(t, (res.Code == uint32(4)) || (res.Code == uint32(5))) t.Cleanup( func() { diff --git a/tests/eibc_fulfillment_test.go b/tests/eibc_fulfillment_test.go index 85690dcf..59aba82b 100644 --- a/tests/eibc_fulfillment_test.go +++ b/tests/eibc_fulfillment_test.go @@ -1697,10 +1697,19 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) { require.True(t, balance.Equal(transferAmountWithoutFee.Sub(bridgingFee)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", transferAmountWithoutFee.Sub(bridgingFee), balance)) // verify funds were deducted from market maker's wallet address + + 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) + balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollappIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) - expMmBalanceRollappDenom = expMmBalanceRollappDenom.Sub(transferAmountWithoutFee).Add(bridgingFee) + expMmBalanceRollappDenom = expMmBalanceRollappDenom.Add(eibcFee) require.True(t, balance.Equal(expMmBalanceRollappDenom), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalanceRollappDenom, balance)) balance, err = dymension.GetBalance(ctx, marketMakerAddr, rollapp2IBCDenom) @@ -2093,13 +2102,6 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { fmt.Println("Balance of dymensionUserAddr after fulfilling the order:", balance) require.True(t, balance.Equal(transferAmountWithoutFee.Sub(bridgingFee)), fmt.Sprintf("Value mismatch. Expected %s, actual %s", transferAmountWithoutFee.Sub(bridgingFee), balance)) - // verify funds were deducted from market maker's wallet address - balance, err = dymension.GetBalance(ctx, marketMakerAddr, gaiaIBCDenom) - require.NoError(t, err) - fmt.Println("Balance of marketMakerAddr after fulfilling the order:", balance) - expMmBalance := transferAmount.Sub((transferAmountWithoutFee)) - require.True(t, balance.Equal(expMmBalance), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalance, balance)) - // wait until packet finalization and verify funds + fee were added to market maker's wallet address isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) require.NoError(t, err) @@ -2111,7 +2113,7 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { balance, err = dymension.GetBalance(ctx, marketMakerAddr, gaiaIBCDenom) require.NoError(t, err) fmt.Println("Balance of marketMakerAddr after packet finalization:", balance) - expMmBalance = expMmBalance.Add(transferData.Amount).Sub(bridgingFee) + expMmBalance := transferAmount.Add(eibcFee).Sub(bridgingFee) require.True(t, balance.Equal(expMmBalance), fmt.Sprintf("Value mismatch. Expected %s, actual %s", expMmBalance, balance)) t.Cleanup( diff --git a/tests/eibc_timeout_test.go b/tests/eibc_timeout_test.go index 0079cbdf..1b0611a7 100644 --- a/tests/eibc_timeout_test.go +++ b/tests/eibc_timeout_test.go @@ -177,7 +177,7 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 20, dymension, rollapp1) + err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1) require.NoError(t, err) // Compose an IBC transfer and send from hub to rollapp @@ -218,7 +218,7 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) // get eibc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 60, true) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) fmt.Println("Event:", eibcEvents[0]) require.Equal(t, eibcEvents[0].Price, fmt.Sprintf("%s%s", transferAmountWithoutFee, dymension.Config().Denom)) @@ -569,7 +569,7 @@ func TestEIBCTimeoutFulFillDymToRollapp_EVM(t *testing.T) { gaiaTokenDenom := transfertypes.GetPrefixedDenom(dymGaiaChan.PortID, dymGaiaChan.ChannelID, gaia.Config().Denom) gaiaIBCDenom := transfertypes.ParseDenomTrace(gaiaTokenDenom).IBCDenom() - err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1, gaia) + err = testutil.WaitForBlocks(ctx, 50, dymension, rollapp1) require.NoError(t, err) testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, gaiaIBCDenom, gaiaToDymTransferData.Amount) @@ -596,7 +596,7 @@ func TestEIBCTimeoutFulFillDymToRollapp_EVM(t *testing.T) { require.NoError(t, err) // get eibc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 60, true) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) fmt.Println("Event:", eibcEvents[0]) require.Equal(t, eibcEvents[0].Price, fmt.Sprintf("%s%s", transferAmountWithoutFee, gaiaIBCDenom)) diff --git a/tests/frozen_test.go b/tests/frozen_test.go index 43c5dfa4..0d08f5d1 100644 --- a/tests/frozen_test.go +++ b/tests/frozen_test.go @@ -1097,7 +1097,7 @@ func TestOtherRollappNotAffected_EVM(t *testing.T) { require.NoError(t, err) // Wait a few blocks - err = testutil.WaitForBlocks(ctx, 20, dymension) + err = testutil.WaitForBlocks(ctx, 30, dymension) // Get updated dym hub ibc denom balance dymUserUpdateBal, err := dymension.GetBalance(ctx, dymensionUserAddr, rollapp1IbcDenom) @@ -1108,6 +1108,8 @@ func TestOtherRollappNotAffected_EVM(t *testing.T) { // Check other rollapp state index still increase rollapp2IndexLater, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp2.Config().ChainID) + fmt.Println(rollapp2IndexLater.StateIndex.Index) + fmt.Println(rollapp2Index.StateIndex.Index) require.NoError(t, err) require.True(t, rollapp2IndexLater.StateIndex.Index > rollapp2Index.StateIndex.Index, "Another rollapp got freeze") @@ -4698,7 +4700,7 @@ func TestRollAppFreezeEibcPending_EVM(t *testing.T) { latestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) + testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) // after Grace period, the latest index should be the same lalatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) @@ -4716,7 +4718,7 @@ func TestRollAppFreezeEibcPending_EVM(t *testing.T) { // eibc demand order reverted resp, err = dymension.QueryEIBCDemandOrders(ctx, "REVERTED") require.NoError(t, err) - require.Equal(t, 2, len(resp.DemandOrders)) + require.Equal(t, 1, len(resp.DemandOrders)) // After rollapp frozen, inability to fulfill eIBC transfer rollappUserUpdateBal, err := rollapp1.GetBalance(ctx, rollapp1UserAddr, rollapp1.Config().Denom) @@ -5040,7 +5042,7 @@ func TestRollAppFreezeEibcPending_Wasm(t *testing.T) { latestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) - testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) + testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) // after Grace period, the latest index should be the same lalatestIndex, err := dymension.GetNode().QueryLatestStateIndex(ctx, rollapp1.Config().ChainID) require.NoError(t, err) diff --git a/tests/fullnode_sync_block_sync_test.go b/tests/fullnode_sync_block_sync_test.go index 324eb719..b22e7289 100644 --- a/tests/fullnode_sync_block_sync_test.go +++ b/tests/fullnode_sync_block_sync_test.go @@ -15,6 +15,7 @@ import ( "go.uber.org/zap/zaptest" test "github.com/decentrio/rollup-e2e-testing" + "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/celes_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/rollapp/dym_rollapp" @@ -43,12 +44,10 @@ func TestSync_BlockSync_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_time"] = "3600s" - dymintTomlOverrides["block_time"] = "20ms" + dymintTomlOverrides["block_time"] = "200ms" dymintTomlOverrides["p2p_gossip_cache_size"] = "1" dymintTomlOverrides["p2p_blocksync_enabled"] = "true" dymintTomlOverrides["p2p_blocksync_block_request_interval"] = 10 - dymintTomlOverrides["da_layer"] = "grpc" - dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -59,6 +58,14 @@ func TestSync_BlockSync_EVM(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -66,7 +73,7 @@ func TestSync_BlockSync_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -208,10 +215,11 @@ func TestSync_BlockSync_EVM(t *testing.T) { celestia_namespace_id, err := RandomHex(10) require.NoError(t, err) println("check namespace: ", celestia_namespace_id) + da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "grpc" - dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" + dymintTomlOverrides["namespace_id"] = celestia_namespace_id + dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides cf = test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{ @@ -231,7 +239,7 @@ func TestSync_BlockSync_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -318,11 +326,9 @@ func TestSync_BlockSync_EVM(t *testing.T) { for scanner.Scan() { lines = append(lines, scanner.Text()) } - da_layer := "celestia" + for i, line := range lines { - if strings.HasPrefix(line, "da_layer =") { - lines[i] = fmt.Sprintf("da_layer = \"%s\"", da_layer) - } else if strings.HasPrefix(line, "namespace_id =") { + if strings.HasPrefix(line, "namespace_id =") { lines[i] = fmt.Sprintf("namespace_id = \"%s\"", celestia_namespace_id) } else if strings.HasPrefix(line, "da_config =") { lines[i] = fmt.Sprintf("da_config = \"{\\\"base_url\\\": \\\"http://test-val-0-%s:26658\\\", \\\"timeout\\\": 60000000000, \\\"gas_prices\\\":1.0, \\\"gas_adjustment\\\": 1.3, \\\"namespace_id\\\": \\\"%s\\\", \\\"auth_token\\\":\\\"%s\\\"}\"", t.Name(), celestia_namespace_id, celestia_token) @@ -384,12 +390,10 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_time"] = "3600s" - dymintTomlOverrides["block_time"] = "20ms" + dymintTomlOverrides["block_time"] = "200ms" dymintTomlOverrides["p2p_gossip_cache_size"] = "1" dymintTomlOverrides["p2p_blocksync_enabled"] = "true" dymintTomlOverrides["p2p_blocksync_block_request_interval"] = 10 - dymintTomlOverrides["da_layer"] = "grpc" - dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -400,6 +404,14 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -407,7 +419,7 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -549,10 +561,11 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { celestia_namespace_id, err := RandomHex(10) require.NoError(t, err) println("check namespace: ", celestia_namespace_id) + da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "grpc" - dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" + dymintTomlOverrides["namespace_id"] = celestia_namespace_id + dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides cf = test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{ @@ -572,7 +585,7 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -596,13 +609,12 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { ic = test.NewSetup(). AddRollUp(dymension, rollapp1) - err = ic.Build(ctx, eRep, test.InterchainBuildOptions{ + _ = ic.Build(ctx, eRep, test.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, SkipPathCreation: true, }, nil, "", nil) - require.Error(t, err) containerID = fmt.Sprintf("rollappevm_1234-1-val-0-%s", t.Name()) @@ -650,38 +662,35 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { _, err = file.Write([]byte(output)) require.NoError(t, err) - // update dymint.toml for full node to connect with Celestia DA - fnHomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") - fnFolderName := fnHomeDir[len(fnHomeDir)-1] + // // update dymint.toml for full node to connect with Celestia DA + // fnHomeDir := strings.Split(rollapp1.FullNodes[0].HomeDir(), "/") + // fnFolderName := fnHomeDir[len(fnHomeDir)-1] - file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", fnFolderName)) - require.NoError(t, err) - defer file.Close() + // file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", fnFolderName)) + // require.NoError(t, err) + // defer file.Close() - lines = []string{} - scanner = bufio.NewScanner(file) - for scanner.Scan() { - lines = append(lines, scanner.Text()) - } + // lines = []string{} + // scanner = bufio.NewScanner(file) + // for scanner.Scan() { + // lines = append(lines, scanner.Text()) + // } - da_layer := "celestia" - for i, line := range lines { - if strings.HasPrefix(line, "da_layer =") { - lines[i] = fmt.Sprintf("da_layer = \"%s\"", da_layer) - } else if strings.HasPrefix(line, "namespace_id =") { - lines[i] = fmt.Sprintf("namespace_id = \"%s\"", celestia_namespace_id) - } else if strings.HasPrefix(line, "da_config =") { - lines[i] = fmt.Sprintf("da_config = \"{\\\"base_url\\\": \\\"http://test-val-0-%s:26658\\\", \\\"timeout\\\": 60000000000, \\\"gas_prices\\\":1.0, \\\"gas_adjustment\\\": 1.3, \\\"namespace_id\\\": \\\"%s\\\", \\\"auth_token\\\":\\\"%s\\\"}\"", t.Name(), celestia_namespace_id, celestia_token) - } - } + // for i, line := range lines { + // if strings.HasPrefix(line, "namespace_id =") { + // lines[i] = fmt.Sprintf("namespace_id = \"%s\"", celestia_namespace_id) + // } else if strings.HasPrefix(line, "da_config =") { + // lines[i] = fmt.Sprintf("da_config = \"{\\\"base_url\\\": \\\"http://test-val-0-%s:26658\\\", \\\"timeout\\\": 60000000000, \\\"gas_prices\\\":1.0, \\\"gas_adjustment\\\": 1.3, \\\"namespace_id\\\": \\\"%s\\\", \\\"auth_token\\\":\\\"%s\\\"}\"", t.Name(), celestia_namespace_id, celestia_token) + // } + // } - output = strings.Join(lines, "\n") - file, err = os.Create(fmt.Sprintf("/tmp/%s/config/dymint.toml", fnFolderName)) - require.NoError(t, err) - defer file.Close() + // output = strings.Join(lines, "\n") + // file, err = os.Create(fmt.Sprintf("/tmp/%s/config/dymint.toml", fnFolderName)) + // require.NoError(t, err) + // defer file.Close() - _, err = file.Write([]byte(output)) - require.NoError(t, err) + // _, err = file.Write([]byte(output)) + // require.NoError(t, err) err = rollapp1.FullNodes[0].StopContainer(ctx) require.NoError(t, err) @@ -714,7 +723,7 @@ func TestSync_BlockSync_fn_disconnect_EVM(t *testing.T) { require.NoError(t, err) // Wait for few blocks before starting the full node - err = testutil.WaitForBlocks(ctx, 10, dymension) + err = testutil.WaitForBlocks(ctx, 30, dymension) require.NoError(t, err) err = rollapp1.FullNodes[0].StartContainer(ctx) diff --git a/tests/fullnode_sync_gossip_test.go b/tests/fullnode_sync_gossip_test.go index 63b8d394..895b3db9 100644 --- a/tests/fullnode_sync_gossip_test.go +++ b/tests/fullnode_sync_gossip_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/strslice" @@ -39,11 +40,11 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappevm_1234-1" dymintTomlOverrides["settlement_gas_prices"] = "0adym" - dymintTomlOverrides["max_idle_time"] = "200ms" + dymintTomlOverrides["max_idle_time"] = "250ms" dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_time"] = "5s" - dymintTomlOverrides["block_time"] = "190ms" - dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["block_time"] = "200ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "true" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -54,6 +55,14 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -61,7 +70,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -119,13 +128,13 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -206,7 +215,6 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -228,7 +236,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -252,13 +260,12 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { ic = test.NewSetup(). AddRollUp(dymension, rollapp1) - err = ic.Build(ctx, eRep, test.InterchainBuildOptions{ + _ = ic.Build(ctx, eRep, test.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, SkipPathCreation: true, }, nil, "", nil) - require.NoError(t, err) containerID = fmt.Sprintf("rollappevm_1234-1-val-0-%s", t.Name()) @@ -316,7 +323,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { rollappHeight, err := rollapp1.Validators[0].Height(ctx) require.NoError(t, err) - isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) + isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 500) require.NoError(t, err) require.True(t, isFinalized) @@ -355,11 +362,11 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappwasm_1234-1" dymintTomlOverrides["settlement_gas_prices"] = "0adym" - dymintTomlOverrides["max_idle_time"] = "200ms" + dymintTomlOverrides["max_idle_time"] = "250ms" dymintTomlOverrides["max_proof_time"] = "150ms" - dymintTomlOverrides["batch_submit_time"] = "50s" - dymintTomlOverrides["block_time"] = "190ms" - dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["batch_submit_time"] = "5s" + dymintTomlOverrides["block_time"] = "200ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "true" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -370,6 +377,14 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyWasmGenesisKV := append( + rollappWasmGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numRollAppFn := 1 @@ -377,7 +392,7 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { numCelestiaFn := 0 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -435,13 +450,13 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -524,7 +539,6 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -546,7 +560,7 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappWasmGenesis(rollappWasmGenesisKV), + ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -589,22 +603,73 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - rollappHeight, err := rollapp1.GetNode().Height(ctx) + containerID = fmt.Sprintf("rollappwasm_1234-1-val-0-%s", t.Name()) + + // Get the container details + containerJSON, err := client.ContainerInspect(context.Background(), containerID) + require.NoError(t, err) + + // Extract the IP address from the network settings + // If the container is using a custom network, the IP might be under a specific network name + var ipAddress string + for _, network := range containerJSON.NetworkSettings.Networks { + ipAddress = network.IPAddress + break // Assuming we only need the IP from the first network + } + + nodeId, err := rollapp1.Validators[0].GetNodeId(ctx) + require.NoError(t, err) + nodeId = strings.TrimRight(nodeId, "\n") + p2p_bootstrap_node := fmt.Sprintf("/ip4/%s/tcp/26656/p2p/%s", ipAddress, nodeId) + + rollapp1HomeDir := strings.Split(rollapp1.HomeDir(), "/") + rollapp1FolderName := rollapp1HomeDir[len(rollapp1HomeDir)-1] + + file, err = os.Open(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) + require.NoError(t, err) + defer file.Close() + + lines = []string{} + scanner = bufio.NewScanner(file) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + + for i, line := range lines { + if strings.HasPrefix(line, "p2p_bootstrap_nodes =") { + lines[i] = fmt.Sprintf("p2p_bootstrap_nodes = \"%s\"", p2p_bootstrap_node) + } + } + + output = strings.Join(lines, "\n") + file, err = os.Create(fmt.Sprintf("/tmp/%s/config/dymint.toml", rollapp1FolderName)) + require.NoError(t, err) + defer file.Close() + + _, err = file.Write([]byte(output)) + require.NoError(t, err) + + // Start full node + err = rollapp1.FullNodes[0].StopContainer(ctx) require.NoError(t, err) - // wait until the packet is finalized - isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 180) - require.Error(t, err) - require.False(t, isFinalized) + _ = rollapp1.FullNodes[0].StartContainer(ctx) - // Poll until full node is sync + rollappHeight, err := rollapp1.Validators[0].Height(ctx) + require.NoError(t, err) + + isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 500) + require.NoError(t, err) + require.True(t, isFinalized) + + valHeight, err := rollapp1.Validators[0].Height(ctx) + require.NoError(t, err) + + //Poll until full node is sync err = testutil.WaitForCondition( time.Minute*50, time.Second*5, // each epoch is 5 seconds func() (bool, error) { - valHeight, err := rollapp1.Validators[0].Height(ctx) - require.NoError(t, err) - fullnodeHeight, err := rollapp1.FullNodes[0].Height(ctx) require.NoError(t, err) @@ -632,11 +697,11 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappevm_1234-1" dymintTomlOverrides["settlement_gas_prices"] = "0adym" - dymintTomlOverrides["max_idle_time"] = "200ms" + dymintTomlOverrides["max_idle_time"] = "250ms" dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_time"] = "5s" - dymintTomlOverrides["block_time"] = "190ms" - dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["block_time"] = "200ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "true" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -647,6 +712,14 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -654,7 +727,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -712,13 +785,13 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -799,7 +872,6 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -821,7 +893,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -845,13 +917,12 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { ic = test.NewSetup(). AddRollUp(dymension, rollapp1) - err = ic.Build(ctx, eRep, test.InterchainBuildOptions{ + _ = ic.Build(ctx, eRep, test.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, SkipPathCreation: true, }, nil, "", nil) - require.NoError(t, err) containerID = fmt.Sprintf("rollappevm_1234-1-val-0-%s", t.Name()) @@ -903,8 +974,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { err = rollapp1.FullNodes[0].StopContainer(ctx) require.NoError(t, err) - err = rollapp1.FullNodes[0].StartContainer(ctx) - require.NoError(t, err) + _ = rollapp1.FullNodes[0].StartContainer(ctx) rollappHeight, err := rollapp1.Validators[0].Height(ctx) require.NoError(t, err) @@ -937,15 +1007,10 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { err = rollapp1.Validators[0].StopContainer(ctx) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 10, celestia) - require.NoError(t, err) - - err = rollapp1.Validators[0].StartContainer(ctx) + err = testutil.WaitForBlocks(ctx, 30, celestia) require.NoError(t, err) - isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) - require.NoError(t, err) - require.True(t, isFinalized) + _ = rollapp1.Validators[0].StartContainer(ctx) valHeight, err = rollapp1.Validators[0].Height(ctx) require.NoError(t, err) @@ -982,11 +1047,11 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappwasm_1234-1" dymintTomlOverrides["settlement_gas_prices"] = "0adym" - dymintTomlOverrides["max_idle_time"] = "200ms" + dymintTomlOverrides["max_idle_time"] = "250ms" dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_time"] = "5s" - dymintTomlOverrides["block_time"] = "190ms" - dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["block_time"] = "200ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "true" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -997,6 +1062,14 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyWasmGenesisKV := append( + rollappWasmGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -1004,7 +1077,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -1062,13 +1135,13 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -1149,7 +1222,6 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1171,7 +1243,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappWasmGenesis(rollappWasmGenesisKV), + ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -1203,7 +1275,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - containerID = fmt.Sprintf("rollappevm_1234-1-val-0-%s", t.Name()) + containerID = fmt.Sprintf("rollappwasm_1234-1-val-0-%s", t.Name()) // Get the container details containerJSON, err := client.ContainerInspect(context.Background(), containerID) @@ -1253,8 +1325,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { err = rollapp1.FullNodes[0].StopContainer(ctx) require.NoError(t, err) - err = rollapp1.FullNodes[0].StartContainer(ctx) - require.NoError(t, err) + _ = rollapp1.FullNodes[0].StartContainer(ctx) rollappHeight, err := rollapp1.Validators[0].Height(ctx) require.NoError(t, err) @@ -1287,15 +1358,10 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { err = rollapp1.Validators[0].StopContainer(ctx) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 10, celestia) - require.NoError(t, err) - - err = rollapp1.Validators[0].StartContainer(ctx) + err = testutil.WaitForBlocks(ctx, 30, celestia) require.NoError(t, err) - isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) - require.NoError(t, err) - require.True(t, isFinalized) + _ = rollapp1.Validators[0].StartContainer(ctx) valHeight, err = rollapp1.Validators[0].Height(ctx) require.NoError(t, err) @@ -1332,11 +1398,11 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappevm_1234-1" dymintTomlOverrides["settlement_gas_prices"] = "0adym" - dymintTomlOverrides["max_idle_time"] = "200ms" + dymintTomlOverrides["max_idle_time"] = "250ms" dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_time"] = "5s" - dymintTomlOverrides["block_time"] = "190ms" - dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["block_time"] = "200ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "true" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -1347,6 +1413,14 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -1354,7 +1428,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -1412,13 +1486,13 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -1499,7 +1573,6 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1521,7 +1594,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -1545,13 +1618,12 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { ic = test.NewSetup(). AddRollUp(dymension, rollapp1) - err = ic.Build(ctx, eRep, test.InterchainBuildOptions{ + _ = ic.Build(ctx, eRep, test.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, SkipPathCreation: true, }, nil, "", nil) - require.NoError(t, err) containerID = fmt.Sprintf("rollappevm_1234-1-val-0-%s", t.Name()) @@ -1609,7 +1681,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { rollappHeight, err := rollapp1.Validators[0].Height(ctx) require.NoError(t, err) - isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) + isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 500) require.NoError(t, err) require.True(t, isFinalized) @@ -1640,8 +1712,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { err = testutil.WaitForBlocks(ctx, 30, celestia) require.NoError(t, err) - err = rollapp1.FullNodes[0].StartContainer(ctx) - require.NoError(t, err) + _ = rollapp1.FullNodes[0].StartContainer(ctx) valHeight, err = rollapp1.Validators[0].Height(ctx) require.NoError(t, err) @@ -1678,11 +1749,11 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappwasm_1234-1" dymintTomlOverrides["settlement_gas_prices"] = "0adym" - dymintTomlOverrides["max_idle_time"] = "200ms" + dymintTomlOverrides["max_idle_time"] = "250ms" dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_time"] = "5s" - dymintTomlOverrides["block_time"] = "190ms" - dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["block_time"] = "200ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "true" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -1693,6 +1764,14 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyWasmGenesisKV := append( + rollappWasmGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + numHubVals := 1 numHubFullNodes := 1 numCelestiaFn := 0 @@ -1700,7 +1779,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" @@ -1758,13 +1837,13 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -1845,7 +1924,6 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1867,7 +1945,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappWasmGenesis(rollappWasmGenesisKV), + ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -1899,7 +1977,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { }, nil, "", nil) require.NoError(t, err) - containerID = fmt.Sprintf("rollappevm_1234-1-val-0-%s", t.Name()) + containerID = fmt.Sprintf("rollappwasm_1234-1-val-0-%s", t.Name()) // Get the container details containerJSON, err := client.ContainerInspect(context.Background(), containerID) @@ -1955,7 +2033,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { rollappHeight, err := rollapp1.Validators[0].Height(ctx) require.NoError(t, err) - isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) + isFinalized, err := dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 500) require.NoError(t, err) require.True(t, isFinalized) @@ -1986,8 +2064,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { err = testutil.WaitForBlocks(ctx, 30, celestia) require.NoError(t, err) - err = rollapp1.FullNodes[0].StartContainer(ctx) - require.NoError(t, err) + _ = rollapp1.FullNodes[0].StartContainer(ctx) valHeight, err = rollapp1.Validators[0].Height(ctx) require.NoError(t, err) diff --git a/tests/fullnode_sync_test.go b/tests/fullnode_sync_test.go index 7922cdc9..bcd9f06d 100644 --- a/tests/fullnode_sync_test.go +++ b/tests/fullnode_sync_test.go @@ -77,6 +77,14 @@ func TestFullnodeSync_EVM(t *testing.T) { numRollAppVals := 1 numRollAppFn := 1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "grpc", + }, + ) + cf := test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{ { Name: "rollapp1", @@ -94,7 +102,7 @@ func TestFullnodeSync_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -192,8 +200,10 @@ func TestFullnodeSync_Wasm(t *testing.T) { dymintTomlOverrides["node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "rollappwasm_1234-1" dymintTomlOverrides["gas_prices"] = "0adym" - dymintTomlOverrides["empty_blocks_max_time"] = "3s" - dymintTomlOverrides["da_layer"] = "grpc" + dymintTomlOverrides["m"] = "0adym" + dymintTomlOverrides["max_idle_time"] = "3s" + dymintTomlOverrides["max_proof_time"] = "500ms" + dymintTomlOverrides["batch_submit_time"] = "50s" dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" dymintTomlOverrides["p2p_blocksync_enabled"] = "false" @@ -204,6 +214,14 @@ func TestFullnodeSync_Wasm(t *testing.T) { numRollAppVals := 1 numRollAppFn := 1 + modifyWasmGenesisKV := append( + rollappWasmGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "grpc", + }, + ) + cf := test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{ { Name: "rollapp1", @@ -221,7 +239,7 @@ func TestFullnodeSync_Wasm(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: nil, + ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -494,7 +512,6 @@ func TestFullnodeSync_Celestia_EVM(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -606,6 +623,14 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyWasmGenesisKV := append( + rollappWasmGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + // Create chain factory with dymension numHubVals := 1 numHubFullNodes := 1 @@ -614,7 +639,7 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" // trustedHash := "\"A62DD37EDF3DFF5A7383C6B5AA2AC619D1F8C8FEB7BA07730E50BBAAC8F2FF0C\"" // sampleFrom := 2395649 @@ -677,13 +702,13 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { }, nil, "", nil) // require.NoError(t, err) - // validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") - // require.NoError(t, err) + validator, err := celestia.Validators[0].AccountKeyBech32(ctx, "validator") + require.NoError(t, err) // Get fund for submit blob - // GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) - // err = testutil.WaitForBlocks(ctx, 10, celestia) - // require.NoError(t, err) + GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 10, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -764,7 +789,6 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -786,7 +810,7 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: nil, + ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -810,7 +834,7 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { ic = test.NewSetup(). AddRollUp(dymension, rollapp1) - err = ic.Build(ctx, eRep, test.InterchainBuildOptions{ + _ = ic.Build(ctx, eRep, test.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, @@ -819,7 +843,6 @@ 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) - require.NoError(t, err) rollappHeight, err := rollapp1.Validators[0].Height(ctx) require.NoError(t, err) diff --git a/tests/hardfork_test.go b/tests/hardfork_test.go index 2a43fd82..9aaa4ec7 100644 --- a/tests/hardfork_test.go +++ b/tests/hardfork_test.go @@ -261,7 +261,7 @@ func TestHardFork_EVM(t *testing.T) { testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, rollappIbcDenom, transferAmount.Sub(bridgingFee)) // get eIbc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) for i, eibcEvent := range eibcEvents { @@ -793,7 +793,7 @@ func TestHardFork_Wasm(t *testing.T) { testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, rollappIbcDenom, transferAmount.Sub(bridgingFee)) // get eIbc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) for i, eibcEvent := range eibcEvents { @@ -1321,7 +1321,7 @@ func TestHardForkRecoverIbcClient_EVM(t *testing.T) { testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, rollappIbcDenom, transferAmount.Sub(bridgingFee)) // get eIbc event - eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false) + eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 10, false) require.NoError(t, err) for i, eibcEvent := range eibcEvents { diff --git a/tests/ibc_grace_period_test.go b/tests/ibc_grace_period_test.go index 2ded3d04..6140910e 100644 --- a/tests/ibc_grace_period_test.go +++ b/tests/ibc_grace_period_test.go @@ -515,7 +515,7 @@ func TestIBCGracePeriodCompliance_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) // Get the IBC denom for urax on Hub @@ -1315,7 +1315,7 @@ func TestDelayedAck_RelayerDown_EVM(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) // Get the IBC denom for urax on Hub @@ -1612,7 +1612,7 @@ func TestDelayedAck_RelayerDown_Wasm(t *testing.T) { require.NoError(t, err) require.True(t, isFinalized) - err = testutil.WaitForBlocks(ctx, 10, dymension, rollapp1) + err = testutil.WaitForBlocks(ctx, 30, dymension, rollapp1) require.NoError(t, err) // Get the IBC denom for urax on Hub diff --git a/tests/sequencer_test.go b/tests/sequencer_test.go index b7a8a231..1667e410 100644 --- a/tests/sequencer_test.go +++ b/tests/sequencer_test.go @@ -16,6 +16,7 @@ import ( "github.com/docker/docker/api/types/strslice" test "github.com/decentrio/rollup-e2e-testing" + "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/celes_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/rollapp/dym_rollapp" @@ -60,10 +61,18 @@ func TestSequencerCelestia_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" // trustedHash := "\"017428B113893E854767E626BC9CF860BDF49C2AC2DF56F3C1B6582B2597AC6E\"" // sampleFrom := 2423882 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + url := "https://api-mocha.celenium.io/v1/block/count" headerKey := "User-Agent" headerValue := "Apidog/1.0.0 (https://apidog.com)" @@ -127,7 +136,9 @@ func TestSequencerCelestia_EVM(t *testing.T) { require.NoError(t, err) // Get fund for submit blob GetFaucet("http://18.184.170.181:3000/api/get-tia", validator) + err = testutil.WaitForBlocks(ctx, 8, celestia) + require.NoError(t, err) err = celestia.GetNode().InitCelestiaDaLightNode(ctx, nodeStore, p2pNetwork, nil) require.NoError(t, err) @@ -213,7 +224,6 @@ func TestSequencerCelestia_EVM(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -235,7 +245,7 @@ func TestSequencerCelestia_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, @@ -331,6 +341,14 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { configFileOverrides1["config/config.toml"] = configTomlOverrides1 + modifyEVMGenesisKV := append( + rollappEVMGenesisKV, + cosmos.GenesisKV{ + Key: "app_state.rollappparams.params.da", + Value: "celestia", + }, + ) + // Create chain factory with dymension numHubVals := 1 numHubFullNodes := 1 @@ -338,7 +356,7 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { numRollAppVals := 1 nodeStore := "/home/celestia/light" p2pNetwork := "mocha-4" - coreIp := "rpc-mocha.pops.one" + coreIp := "mocha-4-consensus.mesa.newmetric.xyz" // trustedHash := "\"017428B113893E854767E626BC9CF860BDF49C2AC2DF56F3C1B6582B2597AC6E\"" // sampleFrom := 2423882 @@ -492,7 +510,6 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { da_config := fmt.Sprintf("{\"base_url\": \"http://test-val-0-%s:26658\", \"timeout\": 60000000000, \"gas_prices\":1.0, \"gas_adjustment\": 1.3, \"namespace_id\": \"%s\", \"auth_token\":\"%s\"}", t.Name(), celestia_namespace_id, celestia_token) configFileOverrides := make(map[string]any) - dymintTomlOverrides["da_layer"] = "celestia" dymintTomlOverrides["namespace_id"] = celestia_namespace_id dymintTomlOverrides["da_config"] = da_config configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -514,7 +531,7 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { TrustingPeriod: "112h", EncodingConfig: encodingConfig(), NoHostMount: false, - ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV), + ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV), ConfigFileOverrides: configFileOverrides, }, NumValidators: &numRollAppVals, diff --git a/tests/setup.go b/tests/setup.go index 02751a4d..d5eec5f0 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -667,7 +667,6 @@ func overridesDymintToml(settlemenLayer, nodeAddress, rollappId, gasPrices, maxI } if includeDaGrpcLayer { - dymintTomlOverrides["da_layer"] = "grpc" dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" } @@ -919,7 +918,7 @@ func getEIbcEventsWithinBlockRange( } fmt.Printf("Dymension height: %d\n", height) - eibcEvents, err := getEibcEventsOfType(dymension.CosmosChain, height-5, height+blockRange, breakOnFirstOccurence) + eibcEvents, err := getEibcEventsOfType(dymension.CosmosChain, height-10, height+blockRange, breakOnFirstOccurence) if err != nil { return nil, fmt.Errorf("error getting events of type 'eibc': %w", err) } @@ -980,7 +979,7 @@ func getEibcEventsOfType(chain *cosmos.CosmosChain, startHeight int64, endHeight for _, tx := range txs { for _, event := range tx.Events { - if event.Type == EventDemandOrderCreated || event.Type == EventDemandOrderFulfilled || event.Type == EventDemandOrderFeeUpdated || event.Type == EventDemandOrderPacketStatusUpdated { + if event.Type == EventDemandOrderCreated { if !contains(eventTypeArray, event) { eventTypeArray = append(eventTypeArray, event) }