Skip to content

fix(watchdog): address PR review on metrics and devnet stack#25

Merged
stephenctw merged 2 commits into
mainfrom
feat/watchdog-tick-metrics-file
Jul 16, 2026
Merged

fix(watchdog): address PR review on metrics and devnet stack#25
stephenctw merged 2 commits into
mainfrom
feat/watchdog-tick-metrics-file

Conversation

@stephenctw

Copy link
Copy Markdown
Collaborator

Resolve chain id at init (persist from eth_chainId) so tick exit never blocks on RPC. Return nil,err from resolve_path; drop dead timestamp; clear stale status.prom in divergence drill. Observe Anvil + sequencer in devnet-for-watchdog; fix doc label order.

Resolve chain id at init (persist from eth_chainId) so tick exit never
blocks on RPC. Return nil,err from resolve_path; drop dead timestamp;
clear stale status.prom in divergence drill. Observe Anvil + sequencer in
devnet-for-watchdog; fix doc label order.
@stephenctw
stephenctw requested a review from GCdePaula July 16, 2026 11:13
@stephenctw stephenctw self-assigned this Jul 16, 2026
GCdePaula
GCdePaula previously approved these changes Jul 16, 2026

@GCdePaula GCdePaula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR, addresses everything I commented!

A few remarks.


The fix updated README.md and operator-deployment.md but missed getting-started.md, which still describes the old tick-time behavior:

docs/watchdog/getting-started.md:178 — the env table row:

CARTESI_WATCHDOG_BLOCKCHAIN_ID | init / tick | Chain id label for status.prom; also read at tick from env or eth_chainId when unset

The "read at tick from ... eth_chainId when unset" is no longer true, tick never queries eth_chainId now.


docs/watchdog/getting-started.md:199 — the troubleshooting row:

chain="unknown" … | Export CARTESI_WATCHDOG_BLOCKCHAIN_ID before init, or rely on tick-time eth_chainId from the L1 RPC

Should say init-time, and note that auto-detect needs CARTESI_WATCHDOG_BLOCKCHAIN_HTTP_ENDPOINT present at init.

This second point is a real behavioral nuance worth a sentence: README.md:171 still frames the L1 endpoint as "intentionally read at tick time, not persisted." Auto-detection now also reads it at init — so an operator who exports the endpoint only for tick (per that framing) will silently get chain="unknown". Setting BLOCKCHAIN_ID explicitly remains the reliable path; just worth making the docs consistent.

Comment thread watchdog/main.lua Outdated
end

local rpc_factory = deps and deps.rpc_factory or nil
if type(deps) == "table" and type(deps.rpc) == "table" and type(deps.rpc.get_chain_id) == "function" then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve_init_blockchain_id has both a deps.rpc branch and a deps.rpc_factory path, but production init uses default_machine_deps (no .rpc) and the tests use rpc_factory, so the deps.rpc branch is never exercised.

Harmless, slightly redundant, could drop it, or keep as defensive.

Comment thread tests/e2e/src/bin/devnet_stack.rs Outdated
eprintln!();
eprintln!("=== sequencer exited unexpectedly ({status}) ===");
eprintln!("=== {label} exited unexpectedly ({status}) ===");
eprintln!("Sequencer log: {}", log_path.display());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

report_child_exit always prints "Sequencer log:" and tails the sequencer log even when Anvil is the child that died. The "Other logs under: .../devnet-stack-*" hint still points at the anvil log, so it's just a mild UX gap, for an Anvil exit the tailed lines will be the sequencer's (probably just connection errors).

Drop unused deps.rpc init path; tail the dying child's log (Anvil vs
sequencer). Correct getting-started/README/operator docs: chain id is
resolved at init, not via tick-time eth_chainId.
@stephenctw
stephenctw force-pushed the feat/watchdog-tick-metrics-file branch from 678a00c to 9d637a6 Compare July 16, 2026 13:19
@stephenctw
stephenctw requested a review from GCdePaula July 16, 2026 13:20

@GCdePaula GCdePaula left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@stephenctw
stephenctw merged commit 6dc4f59 into main Jul 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants