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

ABI dir fixes #2003

Merged
merged 37 commits into from
Jul 11, 2023
Merged

ABI dir fixes #2003

merged 37 commits into from
Jul 11, 2023

Conversation

istankovic
Copy link
Contributor

@istankovic istankovic commented Jun 30, 2023

This PR fixes the current situation with ABI handling (i.e. not using the specfied ABI dir at all and instead relying on contracts/.build). A major change was to move beamer.deploy.artifacts one level up, which required extensive preparation itself. This was necessary due to a headache of circular imports between beamer.deploy.artifacts, beamer.deploy.util and beamer.contracts, the latter being in need of deployment information if it is to do anything useful. Also, it just makes sense on its own because other components need access to artifacts too.

Once this was done, things became somewhat easier, especially proceeding with beamer.contract changes now. Scripts and commands have been updated to make use of the ABI dir, but also the entire code-base was switched to use the new artifacts APIs. In turn, this allowed us to simplify and remove some of the code in beamer.contracts that has now become obsolete.

Summary of the changes

  • use the newly-introduced ABIManager API across the codebase
  • use the new artifacts API wherever appropriate
  • remove old facilities for loading ABI files and deployment artifacts
  • make beamer config, beamer deploy and beamer deploy-base commands handle ABI dir correctly
  • fix fallout in scripts and tests

Closes: #1975

@istankovic istankovic force-pushed the config-commands-abi branch 9 times, most recently from d73621e to e6298ed Compare July 7, 2023 14:55
@istankovic istankovic marked this pull request as ready for review July 7, 2023 15:24
@istankovic istankovic requested review from bilbeyt and fredo July 7, 2023 15:24
beamer/deploy/commands.py Outdated Show resolved Hide resolved
beamer/artifacts.py Outdated Show resolved Hide resolved
beamer/contracts.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@bilbeyt bilbeyt left a comment

Choose a reason for hiding this comment

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

Generally looking really good with some small things.

Ivan Stanković added 23 commits July 11, 2023 10:56
This provides contract ABI and bytecode in a lazy manner, i.e. it reads
each ABI file only once, upon first request, and stores the loaded data
in its cache.
This is in preparation to remove load_contract_abi.
This is used to collect all artifacts under the given artifacts dir into
a mapping keyed by the chain ID.
Useful to avoid repeating the same computation in several places.
This is in preparation for the move of that function to the util module.
Instead, move it to the agent, where it belongs.
Also allow for already existing artifacts and ABI dirs.
This code is no longer needed since we switched to the new artifacts and
ABI handling API.
Instead use the ABI manager and the newly added helper in beamer.artifacts.
@istankovic istankovic requested a review from bilbeyt July 11, 2023 09:49
Copy link
Contributor

@bilbeyt bilbeyt left a comment

Choose a reason for hiding this comment

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

LGTM!

@istankovic istankovic merged commit 084a636 into main Jul 11, 2023
1 check passed
@istankovic istankovic deleted the config-commands-abi branch July 11, 2023 12:12
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.

Make config commands and deployment commands use specified ABI dir
3 participants