@gzeoneth/gov-tracker 0.2.1-beta.c266765 → 0.2.1-beta.d575294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/abis.d.ts +3 -0
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +8 -1
- package/dist/abis.js.map +1 -1
- package/dist/cli/cli.js +88 -44
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/lib/cli.d.ts +41 -3
- package/dist/cli/lib/cli.d.ts.map +1 -1
- package/dist/cli/lib/cli.js +333 -116
- package/dist/cli/lib/cli.js.map +1 -1
- package/dist/cli/lib/json-state.d.ts +23 -0
- package/dist/cli/lib/json-state.d.ts.map +1 -1
- package/dist/cli/lib/json-state.js +51 -4
- package/dist/cli/lib/json-state.js.map +1 -1
- package/dist/constants.d.ts +39 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +47 -2
- package/dist/constants.js.map +1 -1
- package/dist/data/bundled-cache.json +10988 -1580
- package/dist/discovery/governor-discovery.d.ts.map +1 -1
- package/dist/discovery/governor-discovery.js +50 -35
- package/dist/discovery/governor-discovery.js.map +1 -1
- package/dist/discovery/timelock-discovery.d.ts +15 -6
- package/dist/discovery/timelock-discovery.d.ts.map +1 -1
- package/dist/discovery/timelock-discovery.js +27 -11
- package/dist/discovery/timelock-discovery.js.map +1 -1
- package/dist/election/contracts.d.ts +8 -0
- package/dist/election/contracts.d.ts.map +1 -0
- package/dist/election/contracts.js +28 -0
- package/dist/election/contracts.js.map +1 -0
- package/dist/election/details.d.ts +15 -0
- package/dist/election/details.d.ts.map +1 -0
- package/dist/election/details.js +157 -0
- package/dist/election/details.js.map +1 -0
- package/dist/election/index.d.ts +11 -0
- package/dist/election/index.d.ts.map +1 -0
- package/dist/election/index.js +48 -0
- package/dist/election/index.js.map +1 -0
- package/dist/election/params.d.ts +13 -0
- package/dist/election/params.d.ts.map +1 -0
- package/dist/election/params.js +93 -0
- package/dist/election/params.js.map +1 -0
- package/dist/election/participants.d.ts +6 -0
- package/dist/election/participants.d.ts.map +1 -0
- package/dist/election/participants.js +104 -0
- package/dist/election/participants.js.map +1 -0
- package/dist/election/prepare.d.ts +10 -0
- package/dist/election/prepare.d.ts.map +1 -0
- package/dist/election/prepare.js +52 -0
- package/dist/election/prepare.js.map +1 -0
- package/dist/election/proposal-ids.d.ts +18 -0
- package/dist/election/proposal-ids.d.ts.map +1 -0
- package/dist/election/proposal-ids.js +77 -0
- package/dist/election/proposal-ids.js.map +1 -0
- package/dist/election/status.d.ts +15 -0
- package/dist/election/status.d.ts.map +1 -0
- package/dist/election/status.js +102 -0
- package/dist/election/status.js.map +1 -0
- package/dist/election/tracking.d.ts +28 -0
- package/dist/election/tracking.d.ts.map +1 -0
- package/dist/election/tracking.js +412 -0
- package/dist/election/tracking.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -11
- package/dist/index.js.map +1 -1
- package/dist/stages/l2-to-l1-message.d.ts +3 -1
- package/dist/stages/l2-to-l1-message.d.ts.map +1 -1
- package/dist/stages/l2-to-l1-message.js +6 -6
- package/dist/stages/l2-to-l1-message.js.map +1 -1
- package/dist/stages/proposal-created.d.ts +1 -0
- package/dist/stages/proposal-created.d.ts.map +1 -1
- package/dist/stages/proposal-created.js +1 -0
- package/dist/stages/proposal-created.js.map +1 -1
- package/dist/stages/proposal-queued.d.ts +1 -0
- package/dist/stages/proposal-queued.d.ts.map +1 -1
- package/dist/stages/proposal-queued.js +3 -1
- package/dist/stages/proposal-queued.js.map +1 -1
- package/dist/stages/retryables.js +2 -2
- package/dist/stages/retryables.js.map +1 -1
- package/dist/stages/timelock.d.ts +3 -1
- package/dist/stages/timelock.d.ts.map +1 -1
- package/dist/stages/timelock.js +12 -12
- package/dist/stages/timelock.js.map +1 -1
- package/dist/stages/utils.d.ts +5 -9
- package/dist/stages/utils.d.ts.map +1 -1
- package/dist/stages/utils.js +34 -29
- package/dist/stages/utils.js.map +1 -1
- package/dist/tracker/cache.d.ts +10 -6
- package/dist/tracker/cache.d.ts.map +1 -1
- package/dist/tracker/cache.js +36 -13
- package/dist/tracker/cache.js.map +1 -1
- package/dist/tracker/checkpoint-helpers.d.ts +81 -0
- package/dist/tracker/checkpoint-helpers.d.ts.map +1 -0
- package/dist/tracker/checkpoint-helpers.js +201 -0
- package/dist/tracker/checkpoint-helpers.js.map +1 -0
- package/dist/tracker/discovery.d.ts +1 -1
- package/dist/tracker/discovery.d.ts.map +1 -1
- package/dist/tracker/discovery.js +11 -3
- package/dist/tracker/discovery.js.map +1 -1
- package/dist/tracker/execute.d.ts.map +1 -1
- package/dist/tracker/execute.js +1 -25
- package/dist/tracker/execute.js.map +1 -1
- package/dist/tracker/pipeline.d.ts.map +1 -1
- package/dist/tracker/pipeline.js +26 -11
- package/dist/tracker/pipeline.js.map +1 -1
- package/dist/tracker/query.d.ts +1 -0
- package/dist/tracker/query.d.ts.map +1 -1
- package/dist/tracker/query.js +14 -61
- package/dist/tracker/query.js.map +1 -1
- package/dist/tracker/state.d.ts +0 -10
- package/dist/tracker/state.d.ts.map +1 -1
- package/dist/tracker/state.js +1 -28
- package/dist/tracker/state.js.map +1 -1
- package/dist/tracker.d.ts +79 -7
- package/dist/tracker.d.ts.map +1 -1
- package/dist/tracker.js +357 -43
- package/dist/tracker.js.map +1 -1
- package/dist/types/config.d.ts +49 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/core.d.ts +3 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/election.d.ts +66 -11
- package/dist/types/election.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/stages.d.ts +66 -7
- package/dist/types/stages.d.ts.map +1 -1
- package/dist/types/stages.js.map +1 -1
- package/dist/types/tracking.d.ts +10 -10
- package/dist/types/tracking.d.ts.map +1 -1
- package/dist/utils/block-cache.d.ts +50 -0
- package/dist/utils/block-cache.d.ts.map +1 -0
- package/dist/utils/block-cache.js +80 -0
- package/dist/utils/block-cache.js.map +1 -0
- package/dist/utils/formatters.d.ts +91 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +327 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/multicall.d.ts +52 -0
- package/dist/utils/multicall.d.ts.map +1 -0
- package/dist/utils/multicall.js +75 -0
- package/dist/utils/multicall.js.map +1 -0
- package/dist/utils/rpc-utils.d.ts +7 -1
- package/dist/utils/rpc-utils.d.ts.map +1 -1
- package/dist/utils/rpc-utils.js +42 -29
- package/dist/utils/rpc-utils.js.map +1 -1
- package/dist/utils/salt-computation.d.ts.map +1 -1
- package/dist/utils/salt-computation.js +33 -7
- package/dist/utils/salt-computation.js.map +1 -1
- package/dist/utils/sanitize.d.ts.map +1 -1
- package/dist/utils/sanitize.js +3 -0
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/stage-metadata.d.ts +0 -20
- package/dist/utils/stage-metadata.d.ts.map +1 -1
- package/dist/utils/stage-metadata.js +29 -44
- package/dist/utils/stage-metadata.js.map +1 -1
- package/dist/utils/timing.d.ts.map +1 -1
- package/dist/utils/timing.js +2 -1
- package/dist/utils/timing.js.map +1 -1
- package/package.json +3 -2
- package/dist/election.d.ts +0 -312
- package/dist/election.d.ts.map +0 -1
- package/dist/election.js +0 -884
- package/dist/election.js.map +0 -1
- package/dist/types/cross-chain.d.ts +0 -24
- package/dist/types/cross-chain.d.ts.map +0 -1
- package/dist/types/cross-chain.js +0 -6
- package/dist/types/cross-chain.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,C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AC;IACT,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;CAC7C,CAAC,CAYD"}
|
package/dist/cli/lib/cli.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.loopOptions = exports.gasOptions = exports.chunkingOptions = exports.executionOptions = exports.cacheOptions = exports.verboseOption = exports.rpcOptions = exports.HEALTH_CHECK_TIMEOUT_MS = exports.DEFAULT_L2_GAS_SETTINGS = exports.MAX_CONSECUTIVE_ERRORS = exports.DEFAULT_MAX_AGE_DAYS = exports.DEFAULT_BLOCK_LAG = exports.isElectionGovernor = void 0;
|
|
16
16
|
exports.addOptions = addOptions;
|
|
17
|
+
exports.validateCliOptions = validateCliOptions;
|
|
17
18
|
exports.parseGasSettings = parseGasSettings;
|
|
18
19
|
exports.parseChunkingConfig = parseChunkingConfig;
|
|
19
20
|
exports.createProvidersFromOptions = createProvidersFromOptions;
|
|
@@ -24,9 +25,12 @@ exports.formatDryRun = formatDryRun;
|
|
|
24
25
|
exports.formatMultiplePreparedTransactions = formatMultiplePreparedTransactions;
|
|
25
26
|
exports.formatTrackingResult = formatTrackingResult;
|
|
26
27
|
exports.formatCacheStatus = formatCacheStatus;
|
|
28
|
+
exports.formatElectionResult = formatElectionResult;
|
|
27
29
|
exports.displayTrackingResult = displayTrackingResult;
|
|
28
30
|
exports.isShuttingDown = isShuttingDown;
|
|
29
31
|
exports.runWithLoop = runWithLoop;
|
|
32
|
+
exports.filterCheckpointsByTargets = filterCheckpointsByTargets;
|
|
33
|
+
exports.calculateFilteredStats = calculateFilteredStats;
|
|
30
34
|
exports.runMonitorCycle = runMonitorCycle;
|
|
31
35
|
exports.trackAndPrepare = trackAndPrepare;
|
|
32
36
|
const commander_1 = require("commander");
|
|
@@ -115,6 +119,59 @@ exports.loopOptions = [
|
|
|
115
119
|
function addOptions(cmd, opts) {
|
|
116
120
|
opts.forEach((o) => cmd.addOption(o));
|
|
117
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Validate CLI options for contradictions and conflicts.
|
|
124
|
+
* Throws an error if conflicting options are detected.
|
|
125
|
+
*/
|
|
126
|
+
function validateCliOptions(opts, command) {
|
|
127
|
+
const errors = [];
|
|
128
|
+
// Cache conflicts
|
|
129
|
+
if (opts.cache && opts.noCache) {
|
|
130
|
+
errors.push({
|
|
131
|
+
flags: ["--cache", "--no-cache"],
|
|
132
|
+
message: "--cache and --no-cache are mutually exclusive",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
// --force overrides --start-block (warn, not error)
|
|
136
|
+
if (opts.force && opts.startBlock) {
|
|
137
|
+
errors.push({
|
|
138
|
+
flags: ["--force", "--start-block"],
|
|
139
|
+
message: "--force resets discovery to block 0, overriding --start-block",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
// Track command specific validations
|
|
143
|
+
if (command === "track") {
|
|
144
|
+
// --inspect and --inspect-only are mutually exclusive
|
|
145
|
+
if (opts.inspect && opts.inspectOnly) {
|
|
146
|
+
errors.push({
|
|
147
|
+
flags: ["--inspect", "--inspect-only"],
|
|
148
|
+
message: "--inspect and --inspect-only are mutually exclusive",
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
// --inspect-only skips tracking, so execution options don't make sense
|
|
152
|
+
if (opts.inspectOnly) {
|
|
153
|
+
const conflictingFlags = [];
|
|
154
|
+
if (opts.prepare)
|
|
155
|
+
conflictingFlags.push("--prepare");
|
|
156
|
+
if (opts.write)
|
|
157
|
+
conflictingFlags.push("--write");
|
|
158
|
+
if (opts.prepareCompleted)
|
|
159
|
+
conflictingFlags.push("--prepare-completed");
|
|
160
|
+
if (opts.preparePending)
|
|
161
|
+
conflictingFlags.push("--prepare-pending");
|
|
162
|
+
if (conflictingFlags.length > 0) {
|
|
163
|
+
errors.push({
|
|
164
|
+
flags: ["--inspect-only", ...conflictingFlags],
|
|
165
|
+
message: `--inspect-only skips tracking; ${conflictingFlags.join(", ")} require tracking`,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (errors.length > 0) {
|
|
171
|
+
const messages = errors.map((e) => ` ${e.flags.join(" + ")}: ${e.message}`);
|
|
172
|
+
throw new Error(`Conflicting options detected:\n${messages.join("\n")}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
118
175
|
/**
|
|
119
176
|
* Parse gas settings from CLI options
|
|
120
177
|
*/
|
|
@@ -341,113 +398,112 @@ function formatTrackingResult(result, label) {
|
|
|
341
398
|
}
|
|
342
399
|
return lines.join("\n").concat("\n");
|
|
343
400
|
}
|
|
344
|
-
function formatCacheStatus(checkpoints) {
|
|
345
|
-
|
|
346
|
-
let timelockTotal = 0, timelockComplete = 0, timelockActive = 0, timelockFailed = 0;
|
|
347
|
-
let electionTotal = 0, electionComplete = 0, electionActive = 0;
|
|
348
|
-
for (const [, checkpoint] of checkpoints) {
|
|
349
|
-
const stages = checkpoint.cachedData?.completedStages ?? [];
|
|
350
|
-
const isComplete = stages.length > 0 && (0, index_1.areAllStagesComplete)(stages);
|
|
351
|
-
const errorCount = checkpoint.metadata?.errorCount ?? 0;
|
|
352
|
-
const isFailed = errorCount >= exports.MAX_CONSECUTIVE_ERRORS;
|
|
353
|
-
const input = checkpoint.input;
|
|
354
|
-
if (input.type === "governor") {
|
|
355
|
-
if ((0, index_1.isElectionGovernor)(input.governorAddress)) {
|
|
356
|
-
// Legacy election governor checkpoints (discovered but not tracked)
|
|
357
|
-
// These will be replaced by proper election checkpoints
|
|
358
|
-
electionTotal++;
|
|
359
|
-
if (isComplete)
|
|
360
|
-
electionComplete++;
|
|
361
|
-
else
|
|
362
|
-
electionActive++;
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
proposalTotal++;
|
|
366
|
-
if (isComplete)
|
|
367
|
-
proposalComplete++;
|
|
368
|
-
else if (isFailed)
|
|
369
|
-
proposalFailed++;
|
|
370
|
-
else
|
|
371
|
-
proposalActive++;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
else if (input.type === "timelock") {
|
|
375
|
-
timelockTotal++;
|
|
376
|
-
if (isComplete)
|
|
377
|
-
timelockComplete++;
|
|
378
|
-
else if (isFailed)
|
|
379
|
-
timelockFailed++;
|
|
380
|
-
else
|
|
381
|
-
timelockActive++;
|
|
382
|
-
}
|
|
383
|
-
else if (input.type === "election") {
|
|
384
|
-
// Proper election checkpoints with phase tracking
|
|
385
|
-
electionTotal++;
|
|
386
|
-
const electionStatus = checkpoint.cachedData?.electionStatus;
|
|
387
|
-
if (electionStatus?.phase === "COMPLETED") {
|
|
388
|
-
electionComplete++;
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
electionActive++;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
401
|
+
function formatCacheStatus(checkpoints, elections) {
|
|
402
|
+
const stats = (0, index_1.computeCacheStats)(checkpoints, elections, exports.MAX_CONSECUTIVE_ERRORS);
|
|
395
403
|
const lines = [
|
|
396
|
-
`Total cached: ${
|
|
404
|
+
`Total cached: ${stats.total}`,
|
|
397
405
|
``,
|
|
398
|
-
`Proposals: ${
|
|
399
|
-
` Complete: ${
|
|
400
|
-
` Active: ${
|
|
406
|
+
`Proposals: ${stats.proposals.total}`,
|
|
407
|
+
` Complete: ${stats.proposals.complete}`,
|
|
408
|
+
` Active: ${stats.proposals.active}`,
|
|
401
409
|
];
|
|
402
|
-
if (
|
|
403
|
-
lines.push(` Failed: ${
|
|
404
|
-
lines.push(``, `Timelock Ops: ${
|
|
405
|
-
if (
|
|
406
|
-
lines.push(` Failed: ${
|
|
407
|
-
if (
|
|
408
|
-
|
|
410
|
+
if (stats.proposals.errored > 0)
|
|
411
|
+
lines.push(` Failed: ${stats.proposals.errored}`);
|
|
412
|
+
lines.push(``, `Timelock Ops: ${stats.timelocks.total}`, ` Complete: ${stats.timelocks.complete}`, ` Active: ${stats.timelocks.active}`);
|
|
413
|
+
if (stats.timelocks.errored > 0)
|
|
414
|
+
lines.push(` Failed: ${stats.timelocks.errored}`);
|
|
415
|
+
if (stats.elections.total > 0) {
|
|
416
|
+
const active = stats.elections.total - stats.elections.complete;
|
|
417
|
+
lines.push(``, `Elections: ${stats.elections.total}`, ` Complete: ${stats.elections.complete}`, ` Active: ${active}`);
|
|
409
418
|
}
|
|
410
419
|
return lines.join("\n");
|
|
411
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Format an election status for CLI output
|
|
423
|
+
*/
|
|
424
|
+
function formatElectionResult(election) {
|
|
425
|
+
const lines = [];
|
|
426
|
+
const cohortName = election.cohort === 0 ? "First" : "Second";
|
|
427
|
+
const phaseName = election.phase.replace(/_/g, " ");
|
|
428
|
+
lines.push(`[Election #${election.electionIndex}]`);
|
|
429
|
+
lines.push(`Phase: ${phaseName}`);
|
|
430
|
+
lines.push(`Cohort: ${cohortName}`);
|
|
431
|
+
lines.push(`Complete: ${election.phase === "COMPLETED"}`);
|
|
432
|
+
lines.push(`Stages: ${election.stages?.length ?? 0}`);
|
|
433
|
+
lines.push("");
|
|
434
|
+
if (election.stages && election.stages.length > 0) {
|
|
435
|
+
for (let i = 0; i < election.stages.length; i++) {
|
|
436
|
+
const stage = election.stages[i];
|
|
437
|
+
const statusStr = stage.status;
|
|
438
|
+
const title = (0, index_1.formatStageTitle)(stage.type);
|
|
439
|
+
const eta = (0, index_1.calculateExpectedEta)(election.stages, i);
|
|
440
|
+
let line = ` ${title}: ${statusStr}`;
|
|
441
|
+
if (eta)
|
|
442
|
+
line += ` | ETA: ${new Date(eta * 1000).toISOString()}`;
|
|
443
|
+
lines.push(line);
|
|
444
|
+
for (const tx of stage.transactions) {
|
|
445
|
+
lines.push(` tx: ${tx.hash}`);
|
|
446
|
+
const url = (0, index_1.getStageTransactionUrl)(tx);
|
|
447
|
+
if (url)
|
|
448
|
+
lines.push(` ${url}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
// Show timelock operation ID if tracked (useful for cross-referencing)
|
|
453
|
+
if (election.timelockOperationId) {
|
|
454
|
+
lines.push(` Timelock Op: ${election.timelockOperationId}`);
|
|
455
|
+
}
|
|
456
|
+
if (election.canProceedToMemberPhase) {
|
|
457
|
+
lines.push("");
|
|
458
|
+
lines.push(" → Ready to trigger member election");
|
|
459
|
+
}
|
|
460
|
+
if (election.canExecuteMember) {
|
|
461
|
+
lines.push("");
|
|
462
|
+
lines.push(" → Ready to execute member election");
|
|
463
|
+
}
|
|
464
|
+
if (election.canCreateElection) {
|
|
465
|
+
lines.push("");
|
|
466
|
+
lines.push(" → Ready to create election");
|
|
467
|
+
}
|
|
468
|
+
lines.push("");
|
|
469
|
+
return lines.join("\n");
|
|
470
|
+
}
|
|
412
471
|
/**
|
|
413
472
|
* Display a tracking result, automatically switching to election display for election proposals.
|
|
414
473
|
* Handles the election auto-switch logic internally, falling back to formatTrackingResult for non-elections.
|
|
474
|
+
*
|
|
475
|
+
* @param result - Tracking result to display
|
|
476
|
+
* @param label - Optional label prefix
|
|
415
477
|
*/
|
|
416
|
-
|
|
417
|
-
if (result.isElection) {
|
|
418
|
-
const
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
console.log(
|
|
426
|
-
console.log(
|
|
427
|
-
console.log(`
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
console.log(`\nElection ID: ${election.nomineeProposalId}`);
|
|
431
|
-
console.log(`\nNominee Phase:`);
|
|
432
|
-
console.log(` State: ${election.nomineeProposalState}`);
|
|
433
|
-
if (election.vettingDeadline) {
|
|
434
|
-
console.log(` Vetting Deadline: block ${election.vettingDeadline}`);
|
|
435
|
-
}
|
|
436
|
-
console.log(` In Vetting Period: ${election.isInVettingPeriod ? "YES" : "NO"}`);
|
|
437
|
-
}
|
|
438
|
-
if (election.memberProposalId) {
|
|
439
|
-
console.log(`\nMember Phase:`);
|
|
440
|
-
console.log(` State: ${election.memberProposalState}`);
|
|
441
|
-
}
|
|
442
|
-
if (election.canProceedToMemberPhase) {
|
|
443
|
-
console.log(`\n→ Ready to trigger member election`);
|
|
478
|
+
function displayTrackingResult(result, label) {
|
|
479
|
+
if (result.isElection && result.electionStatus) {
|
|
480
|
+
const election = result.electionStatus;
|
|
481
|
+
const cohortName = election.cohort === 0 ? "First" : "Second";
|
|
482
|
+
console.log(`=== Election #${election.electionIndex} ===`);
|
|
483
|
+
console.log(`Phase: ${election.phase}`);
|
|
484
|
+
console.log(`Cohort: ${cohortName} (${election.cohort})`);
|
|
485
|
+
console.log(`Compliant Nominees: ${election.compliantNomineeCount}/${election.targetNomineeCount}`);
|
|
486
|
+
if (election.nomineeProposalId) {
|
|
487
|
+
console.log(`\nElection ID: ${election.nomineeProposalId}`);
|
|
488
|
+
console.log(`\nNominee Phase:`);
|
|
489
|
+
console.log(` State: ${election.nomineeProposalState}`);
|
|
490
|
+
if (election.vettingDeadline) {
|
|
491
|
+
console.log(` Vetting Deadline: block ${election.vettingDeadline}`);
|
|
444
492
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
console.log(
|
|
449
|
-
|
|
493
|
+
console.log(` In Vetting Period: ${election.isInVettingPeriod ? "YES" : "NO"}`);
|
|
494
|
+
}
|
|
495
|
+
if (election.memberProposalId) {
|
|
496
|
+
console.log(`\nMember Phase:`);
|
|
497
|
+
console.log(` State: ${election.memberProposalState}`);
|
|
450
498
|
}
|
|
499
|
+
if (election.canProceedToMemberPhase) {
|
|
500
|
+
console.log(`\n→ Ready to trigger member election`);
|
|
501
|
+
}
|
|
502
|
+
if (election.canExecuteMember) {
|
|
503
|
+
console.log(`\n→ Ready to execute member election`);
|
|
504
|
+
}
|
|
505
|
+
console.log("");
|
|
506
|
+
return;
|
|
451
507
|
}
|
|
452
508
|
console.log(formatTrackingResult(result, label));
|
|
453
509
|
}
|
|
@@ -608,27 +664,193 @@ function shortScope(key) {
|
|
|
608
664
|
}
|
|
609
665
|
return key;
|
|
610
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* Check if a checkpoint matches the enabled discovery targets.
|
|
669
|
+
* Used to filter incomplete checkpoints to only re-track types that are enabled.
|
|
670
|
+
*/
|
|
671
|
+
function checkpointMatchesTargets(checkpoint, targets) {
|
|
672
|
+
if (checkpoint.input.type === "governor") {
|
|
673
|
+
const governorAddress = checkpoint.input.governorAddress;
|
|
674
|
+
// Skip election governors - they're handled separately
|
|
675
|
+
if ((0, index_1.isElectionGovernor)(governorAddress))
|
|
676
|
+
return false;
|
|
677
|
+
// Check if constitutional or non-constitutional governor is enabled
|
|
678
|
+
const isCore = (0, index_1.isConstitutional)(governorAddress);
|
|
679
|
+
return isCore ? !!targets.constitutionalGovernor : !!targets.nonConstitutionalGovernor;
|
|
680
|
+
}
|
|
681
|
+
if (checkpoint.input.type === "timelock") {
|
|
682
|
+
// Timelock operations: check if the corresponding timelock target is enabled
|
|
683
|
+
const timelockAddress = checkpoint.input.timelockAddress;
|
|
684
|
+
const isCore = (0, index_1.isConstitutional)(timelockAddress);
|
|
685
|
+
return isCore ? !!targets.l2ConstitutionalTimelock : !!targets.l2NonConstitutionalTimelock;
|
|
686
|
+
}
|
|
687
|
+
if (checkpoint.input.type === "election") {
|
|
688
|
+
return !!targets.electionNomineeGovernor || !!targets.electionMemberGovernor;
|
|
689
|
+
}
|
|
690
|
+
// Discovery checkpoints don't need re-tracking
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Filter checkpoints to only include those matching enabled discovery targets.
|
|
695
|
+
* Used for JSON output and stats to ensure we only show tracked types.
|
|
696
|
+
*/
|
|
697
|
+
function filterCheckpointsByTargets(checkpoints, targets) {
|
|
698
|
+
const filtered = new Map();
|
|
699
|
+
for (const [key, checkpoint] of checkpoints) {
|
|
700
|
+
if (checkpointMatchesTargets(checkpoint, targets)) {
|
|
701
|
+
filtered.set(key, checkpoint);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return filtered;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Calculate stats filtered by enabled discovery targets.
|
|
708
|
+
* Only counts checkpoints that match the enabled governors/timelocks.
|
|
709
|
+
*/
|
|
710
|
+
function calculateFilteredStats(checkpoints, targets, maxErrorCount = 5) {
|
|
711
|
+
let proposalTotal = 0, proposalComplete = 0, proposalActive = 0, proposalErrored = 0;
|
|
712
|
+
let timelockTotal = 0, timelockComplete = 0, timelockActive = 0, timelockErrored = 0;
|
|
713
|
+
let electionTotal = 0, electionComplete = 0;
|
|
714
|
+
for (const [, checkpoint] of checkpoints) {
|
|
715
|
+
const complete = (0, index_1.isCheckpointComplete)(checkpoint);
|
|
716
|
+
const errored = (0, index_1.isCheckpointErrored)(checkpoint, maxErrorCount);
|
|
717
|
+
const inputType = checkpoint.input.type;
|
|
718
|
+
if (inputType === "governor") {
|
|
719
|
+
const governorAddress = checkpoint.input.governorAddress;
|
|
720
|
+
if ((0, index_1.isElectionGovernor)(governorAddress))
|
|
721
|
+
continue;
|
|
722
|
+
const isCore = (0, index_1.isConstitutional)(governorAddress);
|
|
723
|
+
const matchesTarget = isCore
|
|
724
|
+
? !!targets.constitutionalGovernor
|
|
725
|
+
: !!targets.nonConstitutionalGovernor;
|
|
726
|
+
if (!matchesTarget)
|
|
727
|
+
continue;
|
|
728
|
+
proposalTotal++;
|
|
729
|
+
if (complete)
|
|
730
|
+
proposalComplete++;
|
|
731
|
+
else if (errored)
|
|
732
|
+
proposalErrored++;
|
|
733
|
+
else
|
|
734
|
+
proposalActive++;
|
|
735
|
+
}
|
|
736
|
+
else if (inputType === "timelock") {
|
|
737
|
+
const timelockAddress = checkpoint.input.timelockAddress;
|
|
738
|
+
const isCore = (0, index_1.isConstitutional)(timelockAddress);
|
|
739
|
+
const matchesTarget = isCore
|
|
740
|
+
? !!targets.l2ConstitutionalTimelock
|
|
741
|
+
: !!targets.l2NonConstitutionalTimelock;
|
|
742
|
+
if (!matchesTarget)
|
|
743
|
+
continue;
|
|
744
|
+
timelockTotal++;
|
|
745
|
+
if (complete)
|
|
746
|
+
timelockComplete++;
|
|
747
|
+
else if (errored)
|
|
748
|
+
timelockErrored++;
|
|
749
|
+
else
|
|
750
|
+
timelockActive++;
|
|
751
|
+
}
|
|
752
|
+
else if (inputType === "election") {
|
|
753
|
+
// Only count elections if election tracking is enabled
|
|
754
|
+
if (!targets.electionNomineeGovernor && !targets.electionMemberGovernor)
|
|
755
|
+
continue;
|
|
756
|
+
electionTotal++;
|
|
757
|
+
if (complete)
|
|
758
|
+
electionComplete++;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return {
|
|
762
|
+
total: proposalTotal + timelockTotal + electionTotal,
|
|
763
|
+
proposals: {
|
|
764
|
+
total: proposalTotal,
|
|
765
|
+
complete: proposalComplete,
|
|
766
|
+
active: proposalActive,
|
|
767
|
+
errored: proposalErrored,
|
|
768
|
+
},
|
|
769
|
+
timelocks: {
|
|
770
|
+
total: timelockTotal,
|
|
771
|
+
complete: timelockComplete,
|
|
772
|
+
active: timelockActive,
|
|
773
|
+
errored: timelockErrored,
|
|
774
|
+
},
|
|
775
|
+
elections: { total: electionTotal, complete: electionComplete },
|
|
776
|
+
};
|
|
777
|
+
}
|
|
611
778
|
async function runMonitorCycle(tracker, providers, options = {}) {
|
|
779
|
+
const result = { tracked: 0, prepared: 0, errors: 0, retracked: 0 };
|
|
780
|
+
// Fast path: elections-only mode skips discovery entirely
|
|
781
|
+
if (options.electionsOnly) {
|
|
782
|
+
const elections = [];
|
|
783
|
+
if (!isShuttingDown()) {
|
|
784
|
+
try {
|
|
785
|
+
// Use tracker's cached method - completed elections use cache (0 RPC calls)
|
|
786
|
+
// Use forceElections to bypass cache when --force is specified
|
|
787
|
+
const allElections = await tracker.trackAllElections({ force: options.forceElections });
|
|
788
|
+
for (const electionStatus of allElections) {
|
|
789
|
+
elections.push(electionStatus);
|
|
790
|
+
// Print each election
|
|
791
|
+
console.log(formatElectionResult(electionStatus));
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
catch (err) {
|
|
795
|
+
console.error("Election tracking failed:", err);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return {
|
|
799
|
+
result,
|
|
800
|
+
proposals: [],
|
|
801
|
+
timelockOps: [],
|
|
802
|
+
watermarks: {},
|
|
803
|
+
elections,
|
|
804
|
+
};
|
|
805
|
+
}
|
|
612
806
|
const l2Provider = providers.l2Provider;
|
|
613
807
|
const tipBlock = await l2Provider.getBlockNumber();
|
|
614
808
|
const blockLag = options.blockLag ?? exports.DEFAULT_BLOCK_LAG;
|
|
615
809
|
const currentBlock = Math.max(0, tipBlock - blockLag);
|
|
616
810
|
const concurrency = options.concurrency ?? 1;
|
|
617
811
|
const limit = (0, concurrency_1.pLimit)(concurrency);
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
812
|
+
const maxAgeDays = options.maxAgeDays ?? exports.DEFAULT_MAX_AGE_DAYS;
|
|
813
|
+
// Calculate startBlock based on maxAgeDays if not explicitly provided
|
|
814
|
+
// ~7200 blocks per day on Arbitrum (12s block time on L1, ~250ms on L2)
|
|
815
|
+
const BLOCKS_PER_DAY = 86400 / 0.25; // ~345,600 blocks/day on Arbitrum One
|
|
816
|
+
let startBlockWatermarks;
|
|
817
|
+
// Load existing watermarks to determine scan range
|
|
818
|
+
const loadedWatermarks = await tracker.loadWatermarks();
|
|
819
|
+
const hasWatermarks = Object.values(loadedWatermarks.watermarks).some((v) => v !== undefined);
|
|
820
|
+
if (options.startBlock !== undefined) {
|
|
821
|
+
// Explicit startBlock override (watermarks are exclusive, so subtract 1)
|
|
822
|
+
startBlockWatermarks = {
|
|
621
823
|
constitutionalGovernor: options.startBlock - 1,
|
|
622
824
|
nonConstitutionalGovernor: options.startBlock - 1,
|
|
623
825
|
electionNomineeGovernor: options.startBlock - 1,
|
|
624
826
|
electionMemberGovernor: options.startBlock - 1,
|
|
625
827
|
l2ConstitutionalTimelock: options.startBlock - 1,
|
|
626
828
|
l2NonConstitutionalTimelock: options.startBlock - 1,
|
|
627
|
-
}
|
|
628
|
-
:
|
|
829
|
+
};
|
|
830
|
+
console.log(`Discovery: blocks ${options.startBlock} → ${currentBlock}`);
|
|
831
|
+
}
|
|
832
|
+
else if (!hasWatermarks) {
|
|
833
|
+
// No cache - calculate start block from maxAgeDays
|
|
834
|
+
const defaultStartBlock = Math.max(0, currentBlock - Math.floor(maxAgeDays * BLOCKS_PER_DAY));
|
|
835
|
+
startBlockWatermarks = {
|
|
836
|
+
constitutionalGovernor: defaultStartBlock,
|
|
837
|
+
nonConstitutionalGovernor: defaultStartBlock,
|
|
838
|
+
electionNomineeGovernor: defaultStartBlock,
|
|
839
|
+
electionMemberGovernor: defaultStartBlock,
|
|
840
|
+
l2ConstitutionalTimelock: defaultStartBlock,
|
|
841
|
+
l2NonConstitutionalTimelock: defaultStartBlock,
|
|
842
|
+
};
|
|
843
|
+
console.log(`No cached watermarks. Discovery: blocks ${defaultStartBlock} → ${currentBlock} (~${maxAgeDays} days)`);
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
// Cached watermarks exist - calculate effective range from min watermark
|
|
847
|
+
const watermarkBlocks = Object.values(loadedWatermarks.watermarks).filter((v) => v !== undefined);
|
|
848
|
+
const minWatermark = Math.min(...watermarkBlocks);
|
|
849
|
+
const blockRange = currentBlock - minWatermark;
|
|
850
|
+
console.log(`Discovery: blocks ${minWatermark} → ${currentBlock} (${blockRange.toLocaleString()} blocks)`);
|
|
851
|
+
}
|
|
629
852
|
const targets = options.targets ?? (0, index_1.buildDefaultTargets)();
|
|
630
853
|
const discoveryResult = await tracker.discoverAll(targets, currentBlock, startBlockWatermarks);
|
|
631
|
-
const result = { tracked: 0, prepared: 0, errors: 0, retracked: 0 };
|
|
632
854
|
const trackedKeys = new Set();
|
|
633
855
|
const trackedOperationIds = new Set();
|
|
634
856
|
async function track(key, trackFn) {
|
|
@@ -682,7 +904,6 @@ async function runMonitorCycle(tracker, providers, options = {}) {
|
|
|
682
904
|
});
|
|
683
905
|
}
|
|
684
906
|
// Query incomplete checkpoints first to avoid duplicate tracking
|
|
685
|
-
const maxAgeDays = options.maxAgeDays ?? exports.DEFAULT_MAX_AGE_DAYS;
|
|
686
907
|
const incompleteCheckpoints = await tracker.queryIncompleteCheckpoints({
|
|
687
908
|
maxAgeDays,
|
|
688
909
|
maxErrorCount: exports.MAX_CONSECUTIVE_ERRORS,
|
|
@@ -713,14 +934,10 @@ async function runMonitorCycle(tracker, providers, options = {}) {
|
|
|
713
934
|
},
|
|
714
935
|
});
|
|
715
936
|
}
|
|
716
|
-
// 1b. Incomplete
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
return true;
|
|
721
|
-
});
|
|
722
|
-
result.retracked = nonElectionCheckpoints.length;
|
|
723
|
-
for (const { key, checkpoint } of nonElectionCheckpoints) {
|
|
937
|
+
// 1b. Incomplete checkpoints to re-track (filtered by enabled targets)
|
|
938
|
+
const targetMatchingCheckpoints = incompleteCheckpoints.filter(({ checkpoint }) => checkpointMatchesTargets(checkpoint, targets));
|
|
939
|
+
result.retracked = targetMatchingCheckpoints.length;
|
|
940
|
+
for (const { key, checkpoint } of targetMatchingCheckpoints) {
|
|
724
941
|
if (checkpoint.input.type === "governor") {
|
|
725
942
|
proposalTasks.push({
|
|
726
943
|
key,
|
|
@@ -758,7 +975,7 @@ async function runMonitorCycle(tracker, providers, options = {}) {
|
|
|
758
975
|
});
|
|
759
976
|
}
|
|
760
977
|
// 2b. Incomplete timelock checkpoints to re-track
|
|
761
|
-
for (const { key, checkpoint } of
|
|
978
|
+
for (const { key, checkpoint } of targetMatchingCheckpoints) {
|
|
762
979
|
if (checkpoint.input.type === "timelock") {
|
|
763
980
|
const operationId = checkpoint.input.operationId;
|
|
764
981
|
// Skip if already tracked via proposal
|
|
@@ -774,15 +991,15 @@ async function runMonitorCycle(tracker, providers, options = {}) {
|
|
|
774
991
|
}
|
|
775
992
|
// Run timelock tasks
|
|
776
993
|
await Promise.all(timelockTasks.map((task) => limit(() => track(task.key, task.fn))));
|
|
777
|
-
// Phase 3: Track elections
|
|
778
|
-
// This tracks all elections and stores their status in the cache
|
|
994
|
+
// Phase 3: Track elections (only if election targets are enabled)
|
|
779
995
|
const elections = [];
|
|
780
|
-
|
|
996
|
+
const shouldTrackElections = targets.electionNomineeGovernor || targets.electionMemberGovernor;
|
|
997
|
+
if (shouldTrackElections && !isShuttingDown()) {
|
|
781
998
|
try {
|
|
782
|
-
|
|
999
|
+
// Use tracker's cached method - completed elections use cache (0 RPC calls)
|
|
1000
|
+
const allElections = await tracker.trackAllElections({ force: options.forceElections });
|
|
783
1001
|
for (const electionStatus of allElections) {
|
|
784
1002
|
elections.push(electionStatus);
|
|
785
|
-
await tracker.saveElectionCheckpoint(electionStatus);
|
|
786
1003
|
}
|
|
787
1004
|
}
|
|
788
1005
|
catch (err) {
|