Browse Source

Update the consensus params to include the new TimeoutParams

pull/8177/head
William Banfield 3 years ago
parent
commit
57ff7ad185
No known key found for this signature in database GPG Key ID: EFAD3442BF29E3AC
5 changed files with 832 additions and 60 deletions
  1. +8
    -0
      config/toml.go
  2. +674
    -52
      proto/tendermint/types/params.pb.go
  3. +8
    -0
      types/genesis_test.go
  4. +92
    -0
      types/params.go
  5. +50
    -8
      types/params_test.go

+ 8
- 0
config/toml.go View File

@ -602,6 +602,14 @@ var testGenesisFmt = `{
"message_delay": "500000000",
"precision": "10000000"
},
"timeout": {
"propose": "30000000000",
"propose_delta": "50000000",
"vote": "30000000000",
"vote_delta": "50000000",
"commit": "10000000000",
"enable_commit_timeout_bypass": false
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000",


+ 674
- 52
proto/tendermint/types/params.pb.go View File

@ -35,6 +35,7 @@ type ConsensusParams struct {
Validator *ValidatorParams `protobuf:"bytes,3,opt,name=validator,proto3" json:"validator,omitempty"`
Version *VersionParams `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
Synchrony *SynchronyParams `protobuf:"bytes,5,opt,name=synchrony,proto3" json:"synchrony,omitempty"`
Timeout *TimeoutParams `protobuf:"bytes,6,opt,name=timeout,proto3" json:"timeout,omitempty"`
}
func (m *ConsensusParams) Reset() { *m = ConsensusParams{} }
@ -105,6 +106,13 @@ func (m *ConsensusParams) GetSynchrony() *SynchronyParams {
return nil
}
func (m *ConsensusParams) GetTimeout() *TimeoutParams {
if m != nil {
return m.Timeout
}
return nil
}
// BlockParams contains limits on the block size.
type BlockParams struct {
// Max block size, in bytes.
@ -441,6 +449,123 @@ func (m *SynchronyParams) GetPrecision() *time.Duration {
return nil
}
// TimeoutParams configure the timeouts for the steps of the Tendermint consensus algorithm.
type TimeoutParams struct {
// These fields configure the timeouts for the propose step of the Tendermint
// consensus algorithm: propose is the initial timeout and propose_delta
// determines how much the timeout grows in subsequent rounds.
// For the first round, this propose timeout is used and for every subsequent
// round, the timeout grows by propose_delta.
//
// For example:
// With propose = 10ms, propose_delta = 5ms, the first round's propose phase
// timeout would be 10ms, the second round's would be 15ms, the third 20ms and so on.
//
// If a node waiting for a proposal message does not receive one matching its
// current height and round before this timeout, the node will issue a
// nil prevote for the round and advance to the next step.
Propose *time.Duration `protobuf:"bytes,1,opt,name=propose,proto3,stdduration" json:"propose,omitempty"`
ProposeDelta *time.Duration `protobuf:"bytes,2,opt,name=propose_delta,json=proposeDelta,proto3,stdduration" json:"propose_delta,omitempty"`
// vote along with vote_delta configure the timeout for both of the prevote and
// precommit steps of the Tendermint consensus algorithm.
//
// These parameters influence the vote step timeouts in the the same way that
// the propose and propose_delta parameters do to the proposal step.
//
// The vote timeout does not begin until a quorum of votes has been received. Once
// a quorum of votes has been seen and this timeout elapses, Tendermint will
// procced to the next step of the consensus algorithm. If Tendermint receives
// all of the remaining votes before the end of the timeout, it will proceed
// to the next step immediately.
Vote *time.Duration `protobuf:"bytes,3,opt,name=vote,proto3,stdduration" json:"vote,omitempty"`
VoteDelta *time.Duration `protobuf:"bytes,4,opt,name=vote_delta,json=voteDelta,proto3,stdduration" json:"vote_delta,omitempty"`
// commit configures how long Tendermint will wait after receiving a quorum of
// precommits before beginning consensus for the next height. This can be
// used to allow slow precommits to arrive for inclusion in the next height before progressing.
Commit *time.Duration `protobuf:"bytes,5,opt,name=commit,proto3,stdduration" json:"commit,omitempty"`
// enable_commit_timeout_bypass configures the node to proceed immediately to
// the next height once the node has received all precommits for a block, forgoing
// the remaining commit timeout.
// Setting enable_commit_timeout_bypass false (the default) causes Tendermint to wait
// for the full commit.
EnableCommitTimeoutBypass bool `protobuf:"varint,6,opt,name=enable_commit_timeout_bypass,json=enableCommitTimeoutBypass,proto3" json:"enable_commit_timeout_bypass,omitempty"`
}
func (m *TimeoutParams) Reset() { *m = TimeoutParams{} }
func (m *TimeoutParams) String() string { return proto.CompactTextString(m) }
func (*TimeoutParams) ProtoMessage() {}
func (*TimeoutParams) Descriptor() ([]byte, []int) {
return fileDescriptor_e12598271a686f57, []int{7}
}
func (m *TimeoutParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TimeoutParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_TimeoutParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *TimeoutParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_TimeoutParams.Merge(m, src)
}
func (m *TimeoutParams) XXX_Size() int {
return m.Size()
}
func (m *TimeoutParams) XXX_DiscardUnknown() {
xxx_messageInfo_TimeoutParams.DiscardUnknown(m)
}
var xxx_messageInfo_TimeoutParams proto.InternalMessageInfo
func (m *TimeoutParams) GetPropose() *time.Duration {
if m != nil {
return m.Propose
}
return nil
}
func (m *TimeoutParams) GetProposeDelta() *time.Duration {
if m != nil {
return m.ProposeDelta
}
return nil
}
func (m *TimeoutParams) GetVote() *time.Duration {
if m != nil {
return m.Vote
}
return nil
}
func (m *TimeoutParams) GetVoteDelta() *time.Duration {
if m != nil {
return m.VoteDelta
}
return nil
}
func (m *TimeoutParams) GetCommit() *time.Duration {
if m != nil {
return m.Commit
}
return nil
}
func (m *TimeoutParams) GetEnableCommitTimeoutBypass() bool {
if m != nil {
return m.EnableCommitTimeoutBypass
}
return false
}
func init() {
proto.RegisterType((*ConsensusParams)(nil), "tendermint.types.ConsensusParams")
proto.RegisterType((*BlockParams)(nil), "tendermint.types.BlockParams")
@ -449,48 +574,56 @@ func init() {
proto.RegisterType((*VersionParams)(nil), "tendermint.types.VersionParams")
proto.RegisterType((*HashedParams)(nil), "tendermint.types.HashedParams")
proto.RegisterType((*SynchronyParams)(nil), "tendermint.types.SynchronyParams")
proto.RegisterType((*TimeoutParams)(nil), "tendermint.types.TimeoutParams")
}
func init() { proto.RegisterFile("tendermint/types/params.proto", fileDescriptor_e12598271a686f57) }
var fileDescriptor_e12598271a686f57 = []byte{
// 565 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4d, 0x8b, 0xd3, 0x40,
0x18, 0xc7, 0x9b, 0xed, 0xbe, 0xb4, 0x4f, 0xb7, 0xdb, 0x65, 0x10, 0x8c, 0x2b, 0x9b, 0xd6, 0x1c,
0x64, 0x41, 0x48, 0xc4, 0x45, 0x44, 0x50, 0xc4, 0x6e, 0x45, 0x41, 0x56, 0x24, 0xbe, 0x1c, 0xf6,
0x12, 0x26, 0xed, 0x98, 0x86, 0x6d, 0x32, 0x43, 0x26, 0x29, 0xcd, 0xb7, 0xf0, 0x24, 0x7e, 0x04,
0xfd, 0x18, 0xde, 0xf6, 0xb8, 0x47, 0x4f, 0x2a, 0xed, 0x17, 0x91, 0x99, 0xcc, 0x6c, 0xb6, 0x5d,
0x15, 0x6f, 0xc9, 0x3c, 0xff, 0xdf, 0x3c, 0xcc, 0xef, 0x49, 0x06, 0xf6, 0x33, 0x92, 0x8c, 0x48,
0x1a, 0x47, 0x49, 0xe6, 0x66, 0x05, 0x23, 0xdc, 0x65, 0x38, 0xc5, 0x31, 0x77, 0x58, 0x4a, 0x33,
0x8a, 0x76, 0xab, 0xb2, 0x23, 0xcb, 0x7b, 0xd7, 0x42, 0x1a, 0x52, 0x59, 0x74, 0xc5, 0x53, 0x99,
0xdb, 0xb3, 0x42, 0x4a, 0xc3, 0x09, 0x71, 0xe5, 0x5b, 0x90, 0x7f, 0x70, 0x47, 0x79, 0x8a, 0xb3,
0x88, 0x26, 0x65, 0xdd, 0xfe, 0xb6, 0x06, 0x9d, 0x23, 0x9a, 0x70, 0x92, 0xf0, 0x9c, 0xbf, 0x96,
0x1d, 0xd0, 0x21, 0x6c, 0x04, 0x13, 0x3a, 0x3c, 0x35, 0x8d, 0x9e, 0x71, 0xd0, 0xba, 0xb7, 0xef,
0xac, 0xf6, 0x72, 0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, 0xca, 0xf5, 0xc3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x57, 0x89, 0x7c,
0xd9, 0x59, 0x04, 0x00, 0x00,
// 687 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x6e, 0xd3, 0x4a,
0x14, 0xc6, 0xe3, 0x26, 0x4d, 0x93, 0x93, 0xa6, 0xa9, 0x46, 0x57, 0xba, 0x6e, 0xef, 0xad, 0xd3,
0xeb, 0xc5, 0x55, 0x25, 0x24, 0x07, 0x51, 0xa1, 0x0a, 0x09, 0xa8, 0x48, 0x83, 0x40, 0x42, 0x45,
0xc8, 0x14, 0x16, 0xdd, 0x58, 0xe3, 0x64, 0x70, 0xad, 0xc6, 0x1e, 0xcb, 0x63, 0x47, 0xf1, 0x5b,
0xb0, 0x42, 0x3c, 0x02, 0xbc, 0x49, 0x97, 0x5d, 0xb2, 0x02, 0x94, 0xbe, 0x06, 0x12, 0x68, 0xfe,
0x35, 0x4d, 0x4a, 0x69, 0x56, 0x71, 0xe6, 0xfc, 0x3e, 0x7f, 0x9e, 0xef, 0x9c, 0x19, 0xd8, 0xca,
0x48, 0x3c, 0x20, 0x69, 0x14, 0xc6, 0x59, 0x27, 0x2b, 0x12, 0xc2, 0x3a, 0x09, 0x4e, 0x71, 0xc4,
0x9c, 0x24, 0xa5, 0x19, 0x45, 0xeb, 0xd3, 0xb2, 0x23, 0xca, 0x9b, 0x7f, 0x05, 0x34, 0xa0, 0xa2,
0xd8, 0xe1, 0x4f, 0x92, 0xdb, 0xb4, 0x02, 0x4a, 0x83, 0x21, 0xe9, 0x88, 0x7f, 0x7e, 0xfe, 0xae,
0x33, 0xc8, 0x53, 0x9c, 0x85, 0x34, 0x96, 0x75, 0xfb, 0xc7, 0x12, 0xb4, 0x0e, 0x68, 0xcc, 0x48,
0xcc, 0x72, 0xf6, 0x4a, 0x38, 0xa0,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b2, 0xe8, 0x07, 0x69, 0x9e, 0xef, 0x48, 0x3d, 0xf2,
0x1d, 0x65, 0x78, 0xd1, 0xef, 0x59, 0x55, 0xaa, 0x1e, 0x17, 0xa1, 0x5d, 0xa8, 0x8c, 0x68, 0x46,
0xd4, 0xa1, 0xbe, 0x55, 0x2c, 0x60, 0xf4, 0x18, 0x80, 0xff, 0x2a, 0xdf, 0xca, 0x82, 0x39, 0x70,
0x89, 0x34, 0xdd, 0x83, 0x6a, 0x9f, 0x46, 0x51, 0x98, 0xa9, 0xf3, 0x7c, 0xab, 0x56, 0xe1, 0x68,
0x1f, 0xfe, 0x25, 0x31, 0xf6, 0x87, 0xc4, 0x93, 0x0b, 0x9e, 0x3a, 0xa8, 0x9e, 0x5f, 0x24, 0x98,
0x31, 0x71, 0xbe, 0x6b, 0xee, 0x86, 0x64, 0x0e, 0x04, 0xa2, 0xf2, 0xee, 0x0a, 0xa0, 0xfb, 0xe6,
0xd3, 0xc4, 0x32, 0xce, 0x26, 0x96, 0x71, 0x3e, 0xb1, 0x8c, 0xef, 0x13, 0xcb, 0x78, 0x7f, 0x61,
0x95, 0xce, 0x2f, 0xac, 0xd2, 0x97, 0x0b, 0xab, 0x74, 0xbc, 0x17, 0x84, 0xd9, 0x49, 0xee, 0x3b,
0x7d, 0x1a, 0x75, 0xae, 0xde, 0xef, 0xd3, 0x47, 0x79, 0x81, 0xcf, 0xdf, 0xfd, 0x7e, 0x55, 0xac,
0xef, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xad, 0x03, 0x4c, 0x16, 0x06, 0x00, 0x00,
}
func (this *ConsensusParams) Equal(that interface{}) bool {
@ -527,6 +660,9 @@ func (this *ConsensusParams) Equal(that interface{}) bool {
if !this.Synchrony.Equal(that1.Synchrony) {
return false
}
if !this.Timeout.Equal(that1.Timeout) {
return false
}
return true
}
func (this *BlockParams) Equal(that interface{}) bool {
@ -705,6 +841,75 @@ func (this *SynchronyParams) Equal(that interface{}) bool {
}
return true
}
func (this *TimeoutParams) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*TimeoutParams)
if !ok {
that2, ok := that.(TimeoutParams)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.Propose != nil && that1.Propose != nil {
if *this.Propose != *that1.Propose {
return false
}
} else if this.Propose != nil {
return false
} else if that1.Propose != nil {
return false
}
if this.ProposeDelta != nil && that1.ProposeDelta != nil {
if *this.ProposeDelta != *that1.ProposeDelta {
return false
}
} else if this.ProposeDelta != nil {
return false
} else if that1.ProposeDelta != nil {
return false
}
if this.Vote != nil && that1.Vote != nil {
if *this.Vote != *that1.Vote {
return false
}
} else if this.Vote != nil {
return false
} else if that1.Vote != nil {
return false
}
if this.VoteDelta != nil && that1.VoteDelta != nil {
if *this.VoteDelta != *that1.VoteDelta {
return false
}
} else if this.VoteDelta != nil {
return false
} else if that1.VoteDelta != nil {
return false
}
if this.Commit != nil && that1.Commit != nil {
if *this.Commit != *that1.Commit {
return false
}
} else if this.Commit != nil {
return false
} else if that1.Commit != nil {
return false
}
if this.EnableCommitTimeoutBypass != that1.EnableCommitTimeoutBypass {
return false
}
return true
}
func (m *ConsensusParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -725,6 +930,18 @@ func (m *ConsensusParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.Timeout != nil {
{
size, err := m.Timeout.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
if m.Synchrony != nil {
{
size, err := m.Synchrony.MarshalToSizedBuffer(dAtA[:i])
@ -846,12 +1063,12 @@ func (m *EvidenceParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x18
}
n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAgeDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAgeDuration):])
if err6 != nil {
return 0, err6
n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAgeDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAgeDuration):])
if err7 != nil {
return 0, err7
}
i -= n6
i = encodeVarintParams(dAtA, i, uint64(n6))
i -= n7
i = encodeVarintParams(dAtA, i, uint64(n7))
i--
dAtA[i] = 0x12
if m.MaxAgeNumBlocks != 0 {
@ -976,22 +1193,105 @@ func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
var l int
_ = l
if m.Precision != nil {
n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Precision, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Precision):])
if err7 != nil {
return 0, err7
n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Precision, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Precision):])
if err8 != nil {
return 0, err8
}
i -= n7
i = encodeVarintParams(dAtA, i, uint64(n7))
i -= n8
i = encodeVarintParams(dAtA, i, uint64(n8))
i--
dAtA[i] = 0x12
}
if m.MessageDelay != nil {
n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.MessageDelay, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MessageDelay):])
if err8 != nil {
return 0, err8
n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.MessageDelay, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MessageDelay):])
if err9 != nil {
return 0, err9
}
i -= n8
i = encodeVarintParams(dAtA, i, uint64(n8))
i -= n9
i = encodeVarintParams(dAtA, i, uint64(n9))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *TimeoutParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *TimeoutParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.EnableCommitTimeoutBypass {
i--
if m.EnableCommitTimeoutBypass {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x30
}
if m.Commit != nil {
n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Commit, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Commit):])
if err10 != nil {
return 0, err10
}
i -= n10
i = encodeVarintParams(dAtA, i, uint64(n10))
i--
dAtA[i] = 0x2a
}
if m.VoteDelta != nil {
n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.VoteDelta, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VoteDelta):])
if err11 != nil {
return 0, err11
}
i -= n11
i = encodeVarintParams(dAtA, i, uint64(n11))
i--
dAtA[i] = 0x22
}
if m.Vote != nil {
n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Vote, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Vote):])
if err12 != nil {
return 0, err12
}
i -= n12
i = encodeVarintParams(dAtA, i, uint64(n12))
i--
dAtA[i] = 0x1a
}
if m.ProposeDelta != nil {
n13, err13 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.ProposeDelta, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.ProposeDelta):])
if err13 != nil {
return 0, err13
}
i -= n13
i = encodeVarintParams(dAtA, i, uint64(n13))
i--
dAtA[i] = 0x12
}
if m.Propose != nil {
n14, err14 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Propose, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Propose):])
if err14 != nil {
return 0, err14
}
i -= n14
i = encodeVarintParams(dAtA, i, uint64(n14))
i--
dAtA[i] = 0xa
}
@ -1035,6 +1335,10 @@ func (m *ConsensusParams) Size() (n int) {
l = m.Synchrony.Size()
n += 1 + l + sovParams(uint64(l))
}
if m.Timeout != nil {
l = m.Timeout.Size()
n += 1 + l + sovParams(uint64(l))
}
return n
}
@ -1129,6 +1433,38 @@ func (m *SynchronyParams) Size() (n int) {
return n
}
func (m *TimeoutParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Propose != nil {
l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Propose)
n += 1 + l + sovParams(uint64(l))
}
if m.ProposeDelta != nil {
l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.ProposeDelta)
n += 1 + l + sovParams(uint64(l))
}
if m.Vote != nil {
l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Vote)
n += 1 + l + sovParams(uint64(l))
}
if m.VoteDelta != nil {
l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VoteDelta)
n += 1 + l + sovParams(uint64(l))
}
if m.Commit != nil {
l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Commit)
n += 1 + l + sovParams(uint64(l))
}
if m.EnableCommitTimeoutBypass {
n += 2
}
return n
}
func sovParams(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1344,6 +1680,42 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Timeout == nil {
m.Timeout = &TimeoutParams{}
}
if err := m.Timeout.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
@ -1935,6 +2307,256 @@ func (m *SynchronyParams) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *TimeoutParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: TimeoutParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TimeoutParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Propose", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Propose == nil {
m.Propose = new(time.Duration)
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Propose, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposeDelta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ProposeDelta == nil {
m.ProposeDelta = new(time.Duration)
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.ProposeDelta, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Vote == nil {
m.Vote = new(time.Duration)
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Vote, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field VoteDelta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.VoteDelta == nil {
m.VoteDelta = new(time.Duration)
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.VoteDelta, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Commit == nil {
m.Commit = new(time.Duration)
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Commit, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EnableCommitTimeoutBypass", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.EnableCommitTimeoutBypass = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipParams(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0


+ 8
- 0
types/genesis_test.go View File

@ -72,6 +72,14 @@ func TestBasicGenesisDoc(t *testing.T) {
"app_state":{"account_owner": "Bob"},
"consensus_params": {
"synchrony": {"precision": "1", "message_delay": "10"},
"timeout": {
"propose": "30000000000",
"propose_delta": "50000000",
"vote": "30000000000",
"vote_delta": "50000000",
"commit": "10000000000",
"enable_commit_timeout_bypass": false
},
"validator": {"pub_key_types":["ed25519"]},
"block": {"max_bytes": "100"},
"evidence": {"max_age_num_blocks": "100", "max_age_duration": "10"}


+ 92
- 0
types/params.go View File

@ -42,6 +42,7 @@ type ConsensusParams struct {
Validator ValidatorParams `json:"validator"`
Version VersionParams `json:"version"`
Synchrony SynchronyParams `json:"synchrony"`
Timeout TimeoutParams `json:"timeout"`
}
// HashedParams is a subset of ConsensusParams.
@ -85,6 +86,16 @@ type SynchronyParams struct {
MessageDelay time.Duration `json:"message_delay,string"`
}
// TimeoutParams configure the timings of the steps of the Tendermint consensus algorithm.
type TimeoutParams struct {
Propose time.Duration `json:"propose,string"`
ProposeDelta time.Duration `json:"propose_delta,string"`
Vote time.Duration `json:"vote,string"`
VoteDelta time.Duration `json:"vote_delta,string"`
Commit time.Duration `json:"commit,string"`
EnableCommitTimeoutBypass bool `json:"enable_commit_timeout_bypass"`
}
// DefaultConsensusParams returns a default ConsensusParams.
func DefaultConsensusParams() *ConsensusParams {
return &ConsensusParams{
@ -93,6 +104,7 @@ func DefaultConsensusParams() *ConsensusParams {
Validator: DefaultValidatorParams(),
Version: DefaultVersionParams(),
Synchrony: DefaultSynchronyParams(),
Timeout: DefaultTimeoutParams(),
}
}
@ -135,6 +147,18 @@ func DefaultSynchronyParams() SynchronyParams {
Precision: 505 * time.Millisecond,
MessageDelay: 12 * time.Second,
}
}
func DefaultTimeoutParams() TimeoutParams {
return TimeoutParams{
Propose: 3000 * time.Millisecond,
ProposeDelta: 500 * time.Millisecond,
Vote: 1000 * time.Millisecond,
VoteDelta: 500 * time.Millisecond,
Commit: 1000 * time.Millisecond,
EnableCommitTimeoutBypass: false,
}
}
func (val *ValidatorParams) IsValidPubkeyType(pubkeyType string) bool {
@ -150,6 +174,9 @@ func (params *ConsensusParams) Complete() {
if params.Synchrony == (SynchronyParams{}) {
params.Synchrony = DefaultSynchronyParams()
}
if params.Timeout == (TimeoutParams{}) {
params.Timeout = DefaultTimeoutParams()
}
}
// Validate validates the ConsensusParams to ensure all values are within their
@ -199,6 +226,26 @@ func (params ConsensusParams) ValidateConsensusParams() error {
params.Synchrony.Precision)
}
if params.Timeout.Propose < 0 {
return fmt.Errorf("timeout.ProposeDelta must not be negative. Got: %d", params.Timeout.Propose)
}
if params.Timeout.ProposeDelta < 0 {
return fmt.Errorf("timeout.ProposeDelta must not be negative. Got: %d", params.Timeout.ProposeDelta)
}
if params.Timeout.Vote < 0 {
return fmt.Errorf("timeout.Vote must not be negative. Got: %d", params.Timeout.Vote)
}
if params.Timeout.VoteDelta < 0 {
return fmt.Errorf("timeout.VoteDelta must not be negative. Got: %d", params.Timeout.VoteDelta)
}
if params.Timeout.Commit < 0 {
return fmt.Errorf("timeout.Commit must not be negative. Got: %d", params.Timeout.Commit)
}
if len(params.Validator.PubKeyTypes) == 0 {
return errors.New("len(Validator.PubKeyTypes) must be greater than 0")
}
@ -244,6 +291,7 @@ func (params *ConsensusParams) Equals(params2 *ConsensusParams) bool {
params.Evidence == params2.Evidence &&
params.Version == params2.Version &&
params.Synchrony == params2.Synchrony &&
params.Timeout == params2.Timeout &&
tmstrings.StringSliceEqual(params.Validator.PubKeyTypes, params2.Validator.PubKeyTypes)
}
@ -282,6 +330,24 @@ func (params ConsensusParams) UpdateConsensusParams(params2 *tmproto.ConsensusPa
res.Synchrony.Precision = *params2.Synchrony.GetPrecision()
}
}
if params2.Timeout != nil {
if params2.Timeout.Propose != nil {
res.Timeout.Propose = *params2.Timeout.GetPropose()
}
if params2.Timeout.ProposeDelta != nil {
res.Timeout.ProposeDelta = *params2.Timeout.GetProposeDelta()
}
if params2.Timeout.Vote != nil {
res.Timeout.Vote = *params2.Timeout.GetVote()
}
if params2.Timeout.VoteDelta != nil {
res.Timeout.VoteDelta = *params2.Timeout.GetVoteDelta()
}
if params2.Timeout.Commit != nil {
res.Timeout.Commit = *params2.Timeout.GetCommit()
}
res.Timeout.EnableCommitTimeoutBypass = params2.Timeout.GetEnableCommitTimeoutBypass()
}
return res
}
@ -306,6 +372,14 @@ func (params *ConsensusParams) ToProto() tmproto.ConsensusParams {
MessageDelay: &params.Synchrony.MessageDelay,
Precision: &params.Synchrony.Precision,
},
Timeout: &tmproto.TimeoutParams{
Propose: &params.Timeout.Propose,
ProposeDelta: &params.Timeout.ProposeDelta,
Vote: &params.Timeout.Vote,
VoteDelta: &params.Timeout.VoteDelta,
Commit: &params.Timeout.Commit,
EnableCommitTimeoutBypass: params.Timeout.EnableCommitTimeoutBypass,
},
}
}
@ -335,5 +409,23 @@ func ConsensusParamsFromProto(pbParams tmproto.ConsensusParams) ConsensusParams
c.Synchrony.Precision = *pbParams.Synchrony.GetPrecision()
}
}
if pbParams.Timeout != nil {
if pbParams.Timeout.Propose != nil {
c.Timeout.Propose = *pbParams.Timeout.GetPropose()
}
if pbParams.Timeout.ProposeDelta != nil {
c.Timeout.ProposeDelta = *pbParams.Timeout.GetProposeDelta()
}
if pbParams.Timeout.Vote != nil {
c.Timeout.Vote = *pbParams.Timeout.GetVote()
}
if pbParams.Timeout.VoteDelta != nil {
c.Timeout.VoteDelta = *pbParams.Timeout.GetVoteDelta()
}
if pbParams.Timeout.Commit != nil {
c.Timeout.Commit = *pbParams.Timeout.GetCommit()
}
c.Timeout.EnableCommitTimeoutBypass = pbParams.Timeout.EnableCommitTimeoutBypass
}
return c
}

+ 50
- 8
types/params_test.go View File

@ -168,13 +168,19 @@ func TestConsensusParamsValidation(t *testing.T) {
}
type makeParamsArgs struct {
blockBytes int64
blockGas int64
evidenceAge int64
maxEvidenceBytes int64
pubkeyTypes []string
precision time.Duration
messageDelay time.Duration
blockBytes int64
blockGas int64
evidenceAge int64
maxEvidenceBytes int64
pubkeyTypes []string
precision time.Duration
messageDelay time.Duration
propose time.Duration
proposeDelta time.Duration
vote time.Duration
voteDelta time.Duration
commit time.Duration
enableCommitTimeoutBypass bool
}
func makeParams(args makeParamsArgs) ConsensusParams {
@ -198,8 +204,15 @@ func makeParams(args makeParamsArgs) ConsensusParams {
Precision: args.precision,
MessageDelay: args.messageDelay,
},
Timeout: TimeoutParams{
Propose: args.propose,
ProposeDelta: args.proposeDelta,
Vote: args.vote,
VoteDelta: args.voteDelta,
Commit: args.commit,
EnableCommitTimeoutBypass: args.enableCommitTimeoutBypass,
},
}
}
func TestConsensusParamsHash(t *testing.T) {
@ -252,6 +265,35 @@ func TestConsensusParamsUpdate(t *testing.T) {
},
updatedParams: makeParams(makeParamsArgs{evidenceAge: 3, precision: 2 * time.Second, messageDelay: 4 * time.Second}),
},
{
// update timeout params
intialParams: makeParams(makeParamsArgs{
propose: 3 * time.Second,
proposeDelta: 500 * time.Millisecond,
vote: time.Second,
voteDelta: 500 * time.Millisecond,
commit: time.Second,
enableCommitTimeoutBypass: false,
}),
updates: &tmproto.ConsensusParams{
Timeout: &tmproto.TimeoutParams{
Propose: durationPtr(2 * time.Second),
ProposeDelta: durationPtr(400 * time.Millisecond),
Vote: durationPtr(5 * time.Second),
VoteDelta: durationPtr(400 * time.Millisecond),
Commit: durationPtr(time.Minute),
EnableCommitTimeoutBypass: true,
},
},
updatedParams: makeParams(makeParamsArgs{
propose: 2 * time.Second,
proposeDelta: 400 * time.Millisecond,
vote: 5 * time.Second,
voteDelta: 400 * time.Millisecond,
commit: time.Minute,
enableCommitTimeoutBypass: true,
}),
},
// fine updates
{
intialParams: makeParams(makeParamsArgs{blockBytes: 1, blockGas: 2, evidenceAge: 3}),


Loading…
Cancel
Save