Skip to content

Commit

Permalink
Merge pull request #218 from onflow/gregor/update-flow-go-latest
Browse files Browse the repository at this point in the history
Update to Flow Go v0.34.0-crescendo-preview.16
  • Loading branch information
devbugging authored Apr 30, 2024
2 parents adc9797 + 0e245ff commit 59f309f
Show file tree
Hide file tree
Showing 19 changed files with 511 additions and 403 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20.x'
go-version: '1.21.x'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20.x"
go-version: "1.21.x"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ func (b *BlockChainAPI) prepareBlockResponse(
Uncles: []common.Hash{},
GasLimit: hexutil.Uint64(15_000_000),
Nonce: types.BlockNonce{0x1},
Timestamp: hexutil.Uint64(block.Timestamp),
}

transactions, err := b.fetchBlockTransactions(ctx, block)
Expand Down
26 changes: 15 additions & 11 deletions api/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
storageErrs "github.com/onflow/flow-evm-gateway/storage/errors"
"github.com/onflow/flow-go/engine"
"github.com/onflow/flow-go/engine/access/subscription"
flowgoStorage "github.com/onflow/flow-go/storage"
"github.com/onflow/go-ethereum/common/hexutil"
"github.com/onflow/go-ethereum/eth/filters"
"github.com/onflow/go-ethereum/rpc"
Expand Down Expand Up @@ -65,8 +64,9 @@ func (s *StreamAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
func(ctx context.Context, height uint64) (interface{}, error) {
block, err := s.blocks.GetByHeight(height)
if err != nil {
if errors.Is(err, storageErrs.ErrNotFound) { // make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
}
return nil, fmt.Errorf("failed to get block at height: %d: %w", height, err)
}
Expand Down Expand Up @@ -104,8 +104,9 @@ func (s *StreamAPI) NewPendingTransactions(ctx context.Context, fullTx *bool) (*
func(ctx context.Context, height uint64) (interface{}, error) {
block, err := s.blocks.GetByHeight(height)
if err != nil {
if errors.Is(err, storageErrs.ErrNotFound) { // make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
}
return nil, fmt.Errorf("failed to get block at height: %d: %w", height, err)
}
Expand All @@ -118,16 +119,18 @@ func (s *StreamAPI) NewPendingTransactions(ctx context.Context, fullTx *bool) (*

tx, err := s.transactions.Get(hash)
if err != nil {
if errors.Is(err, storageErrs.ErrNotFound) { // make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
}
return nil, fmt.Errorf("failed to get tx with hash: %s at height: %d: %w", hash, height, err)
}

rcp, err := s.receipts.GetByTransactionID(hash)
if err != nil {
if errors.Is(err, storageErrs.ErrNotFound) { // make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
}
return nil, fmt.Errorf("failed to get receipt with hash: %s at height: %d: %w", hash, height, err)
}
Expand Down Expand Up @@ -168,8 +171,9 @@ func (s *StreamAPI) Logs(ctx context.Context, criteria filters.FilterCriteria) (
func(ctx context.Context, height uint64) (interface{}, error) {
block, err := s.blocks.GetByHeight(height)
if err != nil {
if errors.Is(err, storageErrs.ErrNotFound) { // make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(flowgoStorage.ErrNotFound, err)
if errors.Is(err, storageErrs.ErrNotFound) {
// make sure to wrap in not found error as the streamer expects it
return nil, errors.Join(subscription.ErrBlockNotReady, err)
}
return nil, fmt.Errorf("failed to get block at height: %d: %w", height, err)
}
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func startIngestion(
Uint64("missed-heights", blk.Height-latestCadenceHeight).
Msg("indexing cadence height information")

subscriber := ingestion.NewRPCSubscriber(client)
subscriber := ingestion.NewRPCSubscriber(client, cfg.FlowNetworkID)
engine := ingestion.NewEventIngestionEngine(
subscriber,
blocks,
Expand Down
64 changes: 30 additions & 34 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module github.com/onflow/flow-evm-gateway

go 1.20
go 1.21

require (
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
github.com/goccy/go-json v0.10.2
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/onflow/cadence v1.0.0-preview.19
github.com/onflow/flow-go v0.34.0-crescendo-preview.10
github.com/onflow/flow-go-sdk v1.0.0-preview.17
github.com/onflow/cadence v1.0.0-preview.23
github.com/onflow/flow-go v0.34.0-crescendo-preview.16
github.com/onflow/flow-go-sdk v1.0.0-preview.22
github.com/onflow/go-ethereum v1.13.4
github.com/rs/cors v1.8.0
github.com/rs/zerolog v1.31.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/sync v0.6.0
)
Expand Down Expand Up @@ -58,13 +58,12 @@ require (
github.com/go-stack/stack v1.8.1 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/zerolog/v2 v2.0.0-rc.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -75,14 +74,12 @@ require (
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/boxo v0.19.0 // indirect
github.com/ipfs/go-block-format v0.2.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-util v0.0.3 // indirect
github.com/ipfs/go-ipld-format v0.6.0 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
Expand Down Expand Up @@ -114,19 +111,18 @@ require (
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.6.1-0.20240308163425-dc825c20b1a2 // indirect
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df // indirect
github.com/onflow/crypto v0.25.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240402184019-90048578066e // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240402184019-90048578066e // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240402160548-a9c331660956 // indirect
github.com/onflow/flow-ft/lib/go/templates v0.7.1-0.20240402160548-a9c331660956 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240402163945-74687e7a5b9d // indirect
github.com/onflow/flow-nft/lib/go/templates v0.0.0-20240402163945-74687e7a5b9d // indirect
github.com/onflow/flow/protobuf/go/flow v0.4.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5 // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240424211859-3ff4c0fe2a1e // indirect
github.com/onflow/flow-ft/lib/go/templates v0.7.1-0.20240424211859-3ff4c0fe2a1e // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240429184308-40c3de711140 // indirect
github.com/onflow/flow-nft/lib/go/templates v0.0.0-20240429184308-40c3de711140 // indirect
github.com/onflow/flow/protobuf/go/flow v0.4.1-0.20240412170550-911321113030 // indirect
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.18.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
Expand All @@ -150,7 +146,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
Expand All @@ -164,30 +160,30 @@ require (
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
Expand Down
Loading

0 comments on commit 59f309f

Please sign in to comment.