Skip to content

Commit

Permalink
Update and fix tests (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
anhductn2001 authored Nov 14, 2024
1 parent cb858b0 commit ba5b72b
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/automated_denommetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ func TestADMC_Hub_to_RA_Migrate_Dym_EVM(t *testing.T) {
dymensionTokenDenom := transfertypes.GetPrefixedDenom(channel.Counterparty.PortID, channel.Counterparty.ChannelID, dymension.Config().Denom)
dymensionIBCDenom := transfertypes.ParseDenomTrace(dymensionTokenDenom).IBCDenom()

testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, zeroBal)
testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, math.NewInt(9999999999).MulRaw(1000000000000))
erc20MAcc, err := rollapp1.Validators[0].QueryModuleAccount(ctx, "erc20")
require.NoError(t, err)
erc20MAccAddr := erc20MAcc.Account.BaseAccount.Address
Expand Down
97 changes: 86 additions & 11 deletions tests/sequencer_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ func Test_SeqRotation_OneSeq_DA_EVM(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "OPERATING_STATUS_BONDED", queryGetSequencerResponse.Sequencer.Status)

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

lastBlock, err := rollapp1.Height(ctx)
require.NoError(t, err)

time.Sleep(60 * time.Second)
time.Sleep(100 * time.Second)

rollappHeight, err = rollapp1.GetNode().Height(ctx)
require.NoError(t, err)
Expand Down Expand Up @@ -1427,6 +1427,9 @@ func Test_SeqRotation_NoSeq_P2P_EVM(t *testing.T) {
t.Skip()
}

// start grpc DA
go StartDA()

ctx := context.Background()

// setup config for rollapp 1
Expand All @@ -1439,6 +1442,7 @@ func Test_SeqRotation_NoSeq_P2P_EVM(t *testing.T) {
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "true"
dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}"

configFileOverrides := make(map[string]any)
configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
Expand All @@ -1449,6 +1453,14 @@ func Test_SeqRotation_NoSeq_P2P_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",
Expand All @@ -1466,7 +1478,7 @@ func Test_SeqRotation_NoSeq_P2P_EVM(t *testing.T) {
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV),
ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
Expand Down Expand Up @@ -1840,6 +1852,9 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) {
t.Skip()
}

// start grpc DA
go StartDA()

ctx := context.Background()

// setup config for rollapp 1
Expand All @@ -1852,6 +1867,7 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) {
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "true"
dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}"

configFileOverrides := make(map[string]any)
configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
Expand All @@ -1862,6 +1878,14 @@ func Test_SeqRotation_NoSeq_P2P_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",
Expand All @@ -1879,7 +1903,7 @@ func Test_SeqRotation_NoSeq_P2P_Wasm(t *testing.T) {
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappWasmGenesis(rollappWasmGenesisKV),
ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
Expand Down Expand Up @@ -2612,6 +2636,9 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) {
erc20MAccAddr := erc20MAcc.Account.BaseAccount.Address
testutil.AssertBalance(t, ctx, rollapp1, erc20MAccAddr, dymensionIBCDenom, transferData.Amount)

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

// Unbond sequencer1
err = dymension.Unbond(ctx, "sequencer", rollapp1.GetSequencerKeyDir())
require.NoError(t, err)
Expand All @@ -2623,13 +2650,13 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "OPERATING_STATUS_BONDED", queryGetSequencerResponse.Sequencer.Status)

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

lastBlock, err := rollapp1.Height(ctx)
require.NoError(t, err)

time.Sleep(90 * time.Second)
time.Sleep(100 * time.Second)

currentProposer, err = dymension.GetNode().GetProposerByRollapp(ctx, rollapp1.Config().ChainID, dymensionUserAddr)
require.NoError(t, err)
Expand All @@ -2640,7 +2667,7 @@ func Test_SqcRotation_OneSqc_P2P_EVM(t *testing.T) {

_ = rollapp1.StartAllNodes(ctx)

time.Sleep(30 * time.Second)
time.Sleep(60 * time.Second)

afterBlock, err := rollapp1.Height(ctx)
require.NoError(t, err)
Expand Down Expand Up @@ -2726,6 +2753,9 @@ func Test_SqcRotation_OneSqc_P2P_Wasm(t *testing.T) {
t.Skip()
}

// start grpc DA
go StartDA()

ctx := context.Background()

// setup config for rollapp 1
Expand All @@ -2738,6 +2768,7 @@ func Test_SqcRotation_OneSqc_P2P_Wasm(t *testing.T) {
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "true"
dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}"

configFileOverrides := make(map[string]any)
configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
Expand All @@ -2748,6 +2779,14 @@ func Test_SqcRotation_OneSqc_P2P_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",
Expand All @@ -2765,7 +2804,7 @@ func Test_SqcRotation_OneSqc_P2P_Wasm(t *testing.T) {
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappWasmGenesis(rollappWasmGenesisKV),
ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
Expand Down Expand Up @@ -3115,6 +3154,9 @@ func Test_SqcRotation_MulSqc_P2P_EVM(t *testing.T) {
t.Skip()
}

// start grpc DA
go StartDA()

ctx := context.Background()

// setup config for rollapp 1
Expand All @@ -3127,6 +3169,7 @@ func Test_SqcRotation_MulSqc_P2P_EVM(t *testing.T) {
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "true"
dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}"

configFileOverrides := make(map[string]any)
configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
Expand All @@ -3137,6 +3180,14 @@ func Test_SqcRotation_MulSqc_P2P_EVM(t *testing.T) {
numRollAppVals := 1
numRollAppFn := 2

modifyEVMGenesisKV := append(
rollappEVMGenesisKV,
cosmos.GenesisKV{
Key: "app_state.rollappparams.params.da",
Value: "grpc",
},
)

cf := test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{
{
Name: "rollapp1",
Expand All @@ -3154,7 +3205,7 @@ func Test_SqcRotation_MulSqc_P2P_EVM(t *testing.T) {
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV),
ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
Expand Down Expand Up @@ -3583,6 +3634,9 @@ func Test_SqcRotation_MulSqc_P2P_Wasm(t *testing.T) {
t.Skip()
}

// start grpc DA
go StartDA()

ctx := context.Background()

// setup config for rollapp 1
Expand All @@ -3595,6 +3649,7 @@ func Test_SqcRotation_MulSqc_P2P_Wasm(t *testing.T) {
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "true"
dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}"

configFileOverrides := make(map[string]any)
configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
Expand All @@ -3605,6 +3660,14 @@ func Test_SqcRotation_MulSqc_P2P_Wasm(t *testing.T) {
numRollAppVals := 1
numRollAppFn := 2

modifyWasmGenesisKV := append(
rollappWasmGenesisKV,
cosmos.GenesisKV{
Key: "app_state.rollappparams.params.da",
Value: "grpc",
},
)

cf := test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{
{
Name: "rollapp1",
Expand All @@ -3622,7 +3685,7 @@ func Test_SqcRotation_MulSqc_P2P_Wasm(t *testing.T) {
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappWasmGenesis(rollappWasmGenesisKV),
ModifyGenesis: modifyRollappWasmGenesis(modifyWasmGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
Expand Down Expand Up @@ -9041,6 +9104,9 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) {
t.Skip()
}

// start grpc DA
go StartDA()

ctx := context.Background()

// setup config for rollapp 1
Expand All @@ -9053,6 +9119,7 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) {
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_time"] = "50s"
dymintTomlOverrides["p2p_blocksync_enabled"] = "true"
dymintTomlOverrides["da_config"] = "{\"host\":\"host.docker.internal\",\"port\": 7980}"

configFileOverrides := make(map[string]any)
configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
Expand All @@ -9063,6 +9130,14 @@ func Test_SqcRotation_HisSync_P2P_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",
Expand All @@ -9080,7 +9155,7 @@ func Test_SqcRotation_HisSync_P2P_EVM(t *testing.T) {
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV),
ModifyGenesis: modifyRollappEVMGenesis(modifyEVMGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
Expand Down

0 comments on commit ba5b72b

Please sign in to comment.