Skip to content

Commit 2b2f7bc

Browse files
committed
Updated with new versions of dependencies
1 parent 7b022a3 commit 2b2f7bc

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

adapters/access.go

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (a *AccessAdapter) GetTransactionResult(
189189
id flowgo.Identifier,
190190
_ flowgo.Identifier,
191191
_ flowgo.Identifier,
192-
eventsEncodedVersion *entities.EventEncodingVersionValue,
192+
requiredEventEncodingVersion entities.EventEncodingVersion,
193193
) (
194194
*access.TransactionResult,
195195
error,
@@ -199,10 +199,8 @@ func (a *AccessAdapter) GetTransactionResult(
199199
return nil, convertError(err)
200200
}
201201

202-
convertFromVersion := convert.GetConversionEventEncodingVersion(eventsEncodedVersion)
203-
204202
// Convert CCF events to JSON events, else return CCF encoded version
205-
if convertFromVersion == entities.EventEncodingVersion_CCF_V0 {
203+
if requiredEventEncodingVersion == entities.EventEncodingVersion_JSON_CDC_V0 {
206204
result.Events, err = ConvertCCFEventsToJsonEvents(result.Events)
207205
if err != nil {
208206
return nil, convertError(err)
@@ -329,7 +327,7 @@ func (a *AccessAdapter) GetEventsForHeightRange(
329327
_ context.Context,
330328
eventType string,
331329
startHeight, endHeight uint64,
332-
eventsEncodedVersion *entities.EventEncodingVersionValue,
330+
requiredEventEncodingVersion entities.EventEncodingVersion,
333331
) ([]flowgo.BlockEvents, error) {
334332
events, err := a.emulator.GetEventsForHeightRange(eventType, startHeight, endHeight)
335333
if err != nil {
@@ -338,10 +336,8 @@ func (a *AccessAdapter) GetEventsForHeightRange(
338336

339337
eventCount := 0
340338

341-
convertFromVersion := convert.GetConversionEventEncodingVersion(eventsEncodedVersion)
342-
343339
// Convert CCF events to JSON events, else return CCF encoded version
344-
if convertFromVersion == entities.EventEncodingVersion_CCF_V0 {
340+
if requiredEventEncodingVersion == entities.EventEncodingVersion_JSON_CDC_V0 {
345341
for i := range events {
346342
events[i].Events, err = ConvertCCFEventsToJsonEvents(events[i].Events)
347343
eventCount = eventCount + len(events[i].Events)
@@ -365,7 +361,7 @@ func (a *AccessAdapter) GetEventsForBlockIDs(
365361
_ context.Context,
366362
eventType string,
367363
blockIDs []flowgo.Identifier,
368-
eventsEncodedVersion *entities.EventEncodingVersionValue,
364+
requiredEventEncodingVersion entities.EventEncodingVersion,
369365
) ([]flowgo.BlockEvents, error) {
370366
events, err := a.emulator.GetEventsForBlockIDs(eventType, blockIDs)
371367
if err != nil {
@@ -374,10 +370,8 @@ func (a *AccessAdapter) GetEventsForBlockIDs(
374370

375371
eventCount := 0
376372

377-
convertFromVersion := convert.GetConversionEventEncodingVersion(eventsEncodedVersion)
378-
379373
// Convert CCF events to JSON events, else return CCF encoded version
380-
if convertFromVersion == entities.EventEncodingVersion_CCF_V0 {
374+
if requiredEventEncodingVersion == entities.EventEncodingVersion_JSON_CDC_V0 {
381375
for i := range events {
382376
events[i].Events, err = ConvertCCFEventsToJsonEvents(events[i].Events)
383377
eventCount = eventCount + len(events[i].Events)
@@ -411,7 +405,7 @@ func (a *AccessAdapter) GetTransactionResultByIndex(
411405
_ context.Context,
412406
blockID flowgo.Identifier,
413407
index uint32,
414-
eventsEncodedVersion *entities.EventEncodingVersionValue,
408+
requiredEventEncodingVersion entities.EventEncodingVersion,
415409
) (*access.TransactionResult, error) {
416410
results, err := a.emulator.GetTransactionResultsByBlockID(blockID)
417411
if err != nil {
@@ -421,10 +415,8 @@ func (a *AccessAdapter) GetTransactionResultByIndex(
421415
return nil, convertError(&types.TransactionNotFoundError{ID: flowgo.Identifier{}})
422416
}
423417

424-
convertFromVersion := convert.GetConversionEventEncodingVersion(eventsEncodedVersion)
425-
426418
// Convert CCF events to JSON events, else return CCF encoded version
427-
if convertFromVersion == entities.EventEncodingVersion_CCF_V0 {
419+
if requiredEventEncodingVersion == entities.EventEncodingVersion_JSON_CDC_V0 {
428420
for i := range results {
429421
results[i].Events, err = ConvertCCFEventsToJsonEvents(results[i].Events)
430422
if err != nil {
@@ -447,17 +439,15 @@ func (a *AccessAdapter) GetTransactionsByBlockID(_ context.Context, blockID flow
447439
func (a *AccessAdapter) GetTransactionResultsByBlockID(
448440
_ context.Context,
449441
blockID flowgo.Identifier,
450-
eventsEncodedVersion *entities.EventEncodingVersionValue,
442+
requiredEventEncodingVersion entities.EventEncodingVersion,
451443
) ([]*access.TransactionResult, error) {
452444
result, err := a.emulator.GetTransactionResultsByBlockID(blockID)
453445
if err != nil {
454446
return nil, convertError(err)
455447
}
456448

457-
convertFromVersion := convert.GetConversionEventEncodingVersion(eventsEncodedVersion)
458-
459449
// Convert CCF events to JSON events, else return CCF encoded version
460-
if convertFromVersion == entities.EventEncodingVersion_CCF_V0 {
450+
if requiredEventEncodingVersion == entities.EventEncodingVersion_JSON_CDC_V0 {
461451
for i := range result {
462452
result[i].Events, err = ConvertCCFEventsToJsonEvents(result[i].Events)
463453
if err != nil {

adapters/access_test.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"fmt"
2424
"testing"
2525

26+
"github.com/onflow/flow/protobuf/go/flow/entities"
27+
2628
"github.com/stretchr/testify/require"
2729

2830
"github.com/golang/mock/gomock"
@@ -341,7 +343,7 @@ func TestAccess(t *testing.T) {
341343
Return(&emuResult, nil).
342344
Times(1)
343345

344-
result, err := adapter.GetTransactionResult(context.Background(), txID, blockID, collectionID, nil)
346+
result, err := adapter.GetTransactionResult(context.Background(), txID, blockID, collectionID, entities.EventEncodingVersion_JSON_CDC_V0)
345347
assert.Equal(t, expected, *result)
346348
assert.NoError(t, err)
347349

@@ -351,7 +353,7 @@ func TestAccess(t *testing.T) {
351353
Return(nil, fmt.Errorf("some error")).
352354
Times(1)
353355

354-
result, err = adapter.GetTransactionResult(context.Background(), txID, blockID, collectionID, nil)
356+
result, err = adapter.GetTransactionResult(context.Background(), txID, blockID, collectionID, entities.EventEncodingVersion_JSON_CDC_V0)
355357
assert.Nil(t, result)
356358
assert.Error(t, err)
357359

@@ -562,7 +564,7 @@ func TestAccess(t *testing.T) {
562564
Return(blockEvents, nil).
563565
Times(1)
564566

565-
result, err := adapter.GetEventsForHeightRange(context.Background(), eventType, startHeight, endHeight, nil)
567+
result, err := adapter.GetEventsForHeightRange(context.Background(), eventType, startHeight, endHeight, entities.EventEncodingVersion_JSON_CDC_V0)
566568
assert.Equal(t, expected, result)
567569
assert.NoError(t, err)
568570

@@ -572,7 +574,7 @@ func TestAccess(t *testing.T) {
572574
Return(nil, fmt.Errorf("some error")).
573575
Times(1)
574576

575-
result, err = adapter.GetEventsForHeightRange(context.Background(), eventType, startHeight, endHeight, nil)
577+
result, err = adapter.GetEventsForHeightRange(context.Background(), eventType, startHeight, endHeight, entities.EventEncodingVersion_JSON_CDC_V0)
576578
assert.Nil(t, result)
577579
assert.Error(t, err)
578580

@@ -604,7 +606,7 @@ func TestAccess(t *testing.T) {
604606
Return(blockEvents, nil).
605607
Times(1)
606608

607-
result, err := adapter.GetEventsForBlockIDs(context.Background(), eventType, blockIDs, nil)
609+
result, err := adapter.GetEventsForBlockIDs(context.Background(), eventType, blockIDs, entities.EventEncodingVersion_JSON_CDC_V0)
608610
assert.Equal(t, expected, result)
609611
assert.NoError(t, err)
610612

@@ -614,7 +616,7 @@ func TestAccess(t *testing.T) {
614616
Return(nil, fmt.Errorf("some error")).
615617
Times(1)
616618

617-
result, err = adapter.GetEventsForBlockIDs(context.Background(), eventType, blockIDs, nil)
619+
result, err = adapter.GetEventsForBlockIDs(context.Background(), eventType, blockIDs, entities.EventEncodingVersion_JSON_CDC_V0)
618620
assert.Nil(t, result)
619621
assert.Error(t, err)
620622

@@ -643,7 +645,7 @@ func TestAccess(t *testing.T) {
643645
Return(results, nil).
644646
Times(1)
645647

646-
result, err := adapter.GetTransactionResultByIndex(context.Background(), blockID, index, nil)
648+
result, err := adapter.GetTransactionResultByIndex(context.Background(), blockID, index, entities.EventEncodingVersion_JSON_CDC_V0)
647649
assert.Equal(t, convertedTXResult, result)
648650
assert.NoError(t, err)
649651

@@ -653,7 +655,7 @@ func TestAccess(t *testing.T) {
653655
Return(nil, fmt.Errorf("some error")).
654656
Times(1)
655657

656-
result, err = adapter.GetTransactionResultByIndex(context.Background(), blockID, index, nil)
658+
result, err = adapter.GetTransactionResultByIndex(context.Background(), blockID, index, entities.EventEncodingVersion_JSON_CDC_V0)
657659
assert.Nil(t, result)
658660
assert.Error(t, err)
659661

@@ -712,7 +714,7 @@ func TestAccess(t *testing.T) {
712714
Return(results, nil).
713715
Times(1)
714716

715-
result, err := adapter.GetTransactionResultsByBlockID(context.Background(), blockID, nil)
717+
result, err := adapter.GetTransactionResultsByBlockID(context.Background(), blockID, entities.EventEncodingVersion_JSON_CDC_V0)
716718
assert.Equal(t, expected, result)
717719
assert.NoError(t, err)
718720

@@ -722,7 +724,7 @@ func TestAccess(t *testing.T) {
722724
Return(nil, fmt.Errorf("some error")).
723725
Times(1)
724726

725-
result, err = adapter.GetTransactionResultsByBlockID(context.Background(), blockID, nil)
727+
result, err = adapter.GetTransactionResultsByBlockID(context.Background(), blockID, entities.EventEncodingVersion_JSON_CDC_V0)
726728
assert.Nil(t, result)
727729
assert.Error(t, err)
728730

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/onflow/flow-go-sdk v0.41.10
1919
github.com/onflow/flow-go/crypto v0.24.9
2020
github.com/onflow/flow-nft/lib/go/contracts v1.1.0
21-
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9
21+
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2
2222
github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead
2323
github.com/prometheus/client_golang v1.16.0
2424
github.com/psiemens/graceland v1.0.0
@@ -193,6 +193,6 @@ require (
193193

194194
//TODO: Remove when both version will be merged
195195
replace (
196-
github.com/onflow/flow-go v0.31.1-0.20230808172820-f074502a67e3 => github.com/Guitarheroua/flow-go v0.0.0-20231012141014-37d587e8cbb0
197-
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 => github.com/Guitarheroua/flow/protobuf/go/flow v0.0.0-20231004094238-e7eaa83befe5
196+
github.com/onflow/flow-go v0.31.1-0.20230808172820-f074502a67e3 => github.com/Guitarheroua/flow-go v0.0.0-20231018151139-3e80a49914ad
197+
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 => github.com/Guitarheroua/flow/protobuf/go/flow v0.0.0-20231018150252-f223f1d42001
198198
)

go.sum

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EF
7272
github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w=
7373
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
7474
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
75-
github.com/Guitarheroua/flow-go v0.0.0-20231012141014-37d587e8cbb0 h1:NyQKql9UO5wZaYAkg+kbDbq9DDiCgmjhdKfSqVRH2tw=
76-
github.com/Guitarheroua/flow-go v0.0.0-20231012141014-37d587e8cbb0/go.mod h1:JCNDFGj77VpOHbPjZilgp3m/esnwnD7pO+r3bHdb0xI=
77-
github.com/Guitarheroua/flow/protobuf/go/flow v0.0.0-20231004094238-e7eaa83befe5 h1:k/OJbM33BwI9sEJvNMzmkhM0ZJTSZeCoLImkBLldsJ8=
78-
github.com/Guitarheroua/flow/protobuf/go/flow v0.0.0-20231004094238-e7eaa83befe5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
75+
github.com/Guitarheroua/flow-go v0.0.0-20231018151139-3e80a49914ad h1:3265WGwB1i/zF/nXfRzvEoCYv9VJBDLvlCaMkMoAb/k=
76+
github.com/Guitarheroua/flow-go v0.0.0-20231018151139-3e80a49914ad/go.mod h1:/sD5DGlALj6D7B+p/K2zgWvTc+RFlYshWCokWX816GE=
77+
github.com/Guitarheroua/flow/protobuf/go/flow v0.0.0-20231018150252-f223f1d42001 h1:6Szrh+jL5X83OiKh76ORt7QHxtZvM/uRaU5G6zd6syc=
78+
github.com/Guitarheroua/flow/protobuf/go/flow v0.0.0-20231018150252-f223f1d42001/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
7979
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
8080
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
8181
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
@@ -288,7 +288,6 @@ github.com/fxamacker/circlehash v0.3.0/go.mod h1:3aq3OfVvsWtkWMb6A1owjOQFA+TLsD5
288288
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
289289
github.com/gammazero/deque v0.1.0 h1:f9LnNmq66VDeuAlSAapemq/U7hJ2jpIWa4c09q8Dlik=
290290
github.com/gammazero/deque v0.1.0/go.mod h1:KQw7vFau1hHuM8xmI9RbgKFbAsQFWmBpqQ2KenFLk6M=
291-
github.com/gammazero/workerpool v1.1.2 h1:vuioDQbgrz4HoaCi2q1HLlOXdpbap5AET7xu5/qj87g=
292291
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
293292
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
294293
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=

0 commit comments

Comments
 (0)