-
Notifications
You must be signed in to change notification settings - Fork 50
feat!: limit Sei chain support to mainnet and testnet #328
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sei-js/precompiles': major | ||
| --- | ||
|
|
||
| Export Viem's canonical Sei mainnet and testnet definitions from the package root and `viem` entrypoint. Viem 2.55.16 or newer is now required. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@sei-js/mcp-server': major | ||
| '@sei-js/registry': major | ||
| --- | ||
|
|
||
| Remove Sei devnet support. The MCP server no longer accepts `sei-devnet`, chain ID `713715`, or `DEVNET_RPC_URL`. Registry exports now contain only `pacific-1` and `atlantic-2`, and `CHAIN_IDS.devnet` has been removed. |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import type { Chain } from 'viem'; | ||
| import { sei, seiDevnet, seiTestnet } from 'viem/chains'; | ||
| import { sei, seiTestnet } from 'viem/chains'; | ||
|
|
||
| // Default configuration values | ||
| export const DEFAULT_NETWORK = 'sei'; | ||
|
|
@@ -9,22 +9,19 @@ export const DEFAULT_CHAIN_ID = 1329; | |
| // Map chain IDs to chains | ||
| export const chainMap: Record<number, Chain> = { | ||
| 1329: sei, | ||
| 1328: seiTestnet, | ||
| 713715: seiDevnet | ||
| 1328: seiTestnet | ||
| }; | ||
|
|
||
| // Map network names to chain IDs for easier reference | ||
| export const networkNameMap: Record<string, number> = { | ||
| sei: 1329, | ||
| 'sei-testnet': 1328, | ||
| 'sei-devnet': 713_715 | ||
| 'sei-testnet': 1328 | ||
| }; | ||
|
|
||
| // Map chain IDs to RPC URLs | ||
| export const rpcUrlMap: Record<number, string> = { | ||
| 1329: process.env.MAINNET_RPC_URL || 'https://evm-rpc.sei-apis.com', | ||
| 1328: process.env.TESTNET_RPC_URL || 'https://evm-rpc-testnet.sei-apis.com', | ||
| 713715: process.env.DEVNET_RPC_URL || 'https://evm-rpc-arctic-1.sei-apis.com' | ||
| 1328: process.env.TESTNET_RPC_URL || 'https://evm-rpc-testnet.sei-apis.com' | ||
|
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. [suggestion] Retired identifiers now resolve to mainnet in this module's lookup helpers: Codex rated this High; I'd rate it lower after tracing the call sites. Every reachable path ( Still worth hardening as defence-in-depth, since these are exported helpers and the guard lives in a different function: have |
||
| }; | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion] Removing the devnet entries changes retired identifiers from "supported" to "silently mainnet" rather than "rejected":
resolveChainId('sei-devnet')→ falls through toDEFAULT_CHAIN_ID(1329), sogetRpcUrl('sei-devnet')returns the mainnet RPC URL.getChain(713715)→chainMap[713715] || sei→ mainnet chain;getRpcUrl(713715)→DEFAULT_RPC_URL→ mainnet RPC.Today the model-facing surface does fail closed, but only incidentally: every call site (
getPublicClient,private-key.ts,get_chain_info,resources.ts) hitsgetChain(<string>)first, and the string branch throwsUnsupported network: …for bothsei-devnetand'713715'. The numeric branch and thegetRpcUrl-only paths keep the silent-mainnet fallback, so the guarantee rests on ordering rather than on the resolver.Given a signing key can be attached in stdio mode, I'd make retirement explicit — e.g. an
UNSUPPORTED_CHAIN_IDS/RETIRED_NETWORKSset that throws inresolveChainIdand ingetChain's numeric branch — so a request aimed at devnet can never resolve to a mainnet client.(Codex rated this High on the grounds that callers "could unintentionally sign transactions on mainnet". I agree with the mechanism but not the severity:
networkisz.string()on every tool,mcp-serveronly exports the server entry (dist/index.js) rather thanchains.ts, andgetChainthrows before any client is built — so this is hardening, not a live drain path.)