Skip to content

Conversation

@casks-mutters
Copy link
Owner

Summary

app.py currently prints results in a human-readable format only. For scripting, automation, CI pipelines, dashboards, or data ingestion, it would be extremely helpful to have a JSON output option.

This PR adds a --json flag so callers can request structured output describing:

  • the slot value at block A
  • the slot value at block B
  • whether they differ
  • the pair commitment emitted
  • all arguments (address, slot, block numbers)

Proposed Changes

  • Add a --json boolean flag to argparse.
  • After computing:
    • value_a
    • value_b
    • the hex commitment (pair_hex)
  • If --json is set:
    • print a JSON object with keys:
      • address
      • slot
      • block_a
      • block_b
      • value_a
      • value_b
      • changed (bool)
      • commitment_hex
    • then exit without printing the human-readable summary.

Example Output

{
  "address": "0x1234...",
  "slot": "0x0",
  "block_a": 18000000,
  "block_b": 18000010,
  "value_a": "0x0000...",
  "value_b": "0x0000...",
  "changed": false,
  "commitment_hex": "0xabc123..."
}

## Summary

`app.py` currently prints results in a human-readable format only.  
For scripting, automation, CI pipelines, dashboards, or data ingestion, it would be extremely helpful to have a JSON output option.

This PR adds a `--json` flag so callers can request structured output describing:

- the slot value at block A  
- the slot value at block B  
- whether they differ  
- the pair commitment emitted  
- all arguments (address, slot, block numbers)

## Proposed Changes

- Add a `--json` boolean flag to `argparse`.
- After computing:
  - `value_a`
  - `value_b`
  - the hex commitment (`pair_hex`)
- If `--json` is set:
  - print a JSON object with keys:
    - `address`
    - `slot`
    - `block_a`
    - `block_b`
    - `value_a`
    - `value_b`
    - `changed` (bool)
    - `commitment_hex`
  - then exit without printing the human-readable summary.

## Example Output

```json
{
  "address": "0x1234...",
  "slot": "0x0",
  "block_a": 18000000,
  "block_b": 18000010,
  "value_a": "0x0000...",
  "value_b": "0x0000...",
  "changed": false,
  "commitment_hex": "0xabc123..."
}
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