Skip to content

Commit

Permalink
(no merge) uploading local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Jul 16, 2019
1 parent 03744ee commit 77e3cbe
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 11 deletions.
39 changes: 39 additions & 0 deletions .buildkite/scripts/test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

##########################################
Expand Down
7 changes: 7 additions & 0 deletions go/ekiden/cmd/debug/byzantine/byzantine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -35,3 +37,8 @@ func Register(parentCmd *cobra.Command) {
byzantineCmd.AddCommand(computeHonestCmd)
parentCmd.AddCommand(byzantineCmd)
}

func init() {
genesis.RegisterFlags(computeHonestCmd)
tendermint.RegisterFlags(computeHonestCmd)
}
35 changes: 24 additions & 11 deletions go/ekiden/cmd/debug/byzantine/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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())
}
Expand All @@ -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, &registry.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())
}

Expand Down

0 comments on commit 77e3cbe

Please sign in to comment.