From 1d59688d7b2a53b8d4a2de31808d2f3c1a7bc738 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Fri, 6 Dec 2024 08:34:44 -0800 Subject: [PATCH] remove underscores from imports --- cmd/zetae2e/local/monitor_block_production.go | 6 +++--- zetaclient/chains/interfaces/interfaces.go | 4 ++-- zetaclient/testutils/mocks/zetacore_client.go | 12 +++++------ zetaclient/zetacore/client.go | 20 +++++++++---------- zetaclient/zetacore/client_subscriptions.go | 10 +++++----- zetaclient/zetacore/client_test.go | 12 +++++------ 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cmd/zetae2e/local/monitor_block_production.go b/cmd/zetae2e/local/monitor_block_production.go index 89de03012e..801dfc921b 100644 --- a/cmd/zetae2e/local/monitor_block_production.go +++ b/cmd/zetae2e/local/monitor_block_production.go @@ -7,7 +7,7 @@ import ( "time" rpchttp "github.com/cometbft/cometbft/rpc/client/http" - cometbft_types "github.com/cometbft/cometbft/types" + cometbfttypes "github.com/cometbft/cometbft/types" "github.com/zeta-chain/node/e2e/config" ) @@ -37,11 +37,11 @@ func monitorBlockProduction(ctx context.Context, conf config.Config) error { if err != nil { return fmt.Errorf("subscribe: %w", err) } - latestNewBlockEvent := cometbft_types.EventDataNewBlock{} + latestNewBlockEvent := cometbfttypes.EventDataNewBlock{} for { select { case event := <-blockEventChan: - newBlockEvent, ok := event.Data.(cometbft_types.EventDataNewBlock) + newBlockEvent, ok := event.Data.(cometbfttypes.EventDataNewBlock) if !ok { return fmt.Errorf("expecting new block event, got %T", event.Data) } diff --git a/zetaclient/chains/interfaces/interfaces.go b/zetaclient/chains/interfaces/interfaces.go index 1cc0f1d11d..cd195912bb 100644 --- a/zetaclient/chains/interfaces/interfaces.go +++ b/zetaclient/chains/interfaces/interfaces.go @@ -11,7 +11,7 @@ import ( "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/rpcclient" "github.com/btcsuite/btcd/wire" - cometbft_types "github.com/cometbft/cometbft/types" + cometbfttypes "github.com/cometbft/cometbft/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" @@ -146,7 +146,7 @@ type ZetacoreClient interface { GetUpgradePlan(ctx context.Context) (*upgradetypes.Plan, error) PostOutboundTracker(ctx context.Context, chainID int64, nonce uint64, txHash string) (string, error) - NewBlockSubscriber(ctx context.Context) (chan cometbft_types.EventDataNewBlock, error) + NewBlockSubscriber(ctx context.Context) (chan cometbfttypes.EventDataNewBlock, error) } // BTCRPCClient is the interface for BTC RPC client diff --git a/zetaclient/testutils/mocks/zetacore_client.go b/zetaclient/testutils/mocks/zetacore_client.go index 0ca1681c85..fa5b34486b 100644 --- a/zetaclient/testutils/mocks/zetacore_client.go +++ b/zetaclient/testutils/mocks/zetacore_client.go @@ -23,7 +23,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" zerolog "github.com/rs/zerolog" - cometbft_types "github.com/cometbft/cometbft/types" + cometbfttypes "github.com/cometbft/cometbft/types" ) // ZetacoreClient is an autogenerated mock type for the ZetacoreClient type @@ -893,19 +893,19 @@ func (_m *ZetacoreClient) PostVoteTSS(ctx context.Context, tssPubKey string, key } // NewBlockSubscriber provides a mock function with given fields: ctx -func (_m *ZetacoreClient) NewBlockSubscriber(ctx context.Context) (chan cometbft_types.EventDataNewBlock, error) { +func (_m *ZetacoreClient) NewBlockSubscriber(ctx context.Context) (chan cometbfttypes.EventDataNewBlock, error) { ret := _m.Called(ctx) - var r0 chan cometbft_types.EventDataNewBlock + var r0 chan cometbfttypes.EventDataNewBlock var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (chan cometbft_types.EventDataNewBlock, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (chan cometbfttypes.EventDataNewBlock, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) chan cometbft_types.EventDataNewBlock); ok { + if rf, ok := ret.Get(0).(func(context.Context) chan cometbfttypes.EventDataNewBlock); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(chan cometbft_types.EventDataNewBlock) + r0 = ret.Get(0).(chan cometbfttypes.EventDataNewBlock) } } diff --git a/zetaclient/zetacore/client.go b/zetaclient/zetacore/client.go index 454c02fbf6..de54435c7e 100644 --- a/zetaclient/zetacore/client.go +++ b/zetaclient/zetacore/client.go @@ -6,8 +6,8 @@ import ( "strings" "sync" - cometbft_rpc_client "github.com/cometbft/cometbft/rpc/client" - cometbft_http_client "github.com/cometbft/cometbft/rpc/client/http" + cometbftrpc "github.com/cometbft/cometbft/rpc/client" + cometbfthttp "github.com/cometbft/cometbft/rpc/client/http" cosmosclient "github.com/cosmos/cosmos-sdk/client" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/pkg/errors" @@ -19,7 +19,7 @@ import ( "github.com/zeta-chain/node/app" "github.com/zeta-chain/node/pkg/authz" "github.com/zeta-chain/node/pkg/chains" - zetacore_rpc "github.com/zeta-chain/node/pkg/rpc" + zetacorerpc "github.com/zeta-chain/node/pkg/rpc" "github.com/zeta-chain/node/zetaclient/chains/interfaces" "github.com/zeta-chain/node/zetaclient/config" keyinterfaces "github.com/zeta-chain/node/zetaclient/keys/interfaces" @@ -30,13 +30,13 @@ var _ interfaces.ZetacoreClient = &Client{} // Client is the client to send tx to zetacore type Client struct { - zetacore_rpc.Clients + zetacorerpc.Clients logger zerolog.Logger config config.ClientConfiguration cosmosClientContext cosmosclient.Context - cometBFTClient cometbft_rpc_client.Client + cometBFTClient cometbftrpc.Client blockHeight int64 accountNumber map[authz.KeyType]uint64 @@ -54,7 +54,7 @@ var unsecureGRPC = grpc.WithTransportCredentials(insecure.NewCredentials()) type constructOpts struct { customTendermint bool - tendermintClient cometbft_rpc_client.Client + tendermintClient cometbftrpc.Client customAccountRetriever bool accountRetriever cosmosclient.AccountRetriever @@ -63,7 +63,7 @@ type constructOpts struct { type Opt func(cfg *constructOpts) // WithTendermintClient sets custom tendermint client -func WithTendermintClient(client cometbft_rpc_client.Client) Opt { +func WithTendermintClient(client cometbftrpc.Client) Opt { return func(c *constructOpts) { c.customTendermint = true c.tendermintClient = client @@ -108,7 +108,7 @@ func NewClient( encodingCfg := app.MakeEncodingConfig() - zetacoreClients, err := zetacore_rpc.NewGRPCClients(cosmosGRPC(chainIP), unsecureGRPC) + zetacoreClients, err := zetacorerpc.NewGRPCClients(cosmosGRPC(chainIP), unsecureGRPC) if err != nil { return nil, errors.Wrap(err, "grpc dial fail") } @@ -130,7 +130,7 @@ func NewClient( // create a cometbft client if one was not provided in the constructOptions if !constructOptions.customTendermint { cometBFTURL := "http://" + tendermintRPC(chainIP) - cometBFTClient, err := cometbft_http_client.New(cometBFTURL, "/websocket") + cometBFTClient, err := cometbfthttp.New(cometBFTURL, "/websocket") if err != nil { return nil, errors.Wrapf(err, "new cometbft client (%s)", cometBFTURL) } @@ -198,7 +198,7 @@ func buildCosmosClientContext( remote = fmt.Sprintf("tcp://%s", remote) } - wsClient, err := cometbft_http_client.New(remote, "/websocket") + wsClient, err := cometbfthttp.New(remote, "/websocket") if err != nil { return cosmosclient.Context{}, err } diff --git a/zetaclient/zetacore/client_subscriptions.go b/zetaclient/zetacore/client_subscriptions.go index 364821efab..cb4229b31b 100644 --- a/zetaclient/zetacore/client_subscriptions.go +++ b/zetaclient/zetacore/client_subscriptions.go @@ -3,17 +3,17 @@ package zetacore import ( "context" - cometbft_types "github.com/cometbft/cometbft/types" + cometbfttypes "github.com/cometbft/cometbft/types" ) // NewBlockSubscriber subscribes to cometbft new block events -func (c *Client) NewBlockSubscriber(ctx context.Context) (chan cometbft_types.EventDataNewBlock, error) { - rawBlockEventChan, err := c.cometBFTClient.Subscribe(ctx, "", cometbft_types.EventQueryNewBlock.String()) +func (c *Client) NewBlockSubscriber(ctx context.Context) (chan cometbfttypes.EventDataNewBlock, error) { + rawBlockEventChan, err := c.cometBFTClient.Subscribe(ctx, "", cometbfttypes.EventQueryNewBlock.String()) if err != nil { return nil, err } - blockEventChan := make(chan cometbft_types.EventDataNewBlock) + blockEventChan := make(chan cometbfttypes.EventDataNewBlock) go func() { for { @@ -21,7 +21,7 @@ func (c *Client) NewBlockSubscriber(ctx context.Context) (chan cometbft_types.Ev case <-ctx.Done(): return case event := <-rawBlockEventChan: - newBlockEvent, ok := event.Data.(cometbft_types.EventDataNewBlock) + newBlockEvent, ok := event.Data.(cometbfttypes.EventDataNewBlock) if !ok { c.logger.Error().Msgf("expecting new block event, got %T", event.Data) continue diff --git a/zetaclient/zetacore/client_test.go b/zetaclient/zetacore/client_test.go index a445dcaf3c..f1fe5a2526 100644 --- a/zetaclient/zetacore/client_test.go +++ b/zetaclient/zetacore/client_test.go @@ -21,9 +21,9 @@ import ( "go.nhat.io/grpcmock" "go.nhat.io/grpcmock/planner" - cometbft_rpc_client "github.com/cometbft/cometbft/rpc/client" + cometbftrpc "github.com/cometbft/cometbft/rpc/client" coretypes "github.com/cometbft/cometbft/rpc/core/types" - cometbft_types "github.com/cometbft/cometbft/types" + cometbfttypes "github.com/cometbft/cometbft/types" "github.com/zeta-chain/node/cmd/zetacored/config" crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" "github.com/zeta-chain/node/zetaclient/keys" @@ -113,7 +113,7 @@ func withDefaultObserverKeys() clientTestOpt { return withObserverKeys(keys.NewKeysWithKeybase(keyRing, address, testSigner, "")) } -func withTendermint(client cometbft_rpc_client.Client) clientTestOpt { +func withTendermint(client cometbftrpc.Client) clientTestOpt { return func(cfg *clientTestConfig) { cfg.opts = append(cfg.opts, WithTendermintClient(client)) } } @@ -255,9 +255,9 @@ func TestZetacore_SubscribeNewBlocks(t *testing.T) { height := int64(10) cometBFTClient.PublishToSubscribers(coretypes.ResultEvent{ - Data: cometbft_types.EventDataNewBlock{ - Block: &cometbft_types.Block{ - Header: cometbft_types.Header{ + Data: cometbfttypes.EventDataNewBlock{ + Block: &cometbfttypes.Block{ + Header: cometbfttypes.Header{ Height: height, }, },