mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-03 14:47:16 +00:00
conesnsu: follow up to removing some consensus params (#2427)
* follow up to removing some consensus params Refs #2382 * change args type to int64 in state#makeParams * make valsCount and evidenceCount ints again * MaxEvidenceBytesPerBlock: include magic number in godoc * [spec] creating a proposal * test state#TxFilter * panic if MaxDataBytes is less than 0 * fixes after review * use amino#UvarintSize to calculate overhead https://github.com/tendermint/go-amino/blob/0c74291f3bb61e24f8ea1d13148cece479f79d35/encoder.go#L85-L90 * avoid cyclic imports * you can do better Go, come on * remove testdouble package
This commit is contained in:
committed by
Alexander Simmerl
parent
7b727bf3d0
commit
8d50bb9dad
@@ -21,6 +21,7 @@ please submit them to our [bug bounty](https://tendermint.com/security)!
|
||||
### Consensus Protocol
|
||||
|
||||
- [Consensus Algorithm](/docs/spec/consensus/consensus.md)
|
||||
- [Creating a proposal](/docs/spec/consensus/creating-proposal.md)
|
||||
- [Time](/docs/spec/consensus/bft-time.md)
|
||||
- [Light-Client](/docs/spec/consensus/light-client.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# Creating a proposal
|
||||
|
||||
A block consists of a header, transactions, votes (the commit),
|
||||
and a list of evidence of malfeasance (ie. signing conflicting votes).
|
||||
|
||||
We include no more than 1/10th of the maximum block size
|
||||
(`ConsensusParams.BlockSize.MaxBytes`) of evidence with each block.
|
||||
|
||||
## Reaping transactions from the mempool
|
||||
|
||||
When we reap transactions from the mempool, we calculate maximum data
|
||||
size by subtracting maximum header size (`MaxHeaderBytes`), the maximum
|
||||
amino overhead for a block (`MaxAminoOverheadForBlock`), the size of
|
||||
the last commit (if present) and evidence (if present). While reaping
|
||||
we account for amino overhead for each transaction.
|
||||
|
||||
```go
|
||||
func MaxDataBytes(maxBytes int64, valsCount, evidenceCount int) int64 {
|
||||
return maxBytes -
|
||||
MaxAminoOverheadForBlock -
|
||||
MaxHeaderBytes -
|
||||
int64(valsCount)*MaxVoteBytes -
|
||||
int64(evidenceCount)*MaxEvidenceBytes
|
||||
}
|
||||
```
|
||||
|
||||
## Validating transactions in the mempool
|
||||
|
||||
Before we accept a transaction in the mempool, we check if it's size is no more
|
||||
than {MaxDataSize}. {MaxDataSize} is calculated using the same formula as
|
||||
above, except because the evidence size is unknown at the moment, we subtract
|
||||
maximum evidence size (1/10th of the maximum block size).
|
||||
|
||||
```go
|
||||
func MaxDataBytesUnknownEvidence(maxBytes int64, valsCount int) int64 {
|
||||
return maxBytes -
|
||||
MaxAminoOverheadForBlock -
|
||||
MaxHeaderBytes -
|
||||
int64(valsCount)*MaxVoteBytes -
|
||||
MaxEvidenceBytesPerBlock(maxBytes)
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user