From ec0a19711da7983c5c89a7d75c66b0caac1ac56b Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Thu, 24 Oct 2024 16:17:25 +0200 Subject: [PATCH] docs: improve deployment instructions (#413) Co-authored-by: Francisco de Borja Aranda Castillejo Co-authored-by: skosito --- v2/README.md | 8 +- .../deterministic/DeployERC20Custody.s.sol | 4 +- .../deterministic/DeployGatewayEVM.s.sol | 4 +- v2/scripts/deploy/deterministic/readme.md | 36 ------ v2/scripts/deploy/readme.md | 112 +++++++++++++++++- 5 files changed, 118 insertions(+), 46 deletions(-) delete mode 100644 v2/scripts/deploy/deterministic/readme.md diff --git a/v2/README.md b/v2/README.md index 8b192b3e..706a7a69 100644 --- a/v2/README.md +++ b/v2/README.md @@ -41,12 +41,18 @@ $ forge snapshot $ anvil ``` -### Deploy using script +### Deploy ```shell $ forge script script/.s.sol: --rpc-url --private-key ``` +##### More detailed instructions + +To view detailed instructions on how to deploy the contracts, please refer to the [Deployment Guide](./scripts/deploy/readme.md). + +This guide covers all steps required to deploy the contracts, including environment setup, commands, and best practices. + ### Cast ```shell diff --git a/v2/scripts/deploy/deterministic/DeployERC20Custody.s.sol b/v2/scripts/deploy/deterministic/DeployERC20Custody.s.sol index f90cb404..43c8a135 100644 --- a/v2/scripts/deploy/deterministic/DeployERC20Custody.s.sol +++ b/v2/scripts/deploy/deterministic/DeployERC20Custody.s.sol @@ -14,8 +14,8 @@ contract DeployERC20Custody is Script { address expectedImplAddress; address expectedProxyAddress; - bytes32 implSalt = keccak256("ERC20Custody"); - bytes32 proxySalt = keccak256("ERC20CustodyProxy"); + bytes32 implSalt = keccak256("ERC20Custody-2"); + bytes32 proxySalt = keccak256("ERC20CustodyProxy-2"); vm.startBroadcast(); diff --git a/v2/scripts/deploy/deterministic/DeployGatewayEVM.s.sol b/v2/scripts/deploy/deterministic/DeployGatewayEVM.s.sol index ea60091c..dc047dfa 100644 --- a/v2/scripts/deploy/deterministic/DeployGatewayEVM.s.sol +++ b/v2/scripts/deploy/deterministic/DeployGatewayEVM.s.sol @@ -15,8 +15,8 @@ contract DeployGatewayEVM is Script { address expectedImplAddress; address expectedProxyAddress; - bytes32 implSalt = keccak256("GatewayEVM"); - bytes32 proxySalt = keccak256("GatewayEVMProxy"); + bytes32 implSalt = keccak256("GatewayEVM-2"); + bytes32 proxySalt = keccak256("GatewayEVMProxy-2"); vm.startBroadcast(); diff --git a/v2/scripts/deploy/deterministic/readme.md b/v2/scripts/deploy/deterministic/readme.md deleted file mode 100644 index 88f635d2..00000000 --- a/v2/scripts/deploy/deterministic/readme.md +++ /dev/null @@ -1,36 +0,0 @@ -## Deterministic deployments - -`DeployGatewayEVM` 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 - -Remaining deployment script work in similar way as `GatewayEVM` but much simpler because there is no proxy. - -`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 - -To execute deployment script, following format is needed: - -``` -forge script scripts/deploy/deterministic/