diff --git a/spec/abci/abci.md b/spec/abci/abci.md index 71b94e6c0..ea5b6f708 100644 --- a/spec/abci/abci.md +++ b/spec/abci/abci.md @@ -596,7 +596,8 @@ via light client. - `Block (BlockParams)`: Parameters limiting the size of a block and time between consecutive blocks. - `Evidence (EvidenceParams)`: Parameters limiting the validity of evidence of byzantine behaviour. - - `Validator (ValidatorParams)`: Parameters limitng the types of pubkeys validators can use. + - `Validator (ValidatorParams)`: Parameters limiting the types of pubkeys validators can use. + - `Version (VersionParams)`: The ABCI application version. ### BlockParams @@ -631,6 +632,11 @@ via light client. - `PubKeyTypes ([]string)`: List of accepted pubkey types. Uses same naming as `PubKey.Type`. +### VersionParams + +- **Fields**: + - `AppVersion (uint64)`: The ABCI application version. + ### Proof - **Fields**: diff --git a/spec/blockchain/blockchain.md b/spec/blockchain/blockchain.md index aebb492b0..38b87eabc 100644 --- a/spec/blockchain/blockchain.md +++ b/spec/blockchain/blockchain.md @@ -67,16 +67,16 @@ Further details on each of these fields is described below. ## Version -The `Version` contains the protocol version for the blockchain and the -application as two `uint64` values: - ```go type Version struct { - Block uint64 - App uint64 + Block uint64 + App uint64 } ``` +The `Version` contains the protocol version for the blockchain and the +application as two `uint64` values. + ## BlockID The `BlockID` contains two distinct Merkle roots of the block. @@ -296,11 +296,11 @@ A Header is valid if its corresponding fields are valid. ### Version ``` -block.Version.Block == state.Version.Block -block.Version.App == state.Version.App +block.Version.Block == state.Version.Consensus.Block +block.Version.App == state.Version.Consensus.App ``` -The block version must match the state version. +The block version must match consensus version from the state. ### ChainID @@ -551,18 +551,24 @@ and `ABCIApp` is an ABCI application that can return results and changes to the set (TODO). Execute is defined as: ```go -Execute(s State, app ABCIApp, block Block) State { - // Fuction ApplyBlock executes block of transactions against the app and returns the new root hash of the app state, - // modifications to the validator set and the changes of the consensus parameters. - AppHash, ValidatorChanges, ConsensusParamChanges := app.ApplyBlock(block) - - return State{ - LastResults: abciResponses.DeliverTxResults, - AppHash: AppHash, - LastValidators: state.Validators, - Validators: state.NextValidators, - NextValidators: UpdateValidators(state.NextValidators, ValidatorChanges), - ConsensusParams: UpdateConsensusParams(state.ConsensusParams, ConsensusParamChanges), - } +func Execute(s State, app ABCIApp, block Block) State { + // Fuction ApplyBlock executes block of transactions against the app and returns the new root hash of the app state, + // modifications to the validator set and the changes of the consensus parameters. + AppHash, ValidatorChanges, ConsensusParamChanges := app.ApplyBlock(block) + + nextConsensusParams := UpdateConsensusParams(state.ConsensusParams, ConsensusParamChanges) + return State{ + LastResults: abciResponses.DeliverTxResults, + AppHash: AppHash, + LastValidators: state.Validators, + Validators: state.NextValidators, + NextValidators: UpdateValidators(state.NextValidators, ValidatorChanges), + ConsensusParams: nextConsensusParams, + Version: { + Consensus: { + AppVersion: nextConsensusParams.Version.AppVersion, + }, + }, + } } ``` diff --git a/spec/blockchain/state.md b/spec/blockchain/state.md index b503d5718..09b583cb5 100644 --- a/spec/blockchain/state.md +++ b/spec/blockchain/state.md @@ -30,6 +30,25 @@ type State struct { Note there is a hard-coded limit of 10000 validators. This is inherited from the limit on the number of votes in a commit. +### Version + +```go +type Version struct { + consensus Consensus + software string +} +``` + +The `Consensus` contains the protocol version for the blockchain and the +application as two `uint64` values: + +```go +type Consensus struct { + Block uint64 + App uint64 +} +``` + ### Result ```go @@ -90,36 +109,41 @@ type ConsensusParams struct { Block Evidence Validator + Version } type hashedParams struct { - BlockMaxBytes int64 - BlockMaxGas int64 + BlockMaxBytes int64 + BlockMaxGas int64 } func (params ConsensusParams) Hash() []byte { - SHA256(hashedParams{ - BlockMaxBytes: params.Block.MaxBytes, - BlockMaxGas: params.Block.MaxGas, - }) + SHA256(hashedParams{ + BlockMaxBytes: params.Block.MaxBytes, + BlockMaxGas: params.Block.MaxGas, + }) } type BlockParams struct { - MaxBytes int64 - MaxGas int64 - TimeIotaMs int64 + MaxBytes int64 + MaxGas int64 + TimeIotaMs int64 } type EvidenceParams struct { - MaxAgeNumBlocks int64 - MaxAgeDuration time.Duration - MaxNum uint32 - ProofTrialPeriod int64 + MaxAgeNumBlocks int64 + MaxAgeDuration time.Duration + MaxNum uint32 + ProofTrialPeriod int64 } type ValidatorParams struct { PubKeyTypes []string } + +type VersionParams struct { + AppVersion uint64 +} ``` #### Block