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

feat(contracts): Refactor dependency routing to ensure seamless usability from importer contract repos #1163

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ethenotethan
Copy link
Contributor

@ethenotethan ethenotethan commented Jan 26, 2025

Why are these changes needed?

To Ensures contracts can be publicly hosted in a way that's cross compatible with foundry and hardhat projects when imported. Currently this was tested/validating using nitro-contracts. Also to Introduce some level of release mgmt to our contracts.

Changes

  • Added yarn as a dependency to our contracts for version mgmt
  • Refactored all submodule import paths to raw file schema
  • Reworked remappings.txt to not alias submodule dependencies
  • Set OZ dependencies as JS ones since referencing via submodule imports would cause type collisions with other submodules with OZ in nested dependency graph (e.g, eigenlayer-middleware importing @open-zeppelin/ERC20)
  • Called out some hygiene todos in test-contracts CI
  • Modified test-contracts CI job to install JS/yarn dependencies as prequisite before running tests

Follow up todo(s):

  • Build automation or framework for performing contract releases

Methodology

Played around with hosting the contracts via npm directly from the monorepo. The main issue that was causing dependency conflicts in rollup contract repos that utilize hybrid foundry x hardhat was that foundry uses a remapping.txt to provide shortcut aliasing for dependency contract paths. Hardhat doesn't acknowledge this however unless you use the hardhat x foundry plugin which requires careful re-articulation of each rollup contract repo's yarn dependency graph. This isn't particular pretty but it does remove the need to manually manage https://github.com/Layr-Labs/eigenda-utils/ while providing some level of version management for our contracts. Opening for discussion if this is something we'd wanna pursue and if so will continue to clean up. We should ideally be cutting release for our contracts in-accordance to when we perform on-chain upgrades or make key updates to the verification utils / blob verifier. The new npm library can be found here with reference usage here in nitro-contracts.

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@ethenotethan ethenotethan changed the title experiment: Refactor contracts be compatible for foundry x hardhat co… experiment: Refactor contracts be compatible for cross-env compatibility (hardhat, foundry) when imported Jan 26, 2025
@ethenotethan ethenotethan marked this pull request as ready for review January 28, 2025 00:52
@ethenotethan ethenotethan changed the title experiment: Refactor contracts be compatible for cross-env compatibility (hardhat, foundry) when imported feat(contracts): Refactor dependency routing to ensure seamless usability from forked contract repos Jan 28, 2025
@ethenotethan ethenotethan changed the title feat(contracts): Refactor dependency routing to ensure seamless usability from forked contract repos feat(contracts): Refactor dependency routing to ensure seamless usability from importer contract repos Jan 28, 2025
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.

1 participant