Skip to content

Commit 757be9a

Browse files
OlshanskRawthiL
andcommitted
[Review] Reviewing #1570: Support for Support for SSE and NDJSON (#1805)
Reviewing `Streaming Support for SSE and NDJSON (used for LLMs)` in #1750. **Next steps**: - Outlined in this comment: #1570 (review) **Reproducing this locally (after running localnet)**: ```bash make send_relay_path_REST make pocketd_relayminer_relay_JSONRP ``` **Changes made**: - Updated the LocalNet toolchain to make it easier to test REST & LLM services - Added `make pocketd_relayminer_relay_JSONRPC` and revived `make send_relay_path_REST` - Reviewing streaming RelayMiner changes in [#1570](#1570) for code health & maintainbility - Moved logic from `sync.go` into `server.handleHttp` to follow a similar pattern as `server.handleHttpStream` --- The image below shows the result in LocalNet: <img width="3552" height="1527" alt="Screenshot 2025-09-30 at 8 10 22 PM" src="https://github.com/user-attachments/assets/bcf9b2dc-5560-4ab4-b06f-c1ebdfaaaa93" /> --- Co-authored-by: Ramiro Rodriguez Colmeiro <[email protected]>
1 parent 8d6053d commit 757be9a

File tree

11 files changed

+441
-213
lines changed

11 files changed

+441
-213
lines changed

Makefile

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,31 @@ PNF_ADDRESS = pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw
2727

2828
MODULES := application gateway pocket service session supplier proof tokenomics
2929

30+
# Patterns for classified help categories
31+
HELP_PATTERNS := \
32+
'^(help|help-params|help-unclassified|list):' \
33+
'^(ignite_build|ignite_pocketd_build|ignite_serve|ignite_serve_reset|ignite_release.*|cosmovisor_start_node):' \
34+
'^(go_develop|go_develop_and_test|proto_regen|go_mockgen|go_testgen_fixtures|go_testgen_accounts|go_imports):' \
35+
'^(test_all|test_unit|test_e2e|test_integration|test_timing|test_govupgrade|test_e2e_relay|go_test_verbose|go_test):' \
36+
'^(go_lint|go_vet|go_sec|gosec_version_fix|check_todos):' \
37+
'^(localnet_up|localnet_up_quick|localnet_down|localnet_regenesis|localnet_cancel_upgrade|localnet_show_upgrade_plan):' \
38+
'^testnet_.*:' \
39+
'^(acc_.*|pocketd_addr|pocketd_key):' \
40+
'^query_.*:' \
41+
'^app_.*:' \
42+
'^supplier_.*:' \
43+
'^gateway_.*:' \
44+
'^(relay_.*|claim_.*|ping_.*):' \
45+
'^session_.*:' \
46+
'^ibc_.*:' \
47+
'^release_.*:' \
48+
'^docker_test_.*:' \
49+
'^(go_docs|docusaurus_.*|gen_.*_docs):' \
50+
'^(install_.*|check_.*|grove_.*|act_.*|trigger_ci|docker_wipe):' \
51+
'^telegram_.*:' \
52+
'^claudesync_.*:' \
53+
'^params_.*:'
54+
3055
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
3156
COMMIT := $(shell git log -1 --format='%H')
3257

@@ -163,6 +188,7 @@ help: ## Prints all the targets in all the Makefiles
163188
@grep -h -E '^(claudesync_.*):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(CYAN)%-40s$(RESET) %s\n", $$1, $$2}'
164189
@echo ""
165190
@echo "$(BOLD)Use $(CYAN)make help-params$(RESET) to see parameter management commands"
191+
@echo "$(BOLD)Use $(CYAN)make help-unclassified$(RESET) to see uncategorized targets"
166192
@echo ""
167193

168194
.PHONY: help-params
@@ -207,6 +233,23 @@ help-params: ## Show parameter management commands
207233
@grep -h -E '^(params_consensus_.*):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(CYAN)%-40s$(RESET) %s\n", $$1, $$2}'
208234
@echo ""
209235

236+
.PHONY: help-unclassified
237+
help-unclassified: ## Show uncategorized targets
238+
@printf "\n"
239+
@printf "$(BOLD)$(CYAN)🧭 Unclassified Targets$(RESET)\n"
240+
@printf "\n"
241+
@grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) 2>/dev/null | sed 's/:.*//g' | sort -u > /tmp/poktroll_all_targets.txt
242+
@( \
243+
for pattern in $(HELP_PATTERNS); do \
244+
grep -h -E "$$pattern.*?## .*\$$" $(MAKEFILE_LIST) 2>/dev/null || true; \
245+
done \
246+
) | sed 's/:.*//g' | sort -u > /tmp/poktroll_classified_targets.txt
247+
@comm -23 /tmp/poktroll_all_targets.txt /tmp/poktroll_classified_targets.txt | while read target; do \
248+
grep -h -E "^$$target:.*?## .*\$$" $(MAKEFILE_LIST) 2>/dev/null | awk 'BEGIN {FS = ":.*?## "}; {printf "$(CYAN)%-40s$(RESET) %s\n", $$1, $$2}'; \
249+
done
250+
@rm -f /tmp/poktroll_all_targets.txt /tmp/poktroll_classified_targets.txt
251+
@printf "\n"
252+
210253
#######################
211254
### Proto Helpers ####
212255
#######################
@@ -387,14 +430,6 @@ grove_staging_eth_block_height: ## Sends a relay through the staging grove gatew
387430
-H 'Protocol: shannon-testnet' \
388431
--data $(JSON_RPC_DATA_ETH_BLOCK_HEIGHT)
389432

390-
#################
391-
### Catch all ###
392-
#################
393-
394-
%:
395-
@echo "Error: target '$@' not found."
396-
@exit 1
397-
398433
###############
399434
### Imports ###
400435
###############
@@ -423,3 +458,53 @@ include ./makefiles/ignite.mk
423458
include ./makefiles/release.mk
424459
include ./makefiles/tools.mk
425460
include ./makefiles/ibc.mk
461+
462+
###############################
463+
### Global Error Handling ###
464+
###############################
465+
466+
# Catch-all rule for undefined targets
467+
# This must be defined AFTER includes so color variables are available
468+
# and it acts as a fallback for any undefined target
469+
%:
470+
@echo ""
471+
@echo "$(RED)❌ Error: Unknown target '$(BOLD)$@$(RESET)$(RED)'$(RESET)"
472+
@echo ""
473+
@if echo "$@" | grep -q "^localnet"; then \
474+
echo "$(YELLOW)💡 Hint: LocalNet targets available:$(RESET)"; \
475+
echo " Run: $(CYAN)make help$(RESET) and check the '🌐 LocalNet Operations' section"; \
476+
elif echo "$@" | grep -q "^testnet"; then \
477+
echo "$(YELLOW)💡 Hint: TestNet targets available:$(RESET)"; \
478+
echo " Run: $(CYAN)make help$(RESET) and check the '🔗 TestNet Operations' section"; \
479+
elif echo "$@" | grep -q "^app"; then \
480+
echo "$(YELLOW)💡 Hint: Application targets available:$(RESET)"; \
481+
echo " Run: $(CYAN)make help$(RESET) and check the '🛡️ Applications' section"; \
482+
elif echo "$@" | grep -q "^supplier"; then \
483+
echo "$(YELLOW)💡 Hint: Supplier targets available:$(RESET)"; \
484+
echo " Run: $(CYAN)make help$(RESET) and check the '🏭 Suppliers' section"; \
485+
elif echo "$@" | grep -q "^gateway"; then \
486+
echo "$(YELLOW)💡 Hint: Gateway targets available:$(RESET)"; \
487+
echo " Run: $(CYAN)make help$(RESET) and check the '🌉 Gateways' section"; \
488+
elif echo "$@" | grep -q "^test"; then \
489+
echo "$(YELLOW)💡 Hint: Testing targets available:$(RESET)"; \
490+
echo " Run: $(CYAN)make help$(RESET) and check the '🧪 Testing' section"; \
491+
elif echo "$@" | grep -q "^params"; then \
492+
echo "$(YELLOW)💡 Hint: Parameter management targets available:$(RESET)"; \
493+
echo " Run: $(CYAN)make help-params$(RESET) to see all parameter commands"; \
494+
elif echo "$@" | grep -q "^ignite"; then \
495+
echo "$(YELLOW)💡 Hint: Ignite/build targets available:$(RESET)"; \
496+
echo " Run: $(CYAN)make help$(RESET) and check the '🔨 Build & Run' section"; \
497+
elif echo "$@" | grep -q "^go_"; then \
498+
echo "$(YELLOW)💡 Hint: Go development targets available:$(RESET)"; \
499+
echo " Run: $(CYAN)make help$(RESET) and check the '⚙️ Development' or '✅ Linting & Quality' sections"; \
500+
elif echo "$@" | grep -q "^docker"; then \
501+
echo "$(YELLOW)💡 Hint: Docker targets available:$(RESET)"; \
502+
echo " Run: $(CYAN)make help$(RESET) and check the '🐳 Docker Testing' section"; \
503+
else \
504+
echo "$(YELLOW)💡 Available help commands:$(RESET)"; \
505+
echo " $(CYAN)make help$(RESET) - See all available targets"; \
506+
echo " $(CYAN)make help-params$(RESET) - See parameter management commands"; \
507+
echo " $(CYAN)make help-unclassified$(RESET) - See uncategorized targets"; \
508+
fi
509+
@echo ""
510+
@exit 1

config.yml

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -263,44 +263,41 @@ genesis:
263263
service_configs:
264264
- service_id: anvil
265265
stake:
266-
# NB: This value should be exactly 1upokt smaller than the value in
267-
# `application1_stake_config.yaml` so that the stake command causes a state change.
266+
# DEV_NOTE: Value should be exactly 1upokt smaller than `application1_stake_config.yaml` so that the stake command causes a state change.
268267
amount: "100000068" # ~100 POKT
269268
denom: upokt
270-
- address: pokt184zvylazwu4queyzpl0gyz9yf5yxm2kdhh9hpm
269+
- address: pokt1lqyu4v88vp8tzc86eaqr4lq8rwhssyn6rfwzex
271270
delegatee_gateway_addresses:
272271
[pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4]
273272
service_configs:
274-
- service_id: rest
273+
- service_id: anvilws
275274
stake:
276-
# NB: This value should be exactly 1upokt smaller than the value in
277-
# `application1_stake_config.yaml` so that the stake command causes a state change.
278275
amount: "100000068" # ~100 POKT
279276
denom: upokt
280-
- address: pokt1lqyu4v88vp8tzc86eaqr4lq8rwhssyn6rfwzex
277+
- address: pokt184zvylazwu4queyzpl0gyz9yf5yxm2kdhh9hpm
281278
delegatee_gateway_addresses:
282279
[pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4]
283280
service_configs:
284-
- service_id: anvilws
281+
- service_id: rest
285282
stake:
283+
# DEV_NOTE: Value should be exactly 1upokt smaller than `application1_stake_config.yaml` so that the stake command causes a state change.
286284
amount: "100000068" # ~100 POKT
287285
denom: upokt
288286
- address: pokt1pn64d94e6u5g8cllsnhgrl6t96ysnjw59j5gst
289287
delegatee_gateway_addresses:
290288
[pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4]
291289
service_configs:
292-
- service_id: static
290+
- service_id: ollama
293291
stake:
294-
amount: "10000000000000"
292+
# DEV_NOTE: Value should be exactly 1upokt smaller than `application1_stake_config.yaml` so that the stake command causes a state change.
293+
amount: "100000068" # ~100 POKT
295294
denom: upokt
296295
# For ref, see proto/poktroll/supplier/params.proto
297296
supplier:
298297
params:
299-
# TODO_MAINNET_MIGRATION(@olshansk): Determine realistic amount for minimum gateway stake amount.
300298
min_stake:
301299
amount: "1000000" # 1 POKT
302300
denom: upokt
303-
# TODO_MAINNET_MIGRATION(@olshansk): Determine realistic amount for supplier staking fee.
304301
staking_fee:
305302
amount: "1000000" # 1 POKT
306303
denom: upokt
@@ -324,6 +321,22 @@ genesis:
324321
rev_share:
325322
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
326323
rev_share_percentage: 100
324+
- service_id: rest
325+
endpoints:
326+
- configs: []
327+
rpc_type: REST
328+
url: http://relayminer1:8545
329+
rev_share:
330+
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
331+
rev_share_percentage: 100
332+
- service_id: ollama
333+
endpoints:
334+
- configs: []
335+
rpc_type: REST
336+
url: http://relayminer1:8545
337+
rev_share:
338+
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
339+
rev_share_percentage: 100
327340
- service_id: static
328341
endpoints:
329342
- configs: []
@@ -333,22 +346,20 @@ genesis:
333346
- address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
334347
rev_share_percentage: 100
335348
stake:
336-
# NB: This value should be exactly 1upokt smaller than the value in
349+
# DEV_NOTE: Value should be exactly 1upokt smaller than the value in
337350
# `supplier1_stake_config.yaml` so that the stake command causes a state change.
338351
amount: "1000068"
339352
denom: upokt
340353
# For ref, see proto/poktroll/gateway/params.proto
341354
gateway:
342355
params:
343-
# TODO_MAINNET_MIGRATION(@olshansk): Determine realistic amount for minimum gateway stake amount.
344356
min_stake:
345357
amount: "1000000" # 1 POKT
346358
denom: upokt
347359
gatewayList:
348360
- address: pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4
349361
stake:
350-
# NB: This value should be exactly 1upokt smaller than the value in
351-
# `gateway1_stake_config.yaml` so that the stake command causes a state change.
362+
# DEV_NOTE: Value should be exactly 1upokt smaller than the value in `gateway1_stake_config.yaml` so that the stake command causes a state change.
352363
amount: "1000068"
353364
denom: upokt
354365
# For ref, see proto/poktroll/service/params.proto
@@ -367,14 +378,14 @@ genesis:
367378
name: "anvilws"
368379
compute_units_per_relay: 100
369380
owner_address: pokt1cwnu460557x0z78jv3hhc7356hhkrgc86c87q5
370-
- id: ollama
371-
name: "ollama"
372-
compute_units_per_relay: 100
373-
owner_address: pokt1mx0klkkrj6v3dw8gs4nzlq0cq8lsktmx35t03e
374381
- id: rest
375382
name: "rest"
376383
compute_units_per_relay: 100
377384
owner_address: pokt1mx0klkkrj6v3dw8gs4nzlq0cq8lsktmx35t03e
385+
- id: ollama
386+
name: "ollama"
387+
compute_units_per_relay: 100
388+
owner_address: pokt1pn64d94e6u5g8cllsnhgrl6t96ysnjw59j5gst
378389
- id: static
379390
name: "static"
380391
compute_units_per_relay: 1

localnet/kubernetes/config-path-1.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ shannon_config:
1313
gateway_private_key_hex: cf09805c952fa999e9a63a9f434147b0a5abfd10f268879694c6b5a70e1ae177
1414
owned_apps_private_keys_hex:
1515
- 2d00ef074d9b51e46886dc9a1df11e7b986611d0f336bdcf1f0adce3e037ec0a # anvil - app1 - pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4
16+
- 7cbbaa043b9b63baa7d6bb087483b0a6a9f82596c19dce4c5028eb43e5b63674 # anvilws - app3 - pokt1lqyu4v88vp8tzc86eaqr4lq8rwhssyn6rfwzex
17+
- 7e7571a8c61b0887ff8a9017bb4ad83c016b193234f9dc8b6a8ce10c7c483600 # rest - app2 - pokt184zvylazwu4queyzpl0gyz9yf5yxm2kdhh9hpm
18+
- 84e4f2257f24d9e1517d414b834bbbfa317e0d53fef21c1528a07a5fa8c70d57 # ollama - app4 - pokt1pn64d94e6u5g8cllsnhgrl6t96ysnjw59j5gst

localnet/kubernetes/values-pocketd-faucet.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ nameOverride: ""
1515
fullnameOverride: ""
1616

1717
flags:
18-
log_level: debug
18+
log-level: debug
1919
network: local
2020
node: tcp://validator-pocket-validator:26657
2121
keyring_backend: test
@@ -40,10 +40,12 @@ serviceAccount:
4040

4141
podAnnotations: {}
4242

43-
podSecurityContext: {}
43+
podSecurityContext:
44+
{}
4445
# fsGroup: 2000
4546

46-
securityContext: {}
47+
securityContext:
48+
{}
4749
# capabilities:
4850
# drop:
4951
# - ALL
@@ -58,7 +60,8 @@ service:
5860
ingress:
5961
enabled: false
6062
className: ""
61-
annotations: {}
63+
annotations:
64+
{}
6265
# kubernetes.io/ingress.class: nginx
6366
# kubernetes.io/tls-acme: "true"
6467
hosts:
@@ -71,7 +74,8 @@ ingress:
7174
# hosts:
7275
# - chart-example.local
7376

74-
resources: {}
77+
resources:
78+
{}
7579
# We usually recommend not to specify default resources and to leave this as a conscious
7680
# choice for the user. This also increases chances charts run on environments with little
7781
# resources, such as Minikube. If you do want to specify resources, uncomment the following

makefiles/relay.mk

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
########################################
2+
### pocketd relayminer relay Helpers ###
3+
########################################
4+
5+
.PHONY: pocketd_relayminer_relay_JSONRPC
6+
pocketd_relayminer_relay_JSONRPC: test_e2e_env ## Send a JSONRPC relay through relayminer to a local anvil (test ETH) node
7+
pocketd relayminer relay \
8+
--app=pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 \
9+
--payload='{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \
10+
--home=./localnet/pocketd \
11+
--network=local \
12+
--supplier-public-endpoint-override=http://localhost:8085
13+
114
#####################
2-
### Relay Helpers ###
15+
### Curl Helpers ###
316
#####################
417

518
# TODO_MAINNET(@olshansk): Add all the permissionless/delegated/centralized variations once
@@ -23,18 +36,13 @@ send_relay_path_WEBSOCKET: check_path_up test_e2e_env ## Send a WEBSOCKET relay
2336
-H "App-Address: pokt1lqyu4v88vp8tzc86eaqr4lq8rwhssyn6rfwzex" \
2437
-H "Target-Service-Id: anvilws"
2538

26-
27-
# TODO_POST_MAINNET(@red-0ne): Re-enable this once PATH Gateway supports REST.
28-
# See https://github.com/buildwithgrove/path/issues/87
2939
.PHONY: send_relay_path_REST
30-
send_relay_path_REST: acc_initialize_pubkeys ## Send a REST relay through PATH to a local ollama (LLM) service
31-
@echo "Not implemented yet. Check if PATH supports REST relays yet: https://github.com/buildwithgrove/path/issues/87"
32-
# curl http://localhost:3070/v1/api/chat \
33-
# -H "Authorization: test_api_key" \
34-
# -H "Target-Service-Id: ollama" \
35-
# -H "App-Address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4" \
36-
# -d '{"model": "qwen:0.5b", "stream": false, "messages": [{"role": "user", "content":"count from 1 to 10"}]}'
37-
40+
send_relay_path_REST: check_path_up test_e2e_env ## Send a REST relay through PATH to a local ollama (LLM) service
41+
curl http://localhost:3069/v1/api/chat \
42+
-H "Authorization: test_api_key" \
43+
-H "Target-Service-Id: ollama" \
44+
-H "App-Address: pokt1pn64d94e6u5g8cllsnhgrl6t96ysnjw59j5gst" \
45+
-d '{"model": "qwen:0.5b", "stream": false, "messages": [{"role": "user", "content":"count from 1 to 10"}]}'
3846

3947
##################################
4048
#### Relay Util Test Requests ####

pkg/network/http/http_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func NewDefaultHTTPClientWithDebugMetrics() *HTTPClientWithDebugMetrics {
103103

104104
// Timeout settings optimized for quick failure detection
105105
TLSHandshakeTimeout: 5 * time.Second, // Fast TLS timeout since handshakes typically complete in ~100ms
106-
// ResponseHeaderTimeout: 5 * time.Second, // Header timeout to allow for server processing time. TODO: This affect custom, long, timeouts. This needs to be modified when larger timeouts are needed.
107106

108107
// Performance optimizations
109108
DisableKeepAlives: false, // Enable connection reuse to reduce connection overhead

0 commit comments

Comments
 (0)