Skip to content

fix(staking): separate RPC from advertised validator URL - #996

Open
mj-deving wants to merge 1 commit into
kynesyslabs:stabilisationfrom
mj-deving:codex/validator-stake-url
Open

mj-deving wants to merge 1 commit into
kynesyslabs:stabilisationfrom
mj-deving:codex/validator-stake-url

Conversation

@mj-deving

Copy link
Copy Markdown

Summary

  • keep the transaction RPC separate from the validator endpoint advertised on-chain
  • require an explicit connection URL or EXPOSED_URL instead of implicitly advertising the RPC peer
  • allow pre-start staking with an explicit RPC and no generated peer-list file
  • run validator and public-key helpers through native Bun
  • update staking and fixnet command documentation

Problem

The validator stake helper currently assigns its RPC URL to connectionUrl. On a fresh stopped node this either depends on a peer-list file that does not exist yet or registers the coordinator RPC as the new validator endpoint.

Verification

  • bun test scripts/validator-options.test.ts: 6 passed
  • ESLint passed for the changed TypeScript files
  • targeted TypeScript compilation passed
  • native Bun validator entry point loaded and rejected a missing connection URL before connecting
  • git diff --check passed

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 7fac8db8-8685-4c24-a551-cb66fdbd8587


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR separates the RPC used to submit validator transactions from the validator endpoint advertised on-chain.

  • Adds explicit --connection-url/EXPOSED_URL resolution and validation for staking.
  • Allows an explicit RPC to bypass peer-list loading before node startup.
  • Moves validator and public-key helpers to the native Bun entry point.
  • Updates staking and fixnet operator guidance.
  • The new URL validation is currently narrower than the node's path-based reverse-proxy URL support.

Confidence Score: 4/5

The PR should not merge until staking accepts valid path-based validator endpoints used behind reverse proxies.

The RPC separation works as intended, but the new root-only URL validation prevents operators with path-based public endpoints from creating stake transactions using their existing advertised node URL.

Files Needing Attention: scripts/validator-options.ts

Important Files Changed

Filename Overview
scripts/validator-options.ts Adds independent advertised-URL resolution, but rejects supported path-based reverse-proxy endpoints.
scripts/validator.ts Separates transaction RPC from the advertised stake endpoint and validates configuration before connecting.
scripts/validator-options.test.ts Covers URL separation and rejection behavior, including the overly restrictive non-root-path rule.
package.json Moves validator and public-key helper commands to the repository's established native Bun invocation.
documentation/staking.md Documents explicit RPC and advertised validator URL configuration without destructive checkout cleanup.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    CLI[Validator stake command] --> RPC[Transaction RPC]
    CLI --> URL[Advertised validator URL]
    RPC --> Submit[Submit stake transaction]
    URL --> Tx[Stake transaction payload]
    Tx --> Chain[On-chain validator record]
    Chain --> Peers[Peer RPC requests]
Loading

Fix all with Greploop Fix All in Claude Code

Prompt To Fix All With AI
### Issue 1
scripts/validator-options.ts:25
**Path-based endpoints are rejected**

If an operator uses a supported reverse-proxy endpoint such as `https://node.example/rpc`, this root-only pathname check rejects the node's `EXPOSED_URL`. Peer RPC requests use the advertised URL directly, and the shared SDK accepts absolute URLs with paths, so the operator cannot stake using the documented environment fallback. Preserve valid endpoint paths while continuing to reject credentials, query strings, and fragments.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Separate validator RPC from advertised U..." | Re-trigger Greptile

!new Set(["http:", "https:"]).has(parsed.protocol) ||
parsed.username ||
parsed.password ||
parsed.pathname !== "/" ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Path-based endpoints are rejected

If an operator uses a supported reverse-proxy endpoint such as https://node.example/rpc, this root-only pathname check rejects the node's EXPOSED_URL. Peer RPC requests use the advertised URL directly, and the shared SDK accepts absolute URLs with paths, so the operator cannot stake using the documented environment fallback. Preserve valid endpoint paths while continuing to reject credentials, query strings, and fragments.

Knowledge Base Used: Node runtime and operations

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/validator-options.ts
Line: 25

Comment:
**Path-based endpoints are rejected**

If an operator uses a supported reverse-proxy endpoint such as `https://node.example/rpc`, this root-only pathname check rejects the node's `EXPOSED_URL`. Peer RPC requests use the advertised URL directly, and the shared SDK accepts absolute URLs with paths, so the operator cannot stake using the documented environment fallback. Preserve valid endpoint paths while continuing to reject credentials, query strings, and fragments.

**Knowledge Base Used:** [Node runtime and operations](https://app.greptile.com/kynesyslabs/-/custom-context/knowledge-base/kynesyslabs/node/-/docs/node-runtime.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant