From 4b0302823491976244ca9b017f53190a64d229a7 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Tue, 17 Oct 2023 15:00:36 +0800 Subject: [PATCH] chore: pkg import only once --- cosmos/lcd.go | 5 ++--- e2e/complex_service_test.go | 5 ++--- e2e/runner_test.go | 7 +++---- x/process/internal/keeper/keeper.go | 5 ++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/cosmos/lcd.go b/cosmos/lcd.go index 5363a9ac3..caad19213 100644 --- a/cosmos/lcd.go +++ b/cosmos/lcd.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" - sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" @@ -30,7 +29,7 @@ type LCD struct { chainID string accName string accPassword string - gasPrices sdktypes.DecCoins + gasPrices sdk.DecCoins // local state acc *auth.BaseAccount @@ -40,7 +39,7 @@ type LCD struct { // NewLCD initializes a cosmos LCD client. func NewLCD(endpoint string, cdc *codec.Codec, kb keys.Keybase, chainID, accName, accPassword, gasPrices string) (*LCD, error) { - gasPricesDecoded, err := sdktypes.ParseDecCoins(gasPrices) + gasPricesDecoded, err := sdk.ParseDecCoins(gasPrices) if err != nil { return nil, err } diff --git a/e2e/complex_service_test.go b/e2e/complex_service_test.go index caa9ef8ed..f914777fc 100644 --- a/e2e/complex_service_test.go +++ b/e2e/complex_service_test.go @@ -7,7 +7,6 @@ import ( "github.com/mesg-foundation/engine/ext/xos" "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/protobuf/acknowledgement" - "github.com/mesg-foundation/engine/server/grpc/orchestrator" grpcorchestrator "github.com/mesg-foundation/engine/server/grpc/orchestrator" "github.com/mesg-foundation/engine/service" runnerrest "github.com/mesg-foundation/engine/x/runner/client/rest" @@ -70,7 +69,7 @@ func testComplexService(t *testing.T) { require.NoError(t, cont.Start(testServiceComplexStruct, testInstanceComplexHash, testRunnerComplexHash, testInstanceComplexEnvHash, testInstanceComplexEnv, registerPayloadSignature)) }) - req := orchestrator.EventStreamRequest{} + req := grpcorchestrator.EventStreamRequest{} stream, err := client.EventClient.Stream(context.Background(), &req, grpc.PerRPCCredentials(&signCred{req})) require.NoError(t, err) acknowledgement.WaitForStreamToBeReady(stream) @@ -96,7 +95,7 @@ func testComplexService(t *testing.T) { }) t.Run("delete", func(t *testing.T) { - req := orchestrator.RunnerDeleteRequest{ + req := grpcorchestrator.RunnerDeleteRequest{ RunnerHash: testRunnerComplexHash, } _, err := client.RunnerClient.Delete(context.Background(), &req, grpc.PerRPCCredentials(&signCred{req})) diff --git a/e2e/runner_test.go b/e2e/runner_test.go index f435d6daa..745d38a78 100644 --- a/e2e/runner_test.go +++ b/e2e/runner_test.go @@ -9,7 +9,6 @@ import ( "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/protobuf/acknowledgement" "github.com/mesg-foundation/engine/runner" - "github.com/mesg-foundation/engine/server/grpc/orchestrator" grpcorchestrator "github.com/mesg-foundation/engine/server/grpc/orchestrator" runnerrest "github.com/mesg-foundation/engine/x/runner/client/rest" "github.com/stretchr/testify/require" @@ -56,8 +55,8 @@ func testRunner(t *testing.T) { }) t.Run("wait for service to be ready", func(t *testing.T) { - req := orchestrator.EventStreamRequest{ - Filter: &orchestrator.EventStreamRequest_Filter{ + req := grpcorchestrator.EventStreamRequest{ + Filter: &grpcorchestrator.EventStreamRequest_Filter{ Key: "service_ready", }, } @@ -92,7 +91,7 @@ func testRunner(t *testing.T) { } func testDeleteRunner(t *testing.T) { - req := orchestrator.RunnerDeleteRequest{ + req := grpcorchestrator.RunnerDeleteRequest{ RunnerHash: testRunnerHash, } _, err := client.RunnerClient.Delete(context.Background(), &req, grpc.PerRPCCredentials(&signCred{req})) diff --git a/x/process/internal/keeper/keeper.go b/x/process/internal/keeper/keeper.go index 16dec41bf..28c949cbe 100644 --- a/x/process/internal/keeper/keeper.go +++ b/x/process/internal/keeper/keeper.go @@ -8,7 +8,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/hash" ownershippb "github.com/mesg-foundation/engine/ownership" - "github.com/mesg-foundation/engine/process" processpb "github.com/mesg-foundation/engine/process" "github.com/mesg-foundation/engine/x/process/internal/types" "github.com/tendermint/tendermint/libs/log" @@ -42,7 +41,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreate) (*processpb.Process, error) { store := ctx.KVStore(k.storeKey) - p, err := process.New(msg.Name, msg.Nodes, msg.Edges, msg.Owner) + p, err := processpb.New(msg.Name, msg.Nodes, msg.Edges, msg.Owner) if err != nil { return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error()) } @@ -154,7 +153,7 @@ func (k Keeper) List(ctx sdk.Context) ([]*processpb.Process, error) { } // Import imports a list of processes into the store. -func (k *Keeper) Import(ctx sdk.Context, processes []*process.Process) error { +func (k *Keeper) Import(ctx sdk.Context, processes []*processpb.Process) error { store := ctx.KVStore(k.storeKey) for _, proc := range processes { value, err := k.cdc.MarshalBinaryLengthPrefixed(proc)