Skip to content

Commit

Permalink
go beacon: change dummy entropy
Browse files Browse the repository at this point in the history
This is so that we have more usable testing schedules with a compute-only
role and a merge-only role.
  • Loading branch information
pro-wh committed Jan 10, 2020
1 parent cb98c12 commit 48f1d9e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
14 changes: 13 additions & 1 deletion go/consensus/tendermint/apps/beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,19 @@ func (app *beaconApplication) onBeaconEpochChange(ctx *abci.Context, epoch epoch
case true:
// UNSAFE/DEBUG - Deterministic beacon.
entropyCtx = debugEntropyCtx
entropy = []byte("If you change this, you will fuck up the byzantine tests!!")
// We're setting this random seed so that we have
// suitable committee schedules for Byzantine E2E
// scenarios, where we want nodes to be scheduled for
// only one committee.
// The permutations derived from this on the first
// epoch need to have (i) an index that's compute
// worker only and (ii) an index that's merge worker
// only. See
// /go/oasis-test-runner/scenario/e2e/byzantine.go for
// the permutations generated from this seed.
// These permutations are generated independently of
// the deterministic node IDs.
entropy = []byte("luck=1")
}

b := getBeacon(epoch, entropyCtx, entropy)
Expand Down
16 changes: 13 additions & 3 deletions go/oasis-test-runner/scenario/e2e/byzantine.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ import (
// TODO: Consider referencing script names directly from the Byzantine node.

var (
// Permutations generated in the epoch 1 election are
// compute: 0 (w), 1 (w), 2 (b), 3 (i)
// transaction scheduler: 2 (w), 3 (i), 1 (i), 0 (i)
// merge: 1 (w), 3 (w), 2 (b), 0 (i)
// w = worker; b = backup; i = invalid
// For compute scripts, it suffices to be index 0.
// For merge scripts, it suffices to be index 3.
// No index is transaction scheduler only.
// Indices are by order of node ID.

// ByzantineComputeHonest is the byzantine compute honest scenario.
ByzantineComputeHonest scenario.Scenario = newByzantineImpl("compute-honest", nil, oasis.ByzantineDefaultIdentitySeed)
// ByzantineComputeWrong is the byzantine compute wrong scenario.
Expand All @@ -32,21 +42,21 @@ var (
}, oasis.ByzantineDefaultIdentitySeed)

// ByzantineMergeHonest is the byzantine merge honest scenario.
ByzantineMergeHonest scenario.Scenario = newByzantineImpl("merge-honest", nil, oasis.ByzantineDefaultIdentitySeed)
ByzantineMergeHonest scenario.Scenario = newByzantineImpl("merge-honest", nil, oasis.ByzantineIndex3IdentitySeed)
// ByzantineMergeWrong is the byzantine merge wrong scenario.
ByzantineMergeWrong scenario.Scenario = newByzantineImpl("merge-wrong", []log.WatcherHandlerFactory{
oasis.LogAssertNoTimeouts(),
oasis.LogAssertNoRoundFailures(),
oasis.LogAssertNoComputeDiscrepancyDetected(),
oasis.LogAssertMergeDiscrepancyDetected(),
}, oasis.ByzantineDefaultIdentitySeed)
}, oasis.ByzantineIndex3IdentitySeed)
// ByzantineMergeStraggler is the byzantine merge straggler scenario.
ByzantineMergeStraggler scenario.Scenario = newByzantineImpl("merge-straggler", []log.WatcherHandlerFactory{
oasis.LogAssertTimeouts(),
oasis.LogAssertNoRoundFailures(),
oasis.LogAssertNoComputeDiscrepancyDetected(),
oasis.LogAssertMergeDiscrepancyDetected(),
}, oasis.ByzantineDefaultIdentitySeed)
}, oasis.ByzantineIndex3IdentitySeed)
)

type byzantineImpl struct {
Expand Down

0 comments on commit 48f1d9e

Please sign in to comment.