From 89898aafeb2cec9339bba0f3ce24f0b315e7cd81 Mon Sep 17 00:00:00 2001 From: Peter Us Date: Mon, 1 Jul 2019 11:47:15 +0200 Subject: [PATCH 1/2] go/scheduler: remove trivial scheduler --- go/scheduler/trivial/trivial.go | 674 -------------------------------- 1 file changed, 674 deletions(-) delete mode 100644 go/scheduler/trivial/trivial.go diff --git a/go/scheduler/trivial/trivial.go b/go/scheduler/trivial/trivial.go deleted file mode 100644 index b32b562507a..00000000000 --- a/go/scheduler/trivial/trivial.go +++ /dev/null @@ -1,674 +0,0 @@ -package trivial - -import ( - "bytes" - "context" - "crypto" - "encoding/hex" - "fmt" - "math/rand" - "sync" - "time" - - "github.com/eapache/channels" - - beacon "github.com/oasislabs/ekiden/go/beacon/api" - "github.com/oasislabs/ekiden/go/common/crypto/drbg" - "github.com/oasislabs/ekiden/go/common/crypto/mathrand" - "github.com/oasislabs/ekiden/go/common/crypto/signature" - "github.com/oasislabs/ekiden/go/common/logging" - "github.com/oasislabs/ekiden/go/common/node" - "github.com/oasislabs/ekiden/go/common/pubsub" - epochtime "github.com/oasislabs/ekiden/go/epochtime/api" - registry "github.com/oasislabs/ekiden/go/registry/api" - "github.com/oasislabs/ekiden/go/scheduler/api" - "github.com/oasislabs/ekiden/go/tendermint/service" -) - -// BackendName is the name of this implementation. -const BackendName = "trivial" - -var ( - _ api.Backend = (*trivialScheduler)(nil) - - rngContextCompute = []byte("EkS-Dummy-Compute") - rngContextStorage = []byte("EkS-Dummy-Storage") - rngContextTransactionScheduler = []byte("EkS-Dummy-TransactionScheduler") - rngContextMerge = []byte("EkS-Dummy-Merge") -) - -type trivialScheduler struct { - sync.Once - - logger *logging.Logger - - timeSource epochtime.Backend - beacon beacon.Backend - registry registry.Backend - - state *trivialSchedulerState - - service service.TendermintService - notifier *pubsub.Broker - - closedCh chan struct{} -} - -type trivialSchedulerState struct { - sync.RWMutex - - logger *logging.Logger - - computeNodeLists map[epochtime.EpochTime]map[signature.MapKey]map[node.TEEHardware][]*node.Node - storageNodeLists map[epochtime.EpochTime][]*node.Node - txnSchedulerNodeLists map[epochtime.EpochTime]map[signature.MapKey][]*node.Node - mergeNodeLists map[epochtime.EpochTime]map[signature.MapKey][]*node.Node - beacons map[epochtime.EpochTime][]byte - runtimes map[epochtime.EpochTime]map[signature.MapKey]*registry.Runtime - committees map[epochtime.EpochTime]map[signature.MapKey][]*api.Committee - - epoch epochtime.EpochTime - lastElect epochtime.EpochTime -} - -func (s *trivialSchedulerState) canElect() bool { - s.Lock() - defer s.Unlock() - - return s.computeNodeLists[s.epoch] != nil && s.beacons[s.epoch] != nil && s.storageNodeLists[s.epoch] != nil && s.txnSchedulerNodeLists[s.epoch] != nil && s.mergeNodeLists[s.epoch] != nil -} - -func (s *trivialSchedulerState) elect(rt *registry.Runtime, epoch epochtime.EpochTime, notifier *pubsub.Broker) ([]*api.Committee, error) { //nolint:gocyclo - var committees []*api.Committee - - maybeBroadcast := func() { - if notifier != nil { - for _, committee := range committees { - notifier.Broadcast(committee) - } - } - } - - // Initialize the map for this epoch iff it is missing. - if s.committees[epoch] == nil { - s.committees[epoch] = make(map[signature.MapKey][]*api.Committee) - } - comMap := s.committees[epoch] - - // This may be cached due to an external entity polling for this. - rtID := rt.ID.ToMapKey() - if committees = comMap[rtID]; committees != nil { - maybeBroadcast() - return committees, nil - } - - beacon := s.beacons[epoch] - - // Only generic compute runtimes need to elect all the committees. - kinds := []api.CommitteeKind{api.KindCompute} - if rt.IsCompute() { - kinds = append(kinds, []api.CommitteeKind{api.KindStorage, api.KindTransactionScheduler, api.KindMerge}...) - } - - for _, kind := range kinds { - var nodeList []*node.Node - var workerSize, backupSize int - var ctx []byte - switch kind { - case api.KindCompute: - nodeList = s.computeNodeLists[epoch][rtID][rt.TEEHardware] - workerSize = int(rt.ReplicaGroupSize) - backupSize = int(rt.ReplicaGroupBackupSize) - ctx = rngContextCompute - case api.KindStorage: - nodeList = s.storageNodeLists[epoch] - workerSize = int(rt.StorageGroupSize) - backupSize = 0 - ctx = rngContextStorage - case api.KindTransactionScheduler: - nodeList = s.txnSchedulerNodeLists[epoch][rtID] - workerSize = int(rt.TransactionSchedulerGroupSize) - backupSize = 0 - ctx = rngContextTransactionScheduler - case api.KindMerge: - nodeList = s.mergeNodeLists[epoch][rtID] - // TODO: Allow independent group sizes. - workerSize = int(rt.ReplicaGroupSize) - backupSize = int(rt.ReplicaGroupBackupSize) - ctx = rngContextMerge - default: - return nil, fmt.Errorf("scheduler: invalid committee type: %v", kind) - } - nrNodes := len(nodeList) - - if workerSize == 0 { - return nil, fmt.Errorf("scheduler: empty committee not allowed") - } - if (workerSize + backupSize) > nrNodes { - return nil, fmt.Errorf("scheduler: %v committee size %d exceeds available nodes %d", kind, workerSize+backupSize, nrNodes) - } - - drbg, err := drbg.New(crypto.SHA512, beacon, rt.ID[:], ctx) - if err != nil { - return nil, err - } - rngSrc := mathrand.New(drbg) - rng := rand.New(rngSrc) - idxs := rng.Perm(nrNodes) - - committee := &api.Committee{ - Kind: kind, - RuntimeID: rt.ID, - ValidFor: epoch, - } - - for i := 0; i < (workerSize + backupSize); i++ { - var role api.Role - switch { - case i == 0: - if kind.NeedsLeader() { - role = api.Leader - } else { - role = api.Worker - } - case i >= workerSize: - role = api.BackupWorker - default: - role = api.Worker - } - committee.Members = append(committee.Members, &api.CommitteeNode{ - Role: role, - PublicKey: nodeList[idxs[i]].ID, - }) - } - - committees = append(committees, committee) - } - - comMap[rtID] = committees - maybeBroadcast() - - return committees, nil -} - -func (s *trivialSchedulerState) prune() { - pruneBefore := s.epoch - 1 - if pruneBefore > s.epoch { - return - } - - for epoch := range s.computeNodeLists { - if epoch < pruneBefore { - delete(s.computeNodeLists, epoch) - } - } - for epoch := range s.storageNodeLists { - if epoch < pruneBefore { - delete(s.storageNodeLists, epoch) - } - } - for epoch := range s.txnSchedulerNodeLists { - if epoch < pruneBefore { - delete(s.txnSchedulerNodeLists, epoch) - } - } - for epoch := range s.mergeNodeLists { - if epoch < pruneBefore { - delete(s.mergeNodeLists, epoch) - } - } - for epoch := range s.beacons { - if epoch < pruneBefore { - delete(s.beacons, epoch) - } - } - for epoch := range s.runtimes { - if epoch < pruneBefore { - delete(s.runtimes, epoch) - } - } - - s.Lock() - defer s.Unlock() - - for epoch := range s.committees { - if epoch < pruneBefore { - delete(s.committees, epoch) - } - } -} - -func (s *trivialSchedulerState) updateEpoch(epoch epochtime.EpochTime) { - s.Lock() - defer s.Unlock() - - s.epoch = epoch -} - -func (s *trivialSchedulerState) updateRuntimes(ctx context.Context, epoch epochtime.EpochTime, timeSource epochtime.Backend, reg registry.Backend) error { - s.Lock() - defer s.Unlock() - - // Runtimes per epoch are an invariant. - if s.runtimes[epoch] != nil { - return nil - } - - var ( - runtimes []*registry.Runtime - err error - ) - - var height int64 - height, err = timeSource.GetEpochBlock(ctx, epoch) - if err != nil { - return err - } - - runtimes, err = reg.GetRuntimes(ctx, height) - - if err != nil { - return err - } - - m := make(map[signature.MapKey]*registry.Runtime) - for _, v := range runtimes { - m[v.ID.ToMapKey()] = v - } - s.runtimes[epoch] = m - - return nil -} - -func (s *trivialSchedulerState) updateNodeListLocked(epoch epochtime.EpochTime, nodes []*node.Node, ts time.Time) { - // Invariant: s.Lock() held already. - - // Re-scheduling is not allowed, and if there are node lists already there - // is nothing to do. - if s.computeNodeLists[epoch] != nil || s.storageNodeLists[epoch] != nil || s.txnSchedulerNodeLists[epoch] != nil || s.mergeNodeLists[epoch] != nil { - return - } - - m := make(map[signature.MapKey]map[node.TEEHardware][]*node.Node) - s.txnSchedulerNodeLists[epoch] = make(map[signature.MapKey][]*node.Node) - s.mergeNodeLists[epoch] = make(map[signature.MapKey][]*node.Node) - for id := range s.runtimes[epoch] { - m[id] = make(map[node.TEEHardware][]*node.Node) - s.txnSchedulerNodeLists[epoch][id] = []*node.Node{} - s.mergeNodeLists[epoch][id] = []*node.Node{} - } - s.storageNodeLists[epoch] = []*node.Node{} - - // Build the per-node -> per-runtime -> per-TEE implementation node - // lists for the epoch. It is safe to do it this way as `nodes` is - // already sorted in the appropriate order. - for _, n := range nodes { - // Compute workers - if n.HasRoles(node.RoleComputeWorker) { - for _, rt := range n.Runtimes { - nls, ok := m[rt.ID.ToMapKey()] - if !ok { - s.logger.Warn("node supports unknown runtime", - "node", n, - "runtime", rt.ID, - ) - continue - } - - var ( - hw = node.TEEHardwareInvalid - caps = rt.Capabilities.TEE - ) - switch caps { - case nil: - // No TEE support for this runtime on this node. - default: - if err := caps.Verify(ts); err != nil { - s.logger.Warn("failed to verify node TEE attestaion", - "err", err, - "node", n, - "time_stamp", ts, - "runtime", rt.ID, - ) - continue - } - - hw = caps.Hardware - } - - nls[hw] = append(nls[hw], n) - } - } - - // Storage workers - if n.HasRoles(node.RoleStorageWorker) { - s.storageNodeLists[epoch] = append(s.storageNodeLists[epoch], n) - } - - // Transaction scheduler workers - if n.HasRoles(node.RoleTransactionScheduler) { - for _, rt := range n.Runtimes { - rtID := rt.ID.ToMapKey() - nls, ok := s.txnSchedulerNodeLists[epoch][rtID] - if !ok { - s.logger.Warn("node supports unknown runtime", - "node", n, - "runtime", rt.ID, - ) - continue - } - s.txnSchedulerNodeLists[epoch][rtID] = append(nls, n) - } - } - - // Merge workers - if n.HasRoles(node.RoleMergeWorker) { - for _, rt := range n.Runtimes { - rtID := rt.ID.ToMapKey() - nls, ok := s.mergeNodeLists[epoch][rtID] - if !ok { - s.logger.Warn("node supports unknown runtime", - "node", n, - "runtime", rt.ID, - ) - continue - } - s.mergeNodeLists[epoch][rtID] = append(nls, n) - } - } - } - - s.computeNodeLists[epoch] = m -} - -func (s *trivialSchedulerState) updateBeaconLocked(epoch epochtime.EpochTime, beacon []byte) error { - // Invariant: s.Lock() held already. - - if oldBeacon, ok := s.beacons[epoch]; ok { - if !bytes.Equal(oldBeacon, beacon) { - return fmt.Errorf("scheduler/trivial: beacon already exists for epoch") - } - return nil - } - - s.beacons[epoch] = beacon - - return nil -} - -func (s *trivialScheduler) Cleanup() { - s.Do(func() { - <-s.closedCh - }) -} - -func (s *trivialScheduler) WatchCommittees() (<-chan *api.Committee, *pubsub.Subscription) { - typedCh := make(chan *api.Committee) - sub := s.notifier.Subscribe() - sub.Unwrap(typedCh) - - return typedCh, sub -} - -func (s *trivialScheduler) GetCommittees(ctx context.Context, id signature.PublicKey, height int64) ([]*api.Committee, error) { // nolint: gocyclo - epoch, err := s.timeSource.GetEpoch(ctx, height) - if err != nil { - return nil, err - } - - rtID := id.ToMapKey() - - s.state.Lock() - defer s.state.Unlock() - - // Service the request from the cache if possible. - if comMap := s.state.committees[epoch]; comMap != nil { - if committees := comMap[rtID]; committees != nil { - return committees, nil - } - } - - // Do the election for the runtime now. Since rescheduling isn't - // allowed, this will give identical output to what the worker will - // do eventually. - // - // Note: Since we're likely racing ahead of the worker, we need to - // poll the other backends for what we need to elect. - - if b := s.state.beacons[epoch]; b == nil { - var newBeacon []byte - newBeacon, err = s.beacon.GetBeacon(ctx, height) - if err != nil { - return nil, err - } - - s.logger.Debug("GetCommittees: setting cached beacon", - "epoch", epoch, - "height", height, - "beacon", hex.EncodeToString(newBeacon), - ) - - _ = s.state.updateBeaconLocked(epoch, newBeacon) - } - - if runtimes := s.state.runtimes[epoch]; runtimes == nil { - var runtimes []*registry.Runtime - runtimes, err = s.registry.GetRuntimes(ctx, height) - if err != nil { - return nil, err - } - - m := make(map[signature.MapKey]*registry.Runtime) - for _, v := range runtimes { - m[v.ID.ToMapKey()] = v - } - s.state.runtimes[epoch] = m - } - - rt := s.state.runtimes[epoch][rtID] - if rt == nil { - return nil, registry.ErrNoSuchRuntime - } - - if nodeList := s.state.computeNodeLists[epoch]; nodeList == nil { - var nl *registry.NodeList - nl, err = s.registry.GetNodeList(ctx, height) - if err != nil { - return nil, err - } - var ts time.Time - ts, err = s.getEpochTransitionTime(ctx, epoch) - if err != nil { - return nil, err - } - s.state.updateNodeListLocked(epoch, nl.Nodes, ts) - } - - return s.state.elect(rt, epoch, nil) -} - -func (s *trivialScheduler) electAll() { - s.state.Lock() - defer s.state.Unlock() - - for _, v := range s.state.runtimes[s.state.epoch] { - committees, err := s.state.elect(v, s.state.epoch, s.notifier) - if err != nil { - s.logger.Debug("worker: failed to elect", - "runtime", v, - "err", err, - ) - continue - } - - s.logger.Debug("worker: election", - "runtime", v, - "committees", committees, - ) - } - - s.state.lastElect = s.state.epoch -} - -func (s *trivialScheduler) worker(ctx context.Context) { //nolint:gocyclo - defer close(s.closedCh) - - timeCh, sub := s.timeSource.WatchEpochs() - defer sub.Close() - - nodeListCh, sub := s.registry.WatchNodeList() - defer sub.Close() - - beaconCh, sub := s.beacon.WatchBeacons() - defer sub.Close() - - for { - select { - case <-ctx.Done(): - return - case epoch := <-timeCh: - if epoch == s.state.epoch { - continue - } - s.logger.Debug("worker: epoch transition", - "prev_epoch", s.state.epoch, - "epoch", epoch, - ) - s.state.updateEpoch(epoch) - s.state.prune() - case ev := <-nodeListCh: - // TODO: Check to see if there is an existing *different* - // node list, and ignore the new one. - // - // Omitting the check is mostly harmess, since a changing - // node list within an epoch is an invariant violation. - ts, err := s.getEpochTransitionTime(ctx, ev.Epoch) - if err != nil { - // Attestation validations will fail till after the epoch transition. - s.logger.Error("worker: failed to get epoch transition time", - "err", err, - ) - } - - s.logger.Debug("worker: node list for epoch", - "epoch", ev.Epoch, - "transition_at", ts, - ) - - // If this fails, no elections will happen till the next epoch, - // unless forced by GetBlockCommittees. - if err = s.state.updateRuntimes(ctx, ev.Epoch, s.timeSource, s.registry); err != nil { - s.logger.Error("worker: failed to update runtime list for epoch", - "err", err, - ) - continue - } - - s.state.Lock() - s.state.updateNodeListLocked(ev.Epoch, ev.Nodes, ts) - s.state.Unlock() - case ev := <-beaconCh: - s.state.Lock() - err := s.state.updateBeaconLocked(ev.Epoch, ev.Beacon) - s.state.Unlock() - if err != nil { - s.logger.Error("worker: failed to update beacon for epoch", - "err", err, - "epoch", ev.Epoch, - "beacon", ev.Beacon, - ) - continue - } - s.logger.Debug("worker: beacon for epoch", - "epoch", ev.Epoch, - "beacon", hex.EncodeToString(ev.Beacon), - ) - } - - if s.state.epoch == s.state.lastElect || !s.state.canElect() { - continue - } - - // Elect ALL THE THINGS. \o/ - s.logger.Debug("worker: electing for epoch", - "epoch", s.state.epoch, - ) - - s.electAll() - } -} - -func (s *trivialScheduler) getEpochTransitionTime(ctx context.Context, epoch epochtime.EpochTime) (time.Time, error) { - blockHeight, err := s.timeSource.GetEpochBlock(ctx, epoch) - if err != nil { - return time.Time{}, err - } - - switch blockHeight { - case 0: - // No timestamp in the genesis state. - return time.Time{}, fmt.Errorf("scheduler/trivial: no epoch transition time for 0th epoch") - default: - block, err := s.service.GetBlock(blockHeight) - if err != nil { - return time.Time{}, err - } - - return block.Header.Time, nil - } -} - -// New constracts a new trivial scheduler Backend instance. -func New(ctx context.Context, timeSource epochtime.Backend, registryBackend registry.Backend, beacon beacon.Backend, service service.TendermintService) api.Backend { - s := &trivialScheduler{ - logger: logging.GetLogger("scheduler/trivial"), - timeSource: timeSource, - registry: registryBackend, - beacon: beacon, - state: &trivialSchedulerState{ - computeNodeLists: make(map[epochtime.EpochTime]map[signature.MapKey]map[node.TEEHardware][]*node.Node), - storageNodeLists: make(map[epochtime.EpochTime][]*node.Node), - txnSchedulerNodeLists: make(map[epochtime.EpochTime]map[signature.MapKey][]*node.Node), - mergeNodeLists: make(map[epochtime.EpochTime]map[signature.MapKey][]*node.Node), - beacons: make(map[epochtime.EpochTime][]byte), - runtimes: make(map[epochtime.EpochTime]map[signature.MapKey]*registry.Runtime), - committees: make(map[epochtime.EpochTime]map[signature.MapKey][]*api.Committee), - epoch: epochtime.EpochInvalid, - lastElect: epochtime.EpochInvalid, - }, - service: service, - closedCh: make(chan struct{}), - } - s.state.logger = s.logger - s.notifier = pubsub.NewBrokerEx(func(ch *channels.InfiniteChannel) { - s.state.RLock() - defer s.state.RUnlock() - - if s.state.lastElect != s.state.epoch { - // A mass-election will happen Real Soon Now, don't bother. - s.logger.Debug("notifier: not sending stale committees", - "last_elect", s.state.lastElect, - "epoch", s.state.epoch, - ) - return - } - - comMap := s.state.committees[s.state.epoch] - if comMap == nil { - s.logger.Debug("notifier: no committees for epoch", - "epoch", s.state.epoch, - ) - return - } - - for _, v := range comMap { - for _, vv := range v { - ch.In() <- vv - } - } - }) - - go s.worker(ctx) - - return s -} From 731a96d48ae89c57d79d705fedf4e436b95ca975 Mon Sep 17 00:00:00 2001 From: Peter Us Date: Mon, 1 Jul 2019 11:47:33 +0200 Subject: [PATCH 2/2] go/node: add consensus.backend flag --- .buildkite/scripts/common_e2e.sh | 36 ++++------------------ configs/single_node.yml | 21 +++---------- configs/single_node_sgx.yml | 21 +++---------- go/beacon/init.go | 6 ++-- go/beacon/tendermint/tendermint.go | 2 +- go/ekiden/cmd/common/flags/flags.go | 28 +++++++++++++++++ go/ekiden/cmd/debug/bootstrap/bootstrap.go | 1 + go/ekiden/cmd/genesis/genesis.go | 1 + go/ekiden/cmd/node/node.go | 1 + go/ekiden/cmd/registry/entity/entity.go | 1 + go/ekiden/cmd/registry/runtime/runtime.go | 3 ++ go/ekiden/node_test.go | 7 +---- go/epochtime/tendermint/tendermint.go | 3 +- go/keymanager/init.go | 15 ++------- go/keymanager/tendermint/tendermint.go | 2 +- go/registry/init.go | 15 ++------- go/registry/tendermint/tendermint.go | 2 +- go/roothash/init.go | 6 ++-- go/roothash/tendermint/tendermint.go | 2 +- go/scheduler/init.go | 18 ++--------- go/scheduler/tendermint/tendermint.go | 2 +- go/staking/init.go | 8 ++--- go/staking/tendermint/tendermint.go | 2 +- go/tendermint/api/api.go | 3 ++ scripts/benchmark-e2e.sh | 17 +++------- 25 files changed, 78 insertions(+), 145 deletions(-) diff --git a/.buildkite/scripts/common_e2e.sh b/.buildkite/scripts/common_e2e.sh index ef28b9f6ca6..8e25118be95 100644 --- a/.buildkite/scripts/common_e2e.sh +++ b/.buildkite/scripts/common_e2e.sh @@ -163,14 +163,10 @@ run_backend_tendermint_committee() { --grpc.debug.port ${grpc_debug_port} \ --epochtime.backend ${epochtime_backend} \ --epochtime.tendermint.interval 30 \ - --beacon.backend tendermint \ ${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ --metrics.mode none \ --storage.backend client \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ - --keymanager.backend tendermint \ + --consensus.backend tendermint \ --genesis.file ${genesis_file} \ --tendermint.core.listen_address tcp://0.0.0.0:${tm_port} \ --tendermint.consensus.timeout_commit 250ms \ @@ -250,13 +246,9 @@ run_compute_node() { --storage.cachingclient.file ${data_dir}/storage-cache \ --epochtime.backend ${EKIDEN_EPOCHTIME_BACKEND} \ --epochtime.tendermint.interval 30 \ - --beacon.backend tendermint \ ${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ --metrics.mode none \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ - --keymanager.backend tendermint \ + --consensus.backend tendermint \ --genesis.file ${EKIDEN_GENESIS_FILE} \ --tendermint.core.listen_address tcp://0.0.0.0:${tm_port} \ --tendermint.consensus.timeout_commit 250ms \ @@ -325,14 +317,10 @@ run_storage_node() { --grpc.log.verbose_debug \ --epochtime.backend ${EKIDEN_EPOCHTIME_BACKEND} \ --epochtime.tendermint.interval 30 \ - --beacon.backend tendermint \ ${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ --metrics.mode none \ --storage.backend leveldb \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ - --keymanager.backend tendermint \ + --consensus.backend tendermint \ --genesis.file ${EKIDEN_GENESIS_FILE} \ --tendermint.core.listen_address tcp://0.0.0.0:${tm_port} \ --tendermint.consensus.timeout_commit 250ms \ @@ -386,16 +374,12 @@ run_client_node() { --grpc.log.verbose_debug \ --epochtime.backend ${EKIDEN_EPOCHTIME_BACKEND} \ --epochtime.tendermint.interval 30 \ - --beacon.backend tendermint \ ${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ --metrics.mode none \ --storage.backend cachingclient \ --storage.cachingclient.file ${data_dir}/storage-cache \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ + --consensus.backend tendermint \ --roothash.tendermint.index_blocks \ - --keymanager.backend tendermint \ --genesis.file ${EKIDEN_GENESIS_FILE} \ --tendermint.core.listen_address tcp://0.0.0.0:${tm_port} \ --tendermint.consensus.timeout_commit 250ms \ @@ -471,13 +455,9 @@ run_keymanager_node() { --storage.cachingclient.file ${data_dir}/storage-cache \ --epochtime.backend ${EKIDEN_EPOCHTIME_BACKEND} \ --epochtime.tendermint.interval 30 \ - --beacon.backend tendermint \ ${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ --metrics.mode none \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ - --keymanager.backend tendermint \ + --consensus.backend tendermint \ --genesis.file ${EKIDEN_GENESIS_FILE} \ --tendermint.core.listen_address tcp://0.0.0.0:${tm_port} \ --tendermint.consensus.timeout_commit 250ms \ @@ -531,12 +511,8 @@ run_seed_node() { --genesis.file ${EKIDEN_GENESIS_FILE} \ --epochtime.backend ${EKIDEN_EPOCHTIME_BACKEND} \ --epochtime.tendermint.interval 30 \ - --beacon.backend tendermint \ ${EKIDEN_BEACON_DETERMINISTIC:+--beacon.debug.deterministic} \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ - --keymanager.backend tendermint \ + --consensus.backend tendermint \ --tendermint.core.listen_address tcp://0.0.0.0:${EKIDEN_SEED_NODE_PORT} \ --tendermint.seed_mode \ --tendermint.debug.addr_book_lenient \ diff --git a/configs/single_node.yml b/configs/single_node.yml index 0b95314018b..40336100776 100644 --- a/configs/single_node.yml +++ b/configs/single_node.yml @@ -66,6 +66,10 @@ worker: binary: target/debug/ekiden-keymanager-runtime loader: target/debug/ekiden-runtime-loader +# Consensus backend. +consensus: + backend: tendermint + # Epochtime backend. epochtime: backend: tendermint @@ -73,27 +77,14 @@ epochtime: # This makes each epoch last for 30 tendermint blocks. interval: 30 -# Random beacon backend. -beacon: - backend: tendermint - # Storage backend. storage: backend: leveldb debug: mock_signing_key: true -# Scheduler backend. -scheduler: - backend: tendermint - -# Registry backend. -registry: - backend: tendermint - # Roothash backend. roothash: - backend: tendermint tendermint: index_blocks: true @@ -102,10 +93,6 @@ tendermint: consensus: timeout_commit: 1s -# Key manager backend configuration. -keymanager: - backend: tendermint - # Client configuration. client: indexer: diff --git a/configs/single_node_sgx.yml b/configs/single_node_sgx.yml index c65c0c95075..fb5a2582d66 100644 --- a/configs/single_node_sgx.yml +++ b/configs/single_node_sgx.yml @@ -73,6 +73,10 @@ worker: ias: proxy_addr: "127.0.0.1:9001" +# Consensus backend. +consensus: + backend: tendermint + # Epochtime backend. epochtime: backend: tendermint @@ -80,27 +84,14 @@ epochtime: # This makes each epoch last for 30 tendermint blocks. interval: 30 -# Random beacon backend. -beacon: - backend: tendermint - # Storage backend. storage: backend: leveldb debug: mock_signing_key: true -# Scheduler backend. -scheduler: - backend: tendermint - -# Registry backend. -registry: - backend: tendermint - # Roothash backend. roothash: - backend: tendermint tendermint: index_blocks: true @@ -109,10 +100,6 @@ tendermint: consensus: timeout_commit: 1s -# Key manager backend configuration. -keymanager: - backend: tendermint - # Client configuration. client: indexer: diff --git a/go/beacon/init.go b/go/beacon/init.go index f6d30c4d1c7..b7dcdf6e5f7 100644 --- a/go/beacon/init.go +++ b/go/beacon/init.go @@ -11,12 +11,12 @@ import ( "github.com/oasislabs/ekiden/go/beacon/api" "github.com/oasislabs/ekiden/go/beacon/tendermint" + commonFlags "github.com/oasislabs/ekiden/go/ekiden/cmd/common/flags" epochtime "github.com/oasislabs/ekiden/go/epochtime/api" "github.com/oasislabs/ekiden/go/tendermint/service" ) const ( - cfgBackend = "beacon.backend" cfgDebugDeterministic = "beacon.debug.deterministic" ) @@ -24,7 +24,7 @@ const ( func New(ctx context.Context, timeSource epochtime.Backend, tmService service.TendermintService) (api.Backend, error) { debugDeterministic := viper.GetBool(cfgDebugDeterministic) - backend := viper.GetString(cfgBackend) + backend := commonFlags.ConsensusBackend() switch strings.ToLower(backend) { case tendermint.BackendName: return tendermint.New(ctx, timeSource, tmService, debugDeterministic) @@ -37,12 +37,10 @@ func New(ctx context.Context, timeSource epochtime.Backend, tmService service.Te // command. func RegisterFlags(cmd *cobra.Command) { if !cmd.Flags().Parsed() { - cmd.Flags().String(cfgBackend, tendermint.BackendName, "Random beacon backend") cmd.Flags().Bool(cfgDebugDeterministic, false, "enable deterministic beacon output (UNSAFE)") } for _, v := range []string{ - cfgBackend, cfgDebugDeterministic, } { viper.BindPFlag(v, cmd.Flags().Lookup(v)) //nolint: errcheck diff --git a/go/beacon/tendermint/tendermint.go b/go/beacon/tendermint/tendermint.go index 90fe553a6a7..086f60aa832 100644 --- a/go/beacon/tendermint/tendermint.go +++ b/go/beacon/tendermint/tendermint.go @@ -21,7 +21,7 @@ import ( ) // BackendName is the name of this implementation. -const BackendName = "tendermint" +const BackendName = tmapi.BackendName var _ api.Backend = (*Backend)(nil) diff --git a/go/ekiden/cmd/common/flags/flags.go b/go/ekiden/cmd/common/flags/flags.go index c8f98673425..0586e82342f 100644 --- a/go/ekiden/cmd/common/flags/flags.go +++ b/go/ekiden/cmd/common/flags/flags.go @@ -3,8 +3,13 @@ package flags import ( + "fmt" + "strings" + "github.com/spf13/cobra" "github.com/spf13/viper" + + tmapi "github.com/oasislabs/ekiden/go/tendermint/api" ) const ( @@ -12,6 +17,8 @@ const ( cfgForce = "force" cfgRetries = "retries" + cfgConsensusBackend = "consensus.backend" + cfgDebugTestEntity = "debug.test_entity" ) @@ -57,6 +64,27 @@ func RegisterRetries(cmd *cobra.Command) { _ = viper.BindPFlag(cfgRetries, cmd.Flags().Lookup(cfgRetries)) } +// ConsensusBackend returns the set consensus backend. +func ConsensusBackend() string { + backend := viper.GetString(cfgConsensusBackend) + + switch strings.ToLower(backend) { + case tmapi.BackendName: + return tmapi.BackendName + default: + panic(fmt.Sprintf("consensus: unsupported backend: '%v'", backend)) + } +} + +// RegisterConsensusBackend registers the consensus backend flag for the provided command. +func RegisterConsensusBackend(cmd *cobra.Command) { + if !cmd.Flags().Parsed() { + cmd.Flags().String(cfgConsensusBackend, tmapi.BackendName, "force") + } + + _ = viper.BindPFlag(cfgConsensusBackend, cmd.Flags().Lookup(cfgConsensusBackend)) +} + // DebugTestEntity returns true iff the test entity enable flag is set. func DebugTestEntity() bool { return viper.GetBool(cfgDebugTestEntity) diff --git a/go/ekiden/cmd/debug/bootstrap/bootstrap.go b/go/ekiden/cmd/debug/bootstrap/bootstrap.go index 71071e9430f..97b84e22b7b 100644 --- a/go/ekiden/cmd/debug/bootstrap/bootstrap.go +++ b/go/ekiden/cmd/debug/bootstrap/bootstrap.go @@ -144,6 +144,7 @@ func registerBootstrapFlags(cmd *cobra.Command) { } flags.RegisterDebugTestEntity(cmd) + flags.RegisterConsensusBackend(cmd) } // Register registers the bootstrap sub-command and all of it's children. diff --git a/go/ekiden/cmd/genesis/genesis.go b/go/ekiden/cmd/genesis/genesis.go index eb90d1ede8e..69cafd510c4 100644 --- a/go/ekiden/cmd/genesis/genesis.go +++ b/go/ekiden/cmd/genesis/genesis.go @@ -443,6 +443,7 @@ func registerInitGenesisFlags(cmd *cobra.Command) { } flags.RegisterDebugTestEntity(cmd) + flags.RegisterConsensusBackend(cmd) } // Register registers the genesis sub-command and all of it's children. diff --git a/go/ekiden/cmd/node/node.go b/go/ekiden/cmd/node/node.go index a39a27f792e..c34e9f02505 100644 --- a/go/ekiden/cmd/node/node.go +++ b/go/ekiden/cmd/node/node.go @@ -584,4 +584,5 @@ func RegisterFlags(cmd *cobra.Command) { } flags.RegisterDebugTestEntity(cmd) + flags.RegisterConsensusBackend(cmd) } diff --git a/go/ekiden/cmd/registry/entity/entity.go b/go/ekiden/cmd/registry/entity/entity.go index ae7d2bc72f3..ec0ab97815e 100644 --- a/go/ekiden/cmd/registry/entity/entity.go +++ b/go/ekiden/cmd/registry/entity/entity.go @@ -324,6 +324,7 @@ func Register(parentCmd *cobra.Command) { deregisterCmd, } { cmdFlags.RegisterDebugTestEntity(v) + cmdFlags.RegisterConsensusBackend(v) } for _, v := range []*cobra.Command{ diff --git a/go/ekiden/cmd/registry/runtime/runtime.go b/go/ekiden/cmd/registry/runtime/runtime.go index 819ddb0d0dc..9945e24d867 100644 --- a/go/ekiden/cmd/registry/runtime/runtime.go +++ b/go/ekiden/cmd/registry/runtime/runtime.go @@ -59,6 +59,7 @@ var ( Short: "initialize a runtime for genesis", PreRun: func(cmd *cobra.Command, args []string) { cmdFlags.RegisterDebugTestEntity(cmd) + cmdFlags.RegisterConsensusBackend(cmd) registerRuntimeFlags(cmd) registerOutputFlag(cmd) }, @@ -71,6 +72,7 @@ var ( PreRun: func(cmd *cobra.Command, args []string) { cmdGrpc.RegisterClientFlags(cmd, false) cmdFlags.RegisterDebugTestEntity(cmd) + cmdFlags.RegisterConsensusBackend(cmd) cmdFlags.RegisterRetries(cmd) registerRuntimeFlags(cmd) }, @@ -437,6 +439,7 @@ func Register(parentCmd *cobra.Command) { registerCmd, } { cmdFlags.RegisterDebugTestEntity(v) + cmdFlags.RegisterConsensusBackend(v) } registerRuntimeFlags(initGenesisCmd) diff --git a/go/ekiden/node_test.go b/go/ekiden/node_test.go index 7ec63811abd..e28e5ff3a31 100644 --- a/go/ekiden/node_test.go +++ b/go/ekiden/node_test.go @@ -47,15 +47,10 @@ var ( }{ {"log.level.default", "DEBUG"}, {"epochtime.backend", "tendermint_mock"}, - {"beacon.backend", "tendermint"}, - {"keymanager.backend", "tendermint"}, - {"registry.backend", "tendermint"}, - {"roothash.backend", "tendermint"}, + {"consensus.backend", "tendermint"}, {"roothash.tendermint.index_blocks", true}, - {"scheduler.backend", "tendermint"}, {"storage.backend", "leveldb"}, {"storage.debug.mock_signing_key", true}, - {"staking.backend", "tendermint"}, {"staking.debug.genesis_state", stakingTests.DebugGenesisState}, {"tendermint.consensus.timeout_commit", 1 * time.Millisecond}, {"tendermint.consensus.skip_timeout_commit", true}, diff --git a/go/epochtime/tendermint/tendermint.go b/go/epochtime/tendermint/tendermint.go index b391f1258fb..eee83120dfc 100644 --- a/go/epochtime/tendermint/tendermint.go +++ b/go/epochtime/tendermint/tendermint.go @@ -11,12 +11,13 @@ import ( "github.com/oasislabs/ekiden/go/common/logging" "github.com/oasislabs/ekiden/go/common/pubsub" "github.com/oasislabs/ekiden/go/epochtime/api" + tmapi "github.com/oasislabs/ekiden/go/tendermint/api" "github.com/oasislabs/ekiden/go/tendermint/service" ) const ( // BackendName is the name of this implementation. - BackendName = "tendermint" + BackendName = tmapi.BackendName ) var _ api.Backend = (*tendermintBackend)(nil) diff --git a/go/keymanager/init.go b/go/keymanager/init.go index 5b51abe865f..9993d3297f6 100644 --- a/go/keymanager/init.go +++ b/go/keymanager/init.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/spf13/cobra" - "github.com/spf13/viper" + commonFlags "github.com/oasislabs/ekiden/go/ekiden/cmd/common/flags" epochtime "github.com/oasislabs/ekiden/go/epochtime/api" "github.com/oasislabs/ekiden/go/keymanager/api" "github.com/oasislabs/ekiden/go/keymanager/tendermint" @@ -16,8 +16,6 @@ import ( "github.com/oasislabs/ekiden/go/tendermint/service" ) -const cfgBackend = "keymanager.backend" - // New constructs a new Backend based on the configuration flags. func New( ctx context.Context, @@ -25,7 +23,7 @@ func New( registry registry.Backend, service service.TendermintService, ) (api.Backend, error) { - backend := viper.GetString(cfgBackend) + backend := commonFlags.ConsensusBackend() var ( impl api.Backend @@ -44,13 +42,4 @@ func New( // RegisterFlags registers the configuration flags with the provided command. func RegisterFlags(cmd *cobra.Command) { - if !cmd.Flags().Parsed() { - cmd.Flags().String(cfgBackend, tendermint.BackendName, "Key manager backend") - } - - for _, v := range []string{ - cfgBackend, - } { - _ = viper.BindPFlag(v, cmd.Flags().Lookup(v)) - } } diff --git a/go/keymanager/tendermint/tendermint.go b/go/keymanager/tendermint/tendermint.go index 9d694106c34..a5bf28a1476 100644 --- a/go/keymanager/tendermint/tendermint.go +++ b/go/keymanager/tendermint/tendermint.go @@ -23,7 +23,7 @@ import ( ) // BackendName is the name of the backend. -const BackendName = "tendermint" +const BackendName = tmapi.BackendName type tendermintBackend struct { logger *logging.Logger diff --git a/go/registry/init.go b/go/registry/init.go index 5b2173d7d41..2815c141f48 100644 --- a/go/registry/init.go +++ b/go/registry/init.go @@ -7,19 +7,17 @@ import ( "strings" "github.com/spf13/cobra" - "github.com/spf13/viper" + commonFlags "github.com/oasislabs/ekiden/go/ekiden/cmd/common/flags" epochtime "github.com/oasislabs/ekiden/go/epochtime/api" "github.com/oasislabs/ekiden/go/registry/api" "github.com/oasislabs/ekiden/go/registry/tendermint" "github.com/oasislabs/ekiden/go/tendermint/service" ) -const cfgBackend = "registry.backend" - // New constructs a new Backend based on the configuration flags. func New(ctx context.Context, timeSource epochtime.Backend, tmService service.TendermintService) (api.Backend, error) { - backend := viper.GetString(cfgBackend) + backend := commonFlags.ConsensusBackend() var impl api.Backend var err error @@ -40,13 +38,4 @@ func New(ctx context.Context, timeSource epochtime.Backend, tmService service.Te // RegisterFlags registers the configuration flags with the provided // command. func RegisterFlags(cmd *cobra.Command) { - if !cmd.Flags().Parsed() { - cmd.Flags().String(cfgBackend, tendermint.BackendName, "Registry backend") - } - - for _, v := range []string{ - cfgBackend, - } { - viper.BindPFlag(v, cmd.Flags().Lookup(v)) //nolint: errcheck - } } diff --git a/go/registry/tendermint/tendermint.go b/go/registry/tendermint/tendermint.go index b74115e4165..7401f4c9073 100644 --- a/go/registry/tendermint/tendermint.go +++ b/go/registry/tendermint/tendermint.go @@ -25,7 +25,7 @@ import ( ) // BackendName is the name of this implementation. -const BackendName = "tendermint" +const BackendName = tmapi.BackendName var ( _ api.Backend = (*tendermintBackend)(nil) diff --git a/go/roothash/init.go b/go/roothash/init.go index 1352037b276..2533eb3bb3a 100644 --- a/go/roothash/init.go +++ b/go/roothash/init.go @@ -11,6 +11,7 @@ import ( "github.com/spf13/viper" beacon "github.com/oasislabs/ekiden/go/beacon/api" + commonFlags "github.com/oasislabs/ekiden/go/ekiden/cmd/common/flags" epochtime "github.com/oasislabs/ekiden/go/epochtime/api" registry "github.com/oasislabs/ekiden/go/registry/api" "github.com/oasislabs/ekiden/go/roothash/api" @@ -20,7 +21,6 @@ import ( ) const ( - cfgBackend = "roothash.backend" cfgRoundTimeout = "roothash.round_timeout" ) @@ -34,7 +34,7 @@ func New( beacon beacon.Backend, tmService service.TendermintService, ) (api.Backend, error) { - backend := viper.GetString(cfgBackend) + backend := commonFlags.ConsensusBackend() roundTimeout := viper.GetDuration(cfgRoundTimeout) var impl api.Backend @@ -57,12 +57,10 @@ func New( // command. func RegisterFlags(cmd *cobra.Command) { if !cmd.Flags().Parsed() { - cmd.Flags().String(cfgBackend, tendermint.BackendName, "Root hash backend") cmd.Flags().Duration(cfgRoundTimeout, 10*time.Second, "Root hash round timeout") } for _, v := range []string{ - cfgBackend, cfgRoundTimeout, } { viper.BindPFlag(v, cmd.Flags().Lookup(v)) // nolint: errcheck diff --git a/go/roothash/tendermint/tendermint.go b/go/roothash/tendermint/tendermint.go index 6799d7b7b7a..d8b9a87b77a 100644 --- a/go/roothash/tendermint/tendermint.go +++ b/go/roothash/tendermint/tendermint.go @@ -31,7 +31,7 @@ import ( const ( // BackendName is the name of this implementation. - BackendName = "tendermint" + BackendName = tmapi.BackendName cfgIndexBlocks = "roothash.tendermint.index_blocks" ) diff --git a/go/scheduler/init.go b/go/scheduler/init.go index fb8fe21366f..b015e8ef8e2 100644 --- a/go/scheduler/init.go +++ b/go/scheduler/init.go @@ -7,25 +7,20 @@ import ( "strings" "github.com/spf13/cobra" - "github.com/spf13/viper" beacon "github.com/oasislabs/ekiden/go/beacon/api" + commonFlags "github.com/oasislabs/ekiden/go/ekiden/cmd/common/flags" epochtime "github.com/oasislabs/ekiden/go/epochtime/api" registry "github.com/oasislabs/ekiden/go/registry/api" "github.com/oasislabs/ekiden/go/scheduler/api" "github.com/oasislabs/ekiden/go/scheduler/tendermint" - "github.com/oasislabs/ekiden/go/scheduler/trivial" "github.com/oasislabs/ekiden/go/tendermint/service" ) -const cfgBackend = "scheduler.backend" - // New constructs a new Backend based on the configuration flags. func New(ctx context.Context, timeSource epochtime.Backend, reg registry.Backend, beacon beacon.Backend, service service.TendermintService) (api.Backend, error) { - backend := viper.GetString(cfgBackend) + backend := commonFlags.ConsensusBackend() switch strings.ToLower(backend) { - case trivial.BackendName: - return trivial.New(ctx, timeSource, reg, beacon, service), nil case tendermint.BackendName: return tendermint.New(ctx, timeSource, service) default: @@ -36,13 +31,4 @@ func New(ctx context.Context, timeSource epochtime.Backend, reg registry.Backend // RegisterFlags registers the configuration flags with the provided // command. func RegisterFlags(cmd *cobra.Command) { - if !cmd.Flags().Parsed() { - cmd.Flags().String(cfgBackend, tendermint.BackendName, "Scheduler backend") - } - - for _, v := range []string{ - cfgBackend, - } { - viper.BindPFlag(v, cmd.Flags().Lookup(v)) //nolint: errcheck - } } diff --git a/go/scheduler/tendermint/tendermint.go b/go/scheduler/tendermint/tendermint.go index d42a5ee3ba5..bc8a6063892 100644 --- a/go/scheduler/tendermint/tendermint.go +++ b/go/scheduler/tendermint/tendermint.go @@ -20,7 +20,7 @@ import ( ) // BackendName is the name of this implementation. -const BackendName = "tendermint" +const BackendName = tmapi.BackendName var ( _ api.Backend = (*tendermintScheduler)(nil) diff --git a/go/staking/init.go b/go/staking/init.go index 2eb5f272d55..2df2458dc6e 100644 --- a/go/staking/init.go +++ b/go/staking/init.go @@ -10,14 +10,13 @@ import ( "github.com/spf13/viper" "github.com/oasislabs/ekiden/go/common/json" + commonFlags "github.com/oasislabs/ekiden/go/ekiden/cmd/common/flags" "github.com/oasislabs/ekiden/go/staking/api" "github.com/oasislabs/ekiden/go/staking/tendermint" "github.com/oasislabs/ekiden/go/tendermint/service" ) const ( - cfgBackend = "staking.backend" - cfgDebugGenesisState = "staking.debug.genesis_state" ) @@ -26,7 +25,7 @@ func New(ctx context.Context, tmService service.TendermintService) (api.Backend, var ( impl api.Backend err error - backend = viper.GetString(cfgBackend) + backend = commonFlags.ConsensusBackend() ) // Pull in the debug genesis state if configured. @@ -52,15 +51,12 @@ func New(ctx context.Context, tmService service.TendermintService) (api.Backend, // RegisterFlags registers the configuration flags with the provided command. func RegisterFlags(cmd *cobra.Command) { if !cmd.Flags().Parsed() { - cmd.Flags().String(cfgBackend, tendermint.BackendName, "Staking backend") - // cfgDebugGenesisState isn't for anything but test cases. cmd.Flags().String(cfgDebugGenesisState, "", "(Debug only) Staking genesis state") _ = cmd.Flags().MarkHidden(cfgDebugGenesisState) } for _, v := range []string{ - cfgBackend, cfgDebugGenesisState, } { _ = viper.BindPFlag(v, cmd.Flags().Lookup(v)) diff --git a/go/staking/tendermint/tendermint.go b/go/staking/tendermint/tendermint.go index 0cbc145a1e0..5b908da3c56 100644 --- a/go/staking/tendermint/tendermint.go +++ b/go/staking/tendermint/tendermint.go @@ -20,7 +20,7 @@ import ( ) // BackendName is the name of this implementation. -const BackendName = "tendermint" +const BackendName = tmapi.BackendName var _ api.Backend = (*tendermintBackend)(nil) diff --git a/go/tendermint/api/api.go b/go/tendermint/api/api.go index 7cb06d52e6b..7f1336adc8f 100644 --- a/go/tendermint/api/api.go +++ b/go/tendermint/api/api.go @@ -13,6 +13,9 @@ import ( "github.com/oasislabs/ekiden/go/common/crypto/signature" ) +// Conesnus Backend Name +const BackendName = "tendermint" + // Code is a status code for ABCI requests. type Code uint32 diff --git a/scripts/benchmark-e2e.sh b/scripts/benchmark-e2e.sh index fae64db49d9..53a941a2aac 100755 --- a/scripts/benchmark-e2e.sh +++ b/scripts/benchmark-e2e.sh @@ -11,11 +11,9 @@ run_dummy_node_storage_dummy() { ${WORKDIR}/go/ekiden/ekiden \ --log.level info \ --grpc.port 42261 \ - --epochtime.backend mock \ - --beacon.backend insecure \ + --consensus.backend tendermint \ + --epochtime.backend tendermint_mock \ --storage.backend memory \ - --scheduler.backend trivial \ - --registry.backend memory \ --datadir ${datadir} \ >${LOGDIR}/dummy.log & } @@ -27,11 +25,9 @@ run_dummy_node_storage_persistent() { ${WORKDIR}/go/ekiden/ekiden \ --log.level info \ --grpc.port 42261 \ - --epochtime.backend mock \ - --beacon.backend insecure \ + --consensus.backend tendermint \ + --epochtime.backend tendermint_mock \ --storage.backend leveldb \ - --scheduler.backend trivial \ - --registry.backend memory \ --datadir ${datadir} \ >${LOGDIR}/dummy.log & } @@ -43,12 +39,9 @@ run_dummy_node_tendermint() { ${WORKDIR}/go/ekiden/ekiden \ --log.level info \ --grpc.port 42261 \ + --consensus.backend tendermint \ --epochtime.backend tendermint_mock \ - --beacon.backend insecure \ --storage.backend memory \ - --scheduler.backend tendermint \ - --registry.backend tendermint \ - --roothash.backend tendermint \ --tendermint.consensus.timeout_commit 250ms \ --datadir ${datadir} \ >${LOGDIR}/dummy.log &