Skip to content

Commit ce9c56f

Browse files
committed
fix slot
1 parent 7d0f5d0 commit ce9c56f

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

src/components/EventHistory.test.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,47 @@ describe('Pingme journal cards', () => {
120120

121121
expect(markup).toContain('Node · pending');
122122
expect(markup).toContain('Expected vote round 210');
123+
expect(markup).toContain('Epoch starts at slot 26688');
123124
expect(markup).not.toContain('Pending Offense Detected');
124125
expect(markup).not.toContain('aztec_node');
125126
});
126127

128+
it('labels a precursor duty miss as the first missed slot', () => {
129+
vi.stubGlobal('window', { location: new URL('https://slashmon.example/?view=pingme') });
130+
const event: MonitorEvent = {
131+
id: 'event-precursor',
132+
network: 'mainnet',
133+
type: 'inactivity_first_miss',
134+
source: 'aztec_sentinel',
135+
certainty: 'pending',
136+
sequencer: targets[0],
137+
targets: [targets[0]],
138+
title: 'First missed duty observed',
139+
body: 'This is precursor evidence, not a registered slash offense.',
140+
offense: {
141+
type: null,
142+
reason: 'inactivity precursor',
143+
epochOrSlot: '834',
144+
timeUnit: 'epoch',
145+
amount: null,
146+
epoch: '834',
147+
slot: '26690',
148+
offenseRound: null,
149+
proposalRound: null,
150+
},
151+
nodeEvidence: [],
152+
l1: null,
153+
occurredAt: '2026-07-22T13:34:33.502Z',
154+
};
155+
156+
const markup = renderToStaticMarkup(
157+
<EventHistory events={[event]} hasWatchlistCapability={false} />,
158+
);
159+
160+
expect(markup).toContain('First missed slot 26690');
161+
expect(markup).not.toContain('Epoch starts at slot 26690');
162+
});
163+
127164
it('falls back to an explicit UTC timestamp when local formatting is unavailable', () => {
128165
vi.spyOn(Date.prototype, 'toLocaleString').mockImplementation(() => {
129166
throw new RangeError('locale unavailable');

src/components/EventHistory.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,14 @@ function EventFacts({ event }: { event: MonitorEvent }) {
202202
const offense = event.offense;
203203
facts.push(`Reason: ${humanize(offense.reason)}${offense.type !== null ? ` (#${offense.type})` : ''}`);
204204
if (offense.epoch) facts.push(`Epoch ${offense.epoch}`);
205-
if (offense.slot) facts.push(`${offense.timeUnit === 'epoch' ? 'Epoch starts at slot' : 'Slot'} ${offense.slot}`);
205+
if (offense.slot) {
206+
const slotLabel = event.type === 'inactivity_first_miss'
207+
? 'First missed slot'
208+
: offense.timeUnit === 'epoch'
209+
? 'Epoch starts at slot'
210+
: 'Slot';
211+
facts.push(`${slotLabel} ${offense.slot}`);
212+
}
206213
if (!offense.epoch && offense.epochOrSlot) {
207214
facts.push(`${humanize(offense.timeUnit ?? 'position')} ${offense.epochOrSlot}`);
208215
}

0 commit comments

Comments
 (0)