Remove ConsensusParams.TxSize and ConsensusParams.BlockGossip#2364
Remove ConsensusParams.TxSize and ConsensusParams.BlockGossip#2364
Conversation
node/node.go
Outdated
|
|
||
| // Make MempoolReactor | ||
| maxBytes := state.ConsensusParams.TxSize.MaxBytes | ||
| maxBytes := state.ConsensusParams.BlockSize.MaxBytes |
There was a problem hiding this comment.
TODO: MaxBytes - headerSize and so on
state/execution.go
Outdated
|
|
||
| // Update mempool. | ||
| maxBytes := state.ConsensusParams.TxSize.MaxBytes | ||
| maxBytes := state.ConsensusParams.BlockSize.MaxBytes |
There was a problem hiding this comment.
TODO: MaxBytes - headerSize and so on
consensus/replay_test.go
Outdated
| func(stateDB dbm.DB, cs *ConsensusState, ctx context.Context) { | ||
| // XXX: is there a better way to change BlockPartSizeBytes? | ||
| cs.state.ConsensusParams.BlockPartSizeBytes = 512 | ||
| // cs.state.ConsensusParams.BlockPartSizeBytes = 512 |
There was a problem hiding this comment.
FIXME: make BlockPartSizeBytes a variable?
Codecov Report
@@ Coverage Diff @@
## develop #2364 +/- ##
===========================================
- Coverage 60.96% 60.95% -0.02%
===========================================
Files 197 197
Lines 16301 16259 -42
===========================================
- Hits 9938 9910 -28
+ Misses 5499 5489 -10
+ Partials 864 860 -4
|
|
|
||
| // BlockSize contains limits on the block size. | ||
| message BlockSize { | ||
| // Note: must be greater than 0 |
There was a problem hiding this comment.
Unlimited? Do you think it's a good idea?
There was a problem hiding this comment.
Probably best if we're consistent, so these ints all have the same domain
| firstBlock := makeBlock(blockHeight, state) | ||
| secondBlock := makeBlock(blockHeight+1, state) | ||
| firstParts := firstBlock.MakePartSet(state.ConsensusParams.BlockGossip.BlockPartSizeBytes) | ||
| firstParts := firstBlock.MakePartSet(types.BlockPartSizeBytes) |
There was a problem hiding this comment.
I still don't really understand why we don't want this as a consensus parameter. What optimizations are we getting by optimizing around 1MB blocks, it feels like we could still leave this as parameterized to me. (Or perhaps parameterize as "number of block parts")
There was a problem hiding this comment.
NOTE: BlockPartSizeBytes really depends on the network bandwidth and network topology. It should be possible to make it adaptive to the current env by analysing the network, but it's #post-launch imho.
Plus we wasn't checking the size when accepting block part (no consensus per se 😄 ).
There was a problem hiding this comment.
The goal is to reduce surface area for applications - its unlikely the applications should tweak this parameter directly, would be better if we had a heuristic for it based on the block size.
We'll still want to tweak this parameter in experiments, so we'll need a way for it to be configurable, but it will be a different domain than the ConsensusParams that gets updated by applications.
ebuchman
left a comment
There was a problem hiding this comment.
Looks good. A few minor nits. We also need to update the docs
| firstBlock := makeBlock(blockHeight, state) | ||
| secondBlock := makeBlock(blockHeight+1, state) | ||
| firstParts := firstBlock.MakePartSet(state.ConsensusParams.BlockGossip.BlockPartSizeBytes) | ||
| firstParts := firstBlock.MakePartSet(types.BlockPartSizeBytes) |
There was a problem hiding this comment.
The goal is to reduce surface area for applications - its unlikely the applications should tweak this parameter directly, would be better if we had a heuristic for it based on the block size.
We'll still want to tweak this parameter in experiments, so we'll need a way for it to be configurable, but it will be a different domain than the ConsensusParams that gets updated by applications.
| const ( | ||
| // must be greater than params.BlockGossip.BlockPartSizeBytes + a few bytes | ||
| // must be greater than types.BlockPartSizeBytes + a few bytes | ||
| maxMsgSizeBytes = 1024 * 1024 // 1MB |
There was a problem hiding this comment.
New issue (#2381): We should make this a function of BlockPartSizeBytes. Probably should do something similar in other reactors (ie. max is a function of size of largest message).
| // Update mempool. | ||
| maxBytes := state.ConsensusParams.TxSize.MaxBytes | ||
| filter := func(tx types.Tx) bool { return len(tx) <= maxBytes } | ||
| maxDataBytes := types.MaxDataBytesUnknownEvidence( |
There was a problem hiding this comment.
Maybe the State can expose a FilterTx method that does all this and returns a filter func can be passed into the NewMempool and mempool.Update?
| cdc.RegisterConcrete(MockBadEvidence{}, "tendermint/MockBadEvidence", nil) | ||
| } | ||
|
|
||
| // MaxEvidenceBytesPerBlock returns the maximum evidence size per block. |
There was a problem hiding this comment.
Worth including the magic number (divide by 10) in the documentation
| // TxSize contain limits on the tx size. | ||
| type TxSize struct { | ||
| MaxBytes int `json:"max_bytes"` | ||
| MaxBytes int `json:"max_txs_bytes"` |
There was a problem hiding this comment.
json here should be max_bytes as well
| params.BlockSize.MaxBytes, MaxBlockSizeBytes) | ||
| } | ||
|
|
||
| if params.BlockSize.MaxGas < -1 { |
There was a problem hiding this comment.
Maybe these should all be the same for consistency? ie. < -1
| if params2.TxSize.MaxGas > 0 { | ||
| res.TxSize.MaxGas = params2.TxSize.MaxGas | ||
| } | ||
| res.BlockSize.MaxBytes = int(params2.BlockSize.MaxBytes) |
There was a problem hiding this comment.
can we unify these and remove the cast?
| ) | ||
|
|
||
| func newConsensusParams(txsBytes, partSize int) ConsensusParams { | ||
| func newConsensusParams(txsBytes, evidenceAge int) ConsensusParams { |
There was a problem hiding this comment.
- txBytes should be called maxBytes or blockBytes
- we should also pass in maxGas or blockGas
| } | ||
|
|
||
| func makeParams(txsBytes, blockGas, txBytes, txGas, partSize int) ConsensusParams { | ||
| func makeParams(txsBytes, blockGas, evidenceAge int) ConsensusParams { |
There was a problem hiding this comment.
deduplicate with newConsensusParams?
|
|
||
| // BlockSize contains limits on the block size. | ||
| message BlockSize { | ||
| // Note: must be greater than 0 |
There was a problem hiding this comment.
Probably best if we're consistent, so these ints all have the same domain
|
Follow up in #2382 |
Refs #2347