diff --git a/.buildkite/scripts/test_e2e.sh b/.buildkite/scripts/test_e2e.sh index b33ec81b542..f6bd366e952 100755 --- a/.buildkite/scripts/test_e2e.sh +++ b/.buildkite/scripts/test_e2e.sh @@ -108,6 +108,37 @@ assert_merge_discrepancy_scenario_works() { assert_merge_discrepancies } +scenario_byzantine_compute_honest() { + local runtime=$1 + + # Initialize compute nodes. + run_compute_node 1 ${runtime} + run_compute_node 2 ${runtime} + run_compute_node 3 ${runtime} + + ${EKIDEN_NODE} debug byzantine compute-honest \ + --log.level debug \ + --log.format JSON \ + --genesis.file ${EKIDEN_GENESIS_FILE} \ + --tendermint.core.listen_address tcp://0.0.0.0:13004 \ + --tendermint.consensus.timeout_commit 250ms \ + --tendermint.debug.addr_book_lenient \ + --tendermint.seeds "${EKIDEN_SEED_NODE_ID}@127.0.0.1:${EKIDEN_SEED_NODE_PORT}" \ + --datadir untracked/byz-run/data \ + --debug.allow_test_keys \ + 2>&1 | python ../private-ops/untracked/color-log.py | sed "s/^/[byzantine] /" & + + # Initialize storage nodes. + run_storage_node 1 + run_storage_node 2 + + # Wait for all nodes to start: 3 compute + 1 byzantine + 2 storage + key manager. + wait_nodes 7 + + # Advance epoch to elect a new committee. + set_epoch 1 +} + run_client_km_restart() { local runtime=$1 local client=$2 @@ -198,6 +229,14 @@ test_suite() { client=simple-keyvalue \ on_success_hook=assert_merge_discrepancy_scenario_works \ beacon_deterministic=1 + + run_test \ + scenario=scenario_byzantine_compute_honest \ + name="e2e-${backend_name}-byzantine-compute-honest" \ + backend_runner=$backend_runner \ + runtime=simple-keyvalue \ + client=simple-keyvalue \ + beacon_deterministic=1 } ########################################## diff --git a/go/ekiden/cmd/debug/byzantine/byzantine.go b/go/ekiden/cmd/debug/byzantine/byzantine.go index 8ad00095f8d..bd0d63bcc07 100644 --- a/go/ekiden/cmd/debug/byzantine/byzantine.go +++ b/go/ekiden/cmd/debug/byzantine/byzantine.go @@ -5,6 +5,8 @@ import ( "github.com/oasislabs/ekiden/go/common/logging" "github.com/oasislabs/ekiden/go/ekiden/cmd/common" + "github.com/oasislabs/ekiden/go/tendermint" + "github.com/oasislabs/ekiden/go/genesis" ) var ( @@ -35,3 +37,8 @@ func Register(parentCmd *cobra.Command) { byzantineCmd.AddCommand(computeHonestCmd) parentCmd.AddCommand(byzantineCmd) } + +func init() { + genesis.RegisterFlags(computeHonestCmd) + tendermint.RegisterFlags(computeHonestCmd) +} diff --git a/go/ekiden/cmd/debug/byzantine/steps.go b/go/ekiden/cmd/debug/byzantine/steps.go index 9cf3f2ed984..842178b7cc0 100644 --- a/go/ekiden/cmd/debug/byzantine/steps.go +++ b/go/ekiden/cmd/debug/byzantine/steps.go @@ -4,17 +4,22 @@ import ( "context" "time" + beacon "github.com/oasislabs/ekiden/go/beacon/api" + "github.com/oasislabs/ekiden/go/common/crypto/signature" + fileSigner "github.com/oasislabs/ekiden/go/common/crypto/signature/signers/file" "github.com/oasislabs/ekiden/go/common/identity" "github.com/oasislabs/ekiden/go/common/pubsub" "github.com/oasislabs/ekiden/go/ekiden/cmd/common" "github.com/oasislabs/ekiden/go/epochtime/api" "github.com/oasislabs/ekiden/go/genesis" + registry "github.com/oasislabs/ekiden/go/registry/api" + scheduler "github.com/oasislabs/ekiden/go/scheduler/api" "github.com/oasislabs/ekiden/go/tendermint" - "github.com/oasislabs/ekiden/go/tendermint/apps/beacon" - "github.com/oasislabs/ekiden/go/tendermint/apps/registry" - "github.com/oasislabs/ekiden/go/tendermint/apps/roothash" - "github.com/oasislabs/ekiden/go/tendermint/apps/scheduler" - "github.com/oasislabs/ekiden/go/tendermint/apps/staking" + beaconapp "github.com/oasislabs/ekiden/go/tendermint/apps/beacon" + registryapp "github.com/oasislabs/ekiden/go/tendermint/apps/registry" + roothashapp "github.com/oasislabs/ekiden/go/tendermint/apps/roothash" + schedulerapp "github.com/oasislabs/ekiden/go/tendermint/apps/scheduler" + stakingapp "github.com/oasislabs/ekiden/go/tendermint/apps/staking" "github.com/oasislabs/ekiden/go/tendermint/service" ) @@ -54,7 +59,8 @@ func startHonestTendermint() { } dataDir := common.DataDir() - identity, err := identity.LoadOrGenerate(dataDir) + signerFactory := fileSigner.NewFactory(dataDir, signature.SignerNode, signature.SignerP2P, signature.SignerEntity) + identity, err := identity.LoadOrGenerate(dataDir, signerFactory) if err != nil { panic("identity.LoadOrGenerate: " + err.Error()) } @@ -74,20 +80,27 @@ func startHonestTendermint() { timeSource := &FakeTimeBackend{} // tendermint epochtime has no registration // TODO: tendermint_mock epochtime? - if err := honestTendermint.RegisterApplication(beacon.New(timeSource, true)); err != nil { + if err := honestTendermint.RegisterApplication(beaconapp.New(timeSource, &beacon.Config{ + DebugDeterministic: false, + })); err != nil { panic("honestTendermint.RegisterApplication beacon: " + err.Error()) } - if err := honestTendermint.RegisterApplication(registry.New(timeSource)); err != nil { + if err := honestTendermint.RegisterApplication(registryapp.New(timeSource, ®istry.Config{ + DebugAllowRuntimeRegistration: false, + DebugBypassStake: false, + })); err != nil { panic("honestTendermint.RegisterApplication registry: " + err.Error()) } - if err := honestTendermint.RegisterApplication(staking.New(nil)); err != nil { + if err := honestTendermint.RegisterApplication(stakingapp.New(nil)); err != nil { panic("honestTendermint.RegisterApplication staking: " + err.Error()) } - if err := honestTendermint.RegisterApplication(scheduler.New(timeSource)); err != nil { + if err := honestTendermint.RegisterApplication(schedulerapp.New(timeSource, &scheduler.Config{ + DebugBypassStake: false, + })); err != nil { panic("honestTendermint.RegisterApplication scheduler: " + err.Error()) } // storage has no registration - if err := honestTendermint.RegisterApplication(roothash.New(context.Background(), timeSource, nil, 10*time.Second)); err != nil { + if err := honestTendermint.RegisterApplication(roothashapp.New(context.Background(), timeSource, nil, 10*time.Second)); err != nil { panic("honestTendermint.RegisterApplication roothash: " + err.Error()) }