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.

43 lines
1.3 KiB

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