Skip to content

Commit eacc992

Browse files
committed
Rename prov to pusher in Finalizer
1 parent d157f48 commit eacc992

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

module/finalizer/collection/finalizer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ import (
2121
type Finalizer struct {
2222
db *badger.DB
2323
transactions mempool.Transactions
24-
prov collection.GuaranteedCollectionPublisher
24+
pusher collection.GuaranteedCollectionPublisher
2525
metrics module.CollectionMetrics
2626
}
2727

2828
// NewFinalizer creates a new finalizer for collection nodes.
2929
func NewFinalizer(
3030
db *badger.DB,
3131
transactions mempool.Transactions,
32-
prov collection.GuaranteedCollectionPublisher,
32+
pusher collection.GuaranteedCollectionPublisher,
3333
metrics module.CollectionMetrics,
3434
) *Finalizer {
3535
f := &Finalizer{
3636
db: db,
3737
transactions: transactions,
38-
prov: prov,
38+
pusher: pusher,
3939
metrics: metrics,
4040
}
4141
return f
@@ -159,7 +159,7 @@ func (f *Finalizer) MakeFinal(blockID flow.Identifier) error {
159159
// collection.
160160

161161
// TODO add real signatures here (2711)
162-
f.prov.SubmitCollectionGuarantee(&flow.CollectionGuarantee{
162+
f.pusher.SubmitCollectionGuarantee(&flow.CollectionGuarantee{
163163
CollectionID: payload.Collection.ID(),
164164
ReferenceBlockID: payload.ReferenceBlockID,
165165
ChainID: header.ChainID,

module/finalizer/collection/finalizer_test.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ func TestFinalizer(t *testing.T) {
6464
bootstrap()
6565
defer cleanup()
6666

67-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
68-
prov.On("SubmitCollectionGuarantee", mock.Anything)
69-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
67+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
68+
pusher.On("SubmitCollectionGuarantee", mock.Anything)
69+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
7070

7171
fakeBlockID := unittest.IdentifierFixture()
7272
err := finalizer.MakeFinal(fakeBlockID)
@@ -77,9 +77,9 @@ func TestFinalizer(t *testing.T) {
7777
bootstrap()
7878
defer cleanup()
7979

80-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
81-
prov.On("SubmitCollectionGuarantee", mock.Anything)
82-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
80+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
81+
pusher.On("SubmitCollectionGuarantee", mock.Anything)
82+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
8383

8484
// tx1 is included in the finalized block
8585
tx1 := unittest.TransactionBodyFixture(func(tx *flow.TransactionBody) { tx.ProposalKey.SequenceNumber = 1 })
@@ -103,9 +103,9 @@ func TestFinalizer(t *testing.T) {
103103
bootstrap()
104104
defer cleanup()
105105

106-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
107-
prov.On("SubmitCollectionGuarantee", mock.Anything)
108-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
106+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
107+
pusher.On("SubmitCollectionGuarantee", mock.Anything)
108+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
109109

110110
// create a new block that isn't connected to a parent
111111
block := unittest.ClusterBlockWithParent(genesis)
@@ -122,8 +122,8 @@ func TestFinalizer(t *testing.T) {
122122
bootstrap()
123123
defer cleanup()
124124

125-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
126-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
125+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
126+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
127127

128128
// create a block with empty payload on genesis
129129
block := unittest.ClusterBlockWithParent(genesis)
@@ -140,15 +140,15 @@ func TestFinalizer(t *testing.T) {
140140
assert.Equal(t, block.ID(), final.ID())
141141

142142
// collection should not have been propagated
143-
prov.AssertNotCalled(t, "SubmitCollectionGuarantee", mock.Anything)
143+
pusher.AssertNotCalled(t, "SubmitCollectionGuarantee", mock.Anything)
144144
})
145145

146146
t.Run("finalize single block", func(t *testing.T) {
147147
bootstrap()
148148
defer cleanup()
149149

150-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
151-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
150+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
151+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
152152

153153
// tx1 is included in the finalized block and mempool
154154
tx1 := unittest.TransactionBodyFixture(func(tx *flow.TransactionBody) { tx.ProposalKey.SequenceNumber = 1 })
@@ -162,8 +162,8 @@ func TestFinalizer(t *testing.T) {
162162
block.SetPayload(model.PayloadFromTransactions(refBlock.ID(), &tx1))
163163
insert(block)
164164

165-
// block should be passed to provider
166-
prov.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
165+
// block should be passed to pusher
166+
pusher.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
167167
CollectionID: block.Payload.Collection.ID(),
168168
ReferenceBlockID: refBlock.ID(),
169169
ChainID: block.Header.ChainID,
@@ -192,8 +192,8 @@ func TestFinalizer(t *testing.T) {
192192
bootstrap()
193193
defer cleanup()
194194

195-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
196-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
195+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
196+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
197197

198198
// tx1 is included in the first finalized block and mempool
199199
tx1 := unittest.TransactionBodyFixture(func(tx *flow.TransactionBody) { tx.ProposalKey.SequenceNumber = 1 })
@@ -212,15 +212,15 @@ func TestFinalizer(t *testing.T) {
212212
block2.SetPayload(model.PayloadFromTransactions(refBlock.ID(), &tx2))
213213
insert(block2)
214214

215-
// both blocks should be passed to provider
216-
prov.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
215+
// both blocks should be passed to pusher
216+
pusher.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
217217
CollectionID: block1.Payload.Collection.ID(),
218218
ReferenceBlockID: refBlock.ID(),
219219
ChainID: block1.Header.ChainID,
220220
SignerIndices: block1.Header.ParentVoterIndices,
221221
Signature: nil,
222222
}).Once()
223-
prov.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
223+
pusher.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
224224
CollectionID: block2.Payload.Collection.ID(),
225225
ReferenceBlockID: refBlock.ID(),
226226
ChainID: block2.Header.ChainID,
@@ -247,8 +247,8 @@ func TestFinalizer(t *testing.T) {
247247
bootstrap()
248248
defer cleanup()
249249

250-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
251-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
250+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
251+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
252252

253253
// tx1 is included in the finalized parent block and mempool
254254
tx1 := unittest.TransactionBodyFixture(func(tx *flow.TransactionBody) { tx.ProposalKey.SequenceNumber = 1 })
@@ -267,8 +267,8 @@ func TestFinalizer(t *testing.T) {
267267
block2.SetPayload(model.PayloadFromTransactions(refBlock.ID(), &tx2))
268268
insert(block2)
269269

270-
// block should be passed to provider
271-
prov.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
270+
// block should be passed to pusher
271+
pusher.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
272272
CollectionID: block1.Payload.Collection.ID(),
273273
ReferenceBlockID: refBlock.ID(),
274274
ChainID: block1.Header.ChainID,
@@ -297,8 +297,8 @@ func TestFinalizer(t *testing.T) {
297297
bootstrap()
298298
defer cleanup()
299299

300-
prov := collectionmock.NewGuaranteedCollectionPublisher(t)
301-
finalizer := collection.NewFinalizer(db, pool, prov, metrics)
300+
pusher := collectionmock.NewGuaranteedCollectionPublisher(t)
301+
finalizer := collection.NewFinalizer(db, pool, pusher, metrics)
302302

303303
// tx1 is included in the finalized block and mempool
304304
tx1 := unittest.TransactionBodyFixture(func(tx *flow.TransactionBody) { tx.ProposalKey.SequenceNumber = 1 })
@@ -317,8 +317,8 @@ func TestFinalizer(t *testing.T) {
317317
block2.SetPayload(model.PayloadFromTransactions(refBlock.ID(), &tx2))
318318
insert(block2)
319319

320-
// block should be passed to provider
321-
prov.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
320+
// block should be passed to pusher
321+
pusher.On("SubmitCollectionGuarantee", &flow.CollectionGuarantee{
322322
CollectionID: block1.Payload.Collection.ID(),
323323
ReferenceBlockID: refBlock.ID(),
324324
ChainID: block1.Header.ChainID,

0 commit comments

Comments
 (0)