Skip to content

Commit

Permalink
Merge branch 'main' into e2e_quick_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Dec 13, 2023
2 parents 9228887 + d621631 commit 1a84277
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Select one or more:

- [ ] **Run all unit tests**: `make go_develop_and_test`
- [ ] **Run E2E tests locally**: `make test_e2e`
- [ ] **Run E2E tests on DevNet`: Add the `devnet-test-e2e` label to the PR. This is VERY expensive, o only do it after all the reviews are complete.
- [ ] **Run E2E tests on DevNet**: Add the `devnet-test-e2e` label to the PR. This is VERY expensive, o only do it after all the reviews are complete.

## Sanity Checklist

Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ k8s_resource(
"sequencer",
labels=["blockchains"],
resource_deps=["celestia-rollkit"],
port_forwards=["36657", "40004"],
port_forwards=["36657", "36658", "40004"],
)
k8s_resource(
"relayminers",
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/query/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package query
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

Expand All @@ -14,5 +15,6 @@ var queryCodec *codec.ProtoCodec
func init() {
reg := codectypes.NewInterfaceRegistry()
accounttypes.RegisterInterfaces(reg)
cryptocodec.RegisterInterfaces(reg)
queryCodec = codec.NewProtoCodec(reg)
}
9 changes: 4 additions & 5 deletions pkg/client/query/supplierquerier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"context"

"cosmossdk.io/depinject"
cosmosclient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/gogoproto/grpc"

"github.com/pokt-network/poktroll/pkg/client"
"github.com/pokt-network/poktroll/pkg/client/query/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
suppliertypes "github.com/pokt-network/poktroll/x/supplier/types"
)
Expand All @@ -16,7 +15,7 @@ import (
// querying of on-chain supplier information through a single exposed method
// which returns an sharedtypes.Supplier struct
type supplierQuerier struct {
clientCtx types.Context
clientConn grpc.ClientConn
supplierQuerier suppliertypes.QueryClient
}

Expand All @@ -30,12 +29,12 @@ func NewSupplierQuerier(deps depinject.Config) (client.SupplierQueryClient, erro

if err := depinject.Inject(
deps,
&supq.clientCtx,
&supq.clientConn,
); err != nil {
return nil, err
}

supq.supplierQuerier = suppliertypes.NewQueryClient(cosmosclient.Context(supq.clientCtx))
supq.supplierQuerier = suppliertypes.NewQueryClient(supq.clientConn)

return supq, nil
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/deps/config/suppliers.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,8 @@ func NewSupplyPOKTRollSDKFn(
}

config := &sdk.POKTRollSDKConfig{
PrivateKey: privateKey,
PocketNodeUrl: queryNodeURL,
Deps: deps,
PrivateKey: privateKey,
Deps: deps,
}

poktrollSDK, err := sdk.NewPOKTRollSDK(ctx, config)
Expand Down
14 changes: 11 additions & 3 deletions pkg/sdk/deps_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sdk
import (
"context"
"fmt"
"net/url"

"cosmossdk.io/depinject"
grpctypes "github.com/cosmos/gogoproto/grpc"
Expand All @@ -23,7 +24,7 @@ func (sdk *poktrollSDK) buildDeps(
ctx context.Context,
config *POKTRollSDKConfig,
) (depinject.Config, error) {
pocketNodeWebsocketURL := fmt.Sprintf("ws://%s/websocket", config.PocketNodeUrl.Host)
pocketNodeWebsocketURL := queryNodeToWebsocketURL(config.QueryNodeUrl)

// Have a new depinject config
deps := depinject.Configs()
Expand All @@ -43,10 +44,10 @@ func (sdk *poktrollSDK) buildDeps(
deps = depinject.Configs(deps, depinject.Supply(blockClient))

// Create and supply the grpc client used by the queriers
// TODO_TECHDEBT: Configure the grpc client options from the config
// TODO_TECHDEBT: Configure the grpc client options from the config.
var grpcClient grpctypes.ClientConn
grpcClient, err = grpc.Dial(
config.PocketNodeUrl.Host,
config.QueryNodeGRPCUrl.Host,
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
Expand Down Expand Up @@ -84,3 +85,10 @@ func (sdk *poktrollSDK) buildDeps(

return deps, nil
}

// hostToWebsocketURL converts the provided host into a websocket URL that can
// be used to subscribe to onchain events and query the chain via a client
// context or send transactions via a tx client context.
func queryNodeToWebsocketURL(queryNode *url.URL) string {
return fmt.Sprintf("ws://%s/websocket", queryNode.Host)
}
7 changes: 4 additions & 3 deletions pkg/sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ var _ POKTRollSDK = (*poktrollSDK)(nil)
// Deps is an optional field that can be used to provide the needed dependencies
// for the SDK. If it is not provided, the SDK will build the dependencies itself.
type POKTRollSDKConfig struct {
PocketNodeUrl *url.URL
PrivateKey cryptotypes.PrivKey
Deps depinject.Config
QueryNodeGRPCUrl *url.URL
QueryNodeUrl *url.URL
PrivateKey cryptotypes.PrivKey
Deps depinject.Config
}

// poktrollSDK is the implementation of the POKTRollSDK.
Expand Down

0 comments on commit 1a84277

Please sign in to comment.