From a5d2ac44c9e5bedc4bcc58740b3e82069f7252eb Mon Sep 17 00:00:00 2001 From: skosito Date: Mon, 5 Aug 2024 21:32:17 +0200 Subject: [PATCH] PR comments --- .../{ => deterministic}/DeployGatewayEVM.s.sol | 0 .../{ => deterministic}/UpgradeGatewayEVM.s.sol | 0 v2/scripts/deploy/deterministic/readme.md | 17 +++++++++++++++++ 3 files changed, 17 insertions(+) rename v2/scripts/deploy/{ => deterministic}/DeployGatewayEVM.s.sol (100%) rename v2/scripts/deploy/{ => deterministic}/UpgradeGatewayEVM.s.sol (100%) create mode 100644 v2/scripts/deploy/deterministic/readme.md diff --git a/v2/scripts/deploy/DeployGatewayEVM.s.sol b/v2/scripts/deploy/deterministic/DeployGatewayEVM.s.sol similarity index 100% rename from v2/scripts/deploy/DeployGatewayEVM.s.sol rename to v2/scripts/deploy/deterministic/DeployGatewayEVM.s.sol diff --git a/v2/scripts/deploy/UpgradeGatewayEVM.s.sol b/v2/scripts/deploy/deterministic/UpgradeGatewayEVM.s.sol similarity index 100% rename from v2/scripts/deploy/UpgradeGatewayEVM.s.sol rename to v2/scripts/deploy/deterministic/UpgradeGatewayEVM.s.sol diff --git a/v2/scripts/deploy/deterministic/readme.md b/v2/scripts/deploy/deterministic/readme.md new file mode 100644 index 00000000..2b851270 --- /dev/null +++ b/v2/scripts/deploy/deterministic/readme.md @@ -0,0 +1,17 @@ +## Deterministic GatewayEVM deployments + +`DeployGatewayEVMCreate2` script uses create2 with Foundry (https://book.getfoundry.sh/tutorials/create2-tutorial) to perform deterministic deployment of `GatewayEVM` contracts. +This ensures that on every EVM chain `GatewayEVM` contract will be on same address. + +Since UUPS proxy is used for `GatewayEVM` contract, both implementation and `ERC1967Proxy` are deployed using above technique: + +- calculate expected address +- adding a salt to deployment +- basic assertions to verify that deployed address is same as expected + +`UpgradeGatewayEVM` script uses OpenZeppelin's Foundry Upgrades plugin (https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades), to upgrade `GatewayEVM`: + +- deploy new implementation (doesn't need to be deterministic since proxy address doesn't change) +- use plugin to upgrade proxy + +