mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 22:23:11 +00:00
Remove ConsensusParams.TxSize and ConsensusParams.BlockGossip (#2364)
* remove ConsensusParams.TxSize and ConsensusParams.BlockGossip Refs #2347 * block part size is now fixed Refs #2347 * use max data size, not max bytes for tx limit Refs #2347
This commit is contained in:
committed by
Ethan Buchman
parent
33b4617e9a
commit
0e1cd88863
@@ -145,8 +145,11 @@ func (blockExec *BlockExecutor) Commit(state State, block *types.Block) ([]byte,
|
||||
"appHash", fmt.Sprintf("%X", res.Data))
|
||||
|
||||
// Update mempool.
|
||||
maxBytes := state.ConsensusParams.TxSize.MaxBytes
|
||||
filter := func(tx types.Tx) bool { return len(tx) <= maxBytes }
|
||||
maxDataBytes := types.MaxDataBytesUnknownEvidence(
|
||||
state.ConsensusParams.BlockSize.MaxBytes,
|
||||
state.Validators.Size(),
|
||||
)
|
||||
filter := func(tx types.Tx) bool { return len(tx) <= maxDataBytes }
|
||||
if err := blockExec.mempool.Update(block.Height, block.Txs, filter); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func (state State) MakeBlock(
|
||||
// IncrementAccum for rounds there.
|
||||
block.ProposerAddress = proposerAddress
|
||||
|
||||
return block, block.MakePartSet(state.ConsensusParams.BlockGossip.BlockPartSizeBytes)
|
||||
return block, block.MakePartSet(types.BlockPartSizeBytes)
|
||||
}
|
||||
|
||||
// MedianTime computes a median time for a given Commit (based on Timestamp field of votes messages) and the
|
||||
|
||||
@@ -373,18 +373,14 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func makeParams(txsBytes, blockGas, txBytes, txGas, partSize int) types.ConsensusParams {
|
||||
func makeParams(txsBytes, blockGas, evidenceAge int) types.ConsensusParams {
|
||||
return types.ConsensusParams{
|
||||
BlockSize: types.BlockSize{
|
||||
MaxBytes: txsBytes,
|
||||
MaxGas: int64(blockGas),
|
||||
},
|
||||
TxSize: types.TxSize{
|
||||
MaxBytes: txBytes,
|
||||
MaxGas: int64(txGas),
|
||||
},
|
||||
BlockGossip: types.BlockGossip{
|
||||
BlockPartSizeBytes: partSize,
|
||||
EvidenceParams: types.EvidenceParams{
|
||||
MaxAge: int64(evidenceAge),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -394,7 +390,7 @@ func pk() []byte {
|
||||
}
|
||||
|
||||
func TestApplyUpdates(t *testing.T) {
|
||||
initParams := makeParams(1, 2, 3, 4, 5)
|
||||
initParams := makeParams(1, 2, 3)
|
||||
|
||||
cases := [...]struct {
|
||||
init types.ConsensusParams
|
||||
@@ -404,33 +400,20 @@ func TestApplyUpdates(t *testing.T) {
|
||||
0: {initParams, abci.ConsensusParams{}, initParams},
|
||||
1: {initParams, abci.ConsensusParams{}, initParams},
|
||||
2: {initParams,
|
||||
abci.ConsensusParams{
|
||||
TxSize: &abci.TxSize{
|
||||
MaxBytes: 123,
|
||||
},
|
||||
},
|
||||
makeParams(1, 2, 123, 4, 5)},
|
||||
3: {initParams,
|
||||
abci.ConsensusParams{
|
||||
BlockSize: &abci.BlockSize{
|
||||
MaxBytes: 1,
|
||||
MaxBytes: 44,
|
||||
MaxGas: 55,
|
||||
},
|
||||
},
|
||||
makeParams(1, 55, 3, 4, 5)},
|
||||
4: {initParams,
|
||||
makeParams(44, 55, 3)},
|
||||
3: {initParams,
|
||||
abci.ConsensusParams{
|
||||
BlockSize: &abci.BlockSize{
|
||||
MaxBytes: 1,
|
||||
},
|
||||
TxSize: &abci.TxSize{
|
||||
MaxGas: 888,
|
||||
},
|
||||
BlockGossip: &abci.BlockGossip{
|
||||
BlockPartSizeBytes: 2002,
|
||||
EvidenceParams: &abci.EvidenceParams{
|
||||
MaxAge: 66,
|
||||
},
|
||||
},
|
||||
makeParams(1, 2, 3, 888, 2002)},
|
||||
makeParams(1, 2, 66)},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
|
||||
Reference in New Issue
Block a user