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: add deterministic, multi-layer deployment script #1303

Closed
wants to merge 40 commits into from

Conversation

Thegaram
Copy link
Contributor

@Thegaram Thegaram commented Apr 25, 2024

Purpose or design rationale of this PR

Problem: The current deployment scripts are slow and error-prone. We need to predict the deployment addresses of some contracts (e.g. for preallocating funds to L2ScrollMessenger in L2 genesis), but currently the addresses depend on the deployer private key and the order of deployment. If one transaction fails, subsequent transactions will lead to different addresses.

Solution:

  • Use https://github.com/Arachnid/deterministic-deployment-proxy to make contract addresses much more predictable.
  • Use a single Foundry script for deployment and initialization on L1 and L2 (basically merge the previous 5 scripts).
  • Move genesis generation into the Fundry script. Previously this was a complex combination of Javascript, Rush, and bash scripts.
  • Provide convenient Docker images. This makes deployment much more robust (we enforce a fixed Foundry version known to be working), and fast (compilation done in the build phase, no need to recompile when running the container).
  • Use a TOML configuration file.

Caveats:

  • Some of the deployed addresses still depend on the deployer account. The reason is that some contracts take the owner as a constructor argument, and the initial owner is the deployer account, so changing this also changes the create2 deterministic address. But the addresses do not depend on deployment order anymore.

PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • feat: A new feature

Deployment tag versioning

Has tag in common/version.go been updated or have you added bump-version label to this PR?

  • No, this PR doesn't involve a new deployment, git tag, docker image tag
  • Yes

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change
  • Yes

@Thegaram Thegaram force-pushed the feat-deterministic-deployment branch from 5c4ba52 to 977f570 Compare June 18, 2024 18:13
@Thegaram
Copy link
Contributor Author

Thegaram commented Jul 9, 2024

Migrated to scroll-tech/scroll-contracts#5.

@Thegaram Thegaram closed this Jul 9, 2024
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