Browse Source

PrivValidatorAddr -> PrivValidatorListenAddr. Update ADR008

pull/1256/head
Ethan Buchman 7 years ago
committed by Alexander Simmerl
parent
commit
d4e4055d57
No known key found for this signature in database GPG Key ID: 4694E95C9CC61BDA
5 changed files with 20 additions and 11 deletions
  1. +1
    -1
      cmd/tendermint/commands/run_node.go
  2. +3
    -2
      config/config.go
  3. +7
    -3
      docs/architecture/adr-008-priv-validator.md
  4. +7
    -4
      node/node.go
  5. +2
    -1
      types/priv_validator.go

+ 1
- 1
cmd/tendermint/commands/run_node.go 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")


+ 3
- 2
config/config.go 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
PrivValidatorAddr string `mapstructure:"priv_validator_addr"`
// TCP or UNIX socket address for Tendermint to listen on for
// 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


+ 7
- 3
docs/architecture/adr-008-priv-validator.md 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
to connect over the socket.
doing so will cause Tendermint to ignore any "priv_validator.json" file and to listen
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


+ 7
- 4
node/node.go 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 config.PrivValidatorAddr != "" {
// If an address is provided, listen on the socket for a
// 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


+ 2
- 1
types/priv_validator.go 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.


Loading…
Cancel
Save