Solana M2: swap origination, SOL launch pairs, numéraire quoting#497
Open
LandynDev wants to merge 13 commits into
Open
Solana M2: swap origination, SOL launch pairs, numéraire quoting#497LandynDev wants to merge 13 commits into
LandynDev wants to merge 13 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Solana M2: swap origination, SOL launch pairs, numéraire quoting
feat/solana-m2→contract-v2Summary
Un-stubs swap origination on Solana and flips the subnet to SOL-based launch pairs. A user can now drive a swap end-to-end (verified live on a local stack — see the
alw-utilscompanion PR), and the rate machinery is re-anchored from the old TAO leg to the SOL leg.What changed
Swap intake (was stubbed)
solana/client.py—open_or_request+resolve_poolinstruction builders (+ layouts disc/args,SLOT_HASHES). Account order/borsh cross-checked against the Rust#[derive(Accounts)].validator/solana_swap_loop.py+forward.py— default-on validator resolve-crank: each forward step resolves closed pools into reservations (idempotent, read-only-aware, fault-isolated).cli/swap_commands/swap_intake.py(new) — pure taker amount math: best-miner selection +sol_amount/from_amount/to_amount(SOL leg = the bounded notional), via the sharedcalculate_to_amount.swap.py:swap nowwired to it.SOL launch pairs + rate gate (B8)
chains.py—canonical_pairre-anchored: SOL is the canonical source (rate reads "X per 1 SOL").constants.py—DIRECTION_POOLSflipped tosol↔btc/sol↔tao@ 0.25 each.utils/rate.py—is_executable_rate+min_executable_tao_leg→min_executable_sol_legre-anchored from the TAO leg to the SOL leg (bounds are SOL lamports). Scoring call-sites updated. Dead TAO helpers removed.SOL-numéraire quoting
cli/swap_commands/numeraire.py(new) +alw miner quotes— one price per chain ("X per 1 SOL") derives every pair direction (optional symmetric spread). On-chainMinerQuoteunchanged.Reserve path
validator/axon_handlers.py:handle_swap_reserve— restubbed as a simple FCFS entry (user → validator → on-behalf lottery): rejects if the miner is unbound/inactive/busy, else accepts. Removed the deadreservation_pinstable (replaced by the on-chainReservationPDA).Program id
declare_id!+Anchor.toml+pdas.PROGRAM_IDto a committed dev keypair.smart-contracts/solana/target/deploy/allways_swap_manager-keypair.json) is DEV-ONLY — it exists so the local program id is reproducible across clones. Testnet/mainnet deploys use a separate, uncommitted keypair.handle_swap_reserveis an intentional FCFS stub — the user→validator entry point for the Ventura Labs browser-swap product. The on-behalfopen_or_requestcall + request-window selection are a follow-up (not part of this PR).Robustness (surfaced by the live
--fullstack)neurons/base/validator.py—resync_metagraphoverranmetagraph.hotkeys[uid]when the re-synced metagraphhad fewer hotkeys than the cached
self.hotkeys(a settling subnet);zip-truncate fix + 2 regression tests.Also: step-error handler now logs the origin
file:line(the gap that made this hard to diagnose).Testing
sol↔btc(--fast) andsol↔tao(
--full, real subtensor) — plus an asserted timeout-slash path (see thealw-utilsfull-e2e.shPR).