@@ -41,11 +41,11 @@ func TestRedisValidatorRegistration(t *testing.T) {
4141 key := common .ValidPayloadRegisterValidator .Message .Pubkey
4242 value := common .ValidPayloadRegisterValidator
4343 pkHex := common .NewPubkeyHex (key .String ())
44- err := cache .SetValidatorRegistrationTimestamp (pkHex , uint64 (value .Message .Timestamp .Unix ()))
44+ err := cache .SetValidatorRegistrationTimestamp (pkHex , uint64 (value .Message .Timestamp .Unix ())) //nolint:gosec
4545 require .NoError (t , err )
4646 result , err := cache .GetValidatorRegistrationTimestamp (common .NewPubkeyHex (key .String ()))
4747 require .NoError (t , err )
48- require .Equal (t , result , uint64 (value .Message .Timestamp .Unix ()))
48+ require .Equal (t , result , uint64 (value .Message .Timestamp .Unix ())) //nolint:gosec
4949 })
5050
5151 t .Run ("Returns nil if validator registration is not in cache" , func (t * testing.T ) {
@@ -60,7 +60,7 @@ func TestRedisValidatorRegistration(t *testing.T) {
6060 value := common .ValidPayloadRegisterValidator
6161
6262 pkHex := common .NewPubkeyHex (key .String ())
63- timestamp := uint64 (value .Message .Timestamp .Unix ())
63+ timestamp := uint64 (value .Message .Timestamp .Unix ()) //nolint:gosec
6464
6565 err := cache .SetValidatorRegistrationTimestampIfNewer (pkHex , timestamp )
6666 require .NoError (t , err )
@@ -156,7 +156,7 @@ func TestBuilderBids(t *testing.T) {
156156 require .NoError (t , err )
157157 require .Equal (t , big .NewInt (expectedValue ), value .ToBig ())
158158
159- topBidValue , err := cache .GetTopBidValue (context . Background (), cache .client .Pipeline (), slot , parentHash , proposerPubkey )
159+ topBidValue , err := cache .GetTopBidValue (t . Context (), cache .client .Pipeline (), slot , parentHash , proposerPubkey )
160160 require .NoError (t , err )
161161 require .Equal (t , big .NewInt (expectedValue ), topBidValue )
162162
@@ -168,18 +168,18 @@ func TestBuilderBids(t *testing.T) {
168168 }
169169
170170 ensureBidFloor := func (expectedValue int64 ) {
171- floorValue , err := cache .GetFloorBidValue (context . Background (), cache .client .Pipeline (), slot , parentHash , proposerPubkey )
171+ floorValue , err := cache .GetFloorBidValue (t . Context (), cache .client .Pipeline (), slot , parentHash , proposerPubkey )
172172 require .NoError (t , err )
173173 require .Equal (t , big .NewInt (expectedValue ), floorValue )
174174 }
175175
176176 // deleting a bid that doesn't exist should not error
177- err := cache .DelBuilderBid (context . Background (), cache .client .Pipeline (), slot , parentHash , proposerPubkey , bApubkey )
177+ err := cache .DelBuilderBid (t . Context (), cache .client .Pipeline (), slot , parentHash , proposerPubkey , bApubkey )
178178 require .NoError (t , err )
179179
180180 // submit ba1=10
181181 payload , getPayloadResp , getHeaderResp := common .CreateTestBlockSubmission (t , bApubkey , uint256 .NewInt (10 ), & opts )
182- resp , err := cache .SaveBidAndUpdateTopBid (context . Background (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), false , nil )
182+ resp , err := cache .SaveBidAndUpdateTopBid (t . Context (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), false , nil )
183183 require .NoError (t , err )
184184 require .True (t , resp .WasBidSaved , resp )
185185 require .True (t , resp .WasTopBidUpdated )
@@ -189,7 +189,7 @@ func TestBuilderBids(t *testing.T) {
189189 ensureBidFloor (10 )
190190
191191 // deleting ba1
192- err = cache .DelBuilderBid (context . Background (), cache .client .Pipeline (), slot , parentHash , proposerPubkey , bApubkey )
192+ err = cache .DelBuilderBid (t . Context (), cache .client .Pipeline (), slot , parentHash , proposerPubkey , bApubkey )
193193 require .NoError (t , err )
194194
195195 // best bid and floor should still exist, because it was the floor bid
@@ -198,7 +198,7 @@ func TestBuilderBids(t *testing.T) {
198198
199199 // submit ba2=5 (should not update, because floor is 10)
200200 payload , getPayloadResp , getHeaderResp = common .CreateTestBlockSubmission (t , bApubkey , uint256 .NewInt (5 ), & opts )
201- resp , err = cache .SaveBidAndUpdateTopBid (context . Background (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), false , nil )
201+ resp , err = cache .SaveBidAndUpdateTopBid (t . Context (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), false , nil )
202202 require .NoError (t , err )
203203 require .False (t , resp .WasBidSaved , resp )
204204 require .False (t , resp .WasTopBidUpdated )
@@ -209,7 +209,7 @@ func TestBuilderBids(t *testing.T) {
209209
210210 // submit ba3c=5 (should not update, because floor is 10)
211211 payload , getPayloadResp , getHeaderResp = common .CreateTestBlockSubmission (t , bApubkey , uint256 .NewInt (5 ), & opts )
212- resp , err = cache .SaveBidAndUpdateTopBid (context . Background (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), true , nil )
212+ resp , err = cache .SaveBidAndUpdateTopBid (t . Context (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), true , nil )
213213 require .NoError (t , err )
214214 require .True (t , resp .WasBidSaved )
215215 require .False (t , resp .WasTopBidUpdated )
@@ -221,7 +221,7 @@ func TestBuilderBids(t *testing.T) {
221221
222222 // submit bb1=20
223223 payload , getPayloadResp , getHeaderResp = common .CreateTestBlockSubmission (t , bBpubkey , uint256 .NewInt (20 ), & opts )
224- resp , err = cache .SaveBidAndUpdateTopBid (context . Background (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), false , nil )
224+ resp , err = cache .SaveBidAndUpdateTopBid (t . Context (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), false , nil )
225225 require .NoError (t , err )
226226 require .True (t , resp .WasBidSaved )
227227 require .True (t , resp .WasTopBidUpdated )
@@ -232,7 +232,7 @@ func TestBuilderBids(t *testing.T) {
232232
233233 // submit bb2c=22
234234 payload , getPayloadResp , getHeaderResp = common .CreateTestBlockSubmission (t , bBpubkey , uint256 .NewInt (22 ), & opts )
235- resp , err = cache .SaveBidAndUpdateTopBid (context . Background (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), true , nil )
235+ resp , err = cache .SaveBidAndUpdateTopBid (t . Context (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), true , nil )
236236 require .NoError (t , err )
237237 require .True (t , resp .WasBidSaved )
238238 require .True (t , resp .WasTopBidUpdated )
@@ -243,7 +243,7 @@ func TestBuilderBids(t *testing.T) {
243243
244244 // submit bb3c=12 (should update top bid, using floor at 20)
245245 payload , getPayloadResp , getHeaderResp = common .CreateTestBlockSubmission (t , bBpubkey , uint256 .NewInt (12 ), & opts )
246- resp , err = cache .SaveBidAndUpdateTopBid (context . Background (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), true , nil )
246+ resp , err = cache .SaveBidAndUpdateTopBid (t . Context (), cache .NewPipeline (), trace , payload , getPayloadResp , getHeaderResp , time .Now (), true , nil )
247247 require .NoError (t , err )
248248 require .True (t , resp .WasBidSaved )
249249 require .True (t , resp .WasTopBidUpdated )
@@ -290,7 +290,7 @@ func TestCheckAndSetLastSlotAndHashDelivered(t *testing.T) {
290290 newHash := "0x0000000000000000000000000000000000000000000000000000000000000000"
291291
292292 // should return redis.Nil if wasn't set
293- slot , err := cache .GetLastSlotDelivered (context . Background (), cache .NewPipeline ())
293+ slot , err := cache .GetLastSlotDelivered (t . Context (), cache .NewPipeline ())
294294 require .ErrorIs (t , err , redis .Nil )
295295 require .Equal (t , uint64 (0 ), slot )
296296
@@ -299,7 +299,7 @@ func TestCheckAndSetLastSlotAndHashDelivered(t *testing.T) {
299299 require .NoError (t , err )
300300
301301 // should get slot
302- slot , err = cache .GetLastSlotDelivered (context . Background (), cache .NewPipeline ())
302+ slot , err = cache .GetLastSlotDelivered (t . Context (), cache .NewPipeline ())
303303 require .NoError (t , err )
304304 require .Equal (t , newSlot , slot )
305305
@@ -426,8 +426,8 @@ func TestGetBuilderLatestValue(t *testing.T) {
426426 },
427427 }
428428
429- _ , err = cache .client .TxPipelined (context . Background (), func (pipeliner redis.Pipeliner ) error {
430- return cache .SaveBuilderBid (context . Background (), pipeliner , slot , parentHash , proposerPubkey , builderPubkey , time .Now ().UTC (), getHeaderResp )
429+ _ , err = cache .client .TxPipelined (t . Context (), func (pipeliner redis.Pipeliner ) error {
430+ return cache .SaveBuilderBid (t . Context (), pipeliner , slot , parentHash , proposerPubkey , builderPubkey , time .Now ().UTC (), getHeaderResp )
431431 })
432432 require .NoError (t , err )
433433
@@ -439,7 +439,7 @@ func TestGetBuilderLatestValue(t *testing.T) {
439439
440440func TestPipelineNilCheck (t * testing.T ) {
441441 cache := setupTestRedis (t )
442- f , err := cache .GetFloorBidValue (context . Background (), cache .NewPipeline (), 0 , "1" , "2" )
442+ f , err := cache .GetFloorBidValue (t . Context (), cache .NewPipeline (), 0 , "1" , "2" )
443443 require .NoError (t , err )
444444 require .Equal (t , big .NewInt (0 ), f )
445445}
@@ -450,24 +450,24 @@ func TestPipelineNilCheck(t *testing.T) {
450450// key1 := "test1"
451451// key2 := "test123"
452452// val := "foo"
453- // err := cache.client.Set(context.Background (), key1, val, 0).Err()
453+ // err := cache.client.Set(t.Context (), key1, val, 0).Err()
454454// require.NoError(t, err)
455455
456- // _, err = cache.client.TxPipelined(context.Background (), func(pipeliner redis.Pipeliner) error {
457- // c := tx.Get(context.Background (), key1)
458- // _, err := tx.Exec(context.Background ())
456+ // _, err = cache.client.TxPipelined(t.Context (), func(pipeliner redis.Pipeliner) error {
457+ // c := tx.Get(t.Context (), key1)
458+ // _, err := tx.Exec(t.Context ())
459459// require.NoError(t, err)
460460// str, err := c.Result()
461461// require.NoError(t, err)
462462// require.Equal(t, val, str)
463463
464- // err = tx.Set(context.Background (), key2, val, 0).Err()
464+ // err = tx.Set(t.Context (), key2, val, 0).Err()
465465// require.NoError(t, err)
466466// return nil
467467// })
468468// require.NoError(t, err)
469469
470- // str, err := cache.client.Get(context.Background (), key2).Result()
470+ // str, err := cache.client.Get(t.Context (), key2).Result()
471471// require.NoError(t, err)
472472// require.Equal(t, val, str)
473473// }
0 commit comments