diff --git a/go.mod b/go.mod index 189765b6..ca47f619 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-20240822112829-42feba8c484e + github.com/decentrio/rollup-e2e-testing v0.0.0-20240823161656-0a0ac2f7308e github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240717194206-54c0fca5fada github.com/dymensionxyz/dymint v1.2.0-rc01 ) diff --git a/go.sum b/go.sum index 9686da82..a88ce38f 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-20240822112829-42feba8c484e h1:q4A/P+eXO7f0A2Tkn61W+Cr7He4dz7iLcxcrA6k7FAA= -github.com/decentrio/rollup-e2e-testing v0.0.0-20240822112829-42feba8c484e/go.mod h1:QmBrZgZplhtgHRWC0Z7LC7TDsKuC8sDyQvZyXXaqw/c= +github.com/decentrio/rollup-e2e-testing v0.0.0-20240823161656-0a0ac2f7308e h1:5AchH93BGkHKulz+A26kvban4FI2erpEeho73p1uero= +github.com/decentrio/rollup-e2e-testing v0.0.0-20240823161656-0a0ac2f7308e/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/live-tests/eibc_3rd_token_test.go b/live-tests/eibc_3rd_token_test.go index 784c1aca..8ac14406 100644 --- a/live-tests/eibc_3rd_token_test.go +++ b/live-tests/eibc_3rd_token_test.go @@ -184,7 +184,7 @@ func TestEIBC_3rd_Token_RolY_Live(t *testing.T) { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Price, "") == mochaIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) - _, err := cosmos.FullfillDemandOrder(&hub, eibcEvent.ID, marketMaker.Address, dymFee) + _, err := cosmos.FullfillDemandOrder(&hub, eibcEvent.OrderId, marketMaker.Address, dymFee) require.NoError(t, err) } } @@ -342,7 +342,7 @@ func TestEIBC_3rd_Token_Timeout_RolY_Live(t *testing.T) { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Price, "") == mochaIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) - _, err := cosmos.FullfillDemandOrder(&hub, eibcEvent.ID, marketMaker.Address, dymFee) + _, err := cosmos.FullfillDemandOrder(&hub, eibcEvent.OrderId, marketMaker.Address, dymFee) require.NoError(t, err) } } diff --git a/live-tests/eibc_fulfillment_test.go b/live-tests/eibc_fulfillment_test.go index f3295b48..d4d01166 100644 --- a/live-tests/eibc_fulfillment_test.go +++ b/live-tests/eibc_fulfillment_test.go @@ -140,7 +140,7 @@ func TestEIBCFulfillRolX_Live(t *testing.T) { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Price, "") == rollappXIBCDenom && eibcEvent.PacketStatus == "PENDING"{ fmt.Println("EIBC Event:", eibcEvent) - _, err := cosmos.FullfillDemandOrder(&hub, eibcEvent.ID, marketMaker.Address, dymFee) + _, err := cosmos.FullfillDemandOrder(&hub, eibcEvent.OrderId, marketMaker.Address, dymFee) require.NoError(t, err) } } diff --git a/live-tests/setup.go b/live-tests/setup.go index e39dcb4b..f3f73532 100644 --- a/live-tests/setup.go +++ b/live-tests/setup.go @@ -88,7 +88,7 @@ func encodingConfig() *util.TestEncodingConfig { } func getEibcEventFromTx(t *testing.T, dymension *cosmos.CosmosChain, txResp types.TxResponse) *dymensiontesting.EibcEvent { - const evType = "eibc" + const evType = "dymensionxyz.dymension.eibc.EventDemandOrderFulfilled" events := txResp.Events var ( @@ -100,10 +100,10 @@ func getEibcEventFromTx(t *testing.T, dymension *cosmos.CosmosChain, txResp type ) eibcEvent := new(dymensiontesting.EibcEvent) - eibcEvent.ID = id + eibcEvent.OrderId = id eibcEvent.Price = price eibcEvent.Fee = fee - checkFulfilled, err := strconv.ParseBool(isFulfilled) + checkFulfilled, err := strconv.ParseBool(isFulfilled) if err != nil { require.NoError(t, err) return nil diff --git a/tests/admc_test.go b/tests/admc_test.go index 6304e94a..574d838f 100644 --- a/tests/admc_test.go +++ b/tests/admc_test.go @@ -35,6 +35,7 @@ func TestADMC_Originates_HubtoRA_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -200,6 +201,7 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -421,6 +423,7 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -650,6 +653,7 @@ func TestADMC_Originates_HubtoRA_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -815,6 +819,7 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -1033,6 +1038,7 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -1258,6 +1264,7 @@ func TestADMC_MetaData_NotFound_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1453,6 +1460,7 @@ func TestADMC_MetaData_NotFound_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides diff --git a/tests/automated_denommetadata_test.go b/tests/automated_denommetadata_test.go index 3320c732..53fcbf75 100644 --- a/tests/automated_denommetadata_test.go +++ b/tests/automated_denommetadata_test.go @@ -1276,6 +1276,7 @@ func TestADMC_Hub_to_RA_Migrate_Dym_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -1466,6 +1467,7 @@ func TestADMC_Hub_to_RA_Migrate_Dym_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension diff --git a/tests/disconnection_test.go b/tests/disconnection_test.go index 686985b2..c01aacb2 100644 --- a/tests/disconnection_test.go +++ b/tests/disconnection_test.go @@ -126,6 +126,7 @@ func TestDisconnection_EVM(t *testing.T) { dymintTomlOverrides["max_supported_batch_skew"] = "1" dymintTomlOverrides["batch_acceptance_attempts"] = "1" dymintTomlOverrides["batch_acceptance_timeout"] = "5s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -251,6 +252,7 @@ func TestDisconnection_Wasm(t *testing.T) { dymintTomlOverrides["max_supported_batch_skew"] = "1" dymintTomlOverrides["batch_acceptance_attempts"] = "1" dymintTomlOverrides["batch_acceptance_timeout"] = "5s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension diff --git a/tests/eibc_ack_error_test.go b/tests/eibc_ack_error_test.go index 735e7ddf..20396ec8 100644 --- a/tests/eibc_ack_error_test.go +++ b/tests/eibc_ack_error_test.go @@ -390,7 +390,7 @@ func TestEIBC_AckError_Dym_EVM(t *testing.T) { require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -757,7 +757,7 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) { require.Equal(t, eibcEvents[len(eibcEvents)-1].PacketStatus, "PENDING") // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1194,7 +1194,7 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) { require.Equal(t, eibcEvents[len(eibcEvents)-1].PacketStatus, "PENDING") // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1589,7 +1589,7 @@ func TestEIBC_AckError_Dym_Wasm(t *testing.T) { require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1952,7 +1952,7 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) { require.Equal(t, eibcEvents[len(eibcEvents)-1].PacketStatus, "PENDING") // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -2341,7 +2341,7 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) { require.Equal(t, eibcEvents[len(eibcEvents)-1].PacketStatus, "PENDING") // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) diff --git a/tests/eibc_corrupted_memo_test.go b/tests/eibc_corrupted_memo_test.go index fc1563ce..01bf2324 100644 --- a/tests/eibc_corrupted_memo_test.go +++ b/tests/eibc_corrupted_memo_test.go @@ -38,6 +38,7 @@ func TestEIBCCorruptedMemoNegative_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides diff --git a/tests/eibc_fee_market_test.go b/tests/eibc_fee_market_test.go index 21cdf1a0..65fa860a 100644 --- a/tests/eibc_fee_market_test.go +++ b/tests/eibc_fee_market_test.go @@ -272,9 +272,9 @@ func TestEIBCFulfillAlreadyFulfilledDemand_EVM(t *testing.T) { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Fee, "") == rollappIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvent.ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvent.OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) - demand_order_id = eibcEvent.ID + demand_order_id = eibcEvent.OrderId fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { @@ -587,9 +587,9 @@ func TestEIBCAlreadyFulfilledDemand_Wasm(t *testing.T) { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Fee, "") == rollappIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvent.ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvent.OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) - demand_order_id = eibcEvent.ID + demand_order_id = eibcEvent.OrderId fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { @@ -887,7 +887,7 @@ func TestEIBCUnallowedSigner_EVM(t *testing.T) { if re.ReplaceAllString(eibcEvent.Fee, "") == rollappIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) // attempt to update the fee amount required by demand order with an unallowed signer - txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvent.ID, marketMakerAddr, eibcFee.MulRaw(2)) + txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvent.OrderId, marketMakerAddr, eibcFee.MulRaw(2)) require.NoError(t, err) res, err := dymension.GetTransaction(txhash) require.NoError(t, err) @@ -1147,7 +1147,7 @@ func TestEIBCUnallowedSigner_Wasm(t *testing.T) { if re.ReplaceAllString(eibcEvent.Fee, "") == rollappIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) // attempt to update the fee amount required by demand order with an unallowed signer - txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvent.ID, marketMakerAddr, eibcFee.MulRaw(2)) + txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvent.OrderId, marketMakerAddr, eibcFee.MulRaw(2)) require.NoError(t, err) res, err := dymension.GetTransaction(txhash) require.NoError(t, err) diff --git a/tests/eibc_fee_test.go b/tests/eibc_fee_test.go index 34a031e8..513c0f84 100644 --- a/tests/eibc_fee_test.go +++ b/tests/eibc_fee_test.go @@ -38,6 +38,8 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" + dymintTomlOverrides["block_time"] = "2s" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -210,6 +212,7 @@ func TestEIBCFeeTooHigh_EVM(t *testing.T) { // get eIbc event eibcEvents, _ := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false) + fmt.Println(eibcEvents) require.True(t, len(eibcEvents) == 1) // verify there were no eibc events registered on the hub isFinalized, err = dymension.WaitUntilRollappHeightIsFinalized(ctx, rollapp1.GetChainID(), rollappHeight, 300) diff --git a/tests/eibc_feemarket_test.go b/tests/eibc_feemarket_test.go index 12ec7431..cde27d43 100644 --- a/tests/eibc_feemarket_test.go +++ b/tests/eibc_feemarket_test.go @@ -268,14 +268,14 @@ func TestEIBC_Fee_Market_Success_EVM(t *testing.T) { require.NoError(t, err) fmt.Println("Event:", eibcEvents[1]) - _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].ID, dymensionUserAddr, math.NewInt(100_000)) + _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].OrderId, dymensionUserAddr, math.NewInt(100_000)) require.NoError(t, err) err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, math.NewInt(100_000)) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, math.NewInt(100_000)) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -579,14 +579,14 @@ func TestEIBC_Fee_Market_Success_Wasm(t *testing.T) { require.NoError(t, err) fmt.Println("Event:", eibcEvents[1]) - _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].ID, dymensionUserAddr, eibcFee.MulRaw(2)) + _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].OrderId, dymensionUserAddr, eibcFee.MulRaw(2)) require.NoError(t, err) err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee.MulRaw(2)) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee.MulRaw(2)) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -876,14 +876,14 @@ func TestEIBC_Fee_Market_Auto_Created_EVM(t *testing.T) { require.NoError(t, err) fmt.Println("Event:", eibcEvents[1]) - _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].ID, dymensionUserAddr, eibcFee) + _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].OrderId, dymensionUserAddr, eibcFee) require.NoError(t, err) err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1182,14 +1182,14 @@ func TestEIBC_Fee_Market_Auto_Created_Wasm(t *testing.T) { require.NoError(t, err) fmt.Println("Event:", eibcEvents[1]) - _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].ID, dymensionUserAddr, eibcFee.MulRaw(2)) + _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[1].OrderId, dymensionUserAddr, eibcFee.MulRaw(2)) require.NoError(t, err) err = testutil.WaitForBlocks(ctx, 5, dymension) require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee.MulRaw(2)) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee.MulRaw(2)) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1249,6 +1249,7 @@ func TestEIBCUpdateOnAckErrAndTimeout_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1442,11 +1443,11 @@ func TestEIBCUpdateOnAckErrAndTimeout_EVM(t *testing.T) { require.Equal(t, eibcEvents[0].Fee, fmt.Sprintf("%s%s", globalEIbcFee, dymension.Config().Denom)) // modify demand order with new fee - _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[0].ID, dymensionUserAddr, globalEIbcFee.Mul(math.NewInt(2))) + _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[0].OrderId, dymensionUserAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1700,11 +1701,11 @@ func TestEIBCUpdateOnAckErrAndTimeout_Wasm(t *testing.T) { require.Equal(t, eibcEvents[0].Fee, fmt.Sprintf("%s%s", globalEIbcFee, dymension.Config().Denom)) // modify demand order with new fee - _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[0].ID, dymensionUserAddr, globalEIbcFee.Mul(math.NewInt(2))) + _, err = dymension.UpdateDemandOrder(ctx, eibcEvents[0].OrderId, dymensionUserAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1768,6 +1769,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1960,7 +1962,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) { require.Equal(t, eibcEvents[0].Fee, fmt.Sprintf("%s%s", globalEIbcFee, dymension.Config().Denom)) // modify demand order with new fee - txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) + txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) res, err := dymension.GetTransaction(txhash) @@ -2182,7 +2184,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) { require.Equal(t, eibcEvents[0].Fee, fmt.Sprintf("%s%s", globalEIbcFee, dymension.Config().Denom)) // modify demand order with new fee - txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) + txhash, err := dymension.UpdateDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee.Mul(math.NewInt(2))) require.NoError(t, err) res, err := dymension.GetTransaction(txhash) diff --git a/tests/eibc_fulfillment_test.go b/tests/eibc_fulfillment_test.go index 2655bcfa..46344491 100644 --- a/tests/eibc_fulfillment_test.go +++ b/tests/eibc_fulfillment_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "regexp" - "strconv" "testing" "cosmossdk.io/math" @@ -13,11 +12,9 @@ import ( "go.uber.org/zap/zaptest" test "github.com/decentrio/rollup-e2e-testing" - "github.com/decentrio/rollup-e2e-testing/blockdb" "github.com/decentrio/rollup-e2e-testing/cosmos" "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" "github.com/decentrio/rollup-e2e-testing/cosmos/rollapp/dym_rollapp" - dymensiontesting "github.com/decentrio/rollup-e2e-testing/dymension" "github.com/decentrio/rollup-e2e-testing/ibc" "github.com/decentrio/rollup-e2e-testing/relayer" "github.com/decentrio/rollup-e2e-testing/testreporter" @@ -338,7 +335,7 @@ func TestEIBCFulfillOnOneRollApp_EVM(t *testing.T) { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Price, "") == rollappIBCDenom && eibcEvent.PacketStatus == "PENDING" { fmt.Println("EIBC Event:", eibcEvent) - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvent.ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvent.OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -723,7 +720,7 @@ func TestEIBCFulfillOnOneRollApp_Wasm(t *testing.T) { for _, eibcEvent := range eibcEvents { re := regexp.MustCompile(`^\d+`) if re.ReplaceAllString(eibcEvent.Price, "") == rollappIBCDenom && eibcEvent.PacketStatus == "PENDING" { - _, err := dymension.FullfillDemandOrder(ctx, eibcEvent.ID, marketMakerAddr, eibcFee) + _, err := dymension.FullfillDemandOrder(ctx, eibcEvent.OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { @@ -1048,7 +1045,7 @@ func TestEIBCFulfillment_EVM(t *testing.T) { fmt.Println("Event:", eibcEvents[1]) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1353,7 +1350,7 @@ func TestEIBCFulfillment_Wasm(t *testing.T) { fmt.Println("Event:", eibcEvents[1]) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1692,7 +1689,7 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) { require.Equal(t, eibcEvents[len(eibcEvents)-1].PacketStatus, "PENDING") // fulfill demand order 1 - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1714,7 +1711,7 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) { require.Equal(t, eibcEvents[len(eibcEvents)-1].PacketStatus, "PENDING") // fulfill demand order 2 - txhash, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMakerAddr, eibcFee) + txhash, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) eibcEvent = getEibcEventFromTx(t, dymension, txhash) @@ -2120,7 +2117,7 @@ func TestEIBCFulfillment_ThirdParty_EVM(t *testing.T) { fmt.Println("Event:", eibcEvents[1]) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -2523,7 +2520,7 @@ func TestEIBCFulfillment_ThirdParty_Wasm(t *testing.T) { fmt.Println("Event:", eibcEvents[1]) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -3089,109 +3086,3 @@ func TestEIBCFulfillment_ignore_hub_to_RA_Wasm(t *testing.T) { }, ) } - -func getEibcEventFromTx(t *testing.T, dymension *dym_hub.DymHub, txhash string) *dymensiontesting.EibcEvent { - txResp, err := dymension.GetTransaction(txhash) - if err != nil { - require.NoError(t, err) - return nil - } - - const evType = "eibc" - events := txResp.Events - - var ( - id, _ = cosmos.AttributeValue(events, evType, "id") - price, _ = cosmos.AttributeValue(events, evType, "price") - fee, _ = cosmos.AttributeValue(events, evType, "fee") - isFulfilled, _ = cosmos.AttributeValue(events, evType, "is_fulfilled") - packetStatus, _ = cosmos.AttributeValue(events, evType, "packet_status") - ) - - eibcEvent := new(dymensiontesting.EibcEvent) - eibcEvent.ID = id - eibcEvent.Price = price - eibcEvent.Fee = fee - println("check datra is fulfilled: ", isFulfilled) - eibcEvent.IsFulfilled, err = strconv.ParseBool(isFulfilled) - if err != nil { - require.NoError(t, err) - return nil - } - eibcEvent.PacketStatus = packetStatus - - return eibcEvent -} - -func getEIbcEventsWithinBlockRange( - ctx context.Context, - dymension *dym_hub.DymHub, - blockRange int64, - breakOnFirstOccurence bool, -) ([]dymensiontesting.EibcEvent, error) { - var eibcEventsArray []dymensiontesting.EibcEvent - - height, err := dymension.Height(ctx) - if err != nil { - return nil, fmt.Errorf("failed to get Dymension height: %w", err) - } - fmt.Printf("Dymension height: %d\n", height) - - err = testutil.WaitForBlocks(ctx, int(blockRange), dymension) - if err != nil { - return nil, fmt.Errorf("error waiting for blocks: %w", err) - } - - eibcEvents, err := getEventsOfType(dymension.CosmosChain, height-5, height+blockRange, "eibc", breakOnFirstOccurence) - if err != nil { - return nil, fmt.Errorf("error getting events of type 'eibc': %w", err) - } - - if len(eibcEvents) == 0 { - return nil, fmt.Errorf("There wasn't a single 'eibc' event registered within the specified block range on the hub") - } - - for _, event := range eibcEvents { - eibcEvent, err := dymensiontesting.MapToEibcEvent(event) - if err != nil { - return nil, fmt.Errorf("error mapping to EibcEvent: %w", err) - } - eibcEventsArray = append(eibcEventsArray, eibcEvent) - } - - return eibcEventsArray, nil -} - -func getEventsOfType(chain *cosmos.CosmosChain, startHeight int64, endHeight int64, eventType string, breakOnFirstOccurence bool) ([]blockdb.Event, error) { - var eventTypeArray []blockdb.Event - shouldReturn := false - - for height := startHeight; height <= endHeight && !shouldReturn; height++ { - txs, err := chain.FindTxs(context.Background(), height) - if err != nil { - return nil, fmt.Errorf("error fetching transactions at height %d: %w", height, err) - } - - for _, tx := range txs { - for _, event := range tx.Events { - if event.Type == eventType { - eventTypeArray = append(eventTypeArray, event) - if breakOnFirstOccurence { - shouldReturn = true - fmt.Printf("%s event found on block height: %d", eventType, height) - break - } - } - } - if shouldReturn { - break - } - } - } - - return eventTypeArray, nil -} - -func BuildEIbcMemo(eibcFee math.Int) string { - return fmt.Sprintf(`{"eibc": {"fee": "%s"}}`, eibcFee.String()) -} diff --git a/tests/eibc_invariant_test.go b/tests/eibc_invariant_test.go index 1e591860..7eb16a99 100644 --- a/tests/eibc_invariant_test.go +++ b/tests/eibc_invariant_test.go @@ -300,14 +300,14 @@ func TestEIBCInvariant_EVM(t *testing.T) { require.NoError(t, err) // fulfill 2 demand order - _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { // fmt.Println("After order fulfillment:", eibcEvent) // } - _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[2].ID, marketMakerAddr, eibcFee) + _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[2].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) // eibcEvent = getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { @@ -648,14 +648,14 @@ func TestEIBCInvariant_Wasm(t *testing.T) { require.NoError(t, err) // fulfill 2 demand order - _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[1].ID, marketMakerAddr, eibcFee) + _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { // fmt.Println("After order fulfillment:", eibcEvent) // } - _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[2].ID, marketMakerAddr, eibcFee) + _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[2].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) // eibcEvent = getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { diff --git a/tests/eibc_nobalance_test.go b/tests/eibc_nobalance_test.go index 820cc932..80405a14 100644 --- a/tests/eibc_nobalance_test.go +++ b/tests/eibc_nobalance_test.go @@ -39,6 +39,7 @@ func TestEIBCNoBalanceToFulfillOrder_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -199,7 +200,7 @@ func TestEIBCNoBalanceToFulfillOrder_EVM(t *testing.T) { fmt.Println("Event:", eibcEvents[0]) // attempt to fulfill demand order without having required denom balance - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, eibcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, eibcFee) require.NoError(t, err) fmt.Println(txhash) txData, err := dymension.GetTransaction(txhash) diff --git a/tests/eibc_timeout_test.go b/tests/eibc_timeout_test.go index 1b62d5f4..8f08683c 100644 --- a/tests/eibc_timeout_test.go +++ b/tests/eibc_timeout_test.go @@ -38,6 +38,7 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -230,7 +231,7 @@ func TestEIBCTimeoutDymToRollapp_EVM(t *testing.T) { require.Equal(t, eibcEvents[0].Fee, fmt.Sprintf("%s%s", globalEIbcFee, dymension.Config().Denom)) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -624,7 +625,7 @@ func TestEIBCTimeoutFulFillDymToRollapp_EVM(t *testing.T) { require.Equal(t, eibcEvents[0].Fee, fmt.Sprintf("%s%s", globalEIbcFee, gaiaIBCDenom)) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee) require.NoError(t, err) fmt.Println(txhash) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) @@ -1011,7 +1012,7 @@ func TestEIBCTimeoutFulFillDymToRollapp_Wasm(t *testing.T) { require.NoError(t, err) // fulfill demand order - txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].ID, marketMakerAddr, globalEIbcFee) + txhash, err := dymension.FullfillDemandOrder(ctx, eibcEvents[0].OrderId, marketMakerAddr, globalEIbcFee) // Pushing event assertion later in the test so that fulfill demand order can always be fulfilled 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 4ecad76f..84dd9756 100644 --- a/tests/frozen_test.go +++ b/tests/frozen_test.go @@ -1186,6 +1186,7 @@ func TestOtherRollappNotAffected_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -1198,6 +1199,7 @@ func TestOtherRollappNotAffected_Wasm(t *testing.T) { dymintTomlOverrides2["max_proof_time"] = "500ms" dymintTomlOverrides2["max_idle_time"] = "3s" dymintTomlOverrides2["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides2["config/dymint.toml"] = dymintTomlOverrides2 // Create chain factory with dymension diff --git a/tests/fullnode_sync_gossip_test.go b/tests/fullnode_sync_gossip_test.go index dbca76c9..2510b06e 100644 --- a/tests/fullnode_sync_gossip_test.go +++ b/tests/fullnode_sync_gossip_test.go @@ -43,6 +43,7 @@ func TestSync_Celes_Rt_Gossip_EVM(t *testing.T) { dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_max_time"] = "5s" dymintTomlOverrides["block_time"] = "190ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -357,6 +358,7 @@ func TestSync_Celes_Rt_Gossip_Wasm(t *testing.T) { dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_max_time"] = "80s" dymintTomlOverrides["block_time"] = "190ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -633,6 +635,7 @@ func TestSync_Sqc_Disconnect_Gossip_EVM(t *testing.T) { dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_max_time"] = "5s" dymintTomlOverrides["block_time"] = "190ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -980,6 +983,7 @@ func TestSync_Sqc_Disconnect_Gossip_Wasm(t *testing.T) { dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_max_time"] = "5s" dymintTomlOverrides["block_time"] = "190ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -1327,6 +1331,7 @@ func TestSync_Fullnode_Disconnect_Gossip_EVM(t *testing.T) { dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_max_time"] = "5s" dymintTomlOverrides["block_time"] = "190ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -1671,6 +1676,7 @@ func TestSync_Fullnode_Disconnect_Gossip_Wasm(t *testing.T) { dymintTomlOverrides["max_proof_time"] = "150ms" dymintTomlOverrides["batch_submit_max_time"] = "5s" dymintTomlOverrides["block_time"] = "190ms" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) diff --git a/tests/fullnode_sync_test.go b/tests/fullnode_sync_test.go index c05e82b2..dc88307d 100644 --- a/tests/fullnode_sync_test.go +++ b/tests/fullnode_sync_test.go @@ -194,6 +194,7 @@ func TestFullnodeSync_Wasm(t *testing.T) { dymintTomlOverrides["empty_blocks_max_time"] = "3s" dymintTomlOverrides["da_layer"] = "grpc" dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -317,6 +318,7 @@ func TestFullnodeSync_Celestia_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "80s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -586,6 +588,7 @@ func TestFullnodeSync_Celestia_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "80s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) diff --git a/tests/genesis_transfer_test.go b/tests/genesis_transfer_test.go index ef29a13c..32b183b9 100644 --- a/tests/genesis_transfer_test.go +++ b/tests/genesis_transfer_test.go @@ -35,6 +35,7 @@ func TestGenesisTransferBridgeBlocking_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -184,6 +185,7 @@ func TestGenesisTransferBridgeBlocking_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -333,6 +335,7 @@ func TestGenesisTransferConnectionBlock_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -491,6 +494,7 @@ func TestGenesisTransferConnectionBlock_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension diff --git a/tests/ibc_timeout_test.go b/tests/ibc_timeout_test.go index fd03924c..a0402482 100644 --- a/tests/ibc_timeout_test.go +++ b/tests/ibc_timeout_test.go @@ -38,6 +38,7 @@ func TestIBCTransferTimeout_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "30s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -286,6 +287,7 @@ func TestIBCTransferTimeout_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "30s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides diff --git a/tests/ibc_transfer_test.go b/tests/ibc_transfer_test.go index af810bc6..3e988680 100644 --- a/tests/ibc_transfer_test.go +++ b/tests/ibc_transfer_test.go @@ -34,6 +34,7 @@ func TestSpinUp(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -118,6 +119,7 @@ func TestIBCTransferSuccess_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -618,6 +620,7 @@ func TestGenesisIBCTransferReservedMemo_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension diff --git a/tests/rollapp_upgrade_test.go b/tests/rollapp_upgrade_test.go index a2124c9f..233d1e0e 100644 --- a/tests/rollapp_upgrade_test.go +++ b/tests/rollapp_upgrade_test.go @@ -36,6 +36,7 @@ func TestRollappUpgradeNonStateBreaking_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -242,6 +243,7 @@ func TestRollappUpgradeNonStateBreaking_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -451,6 +453,7 @@ func TestRollapp_EVM_Upgrade(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension @@ -703,6 +706,7 @@ func TestRollapp_Wasm_Upgrade(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides // Create chain factory with dymension diff --git a/tests/sequencer_test.go b/tests/sequencer_test.go index 6e2d922f..8f68ea75 100644 --- a/tests/sequencer_test.go +++ b/tests/sequencer_test.go @@ -42,6 +42,7 @@ func TestSequencerCelestia_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "80s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) @@ -319,6 +320,7 @@ func TestSequencerHubDisconnection_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "30s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides1 := make(map[string]any) configTomlOverrides1 := make(testutil.Toml) diff --git a/tests/setup.go b/tests/setup.go index d9449723..136079c8 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -8,6 +8,7 @@ import ( "io" "net/http" "os" + "strconv" "testing" "time" @@ -16,7 +17,10 @@ import ( "cosmossdk.io/math" util "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/decentrio/rollup-e2e-testing/blockdb" "github.com/decentrio/rollup-e2e-testing/cosmos" + "github.com/decentrio/rollup-e2e-testing/cosmos/hub/dym_hub" + dymensiontesting "github.com/decentrio/rollup-e2e-testing/dymension" "github.com/decentrio/rollup-e2e-testing/ibc" "github.com/decentrio/rollup-e2e-testing/testreporter" "github.com/decentrio/rollup-e2e-testing/testutil" @@ -83,6 +87,10 @@ const ( ibcPath = "dymension-demo" anotherIbcPath = "dymension-demo2" BLOCK_FINALITY_PERIOD = 30 + EventDemandOrderCreated = "dymensionxyz.dymension.eibc.EventDemandOrderCreated" + EventDemandOrderFulfilled = "dymensionxyz.dymension.eibc.EventDemandOrderFulfilled" + EventDemandOrderFeeUpdated = "dymensionxyz.dymension.eibc.EventDemandOrderFeeUpdated" + EventDemandOrderPacketStatusUpdated = "dymensionxyz.dymension.eibc.EventDemandOrderPacketStatusUpdated" ) var ( @@ -635,6 +643,7 @@ func overridesDymintToml(settlemenLayer, nodeAddress, rollappId, gasPrices, maxI dymintTomlOverrides["max_idle_time"] = maxIdleTime dymintTomlOverrides["max_proof_time"] = maxProofTime dymintTomlOverrides["batch_submit_max_time"] = batchSubmitMaxTime + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -829,3 +838,108 @@ func GetLatestBlockHeight(url, headerKey, headerValue string) (string, error) { } return string(body), nil } + +func getEibcEventFromTx(t *testing.T, dymension *dym_hub.DymHub, txhash string) *dymensiontesting.EibcEvent { + txResp, err := dymension.GetTransaction(txhash) + if err != nil { + require.NoError(t, err) + return nil + } + + events := txResp.Events + + var ( + id, _ = cosmos.AttributeValue(events, EventDemandOrderFulfilled, "order_id") + price, _ = cosmos.AttributeValue(events, EventDemandOrderFulfilled, "price") + fee, _ = cosmos.AttributeValue(events, EventDemandOrderFulfilled, "fee") + isFulfilled, _ = cosmos.AttributeValue(events, EventDemandOrderFulfilled, "is_fulfilled") + packetStatus, _ = cosmos.AttributeValue(events, EventDemandOrderFulfilled, "packet_status") + ) + + eibcEvent := new(dymensiontesting.EibcEvent) + eibcEvent.OrderId = id + eibcEvent.Price = price + eibcEvent.Fee = fee + eibcEvent.IsFulfilled, err = strconv.ParseBool(isFulfilled) + if err != nil { + require.NoError(t, err) + return nil + } + eibcEvent.PacketStatus = packetStatus + + return eibcEvent +} + +func getEIbcEventsWithinBlockRange( + ctx context.Context, + dymension *dym_hub.DymHub, + blockRange int64, + breakOnFirstOccurence bool, +) ([]dymensiontesting.EibcEvent, error) { + var eibcEventsArray []dymensiontesting.EibcEvent + + height, err := dymension.Height(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get Dymension height: %w", err) + } + fmt.Printf("Dymension height: %d\n", height) + + err = testutil.WaitForBlocks(ctx, int(blockRange), dymension) + if err != nil { + return nil, fmt.Errorf("error waiting for blocks: %w", err) + } + + eibcEvents, err := getEibcEventsOfType(dymension.CosmosChain, height-5, height+blockRange, breakOnFirstOccurence) + if err != nil { + return nil, fmt.Errorf("error getting events of type 'eibc': %w", err) + } + + if len(eibcEvents) == 0 { + return nil, fmt.Errorf("There wasn't a single 'eibc' event registered within the specified block range on the hub") + } + + for _, event := range eibcEvents { + eibcEvent, err := dymensiontesting.MapToEibcEvent(event) + if err != nil { + println("go to here man") + return nil, fmt.Errorf("error mapping to EibcEvent: %w", err) + } + eibcEventsArray = append(eibcEventsArray, eibcEvent) + } + + return eibcEventsArray, nil +} + +func getEibcEventsOfType(chain *cosmos.CosmosChain, startHeight int64, endHeight int64, breakOnFirstOccurence bool) ([]blockdb.Event, error) { + var eventTypeArray []blockdb.Event + shouldReturn := false + + for height := startHeight; height <= endHeight && !shouldReturn; height++ { + txs, err := chain.FindTxs(context.Background(), height) + if err != nil { + return nil, fmt.Errorf("error fetching transactions at height %d: %w", height, err) + } + + for _, tx := range txs { + for _, event := range tx.Events { + if event.Type == EventDemandOrderCreated || event.Type == EventDemandOrderFulfilled || event.Type == EventDemandOrderFeeUpdated || event.Type == EventDemandOrderPacketStatusUpdated { + eventTypeArray = append(eventTypeArray, event) + if breakOnFirstOccurence { + shouldReturn = true + fmt.Printf("%s event found on block height: %d", event.Type, height) + break + } + } + } + if shouldReturn { + break + } + } + } + + return eventTypeArray, nil +} + +func BuildEIbcMemo(eibcFee math.Int) string { + return fmt.Sprintf(`{"eibc": {"fee": "%s"}}`, eibcFee.String()) +} diff --git a/tests/tx_batch_finalization_test.go b/tests/tx_batch_finalization_test.go index 35273e6d..cb7355ae 100644 --- a/tests/tx_batch_finalization_test.go +++ b/tests/tx_batch_finalization_test.go @@ -43,6 +43,7 @@ func TestBatchFinalization_EVM(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" modifyGenesisKV := append( dymensionGenesisKV, @@ -181,6 +182,7 @@ func TestBatchFinalization_Wasm(t *testing.T) { dymintTomlOverrides["max_idle_time"] = "3s" dymintTomlOverrides["max_proof_time"] = "500ms" dymintTomlOverrides["batch_submit_max_time"] = "100s" + dymintTomlOverrides["p2p_blocksync_enabled"] = "false" modifyGenesisKV := append( dymensionGenesisKV, diff --git a/tests/upgrade_hub_test.go b/tests/upgrade_hub_test.go index 7b0554dd..75346e2e 100644 --- a/tests/upgrade_hub_test.go +++ b/tests/upgrade_hub_test.go @@ -422,7 +422,7 @@ func TestHubUpgrade(t *testing.T) { require.NoError(t, err) fmt.Println("Events:", eibcEvents) - _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMaker1Addr, eibcFee) + _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMaker1Addr, eibcFee) require.NoError(t, err) // eibcEvent := getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil { @@ -534,7 +534,7 @@ func TestHubUpgrade(t *testing.T) { require.NoError(t, err) fmt.Println("Events:", eibcEvents) - _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].ID, marketMaker2Addr, eibcFee) + _, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-1].OrderId, marketMaker2Addr, eibcFee) require.NoError(t, err) // eibcEvent = getEibcEventFromTx(t, dymension, txhash) // if eibcEvent != nil {