Skip to content

Commit

Permalink
rename interfaces Go packages with a "proto" suffix (#10142)
Browse files Browse the repository at this point in the history
* added "proto" suffix to packages and generated folders (I've tried to
keep folder names unchanged, but it was problematic for tooling)
* in the erigon code update package import paths, but keep them aliased
to previous names such that it doesn't lead to massive code churn. We
can do the code changes separately in subsequent PRs. Each code owner
will do it for them.
* had to update make grpc command: tried various --go_opt=paths=xxx (see
https://protobuf.dev/reference/go/go-generated/ ), but it still
generated wrong namespaces, so had to list each of them separately

see erigontech/interfaces#216
  • Loading branch information
battlmonstr authored May 2, 2024
1 parent 8f2cdbe commit 6682ecf
Show file tree
Hide file tree
Showing 162 changed files with 692 additions and 671 deletions.
2 changes: 1 addition & 1 deletion cl/antiquary/antiquary.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/ledgerwatch/erigon-lib/common/datadir"
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloaderproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/clparams"
"github.com/ledgerwatch/erigon/cl/persistence/beacon_indicies"
Expand Down
2 changes: 1 addition & 1 deletion cl/beacon/handler/block_production.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"github.com/ledgerwatch/erigon-lib/common/length"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/abstract"
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
Expand Down
2 changes: 1 addition & 1 deletion cl/beacon/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/go-chi/chi/v5"
"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/aggregation"
"github.com/ledgerwatch/erigon/cl/beacon/beacon_router_configuration"
Expand Down
2 changes: 1 addition & 1 deletion cl/beacon/handler/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"runtime"
"strconv"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
)

Expand Down
2 changes: 1 addition & 1 deletion cl/beacon/handler/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"net/http"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
Expand Down
2 changes: 1 addition & 1 deletion cl/beacon/handler/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/gossip"
Expand Down
2 changes: 1 addition & 1 deletion cl/phase1/execution_client/execution_client_direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"math/big"

libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces/execution"
execution "github.com/ledgerwatch/erigon-lib/gointerfaces/executionproto"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/turbo/engineapi/engine_types"
Expand Down
2 changes: 1 addition & 1 deletion cl/phase1/network/gossip_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/c2h5oh/datasize"
"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon-lib/types/ssz"
"github.com/ledgerwatch/erigon/cl/beacon/beaconevents"
"github.com/ledgerwatch/erigon/cl/clparams"
Expand Down
2 changes: 1 addition & 1 deletion cl/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/golang/snappy"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/log/v3"
"go.uber.org/zap/buffer"

Expand Down
2 changes: 1 addition & 1 deletion cl/sentinel/sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/turbo/snapshotsync/freezeblocks"

sentinelrpc "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinelrpc "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/crypto"
"github.com/ledgerwatch/erigon/p2p/discover"
Expand Down
2 changes: 1 addition & 1 deletion cl/sentinel/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/ledgerwatch/erigon-lib/diagnostics"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
sentinelrpc "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinelrpc "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/utils"
"github.com/ledgerwatch/log/v3"
Expand Down
2 changes: 1 addition & 1 deletion cl/sentinel/service/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/ledgerwatch/erigon/turbo/snapshotsync/freezeblocks"

"github.com/ledgerwatch/erigon-lib/direct"
sentinelrpc "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinelrpc "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/log/v3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"time"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/aggregation"
"github.com/ledgerwatch/erigon/cl/beacon/synced_data"
Expand Down
2 changes: 1 addition & 1 deletion cmd/capcli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import (
"github.com/spf13/afero"
"google.golang.org/grpc"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
)

var CLI struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/caplin/caplin1/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"golang.org/x/sync/semaphore"

proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloaderproto"
"github.com/ledgerwatch/erigon/cl/aggregation"
"github.com/ledgerwatch/erigon/cl/antiquary"
"github.com/ledgerwatch/erigon/cl/beacon"
Expand Down
2 changes: 1 addition & 1 deletion cmd/downloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/ledgerwatch/erigon-lib/downloader"
"github.com/ledgerwatch/erigon-lib/downloader/downloadercfg"
"github.com/ledgerwatch/erigon-lib/downloader/downloadergrpc"
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloaderproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/mdbx"
"github.com/ledgerwatch/log/v3"
Expand Down
4 changes: 2 additions & 2 deletions cmd/rpcdaemon/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/ledgerwatch/erigon-lib/direct"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
"github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
remote "github.com/ledgerwatch/erigon-lib/gointerfaces/remoteproto"
txpool "github.com/ledgerwatch/erigon-lib/gointerfaces/txpoolproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/kvcache"
"github.com/ledgerwatch/erigon-lib/kv/kvcfg"
Expand Down
4 changes: 2 additions & 2 deletions cmd/rpcdaemon/rpcdaemontest/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

"github.com/ledgerwatch/erigon-lib/chain"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
"github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
remote "github.com/ledgerwatch/erigon-lib/gointerfaces/remoteproto"
txpool "github.com/ledgerwatch/erigon-lib/gointerfaces/txpoolproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/accounts/abi/bind"
"github.com/ledgerwatch/erigon/accounts/abi/bind/backends"
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/rpcservices/eth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
remote "github.com/ledgerwatch/erigon-lib/gointerfaces/remoteproto"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/types"
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/rpcservices/eth_mining.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
txpool "github.com/ledgerwatch/erigon-lib/gointerfaces/txpoolproto"
"github.com/ledgerwatch/erigon/ethdb/privateapi"
"github.com/ledgerwatch/log/v3"
"google.golang.org/grpc"
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/rpcservices/eth_txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
txpooproto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
txpooproto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpoolproto"
txpool2 "github.com/ledgerwatch/erigon-lib/txpool"
"github.com/ledgerwatch/log/v3"
"google.golang.org/grpc"
Expand Down
4 changes: 2 additions & 2 deletions cmd/txpool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/ledgerwatch/erigon-lib/direct"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
proto_sentry "github.com/ledgerwatch/erigon-lib/gointerfaces/sentry"
remote "github.com/ledgerwatch/erigon-lib/gointerfaces/remoteproto"
proto_sentry "github.com/ledgerwatch/erigon-lib/gointerfaces/sentryproto"
"github.com/ledgerwatch/erigon-lib/kv/kvcache"
"github.com/ledgerwatch/erigon-lib/kv/kvcfg"
"github.com/ledgerwatch/erigon-lib/kv/remotedb"
Expand Down
26 changes: 22 additions & 4 deletions erigon-lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PROTOC_OS = linux
endif

PROTOC_INCLUDE = build/include/google
PROTO_PATH = vendor/github.com/ledgerwatch/interfaces


default: gen
Expand Down Expand Up @@ -61,11 +62,28 @@ protoc-clean:

grpc: protoc-all
go mod vendor
PATH="$(GOBIN):$(PATH)" protoc --proto_path=vendor/github.com/ledgerwatch/interfaces --go_out=gointerfaces -I=$(PROTOC_INCLUDE) \
PATH="$(GOBIN):$(PATH)" protoc --proto_path=$(PROTO_PATH) --go_out=gointerfaces -I=$(PROTOC_INCLUDE) \
--go_opt=Mtypes/types.proto=./typesproto \
types/types.proto
PATH="$(GOBIN):$(PATH)" protoc --proto_path=vendor/github.com/ledgerwatch/interfaces --go_out=gointerfaces --go-grpc_out=gointerfaces -I=$(PROTOC_INCLUDE) \
--go_opt=Mtypes/types.proto=github.com/ledgerwatch/erigon-lib/gointerfaces/types \
--go-grpc_opt=Mtypes/types.proto=github.com/ledgerwatch/erigon-lib/gointerfaces/types \
PATH="$(GOBIN):$(PATH)" protoc --proto_path=$(PROTO_PATH) --go_out=gointerfaces --go-grpc_out=gointerfaces -I=$(PROTOC_INCLUDE) \
--go_opt=Mtypes/types.proto=github.com/ledgerwatch/erigon-lib/gointerfaces/typesproto \
--go-grpc_opt=Mtypes/types.proto=github.com/ledgerwatch/erigon-lib/gointerfaces/typesproto \
--go_opt=Mp2psentry/sentry.proto=./sentryproto \
--go-grpc_opt=Mp2psentry/sentry.proto=./sentryproto \
--go_opt=Mp2psentinel/sentinel.proto=./sentinelproto \
--go-grpc_opt=Mp2psentinel/sentinel.proto=./sentinelproto \
--go_opt=Mremote/kv.proto=./remoteproto \
--go-grpc_opt=Mremote/kv.proto=./remoteproto \
--go_opt=Mremote/ethbackend.proto=./remoteproto \
--go-grpc_opt=Mremote/ethbackend.proto=./remoteproto \
--go_opt=Mdownloader/downloader.proto=./downloaderproto \
--go-grpc_opt=Mdownloader/downloader.proto=./downloaderproto \
--go_opt=Mexecution/execution.proto=./executionproto \
--go-grpc_opt=Mexecution/execution.proto=./executionproto \
--go_opt=Mtxpool/txpool.proto=./txpoolproto \
--go-grpc_opt=Mtxpool/txpool.proto=./txpoolproto \
--go_opt=Mtxpool/mining.proto=./txpoolproto \
--go-grpc_opt=Mtxpool/mining.proto=./txpoolproto \
p2psentry/sentry.proto p2psentinel/sentinel.proto \
remote/kv.proto remote/ethbackend.proto \
downloader/downloader.proto execution/execution.proto \
Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/direct/downloader_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package direct
import (
"context"

proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloaderproto"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)
Expand Down
4 changes: 2 additions & 2 deletions erigon-lib/direct/eth_backend_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"io"

"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
"github.com/ledgerwatch/erigon-lib/gointerfaces/types"
remote "github.com/ledgerwatch/erigon-lib/gointerfaces/remoteproto"
types "github.com/ledgerwatch/erigon-lib/gointerfaces/typesproto"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)
Expand Down
4 changes: 2 additions & 2 deletions erigon-lib/direct/execution_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package direct
import (
"context"

"github.com/ledgerwatch/erigon-lib/gointerfaces/execution"
"github.com/ledgerwatch/erigon-lib/gointerfaces/types"
execution "github.com/ledgerwatch/erigon-lib/gointerfaces/executionproto"
types "github.com/ledgerwatch/erigon-lib/gointerfaces/typesproto"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)
Expand Down
4 changes: 2 additions & 2 deletions erigon-lib/direct/mining_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"io"

txpool_proto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
"github.com/ledgerwatch/erigon-lib/gointerfaces/types"
txpool_proto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpoolproto"
types "github.com/ledgerwatch/erigon-lib/gointerfaces/typesproto"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)
Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/direct/sentinel_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"io"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
sentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinelproto"
"google.golang.org/grpc"
)

Expand Down
4 changes: 2 additions & 2 deletions erigon-lib/direct/sentry_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/ledgerwatch/erigon-lib/gointerfaces/sentry"
"github.com/ledgerwatch/erigon-lib/gointerfaces/types"
sentry "github.com/ledgerwatch/erigon-lib/gointerfaces/sentryproto"
types "github.com/ledgerwatch/erigon-lib/gointerfaces/typesproto"
)

const (
Expand Down
Loading

0 comments on commit 6682ecf

Please sign in to comment.