github.com/vipernet-xyz/tm@v0.34.24/spec/consensus/creating-proposal.md (about)

     1  ---
     2  order: 2
     3  ---
     4  # Creating a proposal
     5  
     6  A block consists of a header, transactions, votes (the commit),
     7  and a list of evidence of malfeasance (ie. signing conflicting votes).
     8  
     9  We include no more than 1/10th of the maximum block size
    10  (`ConsensusParams.Block.MaxBytes`) of evidence with each block.
    11  
    12  ## Reaping transactions from the mempool
    13  
    14  When we reap transactions from the mempool, we calculate maximum data
    15  size by subtracting maximum header size (`MaxHeaderBytes`), the maximum
    16  amino overhead for a block (`MaxAminoOverheadForBlock`), the size of
    17  the last commit (if present) and evidence (if present). While reaping
    18  we account for amino overhead for each transaction.
    19  
    20  ```go
    21  func MaxDataBytes(maxBytes int64, valsCount, evidenceCount int) int64 {
    22   return maxBytes -
    23    MaxOverheadForBlock -
    24    MaxHeaderBytes -
    25    int64(valsCount)*MaxVoteBytes -
    26    int64(evidenceCount)*MaxEvidenceBytes
    27  }
    28  ```
    29  
    30  ## Validating transactions in the mempool
    31  
    32  Before we accept a transaction in the mempool, we check if it's size is no more
    33  than {MaxDataSize}. {MaxDataSize} is calculated using the same formula as
    34  above, except we subtract the max number of evidence, {MaxNum} by the maximum size of evidence
    35  
    36  ```go
    37  func MaxDataBytesUnknownEvidence(maxBytes int64, valsCount int) int64 {
    38   return maxBytes -
    39    MaxOverheadForBlock -
    40    MaxHeaderBytes -
    41    (maxNumEvidence * MaxEvidenceBytes)
    42  }
    43  ```