Skip to content

Commit

Permalink
(scratch) create custom tendermint instance
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Jul 18, 2019
1 parent b3ea3c4 commit 53a7766
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ scenario_byzantine_compute_honest() {
--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}" \
--tendermint.debug.addr_book_lenient \
--datadir untracked/byz-run/data \
--debug.allow_test_keys \
2>&1 | python ../private-ops/untracked/color-log.py | sed "s/^/[byzantine] /" &
Expand Down
15 changes: 13 additions & 2 deletions go/ekiden/cmd/debug/byzantine/byzantine.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"

"github.com/spf13/cobra"
// "github.com/spf13/viper"
"github.com/spf13/viper"

"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"
"github.com/oasislabs/ekiden/go/tendermint"
)

var (
Expand All @@ -23,6 +23,12 @@ var (
Short: "act as an honest compute worker",
Run: doComputeHonest,
}

cfgGenesisFile = "genesis.file"
cfgCoreListenAddress = "tendermint.core.listen_address"
cfgConsensusTimeoutCommit = "tendermint.consensus.timeout_commit"
cfgP2PSeeds = "tendermint.seeds"
cfgDebugP2PAddrBookLenient = "tendermint.debug.addr_book_lenient"
)

func doComputeHonest(cmd *cobra.Command, args []string) {
Expand All @@ -47,6 +53,11 @@ func Register(parentCmd *cobra.Command) {
}

func init() {
byzantineCmd.PersistentFlags().String(cfgCoreListenAddress, "tcp://0.0.0.0:26656", "tendermint core listen address")
viper.BindPFlag(cfgCoreListenAddress, )
byzantineCmd.PersistentFlags().Duration(cfgConsensusTimeoutCommit, 1*time.Second, "tendermint commit timeout")
byzantineCmd.PersistentFlags().String(cfgP2PSeeds, "", "comma-delimited id@host:port tendermint seed nodes")
byzantineCmd.PersistentFlags().Bool(cfgDebugP2PAddrBookLenient, false, "allow non-routable addresses")
genesis.RegisterFlags(computeHonestCmd)
fmt.Println("this should call RegisterFlags %%%")
tendermint.RegisterFlags(computeHonestCmd)
Expand Down
15 changes: 14 additions & 1 deletion go/ekiden/cmd/debug/byzantine/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package byzantine

import (
"context"
"strings"
"time"

"github.com/spf13/viper"

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"
Expand All @@ -15,6 +18,7 @@ import (
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/abci"
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"
Expand Down Expand Up @@ -68,7 +72,16 @@ func startHonestTendermint() {
if err != nil {
panic("genesis.New: " + err.Error())
}
honestTendermint = tendermint.New(context.Background(), dataDir, identity, genesis)
honestTendermint = tendermint.NewFromConfig(context.Background(), dataDir, &tendermint.Config{
CoreListenAddress: viper.GetString(cfgCoreListenAddress),
ConsensusTimeoutCommit: viper.GetDuration(cfgConsensusTimeoutCommit),
ABCIPruneConfig: abci.PruneConfig{
Strategy: abci.PruneNone,
NumKept: 3600,
},
P2PSeeds: strings.ToLower(viper.GetString(cfgP2PSeeds)),
DebugP2PAddrBookLenient: viper.GetBool(cfgDebugP2PAddrBookLenient),
}, identity, genesis)
logger.Debug("honest Tendermint service instantiated %%%", "honestTendermint", honestTendermint)

if err := honestTendermint.ForceInitialize(); err != nil {
Expand Down

0 comments on commit 53a7766

Please sign in to comment.