Skip to content

Commit

Permalink
Adjust consensus parameters for better convergence
Browse files Browse the repository at this point in the history
* Change sigchain propagation time to 2 blocks
* Reduce sigchain cache expiration to 10 min
* Reduce min voting interval to 200ms

Signed-off-by: Yilun <zyl.skysniper@gmail.com>
  • Loading branch information
yilunzhang committed Jul 13, 2019
1 parent c69df04 commit 5e0d3e1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ Address Public Key
NKNRQxosmUixL8bvLAS5G79m1XNx3YqPsFPW 35db285ea2f91499164cd3e19203ab5e525df6216d1eba3ac6bcef00503407ce
```

If you are using Docker, it should be `docker run -it -v $PWD:/nkn/data
If you are using Docker, it should be `docker run -it -v ${PWD}:/nkn/data
nknorg/nkn nknc wallet -c` instead, assuming you want to store the `wallet.json`
in your current working directory. If you want it to be saved to another
directory, you need to change `$PWD` to that directory.
directory, you need to change `${PWD}` to that directory.

**[IMPORTANT] Each node needs to use a unique wallet. If you use share wallet
among multiple nodes, only one of them will be able to join the network!**
Expand All @@ -200,8 +200,8 @@ chain](https://github.com/nknorg/nkn/wiki/Create-a-Private-Chain).
### Join the MainNet

**[IMPORTANT] Currently, in order to join the MainNet, you need to have a public
*IP address, or set up [port forwarding](#port-forwarding) on your router
*properly so that other people can establish connection to you.**
IP address, or set up [port forwarding](#port-forwarding) on your router
properly so that other people can establish connection to you.**

If you have done the previous steps correctly (`config.json`, create wallet,
public IP or port forwarding), joining the MainNet is as simple as running:
Expand All @@ -213,7 +213,7 @@ $ ./nknd
If you are using Docker then you should run the following command instead:

```shell
$ docker run -p 30001-30003:30001-30003 -v $PWD:/nkn/data --name nkn --rm -it nknorg/nkn nknd
$ docker run -p 30001-30003:30001-30003 -v ${PWD}:/nkn/data --name nkn --rm -it nknorg/nkn nknd
```

If you get an error saying `docker: Error response from daemon: Conflict. The
Expand Down
2 changes: 1 addition & 1 deletion chain/blockValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
TimestampTolerancePast = config.ConsensusDuration / 2
TimestampToleranceVariance = config.ConsensusDuration / 6
ProposingTimeTolerance = config.ConsensusDuration / 2
NumGenesisBlocks = por.SigChainMiningHeightOffset + config.SigChainBlockDelay - 1
NumGenesisBlocks = 4
)

var timestampToleranceSalt []byte = util.RandomBytes(32)
Expand Down
2 changes: 1 addition & 1 deletion consensus/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
electionStartDelay = config.ConsensusDuration / 2
electionDuration = config.ConsensusDuration / 2
proposalVerificationTimeout = electionStartDelay * 4 / 5
minVotingInterval = 500 * time.Millisecond
minVotingInterval = 200 * time.Millisecond
maxVotingInterval = 2 * time.Second
proposingInterval = 500 * time.Millisecond
proposingTimeout = chain.ProposingTimeTolerance * 4 / 5
Expand Down
2 changes: 1 addition & 1 deletion nknd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
)

const (
NetVersionNum = 2 // This is temporary and will be removed soon after mainnet is stabilized
NetVersionNum = 3 // This is temporary and will be removed soon after mainnet is stabilized
)

var (
Expand Down
4 changes: 2 additions & 2 deletions por/porserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const (
destSigChainElemCacheCleanupInterval = config.ConsensusDuration
finalizedBlockCacheExpiration = 10 * config.ConsensusTimeout
finalizedBlockCacheCleanupInterval = config.ConsensusDuration
sigChainTxnCacheExpiration = 50 * config.ConsensusTimeout
sigChainTxnCacheExpiration = 10 * config.ConsensusTimeout
sigChainTxnCacheCleanupInterval = config.ConsensusDuration
miningPorPackageCacheExpiration = 50 * config.ConsensusTimeout
miningPorPackageCacheExpiration = 10 * config.ConsensusTimeout
miningPorPackageCacheCleanupInterval = config.ConsensusDuration
vrfCacheExpiration = (SigChainMiningHeightOffset + config.SigChainBlockDelay + 5) * config.ConsensusTimeout
vrfCacheCleanupInterval = config.ConsensusDuration
Expand Down
8 changes: 4 additions & 4 deletions util/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
NodeIDBytes = 32
MaxRollbackBlocks = 180
SigChainBlockDelay = 1
SigChainPropogationTime = 1
SigChainPropogationTime = 2
HeaderVersion = 1
DBVersion = 0x01
InitialIssueAddress = "NKNFCrUMFPkSeDRMG2ME21hD6wBCA2poc347"
Expand All @@ -50,9 +50,9 @@ const (
GenerateIDBlockDelay = 8
RandomBeaconUniqueLength = vrf.Size
RandomBeaconLength = vrf.Size + vrf.ProofSize
ProtocolVersion = 20
MinCompatibleProtocolVersion = 20
MaxCompatibleProtocolVersion = 29
ProtocolVersion = 30
MinCompatibleProtocolVersion = 30
MaxCompatibleProtocolVersion = 39
DefaultTxPoolCap = 32
ShortHashSize = uint32(8)
MaxAssetPrecision = uint32(8)
Expand Down

0 comments on commit 5e0d3e1

Please sign in to comment.