diff --git a/go/consensus/tendermint/apps/beacon/beacon.go b/go/consensus/tendermint/apps/beacon/beacon.go index e5e05cc9c50..578c0fae363 100644 --- a/go/consensus/tendermint/apps/beacon/beacon.go +++ b/go/consensus/tendermint/apps/beacon/beacon.go @@ -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) diff --git a/go/oasis-test-runner/scenario/e2e/byzantine.go b/go/oasis-test-runner/scenario/e2e/byzantine.go index 3d47ee64121..a1363dbabf0 100644 --- a/go/oasis-test-runner/scenario/e2e/byzantine.go +++ b/go/oasis-test-runner/scenario/e2e/byzantine.go @@ -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. @@ -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 {