sol-mcp 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ """MCP tools for Solana."""
solana_mcp/versions.py ADDED
@@ -0,0 +1,391 @@
1
+ """Solana version and upgrade tracking.
2
+
3
+ Tracks mainnet versions, cluster upgrades, feature activations, and clients.
4
+ Similar to Ethereum's fork tracking but adapted for Solana's model.
5
+
6
+ Key differences from Ethereum:
7
+ - Solana uses semantic versioning (v1.18.x, v2.0.x) not named forks
8
+ - Features activated via feature gates, not hard forks
9
+ - Upgrades are rolling, not simultaneous network-wide
10
+ - Multiple client implementations (like Ethereum's client diversity)
11
+ """
12
+
13
+ from dataclasses import dataclass
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class SolanaVersion:
18
+ """A Solana mainnet version."""
19
+
20
+ version: str
21
+ release_date: str
22
+ description: str
23
+ key_features: list[str]
24
+ breaking_changes: list[str]
25
+ current: bool = False
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class FeatureGate:
30
+ """A Solana feature gate."""
31
+
32
+ name: str
33
+ feature_id: str # The pubkey of the feature
34
+ description: str
35
+ activated_slot: int | None # None if not yet activated
36
+ activated_date: str | None
37
+ version_introduced: str
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class SolanaClient:
42
+ """A Solana validator client implementation."""
43
+
44
+ name: str
45
+ organization: str
46
+ language: str
47
+ repo: str
48
+ description: str
49
+ mainnet_status: str # "production", "beta", "testnet", "development"
50
+ stake_percentage: float | None # Approximate % of stake running this client
51
+ key_differentiators: list[str]
52
+ notes: list[str]
53
+
54
+
55
+ # Solana validator clients
56
+ CLIENTS: list[SolanaClient] = [
57
+ SolanaClient(
58
+ name="Agave",
59
+ organization="Anza (formerly Solana Labs)",
60
+ language="Rust",
61
+ repo="https://github.com/anza-xyz/agave",
62
+ description="Original Solana client, now maintained by Anza. Reference implementation.",
63
+ mainnet_status="production",
64
+ stake_percentage=None, # Combined with Jito-Agave below
65
+ key_differentiators=[
66
+ "Reference implementation - defines protocol behavior",
67
+ "Most battle-tested codebase",
68
+ "Widest tooling and documentation support",
69
+ ],
70
+ notes=[
71
+ "Forked from solana-labs/solana when Anza spun out",
72
+ "Basis for Jito-Agave (MEV-enabled fork)",
73
+ ],
74
+ ),
75
+ SolanaClient(
76
+ name="Jito-Agave",
77
+ organization="Jito Labs",
78
+ language="Rust",
79
+ repo="https://github.com/jito-foundation/jito-solana",
80
+ description="Agave fork with MEV infrastructure (block engine, bundles, tips).",
81
+ mainnet_status="production",
82
+ stake_percentage=70.0, # As of Oct 2025
83
+ key_differentiators=[
84
+ "MEV block engine integration",
85
+ "Bundle support for atomic transaction execution",
86
+ "Tip distribution to stakers",
87
+ "Dominant client on mainnet",
88
+ ],
89
+ notes=[
90
+ "~70% of mainnet stake as of Oct 2025",
91
+ "De facto standard for validators seeking MEV rewards",
92
+ "Based on Agave, tracks upstream releases",
93
+ ],
94
+ ),
95
+ SolanaClient(
96
+ name="Firedancer",
97
+ organization="Jump Crypto",
98
+ language="C",
99
+ repo="https://github.com/firedancer-io/firedancer",
100
+ description="Ground-up rewrite in C for maximum performance. Independent implementation.",
101
+ mainnet_status="production",
102
+ stake_percentage=None, # Full Firedancer still limited
103
+ key_differentiators=[
104
+ "Complete rewrite - independent failure domain",
105
+ "Written in C for hardware-level optimization",
106
+ "Targeting 1M TPS theoretical throughput",
107
+ "Different codebase = different bugs (diversity)",
108
+ ],
109
+ notes=[
110
+ "Went live on mainnet December 2024",
111
+ "~3 years of development by Jump Crypto",
112
+ "Full Firedancer still in limited deployment",
113
+ "Most validators run Frankendancer (hybrid) instead",
114
+ ],
115
+ ),
116
+ SolanaClient(
117
+ name="Frankendancer",
118
+ organization="Jump Crypto",
119
+ language="C + Rust",
120
+ repo="https://github.com/firedancer-io/firedancer",
121
+ description="Hybrid: Firedancer networking + Agave runtime/consensus. Best of both.",
122
+ mainnet_status="production",
123
+ stake_percentage=21.0, # As of Oct 2025
124
+ key_differentiators=[
125
+ "Firedancer's high-performance networking (600K+ TPS capable)",
126
+ "Agave's battle-tested runtime and consensus",
127
+ "Lower risk than full Firedancer",
128
+ "Easier migration path for validators",
129
+ ],
130
+ notes=[
131
+ "~21% of mainnet stake as of Oct 2025 (up from 8% in June)",
132
+ "Launched on mainnet September 2024",
133
+ "Recommended stepping stone to full Firedancer",
134
+ "Combines Firedancer's fd_quic, fd_tpu with Agave runtime",
135
+ ],
136
+ ),
137
+ SolanaClient(
138
+ name="Sig",
139
+ organization="Syndica",
140
+ language="Zig",
141
+ repo="https://github.com/Syndica/sig",
142
+ description="Zig-based client focused on RPC performance and light clients.",
143
+ mainnet_status="development",
144
+ stake_percentage=0.0,
145
+ key_differentiators=[
146
+ "Written in Zig for safety and performance",
147
+ "Focus on RPC node use case",
148
+ "Potential for light client support",
149
+ "Third independent implementation",
150
+ ],
151
+ notes=[
152
+ "Not yet production-ready for validation",
153
+ "Targeting RPC providers initially",
154
+ "Adds to client diversity ecosystem",
155
+ ],
156
+ ),
157
+ ]
158
+
159
+
160
+ # Major Solana versions
161
+ # Note: Solana versions are more continuous than Ethereum forks
162
+ VERSIONS: list[SolanaVersion] = [
163
+ SolanaVersion(
164
+ version="v1.14",
165
+ release_date="2022-10",
166
+ description="QUIC networking, stake-weighted QoS",
167
+ key_features=[
168
+ "QUIC protocol for transaction submission",
169
+ "Stake-weighted quality of service",
170
+ "Improved transaction processing",
171
+ ],
172
+ breaking_changes=[],
173
+ ),
174
+ SolanaVersion(
175
+ version="v1.16",
176
+ release_date="2023-06",
177
+ description="Improved vote costs, versioned transactions",
178
+ key_features=[
179
+ "Reduced vote transaction costs",
180
+ "Address Lookup Tables (ALT) improvements",
181
+ "Versioned transactions default",
182
+ ],
183
+ breaking_changes=[],
184
+ ),
185
+ SolanaVersion(
186
+ version="v1.17",
187
+ release_date="2023-10",
188
+ description="Turbine improvements, SIMD support",
189
+ key_features=[
190
+ "Turbine protocol improvements",
191
+ "Better shred recovery",
192
+ "Gossip optimizations",
193
+ ],
194
+ breaking_changes=[],
195
+ ),
196
+ SolanaVersion(
197
+ version="v1.18",
198
+ release_date="2024-04",
199
+ description="Token extensions, improved finality",
200
+ key_features=[
201
+ "Token-2022 (Token Extensions) wider adoption",
202
+ "Confidential transfers",
203
+ "Transfer hooks",
204
+ "Improved RPC performance",
205
+ ],
206
+ breaking_changes=[],
207
+ ),
208
+ SolanaVersion(
209
+ version="v2.0",
210
+ release_date="2024-08",
211
+ description="Major refactor, Agave client",
212
+ key_features=[
213
+ "Anza's Agave client becomes primary",
214
+ "SVM (Solana Virtual Machine) modularization",
215
+ "Improved validator performance",
216
+ "Better error messages",
217
+ ],
218
+ breaking_changes=[
219
+ "Some deprecated APIs removed",
220
+ "Validator config changes",
221
+ ],
222
+ ),
223
+ SolanaVersion(
224
+ version="v2.1",
225
+ release_date="2024-12",
226
+ description="Performance improvements, Alpenglow prep",
227
+ key_features=[
228
+ "Transaction scheduling improvements",
229
+ "Reduced block propagation latency",
230
+ "Foundation for Alpenglow consensus",
231
+ ],
232
+ breaking_changes=[],
233
+ current=True,
234
+ ),
235
+ # Future
236
+ SolanaVersion(
237
+ version="v2.2 (Alpenglow)",
238
+ release_date="2026-Q1 (expected)",
239
+ description="New consensus protocol - NOT YET LIVE",
240
+ key_features=[
241
+ "Votor: replaces TowerBFT for voting",
242
+ "Rotor: improved data dissemination",
243
+ "~150ms finality (down from 12.8s)",
244
+ "Based on Martin-Alvisi Fast BFT",
245
+ ],
246
+ breaking_changes=[
247
+ "TowerBFT deprecated",
248
+ "Consensus participation changes",
249
+ ],
250
+ current=False,
251
+ ),
252
+ ]
253
+
254
+
255
+ # Notable feature gates
256
+ FEATURE_GATES: list[FeatureGate] = [
257
+ FeatureGate(
258
+ name="require_static_program_ids_in_transaction",
259
+ feature_id="8FUwMvCqV8HMFmKrqZ8JYzLLVwqVrtNh8LdFJCrGdTvr",
260
+ description="Require program IDs to be static in transactions",
261
+ activated_slot=None,
262
+ activated_date=None,
263
+ version_introduced="v1.14",
264
+ ),
265
+ FeatureGate(
266
+ name="vote_state_update_credit_per_dequeue",
267
+ feature_id="CveezY6FDLVBToHDcvJRmtMouqzsmj4UXYh5ths5G5Uv",
268
+ description="Credit per dequeue in vote state updates",
269
+ activated_slot=199_000_000,
270
+ activated_date="2023-09",
271
+ version_introduced="v1.16",
272
+ ),
273
+ FeatureGate(
274
+ name="enable_partitioned_epoch_reward",
275
+ feature_id="9bn2vTJUsUcnpiZWbu2woSKtTGW3ErZC9ERv88SDqQjK",
276
+ description="Partitioned epoch rewards for faster distribution",
277
+ activated_slot=240_000_000,
278
+ activated_date="2024-04",
279
+ version_introduced="v1.18",
280
+ ),
281
+ FeatureGate(
282
+ name="enable_tower_sync_from_snapshots",
283
+ feature_id="HxTQMtHPKrRjVBo76vBPjPKqFHKPnZdfDPnvkyMUppwo",
284
+ description="Allow tower sync from snapshots",
285
+ activated_slot=250_000_000,
286
+ activated_date="2024-06",
287
+ version_introduced="v2.0",
288
+ ),
289
+ ]
290
+
291
+
292
+ def get_current_version() -> SolanaVersion:
293
+ """Get the current mainnet version."""
294
+ for version in VERSIONS:
295
+ if version.current:
296
+ return version
297
+ return VERSIONS[-2] # Second to last (last is future)
298
+
299
+
300
+ def list_versions() -> list[SolanaVersion]:
301
+ """List all versions."""
302
+ return VERSIONS
303
+
304
+
305
+ def get_version(version_str: str) -> SolanaVersion | None:
306
+ """Get a specific version by string."""
307
+ for v in VERSIONS:
308
+ if version_str in v.version:
309
+ return v
310
+ return None
311
+
312
+
313
+ def list_feature_gates(activated_only: bool = False) -> list[FeatureGate]:
314
+ """List feature gates."""
315
+ if activated_only:
316
+ return [f for f in FEATURE_GATES if f.activated_slot is not None]
317
+ return FEATURE_GATES
318
+
319
+
320
+ def get_consensus_status() -> dict:
321
+ """Get current consensus mechanism status."""
322
+ return {
323
+ "current": "TowerBFT",
324
+ "current_description": "PBFT variant optimized for Proof of History",
325
+ "finality": "~12.8 seconds (32 confirmations)",
326
+ "optimistic_confirmation": "~2.5 seconds",
327
+ "future": "Alpenglow",
328
+ "future_status": "SIMD-0326 approved, expected Q1 2026",
329
+ "future_finality": "~150ms median",
330
+ "poh_status": "Active (ordering layer, not consensus)",
331
+ }
332
+
333
+
334
+ def list_clients(production_only: bool = False) -> list[SolanaClient]:
335
+ """List Solana validator clients."""
336
+ if production_only:
337
+ return [c for c in CLIENTS if c.mainnet_status == "production"]
338
+ return CLIENTS
339
+
340
+
341
+ def get_client(name: str) -> SolanaClient | None:
342
+ """Get a specific client by name."""
343
+ name_lower = name.lower()
344
+ for client in CLIENTS:
345
+ if name_lower in client.name.lower():
346
+ return client
347
+ return None
348
+
349
+
350
+ def get_client_diversity() -> dict:
351
+ """Get current client diversity statistics."""
352
+ production_clients = [c for c in CLIENTS if c.mainnet_status == "production"]
353
+
354
+ return {
355
+ "total_clients": len(CLIENTS),
356
+ "production_clients": len(production_clients),
357
+ "client_breakdown": {
358
+ "Jito-Agave (Rust)": "~70% stake - MEV-enabled Agave fork",
359
+ "Frankendancer (C+Rust)": "~21% stake - Firedancer networking + Agave runtime",
360
+ "Agave (Rust)": "~8% stake - Reference implementation",
361
+ "Firedancer (C)": "<1% stake - Full independent implementation",
362
+ "Sig (Zig)": "0% - Development stage",
363
+ },
364
+ "diversity_notes": [
365
+ "Jito-Agave dominance (~70%) is a centralization concern",
366
+ "Frankendancer growth (8% → 21% in 4 months) improving diversity",
367
+ "Full Firedancer provides true independent failure domain",
368
+ "Ethereum has better diversity (~33% each for top clients)",
369
+ ],
370
+ }
371
+
372
+
373
+ if __name__ == "__main__":
374
+ print("Solana Versions:")
375
+ print("=" * 60)
376
+ for v in VERSIONS:
377
+ current = " (CURRENT)" if v.current else ""
378
+ print(f"\n{v.version}{current} - {v.release_date}")
379
+ print(f" {v.description}")
380
+
381
+ print("\n\nConsensus Status:")
382
+ print("=" * 60)
383
+ status = get_consensus_status()
384
+ for k, v in status.items():
385
+ print(f" {k}: {v}")
386
+
387
+ print("\n\nClient Diversity:")
388
+ print("=" * 60)
389
+ diversity = get_client_diversity()
390
+ for name, info in diversity["client_breakdown"].items():
391
+ print(f" {name}: {info}")