feat(cli): add contract diagnostic tool for direct on-chain inspection#765
Draft
vfusco wants to merge 1 commit intofix/advancer-snapshot-syncfrom
Draft
feat(cli): add contract diagnostic tool for direct on-chain inspection#765vfusco wants to merge 1 commit intofix/advancer-snapshot-syncfrom
vfusco wants to merge 1 commit intofix/advancer-snapshot-syncfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an experimental, read-only contract diagnostics subtree to cartesi-rollups-cli that inspects Cartesi Rollups contracts directly via RPC (eth_call / eth_getLogs), plus supporting utilities and bindings.
Changes:
- Introduces
cartesi-rollups-cli contract ...with subcommands for application/consensus/inputbox/tournament/epoch/summary/output/commitment/match inspection. - Adds JSON-RPC error extraction + revert-selector matching utilities and reuses them in PRT tournament handling.
- Extends generated contract bindings to include
IAuthorityandIQuorum.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ethutil/rpcerror.go | Adds JSON-RPC error info extraction and selector-matching helpers. |
| pkg/contracts/iquorum/iquorum.go | New generated Go binding for IQuorum. |
| pkg/contracts/iauthority/iauthority.go | New generated Go binding for IAuthority. |
| pkg/contracts/generate/main.go | Updates binding generator to include IAuthority and IQuorum. |
| internal/prt/util.go | Re-exports JSON-RPC error helpers from pkg/ethutil for backward compatibility. |
| internal/prt/itournament_adapter.go | Uses shared JSON-RPC error helpers and selector matching for “no winner” revert detection. |
| cmd/cartesi-rollups-cli/root/root.go | Registers new contract command under the CLI root. |
| cmd/cartesi-rollups-cli/root/contract/contract.go | Implements contract parent command, shared RPC client setup, consensus detection, and common helpers. |
| cmd/cartesi-rollups-cli/root/contract/types.go | Defines JSON output types for all contract subcommands. |
| cmd/cartesi-rollups-cli/root/contract/app.go | Implements contract app (IApplication inspection + JSON/text output). |
| cmd/cartesi-rollups-cli/root/contract/consensus.go | Implements contract consensus (auto-detect Authority/Quorum/DaveConsensus). |
| cmd/cartesi-rollups-cli/root/contract/inputbox.go | Implements contract inputbox (discover + query InputBox). |
| cmd/cartesi-rollups-cli/root/contract/tournament.go | Implements contract tournament (tournament state, events, and optional tree traversal). |
| cmd/cartesi-rollups-cli/root/contract/epoch.go | Implements contract epoch (event-based epoch/claim history across consensus types). |
| cmd/cartesi-rollups-cli/root/contract/summary.go | Implements contract summary (parallel snapshot across app/consensus/inputbox/tournament). |
| cmd/cartesi-rollups-cli/root/contract/output.go | Implements contract output (output execution checks). |
| cmd/cartesi-rollups-cli/root/contract/commitment.go | Implements contract commitment (commitment state lookup in current tournament). |
| cmd/cartesi-rollups-cli/root/contract/match.go | Implements contract match (match state + commitment discovery via events). |
| cmd/cartesi-rollups-cli/root/contract/selectors.go | Defines selector constants and sentinel errors used by the tool. |
| cmd/cartesi-rollups-cli/root/contract/format.go | Adds formatting + text-output helper primitives. |
| cmd/cartesi-rollups-cli/root/contract/contract_test.go | Unit tests for shared helpers (safeUint64/parseBlockFlag/validateHash/consensusType). |
| cmd/cartesi-rollups-cli/root/contract/format_test.go | Unit tests for formatting and printer output. |
| cmd/cartesi-rollups-cli/root/contract/epoch_test.go | Unit tests for epoch history helpers (block range + merge). |
| cmd/cartesi-rollups-cli/root/contract/tournament_test.go | Unit tests for tournament event formatting and commitment registry resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e167f61 to
66f4738
Compare
Read-only CLI tool that queries Ethereum contracts directly via eth_call and eth_getLogs — no database required. Nine subcommands: summary, app, consensus, inputbox, tournament, epoch, output, commitment, match. Auto-discovers contract tree from application address, detects consensus type via ERC-165, uses FindTransitions for efficient event discovery, and supports --tree for recursive tournament traversal.
66f4738 to
8e20357
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Read-only CLI tool that queries Ethereum contracts directly via eth_call
and eth_getLogs — no database required.
Nine subcommands: summary, app, consensus, inputbox, tournament, epoch,
output, commitment, match. Auto-discovers contract tree from application
address, detects consensus type via ERC-165, uses FindTransitions for
efficient event discovery, and supports --tree for recursive tournament
traversal.