github.com/line/ostracon@v1.0.10-0.20230328032236-7f20145f065d/spec/core/data_structures.md (about)

     1  # Data Structure
     2  
     3  Please ensure you've first read the spec for [CometBFT Data Structure](https://github.com/tendermint/tendermint/blob/v0.34.x/spec/core/data_structures.md). Here only defines the difference between CometBFT.
     4  
     5  ## Block
     6  
     7  Ostracon extends [CometBFT Block](https://github.com/tendermint/tendermint/blob/v0.34.x/spec/core/data_structures.md#block). In Ostracon, Block consists of Entropy in addition to Header, Data, Evidence, and LastCommit.
     8  
     9  | Name | Type | Description | Validation |
    10  |------|------|-------------|------------|
    11  | ...  |      | Header, Data, Evidence, and LastCommit are the same as CometBFT. |            |
    12  | Entropy | [Entropy](#entropy) | Entropy represents height-specific complexity. This field contains infomation used proposer-election. | Must adhere to the validation rules of [entropy](#entropy) |
    13  
    14  ## Execution
    15  
    16  `LastProofHash` is added to the state. Ostracon extends [CometBFT Execute](https://github.com/tendermint/tendermint/blob/v0.34.x/spec/core/data_structures.md#execution) as:
    17  
    18  ```go
    19  func Execute(s State, app ABCIApp, block Block) State {
    20   AppHash, ValidatorChanges, ConsensusParamChanges := app.ApplyBlock(block)
    21   nextConsensusParams := UpdateConsensusParams(state.ConsensusParams, ConsensusParamChanges)
    22   return State{
    23    ChainID:         state.ChainID,
    24    InitialHeight:   state.InitialHeight,
    25    LastResults:     abciResponses.DeliverTxResults,
    26    AppHash:         AppHash,
    27    InitialHeight:   state.InitialHeight,
    28    LastValidators:  state.Validators,
    29    Validators:      state.NextValidators,
    30    NextValidators:  UpdateValidators(state.NextValidators, ValidatorChanges),
    31    ConsensusParams: nextConsensusParams,
    32    Version: {
    33     Consensus: {
    34      AppVersion: nextConsensusParams.Version.AppVersion,
    35     },
    36    },
    37    LastProofHash: ProofToHash(block.Entropy.Proof),
    38   }
    39  }
    40  ```
    41  
    42  Ostracon adds the following steps to the validation of a new block:
    43  
    44  - Validate the entropy in the block.
    45      - Make sure the `Round` is <= current round.
    46      - Make sure the `ProposerAddress` corresponds to the `Round`.
    47      - Make sure the `Proof` corresponds to the `Round`.
    48  
    49  ## Entropy
    50  
    51  Ostracon introduces Entropy as a new data structure. This represents height-specific complexity and is used by proposer-election. This consists of a vrf proof and round in which the proposer generates it.
    52  
    53  | Name | Type | Description | Validation |
    54  |------|------|-------------|------------|
    55  | Round | int32                     | Round in which proposer generate a vrf proof             | Must be >= 0 |
    56  | Proof | slice of bytes (`[]byte`) | Proof is a vrf proof | Length of proof must be == 0, == 81 (r2ishiguro), or == 80 (libsodium) |