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.

42 lines
1.4 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. MaxAminoOverheadForBlock -
  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 because the evidence size is unknown at the moment, we subtract
  25. maximum evidence size (1/10th of the maximum block size).
  26. ```go
  27. func MaxDataBytesUnknownEvidence(maxBytes int64, valsCount int) int64 {
  28. return maxBytes -
  29. MaxAminoOverheadForBlock -
  30. MaxHeaderBytes -
  31. int64(valsCount)*MaxVoteBytes -
  32. MaxEvidenceBytesPerBlock(maxBytes)
  33. }
  34. ```