Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmd): Use JSON for pretty-printing events/results #74

Merged
merged 1 commit into from May 12, 2023

Conversation

kostko
Copy link
Member

@kostko kostko commented May 12, 2023

YAML uses a very verbose notation for printing byte arrays which are quite common in our data structures. Until we have proper pretty printing implementations for event/result structures, JSON produces nicer output.

Previous output:

...
=== Result of transaction 0 ===
Status: ok
Data:
  - 161
  - 98
  - 111
  - 107
  - 162
  - 100
  - 100
...
  - 197
  - 0
  - 0
  - 0
  - 0
  - 0
  - 0
  - 0

=== Events emitted by transaction 0 ===
Events: 2

  --- Event 0 ---
  Module: core
  Code:   1
  Data:
    - amount: 83625

  --- Event 1 ---
  Module: evm
  Code:   1
  Data:
    - address:
      - 252
      - 26
      - 219
      - 227
      - 133
      - 240
...

New output:

...
=== Result of transaction 0 ===
Status: ok
Data:
  "a1626f6ba2646461746155ee2dc55c7b823a0b2cf86eadd74e8d852030872c85656e6f6e63654f000000000011e1c500000000000000"

=== Events emitted by transaction 0 ===
Events: 2

  --- Event 0 ---
  Module: core
  Code:   1
  Data:
    [
      {
        "amount": 83625
      }
    ]

  --- Event 1 ---
  Module: evm
  Code:   1
  Data:
    [
      {
        "address": "fc1adbe385f0bd561d1d53c5a68891dee07efd17",
        "data": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002050726f6f66206f662063726f73732d636861696e20616e7943616c6c206d7367",
        "topics": [
          "398815baeb0820d3e2c52be1de829fc597863cd6cce7d84c712074b5027bc175"
        ]
      },
      {
        "address": "33c80d5492b04bfb94f2757fca88a2d7f49211e6",
        "data": "000000000000000000000000f13f0b44a46238ed3c127ea90a5a6d042ee4f60600000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000061000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002050726f6f66206f662063726f73732d636861696e20616e7943616c6c206d736700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "topics": [
          "17dac14bf31c4070ebb2dc182fc25ae5df58f14162a7f24a65b103e22385af0d",
          "000000000000000000000000fc1adbe385f0bd561d1d53c5a68891dee07efd17"
        ]
      }
    ]

@kostko kostko requested a review from matevz May 12, 2023 09:30
cmd/inspect/block.go Outdated Show resolved Hide resolved
YAML uses a very verbose notation for printing byte arrays which are
quite common in our data structures. Until we have proper pretty
printing implementations for event/result structures, JSON produces
nicer output.
@kostko kostko force-pushed the kostko/fix/inspect-block-json branch from 27c46a5 to b4216ec Compare May 12, 2023 10:12
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Awesome! I also tested reviewing Cipher blocks and everything works as expected!

@kostko kostko merged commit 7889fa6 into master May 12, 2023
2 checks passed
@kostko kostko deleted the kostko/fix/inspect-block-json branch May 12, 2023 16:45
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.

None yet

2 participants