Skip to content

Commit

Permalink
feat!: remove blobs from data (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters authored May 3, 2023
1 parent 9bfa856 commit 6e59072
Show file tree
Hide file tree
Showing 22 changed files with 153 additions and 380 deletions.
2 changes: 1 addition & 1 deletion blockchain/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestBcStatusResponseMessageValidateBasic(t *testing.T) {

//nolint:lll // ignore line length in tests
func TestBlockchainMessageVectors(t *testing.T) {
block := types.MakeBlock(int64(3), factory.MakeData([]types.Tx{types.Tx("Hello World")}, nil), nil, nil)
block := types.MakeBlock(int64(3), factory.MakeData([]types.Tx{types.Tx("Hello World")}), nil, nil)
block.Version.Block = 11 // overwrite updated protocol version

bpb, err := block.ToProto()
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v0/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func makeTxs(height int64) (txs []types.Tx) {
func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Block {
block, _ := state.MakeBlock(
height,
factory.MakeData(makeTxs(height), nil),
factory.MakeData(makeTxs(height)),
lastCommit,
nil,
state.Validators.GetProposer().Address,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v1/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,5 +277,5 @@ func checkByStoppingPeerTimer(t *testing.T, peer *BpPeer, running bool) {
}

func makeSmallBlock(height int) *types.Block {
return types.MakeBlock(int64(height), factory.MakeData([]types.Tx{types.Tx("foo")}, nil), nil, nil)
return types.MakeBlock(int64(height), factory.MakeData([]types.Tx{types.Tx("foo")}), nil, nil)
}
12 changes: 6 additions & 6 deletions blockchain/v1/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func makeBlockPool(bcr *testBcR, height int64, peers []BpPeer, blocks map[int64]
bPool.peers[p.id].RequestSent(h)
if p.create {
// simulate that a block at height h has been received
_ = bPool.peers[p.id].AddBlock(types.MakeBlock(h, factory.MakeData(txs, nil), nil, nil), 100)
_ = bPool.peers[p.id].AddBlock(types.MakeBlock(h, factory.MakeData(txs), nil, nil), 100)
}
}
return bPool
Expand Down Expand Up @@ -393,7 +393,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
pool: makeBlockPool(testBcR, 10, []BpPeer{{ID: "P1", Height: 100}}, map[int64]tPBlocks{}),
args: args{
peerID: "P2",
block: types.MakeBlock(int64(10), factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(int64(10), factory.MakeData(txs), nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10, []BpPeer{{ID: "P1", Height: 100}}, map[int64]tPBlocks{}),
Expand All @@ -405,7 +405,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", false}}),
args: args{
peerID: "P1",
block: types.MakeBlock(int64(11), factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(int64(11), factory.MakeData(txs), nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -419,7 +419,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", true}, 11: {"P1", false}}),
args: args{
peerID: "P1",
block: types.MakeBlock(int64(10), factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(int64(10), factory.MakeData(txs), nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -433,7 +433,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", false}}),
args: args{
peerID: "P2",
block: types.MakeBlock(int64(10), factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(int64(10), factory.MakeData(txs), nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand All @@ -447,7 +447,7 @@ func TestBlockPoolAddBlock(t *testing.T) {
map[int64]tPBlocks{10: {"P1", false}}),
args: args{
peerID: "P1",
block: types.MakeBlock(int64(10), factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(int64(10), factory.MakeData(txs), nil, nil),
blockSize: 100,
},
poolWanted: makeBlockPool(testBcR, 10,
Expand Down
4 changes: 2 additions & 2 deletions blockchain/v1/reactor_fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func sBlockRespEv(current, expected string, peerID p2p.ID, height int64, prevBlo
data: bReactorEventData{
peerID: peerID,
height: height,
block: types.MakeBlock(height, factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(height, factory.MakeData(txs), nil, nil),
length: 100},
wantState: expected,
wantNewBlocks: append(prevBlocks, height),
Expand All @@ -160,7 +160,7 @@ func sBlockRespEvErrored(current, expected string,
data: bReactorEventData{
peerID: peerID,
height: height,
block: types.MakeBlock(height, factory.MakeData(txs, nil), nil, nil),
block: types.MakeBlock(height, factory.MakeData(txs), nil, nil),
length: 100},
wantState: expected,
wantErr: wantErr,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v1/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func makeTxs(height int64) (txs []types.Tx) {
func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Block {
block, _ := state.MakeBlock(
height,
factory.MakeData(makeTxs(height), nil),
factory.MakeData(makeTxs(height)),
lastCommit,
nil,
state.Validators.GetProposer().Address,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v2/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func makeTxs(height int64) (txs []types.Tx) {
func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Block {
block, _ := state.MakeBlock(
height,
factory.MakeData(makeTxs(height), nil),
factory.MakeData(makeTxs(height)),
lastCommit,
nil,
state.Validators.GetProposer().Address,
Expand Down
2 changes: 1 addition & 1 deletion consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ func makeBlock(state sm.State, lastBlock *types.Block, lastBlockMeta *types.Bloc

return state.MakeBlock(
height,
factory.MakeData([]types.Tx{}, nil),
factory.MakeData([]types.Tx{}),
lastCommit,
nil,
state.Validators.GetProposer().Address,
Expand Down
4 changes: 2 additions & 2 deletions evidence/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestEvidencePoolUpdate(t *testing.T) {
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultEvidenceTime.Add(21*time.Minute),
val, evidenceChainID)
lastCommit := makeCommit(height, val.PrivKey.PubKey().Address())
block := types.MakeBlock(height+1, factory.MakeData([]types.Tx{}, nil), lastCommit, []types.Evidence{ev})
block := types.MakeBlock(height+1, factory.MakeData([]types.Tx{}), lastCommit, []types.Evidence{ev})

// update state (partially)
state.LastBlockHeight = height + 1
Expand Down Expand Up @@ -407,7 +407,7 @@ func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) *store.Bloc

for i := int64(1); i <= state.LastBlockHeight; i++ {
lastCommit := makeCommit(i-1, valAddr)
block, _ := state.MakeBlock(i, factory.MakeData([]types.Tx{}, nil), lastCommit, nil,
block, _ := state.MakeBlock(i, factory.MakeData([]types.Tx{}), lastCommit, nil,
state.Validators.GetProposer().Address)
block.Header.Time = defaultEvidenceTime.Add(time.Duration(i) * time.Minute)
block.Header.Version = cmtversion.Consensus{Block: version.BlockProtocol, App: 1}
Expand Down
Loading

0 comments on commit 6e59072

Please sign in to comment.