Add ETH as a launch spoke (SOL<->ETH swaps) - #613
Conversation
- EthereumProvider: eth-account + raw JSON-RPC with endpoint failover (publicnode -> drpc defaults, ETH_RPC_URLS override); plain EOA value transfers only; receipt status==1 required (inclusion != settlement); a mined tx with an unreadable receipt raises ProviderUnreachableError (unknown != absent, never a false slash verdict) - New ChainProvider.normalize_address hook (identity default) used by the base sender-pin and self-transfer checks; ETH lowercases so EIP-55 display casing can never false-reject a real deposit - CHAIN_ETH: 18 decimals, 32 confirmations (~1 epoch), 5e13 wei economic dust floor, no replay grace (timestamps strictly increase) - eth-network CLI config (mainnet/sepolia) mirroring btc-network, wired into the env bundles; miner quote flags derive from LAUNCH_SPOKES - Hand-rolled address validation: eth_utils 5+ is_address accepts unprefixed hex and no longer validates EIP-55 checksums - Scoring tests now derive pool floors from len(LAUNCH_SPOKES); the unsupported-chain test sentinel moved from 'eth' to 'doge'
A mined tx's receipt and its block timestamp are immutable per block hash, so fetch them once and key the cache by the blockHash the per-pass getTransactionByHash already returns — hash change (reorg) misses and refetches. Pending/absent/reverted reads are never cached. Brings the ETH re-verify path to parity with BTC's single /tx call (~3x fewer ETH RPCs at steady load); same shape as the shipped BTC/SOL tip hoists.
|
Added c6c34a9 — settled-tx read cache, prompted by the RPC budget review against The original implementation spent 3 RPCs per re-verify ( Effect at the doc's average model (30 concurrent, all-ETH worst case): ~655k → ~225k req/day per validator; at the realistic 15-leg mix ~110k/day — inside dRPC's free keyed tier with 6× headroom. Covered by 4 new unit tests (call-count assertion, reorg invalidation, never-cache pending/reverted, bound). 890 tests green. |
What
Adds Ethereum as the third spoke:
LAUNCH_SPOKES = ('btc', 'tao', 'eth'), so SOL↔ETH swaps launch with direction pools, miner quote flags, and CLI network config all derived from the registry. No contract changes — chains are opaque strings on-chain and leg amounts were already u128 (wei-scale).Provider design (
allways/chain_providers/ethereum.py)eth-account+ raw JSON-RPC overrequestswith a narrated failover ladder (publicnode → drpc defaults,ETH_RPC_URLSoverride) — same shape as the BTC provider's Esplora client, no web3.py.status == 1(a reverted tx still decodes intactto/value). Mirrors the TAO provider's Balances.Transfer-event rule.ProviderUnreachableErrorinstead of returning None — on a dest leg, None is a slash-eligible verdict.check_connectionverifieseth_chainIdagainstETH_NETWORK, so a wrong-network RPC fails at startup instead of verifying the wrong chain.broadcasted_txids+ an incremental head-cursorfind_recent_outgoing(TAO-style; plain RPC has no address index).Base change
New
ChainProvider.normalize_addresshook (identity default), used byverify_transaction's sender-mismatch and self-transfer checks. ETH overrides with lowercase: EIP-55 is display-only casing, and a checksummed reservation address vs a lowercase RPC sender must not false-reject a real deposit.ChainDefinition choices
Tests / verification
verify_transaction, failover ladder ("null result is authoritative"), send guards, scanner cursor.eth_utils5+is_addressaccepts unprefixed hex and stopped validating EIP-55 checksums — address validation is hand-rolled and tested.len(LAUNCH_SPOKES)instead of a hardcoded 2-pair world; the unsupported-chain sentinel moved'eth'→'doge'.verify_transactionwith an uppercased recipient + pinned sender; chain-id check; balance read.Notes for rollout
ETH_PRIVATE_KEY+ a funded wallet; validators only need RPC reachability (public defaults work).