add mechanism to change the number of bytes sent to the application

This commit is contained in:
William Banfield
2022-03-25 13:05:45 -04:00
parent 14f5588ce2
commit 62fab24cdb
10 changed files with 205 additions and 68 deletions

View File

@@ -342,6 +342,7 @@ func TestCreateProposalBlock(t *testing.T) {
state, commit,
proposerAddr,
nil,
0,
)
require.NoError(t, err)
@@ -396,8 +397,9 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
)
// fill the mempool with one txs just below the maximum size
txLength := int(types.MaxDataBytesNoEvidence(maxBytes, 1))
tx := tmrand.Bytes(txLength - 4) // to account for the varint
mb, err := types.MaxDataBytesNoEvidence(maxBytes, 1)
require.NoError(t, err)
tx := tmrand.Bytes(int(mb) - 4) // to account for the varint
err = mp.CheckTx(ctx, tx, nil, mempool.TxInfo{})
assert.NoError(t, err)
@@ -421,6 +423,7 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
state, commit,
proposerAddr,
nil,
0,
)
require.NoError(t, err)
@@ -464,8 +467,9 @@ func TestMaxProposalBlockSize(t *testing.T) {
)
// fill the mempool with one txs just below the maximum size
txLength := int(types.MaxDataBytesNoEvidence(maxBytes, types.MaxVotesCount))
tx := tmrand.Bytes(txLength - 6) // to account for the varint
mb, err := types.MaxDataBytesNoEvidence(maxBytes, types.MaxVotesCount)
require.NoError(t, err)
tx := tmrand.Bytes(int(mb) - 6) // to account for the varint
err = mp.CheckTx(ctx, tx, nil, mempool.TxInfo{})
assert.NoError(t, err)
// now produce more txs than what a normal block can hold with 10 smaller txs
@@ -542,6 +546,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
state, commit,
proposerAddr,
nil,
0,
)
require.NoError(t, err)
partSet, err := block.MakePartSet(types.BlockPartSizeBytes)