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(--gas-report): add back signatures, even if empty, avoid nesting multiple selectors #9229

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

zerosnacks
Copy link
Member

Motivation

Per feedback: #9216 (comment)

I had originally not included the empty signature as it differs from the regular --gas-report Markdown output

Solution

Looks as follows after passing through | jq:

It does not render pretty formatted in the terminal by itself

[
  {
    "contract": "src/Contracts.sol:ContractOne",
    "deployment": {
      "gas": 103375,
      "size": 255
    },
    "functions": {
      "foo()": {
        "calls": 1,
        "min": 45387,
        "mean": 45387,
        "median": 45387,
        "max": 45387
      }
    }
  },
  {
    "contract": "src/Contracts.sol:ContractThree",
    "deployment": {
      "gas": 103591,
      "size": 256
    },
    "functions": {
      "baz()": {
        "calls": 1,
        "min": 260712,
        "mean": 260712,
        "median": 260712,
        "max": 260712
      }
    }
  },
  {
    "contract": "src/Contracts.sol:ContractTwo",
    "deployment": {
      "gas": 103375,
      "size": 255
    },
    "functions": {
      "bar()": {
        "calls": 1,
        "min": 64984,
        "mean": 64984,
        "median": 64984,
        "max": 64984
      }
    }
  }
]
[
  {
    "contract": "src/Counter.sol:Counter",
    "deployment": {
      "gas": 101137,
      "size": 250
    },
    "functions": {
      "a()": {
        "calls": 1,
        "min": 2261,
        "mean": 2261,
        "median": 2261,
        "max": 2261
      },
      "b()": {
        "calls": 1,
        "min": 2305,
        "mean": 2305,
        "median": 2305,
        "max": 2305
      },
      "setNumber(int256)": {
        "calls": 2,
        "min": 23648,
        "mean": 33604,
        "median": 33604,
        "max": 43560
      },
      "setNumber(uint256)": {
        "calls": 2,
        "min": 23604,
        "mean": 33560,
        "median": 33560,
        "max": 43516
      }
    }
  }
]

@zerosnacks
Copy link
Member Author

zerosnacks commented Oct 30, 2024

Hi @sakulstra, addressed your feedback in #9216 (comment)

Please have a look if this format is in line with your request

@sakulstra
Copy link
Contributor

@zerosnacks thanks that seems perfect to me 👍

Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

lgtm

@DaniPopes DaniPopes removed the T-blocked Type: blocked label Oct 30, 2024
@zerosnacks zerosnacks enabled auto-merge (squash) October 30, 2024 10:22
@zerosnacks zerosnacks merged commit 748af79 into master Oct 30, 2024
21 checks passed
@zerosnacks zerosnacks deleted the zerosnacks/gas-report-json-signatures branch October 30, 2024 10:29
rplusq pushed a commit to rplusq/foundry that referenced this pull request Nov 29, 2024
…g multiple selectors (foundry-rs#9229)

* add back signatures, even if empty, flatten multiple selectors per feedback foundry-rs#9216 (comment)

* avoid manually serializing `gas_info`, already implements serialize
@grandizzy grandizzy added T-bug Type: bug C-forge Command: forge labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge T-bug Type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants