evidence: cap evidence to an absolute number (#4780)

The number of evidence that can be committed in a single block is capped by a new evidence parameter called MaxNum
This commit is contained in:
Callum Waters
2020-05-11 15:28:08 +02:00
committed by GitHub
parent fed2502618
commit a620e5fd96
25 changed files with 130 additions and 99 deletions

View File

@@ -146,6 +146,7 @@ type EvidenceParams struct {
// Note: must be greater than 0
MaxAgeNumBlocks int64 `protobuf:"varint,1,opt,name=max_age_num_blocks,json=maxAgeNumBlocks,proto3" json:"max_age_num_blocks,omitempty"`
MaxAgeDuration time.Duration `protobuf:"bytes,2,opt,name=max_age_duration,json=maxAgeDuration,proto3,stdduration" json:"max_age_duration"`
MaxNumEvidence uint32 `protobuf:"varint,1,opt,name=max_num_evidence,json=maxNumEvidence,proto3" json:"max_num_evidence,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -189,6 +190,13 @@ func (m *EvidenceParams) GetMaxAgeDuration() time.Duration {
return 0
}
func (m *EvidenceParams) GetMaxNumEvidence() uint32 {
if m != nil {
return m.MaxNumEvidence
}
return 0
}
// ValidatorParams restrict the public key types validators can use.
// NOTE: uses ABCI pubkey naming, not Amino names.
type ValidatorParams struct {

View File

@@ -33,6 +33,7 @@ message EvidenceParams {
int64 max_age_num_blocks = 1;
google.protobuf.Duration max_age_duration = 2
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
uint32 max_num = 3;
}
// ValidatorParams restrict the public key types validators can use.