PrivValidatorAddr -> PrivValidatorListenAddr. Update ADR008

This commit is contained in:
Ethan Buchman 2018-02-28 09:35:52 -05:00 committed by Alexander Simmerl
parent ee51ad8e29
commit d4e4055d57
No known key found for this signature in database
GPG Key ID: 4694E95C9CC61BDA
5 changed files with 20 additions and 11 deletions

View File

@ -15,7 +15,7 @@ func AddNodeFlags(cmd *cobra.Command) {
cmd.Flags().String("moniker", config.Moniker, "Node Name") cmd.Flags().String("moniker", config.Moniker, "Node Name")
// priv val flags // priv val flags
cmd.Flags().String("priv_validator_addr", config.PrivValidatorAddr, "Socket address for private validator") cmd.Flags().String("priv_validator_laddr", config.PrivValidatorListenAddr, "Socket address to listen on for connections from external priv_validator process")
// node flags // node flags
cmd.Flags().Bool("fast_sync", config.FastSync, "Fast blockchain syncing") cmd.Flags().Bool("fast_sync", config.FastSync, "Fast blockchain syncing")

View File

@ -104,8 +104,9 @@ type BaseConfig struct {
// A custom human readable name for this node // A custom human readable name for this node
Moniker string `mapstructure:"moniker"` Moniker string `mapstructure:"moniker"`
// TCP or UNIX socket address of the PrivValidator server // TCP or UNIX socket address for Tendermint to listen on for
PrivValidatorAddr string `mapstructure:"priv_validator_addr"` // connections from an external PrivValidator process
PrivValidatorListenAddr string `mapstructure:"priv_validator_laddr"`
// TCP or UNIX socket address of the ABCI application, // TCP or UNIX socket address of the ABCI application,
// or the name of an ABCI application compiled in with the Tendermint binary // or the name of an ABCI application compiled in with the Tendermint binary

View File

@ -29,8 +29,12 @@ Tendermint node's should support only two in-process PrivValidator implementatio
- PrivValidatorSocket uses a socket to send signing requests to another process - user is responsible for starting that process themselves. - PrivValidatorSocket uses a socket to send signing requests to another process - user is responsible for starting that process themselves.
The PrivValidatorSocket address can be provided via flags at the command line - The PrivValidatorSocket address can be provided via flags at the command line -
doing so will cause Tendermint to ignore any "priv_validator.json" file and to attempt doing so will cause Tendermint to ignore any "priv_validator.json" file and to listen
to connect over the socket. on the given address for incoming connections from an external priv_validator process.
The external priv_validator process will dial the address to connect to Tendermint,
and then Tendermint will send requests on the ensuing connection to sign votes and proposals.
Thus the external process initiates the connection, but the Tendermint process makes all requests.
In addition, Tendermint will provide implementations that can be run in that external process. In addition, Tendermint will provide implementations that can be run in that external process.
These include: These include:
@ -103,7 +107,7 @@ It wraps the PrivValidatorUnencrypted and persists it to disk after every signat
## Status ## Status
Proposed. Accepted.
## Consequences ## Consequences

View File

@ -173,13 +173,16 @@ func NewNode(config *cfg.Config,
// reload the state (it may have been updated by the handshake) // reload the state (it may have been updated by the handshake)
state = sm.LoadState(stateDB) state = sm.LoadState(stateDB)
// Connect to external signing process, if an address is provided. // If an address is provided, listen on the socket for a
if config.PrivValidatorAddr != "" { // connection from an external signing process.
if config.PrivValidatorListenAddr != "" {
var ( var (
// TODO: persist this key so external signer
// can actually authenticate us
privKey = crypto.GenPrivKeyEd25519() privKey = crypto.GenPrivKeyEd25519()
pvsc = priv_val.NewSocketClient( pvsc = priv_val.NewSocketClient(
logger.With("module", "priv_val"), logger.With("module", "priv_val"),
config.PrivValidatorAddr, config.PrivValidatorListenAddr,
&privKey, &privKey,
) )
) )
@ -395,7 +398,7 @@ func (n *Node) OnStart() error {
n.sw.AddListener(l) n.sw.AddListener(l)
// Generate node PrivKey // Generate node PrivKey
// TODO: pass in like priv_val // TODO: pass in like privValidator
nodeKey, err := p2p.LoadOrGenNodeKey(n.config.NodeKeyFile()) nodeKey, err := p2p.LoadOrGenNodeKey(n.config.NodeKeyFile())
if err != nil { if err != nil {
return err return err

View File

@ -34,7 +34,7 @@ func voteToStep(vote *Vote) int8 {
} }
//-------------------------------------------------------------- //--------------------------------------------------------------
// PrivValidator is being upgraded! See types/priv_validator // PrivValidator is being upgraded! See types/priv_validator/
// ValidatorID contains the identity of the validator. // ValidatorID contains the identity of the validator.
type ValidatorID struct { type ValidatorID struct {
@ -82,6 +82,7 @@ func (ds *DefaultTestSigner) Sign(msg []byte) (crypto.Signature, error) {
} }
//-------------------------------------------------------------- //--------------------------------------------------------------
// TODO: Deprecate!
// PrivValidator defines the functionality of a local Tendermint validator // PrivValidator defines the functionality of a local Tendermint validator
// that signs votes, proposals, and heartbeats, and never double signs. // that signs votes, proposals, and heartbeats, and never double signs.