Skip to content

Commit 7d0f5d0

Browse files
committed
casing fix
1 parent 3958151 commit 7d0f5d0

8 files changed

Lines changed: 29 additions & 11 deletions

File tree

collector/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AZTEC_SENTINEL_VALIDATOR_MAX_RESPONSE_BYTES=2097152
1717
# Comma-separated Ethereum RPCs. The network selects the chain and Registry.
1818
L1_RPC_URL=http://127.0.0.1:8545
1919
# L1_REGISTRY_ADDRESS=
20-
L1_SLASH_LOG_LOOKBACK_BLOCKS=50000
20+
L1_SLASH_LOG_LOOKBACK_BLOCKS=600
2121

2222
# Enable Telegram only when both values are set.
2323
TELEGRAM_BOT_TOKEN=

collector/deploy/slashmon-backend.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ AZTEC_SENTINEL_VALIDATOR_MAX_RESPONSE_BYTES=2097152
1818
# Comma-separated Ethereum RPCs. The network selects the chain and Registry.
1919
L1_RPC_URL=http://127.0.0.1:8545
2020
# L1_REGISTRY_ADDRESS=
21-
L1_SLASH_LOG_LOOKBACK_BLOCKS=50000
21+
L1_SLASH_LOG_LOOKBACK_BLOCKS=600
2222

2323
# Optional notification channels.
2424
TELEGRAM_BOT_TOKEN=

collector/src/collector.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ export function validateNodeIdentity(nodeInfo, {
194194
throw new Error(`Aztec node L1 chain mismatch: reported ${String(nodeInfo.l1ChainId)}, expected ${expectedChainId}`);
195195
}
196196
const registryAddress = normalizeAddress(nodeInfo.registryAddress, 'node Registry');
197-
if (registryAddress !== expectedRegistryAddress) {
198-
throw new Error(`Aztec node Registry mismatch: reported ${registryAddress}, expected ${expectedRegistryAddress}`);
197+
const expectedRegistry = normalizeAddress(expectedRegistryAddress, 'expected Registry');
198+
if (registryAddress !== expectedRegistry) {
199+
throw new Error(`Aztec node Registry mismatch: reported ${registryAddress}, expected ${expectedRegistry}`);
199200
}
200201
const rollupAddress = normalizeAddress(nodeInfo.rollupAddress, 'node Rollup');
201-
if (canonicalRollupAddress && rollupAddress !== canonicalRollupAddress) {
202-
throw new Error(`Aztec node Rollup mismatch: reported ${rollupAddress}, canonical L1 is ${canonicalRollupAddress}`);
202+
const canonicalRollup = canonicalRollupAddress
203+
? normalizeAddress(canonicalRollupAddress, 'canonical L1 Rollup')
204+
: undefined;
205+
if (canonicalRollup && rollupAddress !== canonicalRollup) {
206+
throw new Error(`Aztec node Rollup mismatch: reported ${rollupAddress}, canonical L1 is ${canonicalRollup}`);
203207
}
204208
}
205209

collector/src/config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function loadConfig(env = process.env, cwd = process.cwd()) {
101101
l1SlashLogLookbackBlocks: readInteger(
102102
env,
103103
'L1_SLASH_LOG_LOOKBACK_BLOCKS',
104-
50_000,
104+
600,
105105
1,
106106
10_000_000,
107107
),

collector/src/l1-scanner.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class L1Scanner {
2323
maxHeadAgeMs = 15 * 60_000,
2424
maxHeadStallMs = 2 * 60_000,
2525
maxFutureSkewMs = 2 * 60_000,
26-
slashLogLookbackBlocks = 50_000,
26+
slashLogLookbackBlocks = 600,
2727
slashLogChunkSize = 1_000,
2828
slashLogOverlapBlocks = 12,
2929
slashLogReorgRewindBlocks = 128,

collector/test/collector.test.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
import assert from 'node:assert/strict';
22
import test from 'node:test';
33

4-
import { OffenseCollector } from '../src/collector.mjs';
4+
import { OffenseCollector, validateNodeIdentity } from '../src/collector.mjs';
55
import { OffenseRepository } from '../src/database.mjs';
66
import { parseOffenseSnapshot } from '../src/offenses.mjs';
77
import { OFFENSE_A, OFFENSE_B, silentLogger } from './helpers.mjs';
88

99
const REGISTRY = `0x${'a'.repeat(40)}`;
1010
const ROLLUP = `0x${'b'.repeat(40)}`;
1111

12+
test('node identity comparisons ignore Ethereum address casing', () => {
13+
assert.doesNotThrow(() => validateNodeIdentity({
14+
l1ChainId: 1,
15+
registryAddress: '0x35b22e09ee0390539439e24f06da43d83f90e298',
16+
rollupAddress: ROLLUP,
17+
}, {
18+
expectedChainId: 1,
19+
expectedRegistryAddress: '0x35b22e09Ee0390539439E24f06Da43D83f90e298',
20+
canonicalRollupAddress: `0x${'B'.repeat(40)}`,
21+
}));
22+
});
23+
1224
test('collector retains data while the node is unavailable and recovers', async (t) => {
1325
const repository = new OffenseRepository(':memory:');
1426
t.after(() => repository.close());

collector/test/config.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('loadConfig provides a complete local configuration', () => {
2020
assert.equal(config.port, 8790);
2121
assert.equal(config.l1ChainId, 1);
2222
assert.equal(config.l1RegistryAddress, '0x35b22e09Ee0390539439E24f06Da43D83f90e298');
23-
assert.equal(config.l1SlashLogLookbackBlocks, 50_000);
23+
assert.equal(config.l1SlashLogLookbackBlocks, 600);
2424
assert.equal(config.sentinelPollIntervalMs, 60_000);
2525
assert.equal(config.sentinelLookbackEpochs, 3);
2626
assert.equal(config.sentinelEpochEndBufferSlots, 2);

docs/runbook.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ sudoedit /etc/slashmon-backend.env
3434
Set the public PWA URL, its exact CORS origin, both Aztec endpoints, and at least
3535
one Ethereum RPC. Keep the admin RPC private. Choose
3636
`L1_SLASH_LOG_LOOKBACK_BLOCKS` before first start; it bounds only the initial
37-
confirmed-log history. Later scans resume from SQLite.
37+
confirmed-log history. Its default is 600 Ethereum blocks, approximately the
38+
current mainnet wall-clock span of three Aztec epochs with a small margin.
39+
Later scans resume from SQLite.
3840

3941
Sentinel duty indexing checks sync every 60 seconds and quietly indexes a
4042
three-epoch window on first start. It fetches one confirmed L1 committee and

0 commit comments

Comments
 (0)