-
Notifications
You must be signed in to change notification settings - Fork 2
Added TLSN proxy service and make Telegram backend host configurable #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SergeyG-Solicy
wants to merge
2
commits into
testnet
Choose a base branch
from
feature/tlsn-proxy-configurable-backends
base: testnet
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # TLSNotary Stack — Environment Variables | ||
| # Copy this file to .env and adjust values as needed. | ||
| # | ||
| # Usage: docker compose --env-file .env up -d | ||
|
|
||
| # Port the TLSNotary notary server is exposed on. | ||
| TLSNOTARY_PORT=7047 | ||
|
|
||
| # Port the wstcp WebSocket-to-TCP proxy is exposed on. | ||
| # Must match TLSNOTARY_PROXY_PORT in the node's .env and | ||
| # PROXY_URL (ws://<host>:<port>) in the incentives backend .env. | ||
| PROXY_PORT=55688 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # wstcp — WebSocket-to-TCP proxy for TLSNotary | ||
| # | ||
| # Forwards browser WebSocket connections to the notary's TCP port so that | ||
| # tlsn-js (which cannot open raw TCP sockets) can reach the notary. | ||
| # | ||
| # Build: docker build -f Dockerfile.proxy -t tlsn-proxy . | ||
| # Run: docker run -p 55688:55688 tlsn-proxy notary:7047 | ||
|
|
||
| # ── Builder ────────────────────────────────────────────────────────────────── | ||
| FROM rust:alpine AS builder | ||
|
|
||
| RUN apk add --no-cache musl-dev | ||
|
|
||
| RUN cargo install wstcp | ||
|
|
||
| # ── Runtime ────────────────────────────────────────────────────────────────── | ||
| FROM alpine:3.20 | ||
|
|
||
| RUN apk add --no-cache ca-certificates \ | ||
| && addgroup -S wstcp \ | ||
| && adduser -S -G wstcp wstcp | ||
|
|
||
| COPY --from=builder /usr/local/cargo/bin/wstcp /usr/local/bin/wstcp | ||
|
|
||
| USER wstcp | ||
|
|
||
| EXPOSE 55688 | ||
|
|
||
| # First arg after the image is the TCP target (e.g. notary:7047). | ||
| # Override via `command:` in docker-compose. | ||
| ENTRYPOINT ["wstcp", "--bind-addr", "0.0.0.0:55688"] | ||
| CMD ["notary:7047"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| # TLSNotary Docker Notary Server | ||
| # Uses the official tlsn-js compatible notary server image | ||
| # TLSNotary Stack | ||
| # | ||
| # This provides the full HTTP API + WebSocket interface that tlsn-js expects: | ||
| # - GET /info - Get notary public key | ||
| # - POST /session - Create session, returns sessionId | ||
| # - WS /notarize?sessionId=xxx - WebSocket MPC-TLS session | ||
| # Services: | ||
| # notary — TLSNotary notary server (HTTP API + WebSocket MPC-TLS sessions) | ||
| # proxy — wstcp WebSocket-to-TCP proxy (lets browsers reach the notary) | ||
| # | ||
| # Environment variables: | ||
| # - TLSNOTARY_PORT: Port to expose (default: 7047) | ||
| # Usage: | ||
| # docker compose up -d | ||
| # | ||
| # Environment variables (copy .env.example → .env to override defaults): | ||
| # TLSNOTARY_PORT Port the notary listens on (default: 7047) | ||
| # PROXY_PORT Port the wstcp proxy listens on (default: 55688) | ||
|
|
||
| services: | ||
| notary: | ||
|
|
@@ -19,16 +21,26 @@ services: | |
| ports: | ||
| - "${TLSNOTARY_PORT:-7047}:7047" | ||
| restart: unless-stopped | ||
| healthcheck: | ||
| test: [CMD, curl, -f, http://localhost:7047/info] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 3 | ||
| start_period: 10s | ||
| # Note: The Docker notary-server uses its own internal signing key | ||
| # Attestations are cryptographically bound to this notary's public key | ||
| # which can be retrieved via GET /info endpoint | ||
| networks: | ||
| - tlsn | ||
|
|
||
| proxy: | ||
| container_name: tlsn-proxy-${PROXY_PORT:-55688} | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.proxy | ||
| ports: | ||
| - "${PROXY_PORT:-55688}:55688" | ||
|
Comment on lines
+27
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Proxy port env mismatch tlsnotary/docker-compose.yml exposes the proxy on PROXY_PORT, but the node’s tlsnotary.getInfo endpoint advertises the proxy using TLSNOTARY_PROXY_PORT; if they diverge, SDK clients will receive an incorrect proxyUrl and fail to connect. This is easy to misconfigure because the two variables are named differently and live in different .env files. Agent Prompt
|
||
| # Forward WebSocket connections to the notary's internal TCP port. | ||
| # Uses the Docker service name so the proxy can reach the notary | ||
| # without exposing any extra ports on the host. | ||
| command: ["notary:7047"] | ||
| restart: unless-stopped | ||
| depends_on: | ||
| - notary | ||
| networks: | ||
| - tlsn | ||
|
|
||
| networks: | ||
| default: | ||
| tlsn: | ||
| driver: bridge | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.