Skip to content

Commit

Permalink
rm genesis transfer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anhductn2001 committed Sep 16, 2024
1 parent f62f09c commit a907ed0
Show file tree
Hide file tree
Showing 6 changed files with 680 additions and 648 deletions.
8 changes: 4 additions & 4 deletions tests/admc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func TestADMC_Migrate_Empty_User_Memo_EVM(t *testing.T) {

resp, err := dymension.GetNode().QueryAllDenomMetadata(ctx)
require.NoError(t, err)
require.Equal(t, 2, len(resp.Metadatas))
require.Equal(t, 1, len(resp.Metadatas))

// Send a normal ibc tx from RA -> Hub
transferData := ibc.WalletData{
Expand Down Expand Up @@ -532,7 +532,7 @@ func TestADMC_Migrate_With_User_Memo_EVM(t *testing.T) {

resp, err := dymension.GetNode().QueryAllDenomMetadata(ctx)
require.NoError(t, err)
require.Equal(t, 2, len(resp.Metadatas))
require.Equal(t, 1, len(resp.Metadatas))

// Send a normal ibc tx from RA -> Hub
transferData := ibc.WalletData{
Expand Down Expand Up @@ -937,7 +937,7 @@ func TestADMC_Migrate_Empty_User_Memo_Wasm(t *testing.T) {

resp, err := dymension.GetNode().QueryAllDenomMetadata(ctx)
require.NoError(t, err)
require.Equal(t, 2, len(resp.Metadatas))
require.Equal(t, 1, len(resp.Metadatas))

// Send a normal ibc tx from RA -> Hub
transferData := ibc.WalletData{
Expand Down Expand Up @@ -1162,7 +1162,7 @@ func TestADMC_Migrate_With_User_Memo_Wasm(t *testing.T) {

resp, err := dymension.GetNode().QueryAllDenomMetadata(ctx)
require.NoError(t, err)
require.Equal(t, 2, len(resp.Metadatas))
require.Equal(t, 1, len(resp.Metadatas))

// Send a normal ibc tx from RA -> Hub
transferData := ibc.WalletData{
Expand Down
16 changes: 16 additions & 0 deletions tests/eibc_ack_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ func TestEIBC_AckError_RA_Token_EVM(t *testing.T) {
// market maker needs to have funds on the hub first to be able to fulfill upcoming demand order
err = dymension.Validators[0].SendFunds(ctx, "validator", transferData)
require.NoError(t, err)

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

testutil.AssertBalance(t, ctx, dymension, marketMakerAddr, rollappIBCDenom, transferAmount)
// end of preconditions

Expand Down Expand Up @@ -1098,6 +1102,10 @@ func TestEIBC_AckError_3rd_Party_Token_EVM(t *testing.T) {
// market maker needs to have funds on the hub first to be able to fulfill upcoming demand order
err = dymension.Validators[0].SendFunds(ctx, "validator", transferData)
require.NoError(t, err)

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

testutil.AssertBalance(t, ctx, dymension, marketMakerAddr, thirdPartyDenom, transferAmount)
// user from rollapp1 should have funds to be able to make the ibc transfer transaction
transferData = ibc.WalletData{
Expand Down Expand Up @@ -1888,6 +1896,10 @@ func TestEIBC_AckError_RA_Token_Wasm(t *testing.T) {
// market maker needs to have funds on the hub first to be able to fulfill upcoming demand order
err = dymension.Validators[0].SendFunds(ctx, "validator", transferData)
require.NoError(t, err)

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

testutil.AssertBalance(t, ctx, dymension, marketMakerAddr, rollappIBCDenom, transferAmount)
// end of preconditions

Expand Down Expand Up @@ -2253,6 +2265,10 @@ func TestEIBC_AckError_3rd_Party_Token_Wasm(t *testing.T) {
// market maker needs to have funds on the hub first to be able to fulfill upcoming demand order
err = dymension.Validators[0].SendFunds(ctx, "validator", transferData)
require.NoError(t, err)

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

testutil.AssertBalance(t, ctx, dymension, marketMakerAddr, thirdPartyDenom, transferAmount)
// user from rollapp1 should have funds to be able to make the ibc transfer transaction
transferData = ibc.WalletData{
Expand Down
16 changes: 12 additions & 4 deletions tests/eibc_feemarket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_EVM(t *testing.T) {
require.NoError(t, err)

// get eibc event
eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 80, false)
eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false)
require.NoError(t, err)
fmt.Println("Event:", eibcEvents)
require.Equal(t, eibcEvents[0].Price, fmt.Sprintf("%s%s", transferAmountWithoutFee, dymension.Config().Denom))
Expand Down Expand Up @@ -1959,11 +1959,19 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) {
dymintTomlOverrides["settlement_gas_prices"] = "0adym"
dymintTomlOverrides["max_idle_time"] = "3s"
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "20s"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "false"

configFileOverrides["config/dymint.toml"] = dymintTomlOverrides

modifyGenesisKV := append(
dymensionGenesisKV,
cosmos.GenesisKV{
Key: "app_state.rollapp.params.dispute_period_in_blocks",
Value: fmt.Sprint(100),
},
)

// Create chain factory with dymension
numHubVals := 1
numHubFullNodes := 1
Expand Down Expand Up @@ -2009,7 +2017,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) {
GasAdjustment: 1.1,
TrustingPeriod: "112h",
NoHostMount: false,
ModifyGenesis: modifyDymensionGenesis(dymensionGenesisKV),
ModifyGenesis: modifyDymensionGenesis(modifyGenesisKV),
ConfigFileOverrides: nil,
},
NumValidators: &numHubVals,
Expand Down Expand Up @@ -2141,7 +2149,7 @@ func TestEIBCUpdateOnTimeout_Unallowed_Wasm(t *testing.T) {
require.NoError(t, err)

// get eibc event
eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 30, false)
eibcEvents, err := getEIbcEventsWithinBlockRange(ctx, dymension, 50, false)
require.NoError(t, err)
fmt.Println("Event:", eibcEvents)
require.Equal(t, eibcEvents[0].Price, fmt.Sprintf("%s%s", transferAmountWithoutFee, dymension.Config().Denom))
Expand Down
12 changes: 10 additions & 2 deletions tests/eibc_fulfillment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,14 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) {
maxIdleTime2 := "1s"
configFileOverrides2 := overridesDymintToml(settlement_layer_rollapp2, settlement_node_address, rollapp2_id, gas_price_rollapp2, maxIdleTime2, maxProofTime, "50s")

modifyGenesisKV := append(
dymensionGenesisKV,
cosmos.GenesisKV{
Key: "app_state.rollapp.params.dispute_period_in_blocks",
Value: fmt.Sprint(100),
},
)

// Create chain factory with dymension
numHubVals := 1
numHubFullNodes := 1
Expand Down Expand Up @@ -1485,7 +1493,7 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) {
GasAdjustment: 1.1,
TrustingPeriod: "112h",
NoHostMount: false,
ModifyGenesis: modifyDymensionGenesis(dymensionGenesisKV),
ModifyGenesis: modifyDymensionGenesis(modifyGenesisKV),
ConfigFileOverrides: nil,
},
NumValidators: &numHubVals,
Expand Down Expand Up @@ -1709,7 +1717,7 @@ func TestEIBCFulfillment_two_rollapps_EVM(t *testing.T) {
require.Equal(t, "PENDING", eibcEvents[1].PacketStatus)

// fulfill demand order 2
txhash, err = dymension.FullfillDemandOrder(ctx, eibcEvents[len(eibcEvents)-2].OrderId, marketMakerAddr, eibcFee)
txhash, err = dymension.FullfillDemandOrder(ctx, eibcEvents[1].OrderId, marketMakerAddr, eibcFee)
require.NoError(t, err)
fmt.Println(txhash)
eibcEvent = getEibcEventFromTx(t, dymension, txhash)
Expand Down
2 changes: 1 addition & 1 deletion tests/eibc_invariant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestEIBCInvariant_EVM(t *testing.T) {
require.NoError(t, err)
require.True(t, isFinalized)

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

// Minus 0.1% of transfer amount for bridge fee
Expand Down
Loading

0 comments on commit a907ed0

Please sign in to comment.