Skip to content

Commit

Permalink
Debugging checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Nov 11, 2023
1 parent 34e52f7 commit ee397d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ genesis:
- endpoints:
- configs: []
rpc_type: JSON_RPC
url: http://anvil:8547
url: http://localhost:8545
service:
id: anvil
name: ""
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData(appName
if err != nil {
s.Fatalf("error sending relay request from app %s to supplier %s for service %s: %v", appName, supplierName, serviceId, err)
}
fmt.Println("OLSH Res", res)
fmt.Println("OLSH Res", res.Stdout)
}

func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName string, supplierName string) {
Expand Down
6 changes: 6 additions & 0 deletions e2e/tests/relay.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Feature: Relay Namespace

Scenario: App can send relay to Supplier
Given the user has the pocketd binary installed

# TEMP: DELETE
When the user sends "1000" uPOKT from account "app2" to account "app1"
When the user sends "1000" uPOKT from account "app2" to account "supplier1"
# TEMP: DELETE

And the application "app1" is staked for service "anvil"
And the supplier "supplier1" is staked for service "anvil"
And the session for application "app1" and service "anvil" contains the supplier "supplier1"
Expand Down
11 changes: 10 additions & 1 deletion pkg/appgateserver/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package appgateserver
import (
"bytes"
"context"
"fmt"
"io"
"log"
"net/http"
Expand Down Expand Up @@ -78,6 +79,7 @@ func (app *appGateServer) handleJSONRPCRelay(
return err
}
relayRequestReader := io.NopCloser(bytes.NewReader(relayRequestBz))
// relayRequestReader := io.NopCloser(bytes.NewReader(payloadBz))

// Create the HTTP request to send the request to the relayer.
relayHTTPRequest := &http.Request{
Expand All @@ -87,8 +89,15 @@ func (app *appGateServer) handleJSONRPCRelay(
Body: relayRequestReader,
}

// TODO: relayminer is currently named relayers
// application (localhost)
// -> appgate (localhost:42069); configured by the gateway/application **off-chain**
// -> relayminer (supplierURL); advertised **on-chain**
// -> anvil (localhost:8547); configured **behind-the-scenes**; chains.json (v0); currently hard-coded

// Perform the HTTP request to the relayer.
log.Printf("DEBUG: Sending signed relay request to %s", supplierUrl)
log.Printf("DEBUG: Sending raw payload to signed relay request to %s", supplierUrl)
fmt.Printf("\n~~~~ OLSH %+v \n~~~~\n", relayHTTPRequest)
relayHTTPResponse, err := http.DefaultClient.Do(relayHTTPRequest)
if err != nil {
return err
Expand Down

0 comments on commit ee397d3

Please sign in to comment.