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): Add deployment check for existing implementations #13721

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

Description

Added implementation check in DeployImplementationsInput.salt() to prevent duplicate deployments of contracts. This change improves the deployment process by ensuring we don't unnecessarily redeploy contracts that are already deployed with the same salt.

Key changes:

  • Added salt validation in DeployImplementationsInput.salt()
  • Added CREATE2 address computation helper function
  • Added comprehensive test suite for the new functionality

Tests

There is a file with tests for DeployImpelemtations.s.sol
packages/contracts-bedrock/test/opcm/DeployImpelemtations.s.sol

The tests cover all critical paths:

  • Zero salt case
  • Non-zero salt with no existing deployments
  • Non-zero salt with existing deployments

Additional context

This change addresses the TODO comment in DeployImplementationsInput.salt() and improves deployment efficiency by preventing unnecessary redeployments. The implementation uses CREATE2 address computation to check for existing deployments, which is a gas-efficient way to validate deployment status.

Description:
- Added implementation check in DeployImplementationsInput.salt() to prevent duplicate deployments
- Added CREATE2 address computation to verify if contracts are already deployed
- Added revert if implementations are already deployed with the given salt
- Maintains backward compatibility by allowing deployment when no salt is provided
- Improves deployment efficiency by preventing unnecessary redeployments
@VolodymyrBg VolodymyrBg requested a review from a team as a code owner January 12, 2025 15:46
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