Files
lp-terminal_github/indexer/rpcConfig.test.ts
T
labrinyang d73eaf873a fix(indexer): stop a manipulated pool from minting prices
A price used to propagate from any pool with enough depth on the priced side,
which let a thin pool with one inflated side mint a price for its other token
and carry it across the graph. Depth is now measured on the side that is
already credibly priced, and a pool-priced side may claim at most 100x that
depth.

Guard rails around it, all in one place: prices travel at most 3 hops from a
GT/anchor seed, |tick| beyond 700k is a broken init rather than a market,
stored prices must land in a plausibility band, and a TVL above $1B is treated
as corrupt instead of as a whale.

Adds a log tail so pool stats follow chain events instead of polling, a
demand-gated frontpage, and a last-good fallback so a failed refresh serves
the previous stat rather than a hole.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 23:59:56 +08:00

22 lines
791 B
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { rpcUrls } from './config'
test('indexer uses its dedicated RPC before the shared paid RPC', () => {
const previousExtraKey = process.env.EXTRA_ALCHEMY_RPC_KEY
const previousRpc = process.env.RPC
try {
process.env.EXTRA_ALCHEMY_RPC_KEY = 'extra-test-key'
process.env.RPC = 'https://shared.invalid'
assert.deepEqual(rpcUrls(), [
'https://robinhood-mainnet.g.alchemy.com/v2/extra-test-key',
'https://shared.invalid',
])
} finally {
if (previousExtraKey === undefined) delete process.env.EXTRA_ALCHEMY_RPC_KEY
else process.env.EXTRA_ALCHEMY_RPC_KEY = previousExtraKey
if (previousRpc === undefined) delete process.env.RPC
else process.env.RPC = previousRpc
}
})