From 7a0cdd53d5b9cc585214b70ec91c4f9760eb8c27 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 14 Apr 2020 14:46:21 +0400 Subject: [PATCH] abci: add MaxAgeNumBlocks/MaxAgeDuration to EvidenceParams (#87) --- spec/abci/apps.md | 29 +++++++++++++++++++++-------- spec/blockchain/state.md | 10 +++++----- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/spec/abci/apps.md b/spec/abci/apps.md index 528f92634..9989deecd 100644 --- a/spec/abci/apps.md +++ b/spec/abci/apps.md @@ -233,7 +233,7 @@ ConsensusParams enforce certain limits in the blockchain, like the maximum size of blocks, amount of gas used in a block, and the maximum acceptable age of evidence. They can be set in InitChain and updated in EndBlock. -### Block.MaxBytes +### BlockParams.MaxBytes The maximum size of a complete Amino encoded block. This is enforced by Tendermint consensus. @@ -243,7 +243,7 @@ the header, the validator set, and any included evidence in the block. Must have `0 < MaxBytes < 100 MB`. -### Block.MaxGas +### BlockParams.MaxGas The maximum of the sum of `GasWanted` in a proposed block. This is *not* enforced by Tendermint consensus. @@ -254,21 +254,34 @@ txs included in a proposed block. Must have `MaxGas >= -1`. If `MaxGas == -1`, no limit is enforced. -### Block.TimeIotaMs +### BlockParams.TimeIotaMs The minimum time between consecutive blocks (in milliseconds). This is enforced by Tendermint consensus. Must have `TimeIotaMs > 0` to ensure time monotonicity. -### EvidenceParams.MaxAge +### EvidenceParams.MaxAgeDuration -This is the maximum age of evidence. +This is the maximum age of evidence in time units. This is enforced by Tendermint consensus. -If a block includes evidence older than this, the block will be rejected -(validators won't vote for it). -Must have `MaxAge > 0`. +If a block includes evidence older than this (AND the evidence was created more +than `MaxAgeNumBlocks` ago), the block will be rejected (validators won't vote +for it). + +Must have `MaxAgeDuration > 0`. + +### EvidenceParams.MaxAgeNumBlocks + +This is the maximum age of evidence in blocks. +This is enforced by Tendermint consensus. + +If a block includes evidence older than this (AND the evidence was created more +than `MaxAgeDuration` ago), the block will be rejected (validators won't vote +for it). + +Must have `MaxAgeNumBlocks > 0`. ### Updates diff --git a/spec/blockchain/state.md b/spec/blockchain/state.md index 535eee8b2..01f430c15 100644 --- a/spec/blockchain/state.md +++ b/spec/blockchain/state.md @@ -110,8 +110,8 @@ type BlockParams struct { } type EvidenceParams struct { - MaxAgeNumBlocks int64 - MaxAgeDuration time.Duration + MaxAgeNumBlocks int64 + MaxAgeDuration time.Duration } type ValidatorParams struct { @@ -135,9 +135,9 @@ The minimal time between consecutive blocks is controlled by the For evidence in a block to be valid, it must satisfy: -``` -block.Header.Height - evidence.Height < ConsensusParams.Evidence.MaxAgeNumBlocks -block.Header.Time - evidence.Time < ConsensusParams.Evidence.MaxAgeDuration +```go +block.Header.Time-evidence.Time < ConsensusParams.Evidence.MaxAgeDuration && + block.Header.Height-evidence.Height < ConsensusParams.Evidence.MaxAgeNumBlocks ``` #### Validator