Skip to content

Commit

Permalink
fix(tests): override p2p_blocksync_enable = false (#392)
Browse files Browse the repository at this point in the history
Co-authored-by: ThanhNhann <[email protected]>
  • Loading branch information
anhductn2001 and ThanhNhann authored Aug 26, 2024
1 parent 0412235 commit fc020a7
Show file tree
Hide file tree
Showing 28 changed files with 215 additions and 162 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ replace (

require (
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869
github.com/decentrio/rollup-e2e-testing v0.0.0-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
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U=
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869 h1:qWpUYGOsrSC+1Vmd2TjhbsSpntvvx9PsX3AoeMunFxc=
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869/go.mod h1:HZNYnPwmSxkwTPjSD5yolauc1Vx1ZzKL4FFMxTq4H5Y=
github.com/decentrio/rollup-e2e-testing v0.0.0-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=
Expand Down
4 changes: 2 additions & 2 deletions live-tests/eibc_3rd_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion live-tests/eibc_fulfillment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
6 changes: 3 additions & 3 deletions live-tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/admc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions tests/automated_denommetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/disconnection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tests/eibc_ack_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/eibc_corrupted_memo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions tests/eibc_fee_market_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions tests/eibc_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit fc020a7

Please sign in to comment.