mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 12:51:22 +00:00
reap max bytes from the mempool & check transaction size
See ADR 020: Limiting txs size inside a block docs/architecture/adr-020-block-size.md Refs #2035
This commit is contained in:
@ -373,13 +373,10 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func makeParams(blockBytes, blockTx, blockGas, txBytes,
|
||||
txGas, partSize int) types.ConsensusParams {
|
||||
|
||||
func makeParams(txsBytes, blockGas, txBytes, txGas, partSize int) types.ConsensusParams {
|
||||
return types.ConsensusParams{
|
||||
BlockSize: types.BlockSize{
|
||||
MaxBytes: blockBytes,
|
||||
MaxTxs: blockTx,
|
||||
MaxBytes: txsBytes,
|
||||
MaxGas: int64(blockGas),
|
||||
},
|
||||
TxSize: types.TxSize{
|
||||
@ -397,7 +394,7 @@ func pk() []byte {
|
||||
}
|
||||
|
||||
func TestApplyUpdates(t *testing.T) {
|
||||
initParams := makeParams(1, 2, 3, 4, 5, 6)
|
||||
initParams := makeParams(1, 2, 3, 4, 5)
|
||||
|
||||
cases := [...]struct {
|
||||
init types.ConsensusParams
|
||||
@ -412,19 +409,19 @@ func TestApplyUpdates(t *testing.T) {
|
||||
MaxBytes: 123,
|
||||
},
|
||||
},
|
||||
makeParams(1, 2, 3, 123, 5, 6)},
|
||||
makeParams(1, 2, 123, 4, 5)},
|
||||
3: {initParams,
|
||||
abci.ConsensusParams{
|
||||
BlockSize: &abci.BlockSize{
|
||||
MaxTxs: 44,
|
||||
MaxGas: 55,
|
||||
MaxBytes: 1,
|
||||
MaxGas: 55,
|
||||
},
|
||||
},
|
||||
makeParams(1, 44, 55, 4, 5, 6)},
|
||||
makeParams(1, 55, 3, 4, 5)},
|
||||
4: {initParams,
|
||||
abci.ConsensusParams{
|
||||
BlockSize: &abci.BlockSize{
|
||||
MaxTxs: 789,
|
||||
MaxBytes: 1,
|
||||
},
|
||||
TxSize: &abci.TxSize{
|
||||
MaxGas: 888,
|
||||
@ -433,7 +430,7 @@ func TestApplyUpdates(t *testing.T) {
|
||||
BlockPartSizeBytes: 2002,
|
||||
},
|
||||
},
|
||||
makeParams(1, 789, 3, 4, 888, 2002)},
|
||||
makeParams(1, 2, 3, 888, 2002)},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
|
Reference in New Issue
Block a user