Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Commit ec25392

Browse files
author
Sean Young
authored
Merge pull request #1078 from hyperledger/develop
Merge for v0.24.6 release
2 parents 5c1e505 + 0c472c7 commit ec25392

24 files changed

+796
-492
lines changed

CHANGELOG.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
## [Unreleased]
33

44

5+
## [0.24.6] - 2019-03-19
6+
### Changed
7+
- [RPC] 'blocks' on info RPC now lists blocks in ascending rather than descending height order
8+
9+
### Added
10+
- [CLI] Introduced burrow configure --pool for generation of multiple validator configs suitable for running on a single (or many) machines
11+
12+
### Fixed
13+
- [Metrics] Fix histogram statistics by making counts cumulative
14+
15+
516
## [0.24.5] - 2019-03-14
617
### Changed
718
- [Consensus] Tendermint timeouts configurable by a float factor from defaults and default change to 0.33 of Tendermint's default for smaller networks'
@@ -245,7 +256,7 @@ In addition to breaking changes associated with Tendermint (see their changelog)
245256
- Add BlockExplorer CLI for forensics
246257
- Expose reason for REVERT
247258
- Add last_block_info healthcheck endpoint to rpc/TM
248-
-
259+
-
249260
#### Improvements
250261
- Implement checkpointing when saving application and blockchain state in commit - interrupted commit rolls burrow back to last block whereon it can catch up using Tendermint
251262
- Maintain separate read-only tree in state so that long-running RPC request cannot block writes
@@ -411,7 +422,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
411422
- Allow multiple event subscriptions from same host under rpc/tendermint
412423

413424

414-
- Tool changes
425+
- Tool changes
415426
- Use glide instead of godeps for dependencies
416427

417428

@@ -428,7 +439,8 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
428439
- [Blockchain] Fix getBlocks to respect block height cap.
429440

430441

431-
[Unreleased]: https://github.com/hyperledger/burrow/compare/v0.24.5...HEAD
442+
[Unreleased]: https://github.com/hyperledger/burrow/compare/v0.24.6...HEAD
443+
[0.24.6]: https://github.com/hyperledger/burrow/compare/v0.24.5...v0.24.6
432444
[0.24.5]: https://github.com/hyperledger/burrow/compare/v0.24.4...v0.24.5
433445
[0.24.4]: https://github.com/hyperledger/burrow/compare/v0.24.3...v0.24.4
434446
[0.24.3]: https://github.com/hyperledger/burrow/compare/v0.24.2...v0.24.3

Gopkg.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NOTES.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
### Changed
2-
- [Consensus] Tendermint timeouts configurable by a float factor from defaults and default change to 0.33 of Tendermint's default for smaller networks'
3-
- [Transactor] Hard-coded timeout removed from transactor and added to TxEnvelopeParam for client specified server-side timeout (in case of longer confirmation times such as when some validators are unavailable
4-
- [Logging] ExcludeTrace config inverted to Trace and now defaults to false (i.e. no trace/debug logging). Default log output now excludes Tendermint logging (and is therefore much less talkative)
2+
- [RPC] 'blocks' on info RPC now lists blocks in ascending rather than descending height order
53

64
### Added
7-
- [Logging] Add height to all logging messages
8-
- [RPC] Add LastBlockCommitDuration to SyncInfo
5+
- [CLI] Introduced burrow configure --pool for generation of multiple validator configs suitable for running on a single (or many) machines
96

107
### Fixed
11-
- [Metrics] Replace use of Summary metrics when Histogram was intended
8+
- [Metrics] Fix histogram statistics by making counts cumulative
129

cmd/burrow/commands/configure.go

+40-4
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ func Configure(output Output) func(cmd *cli.Cmd) {
7070

7171
restoreDumpOpt := cmd.StringOpt("restore-dump", "", "Including AppHash for restored file")
7272

73+
pool := cmd.BoolOpt("pool", false, "Write config files for all the validators called burrowNNN.toml")
74+
7375
cmd.Spec = "[--keys-url=<keys URL> | --keysdir=<keys directory>] " +
7476
"[--config-template-in=<text template> --config-out=<output file>]... " +
7577
"[--genesis-spec=<GenesisSpec file> | --genesis-doc=<GenesisDoc file>] " +
7678
"[--separate-genesis-doc=<genesis JSON file>] [--chain-name=<chain name>] [--json] " +
7779
"[--generate-node-keys] [--restore-dump=<dump file>] " +
78-
"[--logging=<logging program>] [--describe-logging] [--debug]"
80+
"[--logging=<logging program>] [--describe-logging] [--debug] [--pool]"
7981

8082
configOpts := addConfigOptions(cmd)
8183

@@ -129,7 +131,7 @@ func Configure(output Output) func(cmd *cli.Cmd) {
129131
keyStore := keys.NewKeyStore(dir, conf.Keys.AllowBadFilePermissions)
130132

131133
keyClient := keys.NewLocalKeyClient(keyStore, logging.NewNoopLogger())
132-
conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient, *generateNodeKeys)
134+
conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient, *generateNodeKeys || *pool)
133135
if err != nil {
134136
output.Fatalf("Could not generate GenesisDoc from GenesisSpec using MockKeyClient: %v", err)
135137
}
@@ -188,7 +190,7 @@ func Configure(output Output) func(cmd *cli.Cmd) {
188190
if err != nil {
189191
output.Fatalf("Could not create remote key client: %v", err)
190192
}
191-
conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient, *generateNodeKeys)
193+
conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient, *generateNodeKeys || *pool)
192194
}
193195

194196
if err != nil {
@@ -285,6 +287,11 @@ func Configure(output Output) func(cmd *cli.Cmd) {
285287
}
286288
}
287289

290+
var validators []genesis.Validator
291+
if conf.GenesisDoc != nil {
292+
validators = conf.GenesisDoc.Validators
293+
}
294+
288295
if *separateGenesisDoc != "" {
289296
if conf.GenesisDoc == nil {
290297
output.Fatalf("Cannot write separate genesis doc since no GenesisDoc/GenesisSpec provided.")
@@ -305,11 +312,40 @@ func Configure(output Output) func(cmd *cli.Cmd) {
305312
output.Fatalf("could not update burrow config: %v", err)
306313
}
307314

308-
if *jsonOutOpt {
315+
if *pool && len(validators) > 0 {
316+
for i, v := range validators {
317+
if v.NodeAddress == nil {
318+
continue
319+
}
320+
seeds := ""
321+
for n, v := range validators {
322+
if i == n || v.NodeAddress == nil {
323+
continue
324+
}
325+
if seeds != "" {
326+
seeds += ","
327+
}
328+
seeds += fmt.Sprintf("tcp://%[email protected]:%d", strings.ToLower(v.NodeAddress.String()), 26656+n)
329+
}
330+
// set stuff
331+
conf.ValidatorAddress = &v.Address
332+
conf.Tendermint.PersistentPeers = seeds
333+
conf.Tendermint.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", 26656+i)
334+
conf.Tendermint.TendermintRoot = fmt.Sprintf("burrow%03d", i)
335+
conf.RPC.Info.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", 26758+i)
336+
conf.RPC.GRPC.ListenAddress = fmt.Sprintf("127.0.0.1:%d", 10997+i)
337+
conf.RPC.Metrics.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", 9102+i)
338+
conf.Logging.RootSink.Output.OutputType = "file"
339+
conf.Logging.RootSink.Output.FileConfig = &logconfig.FileConfig{Path: fmt.Sprintf("burrow%03d.log", i)}
340+
341+
ioutil.WriteFile(fmt.Sprintf("burrow%03d.toml", i), []byte(conf.TOMLString()), 0644)
342+
}
343+
} else if *jsonOutOpt {
309344
output.Printf(conf.JSONString())
310345
} else {
311346
output.Printf(conf.TOMLString())
312347
}
348+
313349
}
314350
}
315351
}

config/config.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,20 @@ func (conf *BurrowConfig) Kernel(ctx context.Context, restoreDump string) (*core
8484
}
8585
}
8686

87+
// find node key
88+
var nodeKey *crypto.PrivateKey
89+
for _, v := range conf.GenesisDoc.Validators {
90+
if v.Address == *conf.ValidatorAddress && v.NodeAddress != nil {
91+
k, err := keyStore.GetKey("", v.NodeAddress.Bytes())
92+
if err == nil {
93+
nodeKey = &k.PrivateKey
94+
}
95+
break
96+
}
97+
}
98+
8799
return core.NewKernel(ctx, keyClient, privValidator, conf.GenesisDoc, conf.Tendermint.TendermintConfig(), conf.RPC,
88-
conf.Keys, keyStore, exeOptions, conf.Tendermint.DefaultAuthorizedPeersProvider(), restoreDump, logger)
100+
conf.Keys, keyStore, exeOptions, conf.Tendermint.DefaultAuthorizedPeersProvider(), restoreDump, nodeKey, logger)
89101
}
90102

91103
func (conf *BurrowConfig) JSONString() string {

consensus/tendermint/config.go

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func (btc *BurrowTendermintConfig) TendermintConfig() *tm_config.Config {
7171
conf.Consensus.TimeoutPrecommit = scaleTimeout(btc.TimeoutFactor, conf.Consensus.TimeoutPrecommit)
7272
conf.Consensus.TimeoutPrecommitDelta = scaleTimeout(btc.TimeoutFactor, conf.Consensus.TimeoutPrecommitDelta)
7373
conf.Consensus.TimeoutCommit = scaleTimeout(btc.TimeoutFactor, conf.Consensus.TimeoutCommit)
74+
// This is the smallest increment we can use to get a strictly increasing sequence of block time - we set it low to avoid skew
75+
// if the BlockTimeIota is longer than the average block time
76+
conf.Consensus.BlockTimeIota = time.Nanosecond
7477

7578
// P2P
7679
conf.Moniker = btc.Moniker

consensus/tendermint/tendermint.go

+16-8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/hyperledger/burrow/logging"
1212
"github.com/hyperledger/burrow/logging/structure"
1313
"github.com/tendermint/tendermint/config"
14+
"github.com/tendermint/tendermint/crypto/ed25519"
1415
dbm "github.com/tendermint/tendermint/libs/db"
1516
"github.com/tendermint/tendermint/node"
1617
"github.com/tendermint/tendermint/p2p"
@@ -44,20 +45,27 @@ func (n *Node) Close() {
4445
}
4546

4647
func NewNode(conf *config.Config, privValidator tmTypes.PrivValidator, genesisDoc *tmTypes.GenesisDoc,
47-
app *abci.App, metricsProvider node.MetricsProvider, logger *logging.Logger) (*Node, error) {
48+
app *abci.App, metricsProvider node.MetricsProvider, marmotNodeKey *crypto.PrivateKey, logger *logging.Logger) (*Node, error) {
4849

4950
var err error
5051
// disable Tendermint's RPC
5152
conf.RPC.ListenAddress = ""
5253

53-
err = os.MkdirAll(path.Dir(conf.NodeKeyFile()), 0777)
54-
if err != nil {
55-
return nil, err
56-
}
54+
var nodeKey *p2p.NodeKey
55+
if marmotNodeKey != nil && marmotNodeKey.CurveType == crypto.CurveTypeEd25519 {
56+
var pkey ed25519.PrivKeyEd25519
57+
copy(pkey[:], marmotNodeKey.PrivateKey)
58+
nodeKey = &p2p.NodeKey{PrivKey: pkey}
59+
} else {
60+
err = os.MkdirAll(path.Dir(conf.NodeKeyFile()), 0777)
61+
if err != nil {
62+
return nil, err
63+
}
5764

58-
nodeKey, err := p2p.LoadOrGenNodeKey(conf.NodeKeyFile())
59-
if err != nil {
60-
return nil, err
65+
nodeKey, err = p2p.LoadOrGenNodeKey(conf.NodeKeyFile())
66+
if err != nil {
67+
return nil, err
68+
}
6169
}
6270

6371
nde := &Node{}

core/kernel.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/hyperledger/burrow/bcm"
4040
"github.com/hyperledger/burrow/consensus/tendermint"
4141
"github.com/hyperledger/burrow/consensus/tendermint/abci"
42+
"github.com/hyperledger/burrow/crypto"
4243
"github.com/hyperledger/burrow/event"
4344
"github.com/hyperledger/burrow/execution"
4445
"github.com/hyperledger/burrow/genesis"
@@ -94,7 +95,7 @@ func NewBurrowDB(dbDir string) dbm.DB {
9495

9596
func NewKernel(ctx context.Context, keyClient keys.KeyClient, privValidator tmTypes.PrivValidator,
9697
genesisDoc *genesis.GenesisDoc, tmConf *tmConfig.Config, rpcConfig *rpc.RPCConfig, keyConfig *keys.KeysConfig,
97-
keyStore *keys.KeyStore, exeOptions []execution.ExecutionOption, authorizedPeersProvider abci.PeersFilterProvider, restore string, logger *logging.Logger) (*Kernel, error) {
98+
keyStore *keys.KeyStore, exeOptions []execution.ExecutionOption, authorizedPeersProvider abci.PeersFilterProvider, restore string, nodeKey *crypto.PrivateKey, logger *logging.Logger) (*Kernel, error) {
9899

99100
var err error
100101
kern := &Kernel{
@@ -189,7 +190,7 @@ func NewKernel(ctx context.Context, keyClient keys.KeyClient, privValidator tmTy
189190
Prometheus: false,
190191
PrometheusListenAddr: "",
191192
})
192-
kern.Node, err = tendermint.NewNode(tmConf, privValidator, tmGenesisDoc, app, metricsProvider, tendermintLogger)
193+
kern.Node, err = tendermint.NewNode(tmConf, privValidator, tmGenesisDoc, app, metricsProvider, nodeKey, tendermintLogger)
193194
if err != nil {
194195
return nil, err
195196
}

docs/quickstart/multiple-validators.md

+7-103
Original file line numberDiff line numberDiff line change
@@ -3,125 +3,29 @@
33
### Configure a chain with 2 full accounts and validators
44
```bash
55
rm -rf .burrow* .keys*
6-
burrow spec -f2 | burrow configure -s- > .burrow_init.toml
7-
```
8-
9-
### Configure 2 validator nodes config files
10-
From the generated `.burrow_init.toml `file, create new files for each node, and change the content, example:
11-
12-
#### Validator 1 node `.burrow_val0.toml` modified line from `.burrow_init.toml`
13-
14-
```toml
15-
[Tendermint]
16-
Seeds = ""
17-
SeedMode = false
18-
PersistentPeers = ""
19-
ListenAddress = "tcp://0.0.0.0:20000"
20-
Moniker = "val_node_0"
21-
TendermintRoot = ".burrow_node0"
22-
23-
[Execution]
24-
25-
[Keys]
26-
GRPCServiceEnabled = false
27-
AllowBadFilePermissions = true
28-
RemoteAddress = ""
29-
KeysDirectory = ".keys"
30-
31-
[RPC]
32-
[RPC.Info]
33-
Enabled = true
34-
ListenAddress = "tcp://127.0.0.1:20001"
35-
[RPC.Profiler]
36-
Enabled = false
37-
[RPC.GRPC]
38-
Enabled = true
39-
ListenAddress = "127.0.0.1:20002"
40-
[RPC.Metrics]
41-
Enabled = false
42-
```
43-
44-
#### Validator 2 node `.burrow_val1.toml` modified line from `.burrow_init.toml`
45-
46-
```toml
47-
[Tendermint]
48-
Seeds = ""
49-
SeedMode = false
50-
PersistentPeers = "PUT_HERE_NODE_0_ID@LISTEN_EXTERNAL_ADDRESS"
51-
ListenAddress = "tcp://0.0.0.0:30000"
52-
Moniker = "val_node_1"
53-
TendermintRoot = ".burrow_node1"
54-
55-
[Execution]
56-
57-
[Keys]
58-
GRPCServiceEnabled = false
59-
AllowBadFilePermissions = true
60-
RemoteAddress = ""
61-
KeysDirectory = ".keys"
62-
63-
[RPC]
64-
[RPC.Info]
65-
Enabled = true
66-
ListenAddress = "tcp://127.0.0.1:30001"
67-
[RPC.Profiler]
68-
Enabled = false
69-
[RPC.GRPC]
70-
Enabled = true
71-
ListenAddress = "127.0.0.1:30002"
72-
[RPC.Metrics]
73-
Enabled = false
74-
```
75-
76-
Node 0 will be defined as persistent peer of node 1.
77-
Persistent peers are people you want to be constantly connected with.
78-
6+
burrow spec -f2 | burrow configure -s- --pool
7+
```
798
### Start the network
809

8110
#### Start the first node
8211
```bash
83-
burrow start --validator-index=0 --config=.burrow_val0.toml
12+
burrow start --config=burrow000.toml
8413
```
8514

86-
You will see `Blockpool has no peers` in console logs.
15+
You will see `Blockpool has no peers` in burrow000.log.
8716
The node has not enough validator power in order to have quorum (2/3) on the network, so it is blocked waiting for the second validator to join.
8817

89-
#### Find the first node identifier and address
90-
91-
Configure second node to persistently connect to the first node.
92-
93-
```bash
94-
NODE_0_URL=`curl -s 127.0.0.1:20001/network | jq -r '.result.ThisNode | [.ID, .ListenAddress] | join("@") | ascii_downcase'`
95-
sed -i s%PUT_HERE_NODE_0_ID@LISTEN_EXTERNAL_ADDRESS%${NODE_0_URL}% .burrow_val1.toml
96-
```
97-
9818
#### Start the second node
9919

10020
```bash
101-
burrow start --validator-index=1 --config=.burrow_val1.toml
21+
burrow start --config=burrow001.toml
10222
```
10323

10424
If the connection successed, you will see empty blocks automatically created `Sending vote message` and `Finalizing commit of block with 0 txs`, you can see consensus state:
10525
```bash
106-
curl -s 127.0.0.1:20001/consensus
26+
curl -s 127.0.0.1:26758/consensus
10727
```
10828

109-
#### Disable Tendermint strict address if required
110-
If you face `Cannot add non-routable address` message in logs, it means your listen address is not routable for tendermint.
111-
112-
You can disable this check by modified default tendermint/config.go:46 and rebuild burrow:
113-
```go
114-
conf.P2P.AddrBookStrict = false
115-
```
116-
117-
Or explicitly set an external routable address, for example on node 0, if you have a net interface on `172.217.19.227`:
118-
```toml
119-
[Tendermint]
120-
ExternalAddress = "172.217.19.227:20000"
121-
```
122-
123-
Update `PersistentPeers` property of node 1 with this new address.
124-
12529
## Send transactions to the blockchain
12630

127-
You can start to [send transactions](send-transactions.md).
31+
You can start to [send transactions](send-transactions.md).

0 commit comments

Comments
 (0)