You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

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