Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ the latest fullnode release on every push and pull request, and gates on it.
| `STATS_INTERVAL_SECS` | `5` | minimum interval between stats refreshes |
| `NODES_INTERVAL_SECS` | `60` | peer list / geolocation refresh interval |
| `NODE_PUBLIC_IP` | auto-detected | public IP of the node the explorer runs on |
| `RANDSCAN_EXPECTED_CHAIN_ID` | `21` | the chain this deployment expects; `/api/v1/chain` classifies against it, and the indexer re-indexes from height 0 only when the node moves to it (any other chain change stops the indexer). Move it, with the frontend's `src/lib/chainPin.ts`, at every chain cut |
| `RANDSCAN_EXPECTED_GENESIS` | chain 21's `ca76c276…ca9a` | the expected chain's genesis hash (hex) |
| `RANDSCAN_EXPECTED_CHAIN_ID` | `22` | the chain this deployment expects; `/api/v1/chain` classifies against it, and the indexer re-indexes from height 0 only when the node moves to it (any other chain change stops the indexer). Move it, with the frontend's `src/lib/chainPin.ts`, at every chain cut |
| `RANDSCAN_EXPECTED_GENESIS` | chain 22's `29d67542…e9c0` | the expected chain's genesis hash (hex) |
| `RUST_LOG` | `info` | log filter |
| `COOKIE_SECURE` | `true` | set the session cookie `Secure` (requires https; use `false` for local http) |
| `TRUST_PROXY` | `false` | read the client IP from `X-Forwarded-For` (true behind Caddy/nginx) |
Expand Down
16 changes: 8 additions & 8 deletions crates/randscan-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ pub const STALL_MS: i64 = 60_000;
/// An indexer more than this many blocks behind its node is behind.
pub const MAX_LAG: i64 = 10;

/// The chain a deployment expects when nothing configures another: chain 21, cut 2026-10-12.
/// The chain a deployment expects when nothing configures another: chain 22, cut 2026-11-21.
/// Every pin moves at a chain cut; the monorepo's site-sync cron fails while one is left behind.
pub const DEFAULT_EXPECTED_CHAIN_ID: i64 = 21;
pub const DEFAULT_EXPECTED_CHAIN_ID: i64 = 22;
pub const DEFAULT_EXPECTED_GENESIS: &str =
"ca76c2766ed6090ac6ba5dad86b724dd5d2b80c0edfaed287cd8b129e663ca9a";
"29d67542941f2eb6f2c1bb68c759926f5d814c9e2c7a934292806a2d98b7e9c0";

/// Lowercase hex without a `0x` prefix, so two spellings of one hash compare equal.
pub fn normalize_hash(h: &str) -> String {
Expand Down Expand Up @@ -241,13 +241,13 @@ mod tests {

fn live_view() -> ChainView {
ChainView {
chain_id: 21,
chain_id: 22,
genesis_hash: Some(G.into()),
head_height: 495_700,
head_timestamp_ms: Some(NOW - 2_500),
node_height: Some(495_700),
lag: Some(0),
node_chain_id: Some(21),
node_chain_id: Some(22),
node_genesis_hash: Some(G.into()),
}
}
Expand Down Expand Up @@ -330,7 +330,7 @@ mod tests {
assert_eq!(c.state, ChainState::WrongChain);
assert!(c.detail.contains("indexing stopped"), "{}", c.detail);
let mut v = live_view();
v.node_chain_id = Some(22);
v.node_chain_id = Some(23);
assert_eq!(state(Some(&v)), ChainState::WrongChain);
}

Expand Down Expand Up @@ -371,9 +371,9 @@ mod tests {
}

#[test]
fn the_default_pin_is_chain_21() {
fn the_default_pin_is_chain_22() {
let p = ChainPin::default();
assert_eq!(p.chain_id, 21);
assert_eq!(p.chain_id, 22);
assert_eq!(p.genesis_hash, G);
}
}
4 changes: 2 additions & 2 deletions frontend/src/lib/chainPin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface ChainPin {

/** Chain 21, cut 2026-10-12. */
export const EXPECTED_CHAIN: ChainPin = {
chain_id: 21,
genesis_hash: 'ca76c2766ed6090ac6ba5dad86b724dd5d2b80c0edfaed287cd8b129e663ca9a',
chain_id: 22,
genesis_hash: '29d67542941f2eb6f2c1bb68c759926f5d814c9e2c7a934292806a2d98b7e9c0',
};

/** The <meta> tags that carry the pin in every page's <head>. */
Expand Down
12 changes: 6 additions & 6 deletions frontend/tests/chain-status.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ if (supported) {
server = await import('react-dom/server');
}

const G = 'ca76c2766ed6090ac6ba5dad86b724dd5d2b80c0edfaed287cd8b129e663ca9a';
const G = '29d67542941f2eb6f2c1bb68c759926f5d814c9e2c7a934292806a2d98b7e9c0';
const NOW = 1_800_000_000_000;
const view = (over = {}) => ({
chain_id: 21,
chain_id: 22,
genesis_hash: G,
head_height: 495_700,
head_timestamp_ms: NOW - 2_500,
node_height: 495_700,
lag: 0,
node_chain_id: 21,
node_chain_id: 22,
node_genesis_hash: G,
halted: false,
node_connected: true,
Expand All @@ -55,7 +55,7 @@ const state = (v) => cs.classify(v, pin.EXPECTED_CHAIN, NOW).state;
const reason = (v) => cs.classify(v, pin.EXPECTED_CHAIN, NOW).reason;

test('the pin is chain 21 and the thresholds are the spec\'s', { skip }, () => {
assert.deepEqual(pin.EXPECTED_CHAIN, { chain_id: 21, genesis_hash: G });
assert.deepEqual(pin.EXPECTED_CHAIN, { chain_id: 22, genesis_hash: G });
assert.equal(cs.STALL_MS, 60_000);
assert.equal(cs.MAX_LAG, 10);
assert.equal(cs.POLL_MS, 15_000);
Expand Down Expand Up @@ -107,7 +107,7 @@ test('a node that moved to another chain under the indexer is the wrong chain',
const v = view({ node_genesis_hash: 'cd'.repeat(32), halted: true, node_height: null, lag: null });
assert.equal(state(v), 'wrong_chain');
assert.equal(reason(v), 'halted');
assert.equal(state(view({ node_chain_id: 22 })), 'wrong_chain');
assert.equal(state(view({ node_chain_id: 23 })), 'wrong_chain');
});

test('an explorer cut off from its node is unreachable until the head goes stale', { skip }, () => {
Expand All @@ -134,7 +134,7 @@ test('pill tone per state', { skip }, () => {

test('every page\'s <head> carries the pin as rand-genesis / rand-chain-id meta tags', { skip }, () => {
const html = server.renderToStaticMarkup(React.createElement(meta.ChainMeta));
assert.equal(html, `<meta name="rand-genesis" content="${G}"/><meta name="rand-chain-id" content="21"/>`);
assert.equal(html, `<meta name="rand-genesis" content="${G}"/><meta name="rand-chain-id" content="22"/>`);
const other = server.renderToStaticMarkup(
React.createElement(meta.ChainMeta, { pin: { chain_id: 22, genesis_hash: 'ef'.repeat(32) } }),
);
Expand Down
Loading