Skip to content

Commit

Permalink
wip: debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Nov 11, 2023
1 parent fa8c2eb commit 0638e8d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,24 @@ supplier_stake: ## Stake tokens for the supplier specified (must specify the APP

.PHONY: supplier1_stake
supplier1_stake: ## Stake supplier1
SUPPLIER=supplier1 SERVICES="anvil;http://anvil:8547,svc1;http://localhost:8081" make supplier_stake
# TODO_IMPROVE: consolidate supplier1 staking; why/where is supplier1
# being staked other than this make target?
# Supplier1 seems to be staked at some point during localnet startup.
# TODO_TECHDEBT: once `relayminer` service is added to tilt, this hostname should point to that service.
# I.e.: replace `localhost` with `relayminer` (or whatever the service's hostname is).
SUPPLIER=supplier1 SERVICES="anvil;http://localhost:8548,svc1;http://localhost:8081" make supplier_stake

.PHONY: supplier2_stake
supplier2_stake: ## Stake supplier2
SUPPLIER=supplier2 SERVICES="anvil;http://anvil:8547,svc2;http://localhost:8082" make supplier_stake
# TODO_TECHDEBT: once `relayminer` service is added to tilt, this hostname should point to that service.
# I.e.: replace `localhost` with `relayminer` (or whatever the service's hostname is).
SUPPLIER=supplier2 SERVICES="anvil;http://localhost:8548,svc2;http://localhost:8082" make supplier_stake

.PHONY: supplier3_stake
supplier3_stake: ## Stake supplier3
SUPPLIER=supplier3 SERVICES="anvil;http://anvil:8547,svc3;http://localhost:8083" make supplier_stake
# TODO_TECHDEBT: once `relayminer` service is added to tilt, this hostname should point to that service.
# I.e.: replace `localhost` with `relayminer` (or whatever the service's hostname is).
SUPPLIER=supplier3 SERVICES="anvil;http://localhost:8548,svc3;http://localhost:8083" make supplier_stake

.PHONY: supplier_unstake
supplier_unstake: ## Unstake an supplier (must specify the SUPPLIER env var)
Expand Down
14 changes: 11 additions & 3 deletions pkg/relayer/proxy/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ func NewJSONRPCServer(
servedRelaysProducer chan<- *types.Relay,
proxy relayer.RelayerProxy,
) relayer.RelayServer {
// TODO_IN_THIS_COMMIT: refactor / rename / simplify
url, err := url.Parse(supplierEndpoint.Url)
if err != nil {
panic(err)
}
supplierEndpointHost := url.Host

return &jsonRPCServer{
service: service,
serverEndpoint: supplierEndpoint,
server: &http.Server{Addr: supplierEndpoint.Url},
service: service,
serverEndpoint: supplierEndpoint,
//server: &http.Server{Addr: supplierEndpoint.Url},
server: &http.Server{Addr: supplierEndpointHost},
relayerProxy: proxy,
proxiedServiceEndpoint: proxiedServiceEndpoint,
servedRelaysProducer: servedRelaysProducer,
Expand Down
8 changes: 7 additions & 1 deletion pkg/relayer/proxy/server_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package proxy

import (
"context"
"log"

"github.com/pokt-network/poktroll/pkg/relayer"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
Expand Down Expand Up @@ -38,11 +39,16 @@ func (rp *relayerProxy) BuildProvidedServices(ctx context.Context) error {
for _, serviceConfig := range services {
service := serviceConfig.Service
proxiedServicesEndpoints := rp.proxiedServicesEndpoints[service.Id]
serviceEndpoints := make([]relayer.RelayServer, len(serviceConfig.Endpoints))
var serviceEndpoints []relayer.RelayServer

for _, endpoint := range serviceConfig.Endpoints {
var server relayer.RelayServer

log.Printf(
"INFO: starting relay server for service %s at endpoint %s",
service.Id, endpoint.Url,
)

// Switch to the RPC type to create the appropriate RelayServer
switch endpoint.RpcType {
case sharedtypes.RPCType_JSON_RPC:
Expand Down

0 comments on commit 0638e8d

Please sign in to comment.