Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add an experimental layout command #101

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Add an experimental layout command #101

wants to merge 10 commits into from

Conversation

sz-piotr
Copy link
Member

@sz-piotr sz-piotr commented Nov 28, 2023

This PR adds a layout command. This command downloads sources from Etherscan and compiles them with solc to get the storage layout. Then it removes indirection and recursion from the layout, flattens the layout and finally combines it with the layouts of other implementations to get a unified view of the storage.

This is experimental functionality. While there are tests some edge cases surely exist. There is also the issue of compiler versions. Currently the installed version of solc is used, but that should be changed to a dynamic version based on the sources.

Try it with the following command for the zkSync diamond:

ts-node src/cli.ts layout ethereum 0x32400084C286CF3E17e7B677ea9583e60a000324 0xa389bf185b301c8e20e79e3098e71399914035df 0x91ca046dad8c3db41f296267e1720d9c940f613d 0x2ea0cfb9c942058ee5a84411ef2e37c6de5bfe5c 0x7ed066718dfb1b2b04d94780eca92b67ecf3330b 0xc796a402e1b26ecd2cd38f23e05a2f904504ec89 0x389a081bcf20e5803288183b929f08458f1d863d 0xb91d905a698c28b73c61af60c63919b754fcf4de 0xdc7c3d03845efe2c4a9e758a70a68ba6bba9fac4 0x5349e94435cc9cab9ffb40a492da46935052733a 0x9b1a10bdc4a40219544c835263b2ca3f3e689693 0xa7e8a8f71c3cc43946601cc99997f8cd6828a9b9 0x98e900eb2e5fde9786f736e86d6bfbfdb3e4683b 0x62aa95ac4740a367746a664c4c69034d52e968ef 0x16615a85b451edfb6fcbea0b34405d9c7ca1a22a 0xb2097dbe4410b538a45574b1fcd767e2303c7867 0xc48d496459e1358d055a79173bea41efb7449028

Copy link

changeset-bot bot commented Nov 28, 2023

⚠️ No Changeset found

Latest commit: 0da27c2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sz-piotr sz-piotr marked this pull request as draft November 28, 2023 16:30
@sz-piotr sz-piotr marked this pull request as ready for review December 1, 2023 11:10
Copy link
Contributor

@mateuszradomski mateuszradomski left a comment

Choose a reason for hiding this comment

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

lgtm, just one suggestion

await runLayout(etherscanClient, config.layout.addresses, logger)
}

async function runLayout(
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about making this function return the results (the layout variable) and the function above can save them. This would allow us to later export this runLayout and use the results without having to interface with the filesystem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants