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: config storage-layout to output in json #178

Conversation

baroooo
Copy link

@baroooo baroooo commented Dec 6, 2024

After latest updates, forge requires a --json flag to output storage layout in json format. Without this flag, forge inspect ${contract} storage-layout returns a formated txt that looks like this which can not be parsed as JSON:

╭---------------------+--------------------------------------------------+------+--------+-------+----------------------------------╮
| Name                | Type                                             | Slot | Offset | Bytes | Contract                         |
+===================================================================================================================================+
| initialized         | bool                                             | 0    | 0      | 1     | contracts/swap/Broker.sol:Broker |
|---------------------+--------------------------------------------------+------+--------+-------+----------------------------------|
| _owner              | address                                          | 0    | 1      | 20    | contracts/swap/Broker.sol:Broker |
|---------------------+--------------------------------------------------+------+--------+-------+----------------------------------|
| _status             | uint256                                          | 1    | 0      | 32    | contracts/swap/Broker.sol:Broker |
╰---------------------+--------------------------------------------------+------+--------+-------+----------------------------------╯

This was causing foundry-storage-check to error out with
SyntaxError: Unexpected token '╭', " ╭---------"... is not valid JSON when run on any contract.
https://github.com/mento-protocol/mento-core/actions/runs/12198857654/job/34031496550

This PR aims to fix this issue by forcing forge inspect to return a json output using the --json flag

@baroooo
Copy link
Author

baroooo commented Dec 6, 2024

@Rubilmax

@Rubilmax
Copy link
Owner

Rubilmax commented Dec 6, 2024

Thanks a lot! Checking just now

@Rubilmax
Copy link
Owner

Rubilmax commented Dec 6, 2024

Could not merge your PR as I needed to include the js release. Included in 073eec3, thanks a lot!

Will update latest tag asap

@Rubilmax Rubilmax closed this Dec 6, 2024
baroooo added a commit to mento-protocol/mento-core that referenced this pull request Dec 16, 2024
### Description

Storage layout check GH action is failing because of the issue described
here:
Rubilmax/foundry-storage-check#178

This PR updates the action to the latest release that includes a fix for
this issue

### Other changes

Uses official foundry toolchain and newer versions of checkout and
setup-node actions

### Tested

https://github.com/mento-protocol/mento-core/actions/runs/12201703113
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