Skip to content

Commit

Permalink
feat: add block-height runenv for test-cases
Browse files Browse the repository at this point in the history
remove obsolete snippets
adapt compositions for block-height
  • Loading branch information
Bidon15 committed Sep 9, 2022
1 parent 974122f commit 5e42394
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
[groups.run.test_params]
latency = "0"
bandwidth = "320Mib"
block-height = "13"
role = "bridge"

[[groups]]
Expand All @@ -80,6 +81,7 @@
[groups.run.test_params]
latency = "0"
bandwidth = "320Mib"
block-height = "12"
role = "full"

[[groups]]
Expand All @@ -100,4 +102,6 @@
[groups.run]
[groups.run.test_params]
latency = "0"
bandwidth = "100Mib"
bandwidth = "100Mib"
block-height = "12"
role = "light"
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
[groups.run.test_params]
latency = "100"
bandwidth = "320Mib"
block-height = "13"
role = "bridge"

[[groups]]
Expand All @@ -80,6 +81,7 @@
[groups.run.test_params]
latency = "100"
bandwidth = "320Mib"
block-height = "12"
role = "full"

[[groups]]
Expand All @@ -100,4 +102,6 @@
[groups.run]
[groups.run.test_params]
latency = "100"
bandwidth = "100Mib"
bandwidth = "100Mib"
block-height = "12"
role = "light"
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
[groups.run.test_params]
latency = "200"
bandwidth = "320Mib"
block-height = "13"
role = "bridge"

[[groups]]
Expand All @@ -80,6 +81,7 @@
[groups.run.test_params]
latency = "200"
bandwidth = "320Mib"
block-height = "12"
role = "full"

[[groups]]
Expand All @@ -100,4 +102,6 @@
[groups.run]
[groups.run.test_params]
latency = "200"
bandwidth = "100Mib"
bandwidth = "100Mib"
block-height = "12"
role = "light"
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
[groups.run.test_params]
latency = "0"
bandwidth = "256Mib"
block-height = "13"
role = "bridge"

[[groups]]
Expand All @@ -80,6 +81,7 @@
[groups.run.test_params]
latency = "0"
bandwidth = "256Mib"
block-height = "12"
role = "full"

[[groups]]
Expand All @@ -100,4 +102,6 @@
[groups.run]
[groups.run.test_params]
latency = "0"
bandwidth = "100Mib"
bandwidth = "100Mib"
block-height = "12"
role = "light"
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
[groups.run.test_params]
latency = "100"
bandwidth = "320Mib"
block-height = "13"
role = "bridge"

[[groups]]
Expand All @@ -80,6 +81,7 @@
[groups.run.test_params]
latency = "100"
bandwidth = "320Mib"
block-height = "12"
role = "full"

[[groups]]
Expand All @@ -100,4 +102,6 @@
[groups.run]
[groups.run.test_params]
latency = "100"
bandwidth = "100Mib"
bandwidth = "100Mib"
block-height = "12"
role = "light"
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
[groups.run.test_params]
latency = "200"
bandwidth = "320Mib"
block-height = "13"
role = "bridge"

[[groups]]
Expand All @@ -80,6 +81,7 @@
[groups.run.test_params]
latency = "200"
bandwidth = "320Mib"
block-height = "12"
role = "full"

[[groups]]
Expand All @@ -100,4 +102,6 @@
[groups.run]
[groups.run.test_params]
latency = "200"
bandwidth = "100Mib"
bandwidth = "100Mib"
block-height = "12"
role = "light"
1 change: 1 addition & 0 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ instances = { min = 4, max = 3000, default = 12 }
full = { type = "int", default = 3}
light = { type = "int", default = 3}
role = { type = "string" }
block-height = { type = "int" default = 10}
6 changes: 4 additions & 2 deletions tests/node-sync/run_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ func RunBridgeNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error {

runenv.RecordMessage("Finished published bridgeID Addr %d", int(initCtx.GroupSeq))

eh, err = nd.HeaderServ.GetByHeight(ctx, uint64(13))
eh, err = nd.HeaderServ.GetByHeight(ctx, uint64(runenv.IntParam("block-height")))
if err != nil {
return err
}
runenv.RecordMessage("Reached Block#13 contains Hash: %s", eh.Commit.BlockID.Hash.String())
runenv.RecordMessage("Reached Block#%d contains Hash: %s",
runenv.IntParam("block-height"),
eh.Commit.BlockID.Hash.String())

if nd.HeaderServ.IsSyncing() {
runenv.RecordFailure(fmt.Errorf("bridge node is still syncing the past"))
Expand Down
6 changes: 4 additions & 2 deletions tests/node-sync/run_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ func RunFullNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error {
return err
}

eh, err := nd.HeaderServ.GetByHeight(ctx, uint64(12))
eh, err := nd.HeaderServ.GetByHeight(ctx, uint64(runenv.IntParam("block-height")))
if err != nil {
return err
}
runenv.RecordMessage("Reached Block#12 contains Hash: %s", eh.Commit.BlockID.Hash.String())
runenv.RecordMessage("Reached Block#%d contains Hash: %s",
runenv.IntParam("block-height"),
eh.Commit.BlockID.Hash.String())

if nd.HeaderServ.IsSyncing() {
runenv.RecordFailure(fmt.Errorf("full node is still syncing the past"))
Expand Down
6 changes: 4 additions & 2 deletions tests/node-sync/run_light.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ func RunLightNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error {
return err
}

eh, err := nd.HeaderServ.GetByHeight(ctx, uint64(12))
eh, err := nd.HeaderServ.GetByHeight(ctx, uint64(runenv.IntParam("block-height")))
if err != nil {
return err
}
runenv.RecordMessage("Reached Block#12 contains Hash: %s", eh.Commit.BlockID.Hash.String())
runenv.RecordMessage("Reached Block#%d contains Hash: %s",
runenv.IntParam("block-height"),
eh.Commit.BlockID.Hash.String())

if nd.HeaderServ.IsSyncing() {
runenv.RecordFailure(fmt.Errorf("full node is still syncing the past"))
Expand Down
7 changes: 0 additions & 7 deletions tests/tc-002-da-sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ import (
)

func SyncNodes(runenv *runtime.RunEnv, initCtx *run.InitContext) (err error) {
vn := runenv.IntParam("validator")
bn := runenv.IntParam("bridge")
fn := runenv.IntParam("full")
ln := runenv.IntParam("light")

// TODO(@Bidon15): how do we assign LN per BN with non-detirministic assignment of GlobalSeq
// due to roles and compositions
switch runenv.StringParam("role") {
case "validator":
err = nodesync.RunAppValidator(runenv, initCtx)
Expand Down

0 comments on commit 5e42394

Please sign in to comment.