Skip to content

Commit

Permalink
Update post L1 devnet deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
shirren committed Nov 6, 2024
1 parent 123beae commit 06c155c
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 23 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.17.0
4 changes: 4 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const config: HardhatUserConfig = {
url: 'https://rpc.dev.immutable.com',
accounts: []
},
l1devnet: {
url: 'https://rpc.ankr.com/eth_holesky',
accounts: []
},
testnet: {
url: 'https://rpc.testnet.immutable.com',
accounts: []
Expand Down
33 changes: 20 additions & 13 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ in the `contract.ts` file.

## Step 5

Create a `.env` file. Use the `env.example` as a template.
Create a `.env` file. Use the `env.example` as a template. Set the following values in the `.env`

* Set the DEPLOYER_CONTRACT_ADDRESS to match the address of the OwnableCreate2Deployer factory.
* Set the MULTICALL_ADMIN_PUB_KEY and FACTORY_ADMIN_PUB_KEY to match the address of the address of the privileged transaction multisig. This address for reference should be `0x0E2D55943f4EF07c336C12A85d083c20FF189182`.

## Execution steps

Expand All @@ -52,53 +55,57 @@ in this step because we want the `Factory` contract to have the same address acr
this address is used to produce a deterministic counter factual address for the smart contract wallets across
all the chains.

* Set the `accountIndex` to 10.
* Set the value of RELAYER_SUBMITTER_EOA_PUB_KEY to match the EOA of the primary Relayer submitter.
* Set the `accountIndex` to 10 in `wallet-options.ts`.
* Execute the command `npx hardhat run scripts/step1.ts --network <ENV>`

### `step2.ts`

In this step we deploy the contract that tracks the location of the latest wallet implementation. As this step
just uses the CREATE2 contract factory we use the standard deployment key.
just uses the CREATE2 contract factory we use the standard deployment key (Orange Key!!!).

* Set the value of WALLET_IMPL_LOCATOR_ADMIN, and WALLET_IMPL_CHANGER_ADMIN environment variables to the public key of the Priveleged key.
* Set the `accountIndex` to 0.
* Execute the command `npx hardhat run scripts/step2.ts --network <ENV>`

### `step3.ts`

In this step we deploy the startup wallet. This wallet address is used to generate the CFA, and hence like the Factory
uses a Passport nonce reserver key.
In this step we deploy the startup wallet. This wallet address is used to generate the CFA, and hence like the Factory uses a Passport nonce reserver key.

* Set the `accountIndex` to 10.
* WARNING: COPY the `LatestWalletImplLocator` address into the `step3.ts` script from step2.
* Execute the command `npx hardhat run scripts/step3.ts --network <ENV>`
* WARNING: COPY the `LatestWalletImplLocator` address into the `step3.ts` script from step2.

### `step4.ts`

In this step we deploy the `MainModuleDynamicAuth` module, and it can simply use the standard deployment key.
In this step we deploy the `MainModuleDynamicAuth` module, and it should use the standard deployment key (Orange Key!!!)

* Set the `accountIndex` to 0.
* WARNING: COPY the `FactoryAddress` address into the `step4.ts` script from step1.
* WARNING: COPY the `StartupWalletImpl` address into the `step4.ts` script from step3.
* Execute the command `npx hardhat run scripts/step4.ts --network <ENV>`
* WARNING: COPY the `FactoryAddress` address into the `step4.ts` script from step1.
* WARNING: COPY the `StartupWalletImpl` address into the `step4.ts` script from step3.

### `step5.ts`

In this step we deploy the Signer contract, which is also used to generate the CFA, and hence like the Factory, and
Startup wallet implementation, we use the Passport nonce reserver key in this step.
Startup wallet implementation, we use the Passport nonce reserver key (Black Key!!!) in this step.

* Set the `accountIndex` to 10.
* Set the SIGNER_ROOT_ADMIN_PUB_KEY to the Privileged public key.
* Set the SIGNER_ADMIN_PUB_KEY to the relevant Breakglass public key.
* Set the IMMUTABLE_SIGNER_PUB_KEY
* Execute the command `npx hardhat run scripts/step5.ts --network <ENV>`

### `step6.ts`

In this step we point the `LatestWalletImplLocator` to the `MainModuleDynamicAuth` module address. In this step
we use the privileged deployment key, as we gave this key authority to alter the implementation address in `step2.ts`
we use the privileged deployment key (Purple Key!!!), as we gave this key authority to alter the implementation address in `step2.ts`.
above.

* Set the `accountIndex` to 10.
* WARNING: COPY the `MainModuleDynamicAuth` address into the `step6.ts` script from step4.
* WARNING: COPY the `LatestWalletImplLocator` address into the `step6.ts` script from step2.
* Execute the command `npx hardhat run scripts/step6.ts --network <ENV>`
* WARNING: COPY the `MainModuleDynamicAuth` address into the `step6.ts` script from step4.
* WARNING: COPY the `LatestWalletImplLocator` address into the `step6.ts` script from step2.

## Update Relayer and Passport Environment

Expand Down
6 changes: 3 additions & 3 deletions scripts/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getSaltFromKey = (): string => {
};

/**
* Load the OwnableCreate2Deployer
* Load the OwnableCreate2Deployer
*/
const loadDeployerContract = async (env: EnvironmentInfo, walletOptions: WalletOptions): Promise<Contract> => {
return new Contract(env.deployerContractAddress, ContractDeployerInterface.abi, walletOptions.getWallet());
Expand All @@ -39,8 +39,8 @@ export async function deployContractViaCREATE2(

// Deploy the contract
let tx = await deployer.deploy(bytecode, salt, {
gasLimit: 30000000,
maxFeePerGas: 10000000000,
gasLimit: 10_000_000,
maxFeePerGas: 40000000000,
maxPriorityFeePerGas: 10000000000,
});
await tx.wait();
Expand Down
6 changes: 6 additions & 0 deletions scripts/deployment_artefacts/l1devnet_deploy/step1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"multiCallAdminPubKey": "0x0E2D55943f4EF07c336C12A85d083c20FF189182",
"factoryAdminPubKey": "0x0E2D55943f4EF07c336C12A85d083c20FF189182",
"multiCallDeploy": "0x307d214799D3B1625D1eC70F83d170d5fd0ee5A1",
"factory": "0x8Fa5088dF65855E0DaF87FA6591659893b24871d"
}
5 changes: 5 additions & 0 deletions scripts/deployment_artefacts/l1devnet_deploy/step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"walletImplLocatorAdmin": "0x0E2D55943f4EF07c336C12A85d083c20FF189182",
"walletImplChangerAdmin": "0x0E2D55943f4EF07c336C12A85d083c20FF189182",
"latestWalletImplLocator": "0x889b5e1B25351AB543bf6D81bFD0777EA02EC879"
}
4 changes: 4 additions & 0 deletions scripts/deployment_artefacts/l1devnet_deploy/step3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"walletImplLocatorAddress": "0x889b5e1B25351AB543bf6D81bFD0777EA02EC879",
"startupWalletImpl": "0x8FD900677aabcbB368e0a27566cCd0C7435F1926"
}
5 changes: 5 additions & 0 deletions scripts/deployment_artefacts/l1devnet_deploy/step4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"factoryAddress": "0x8Fa5088dF65855E0DaF87FA6591659893b24871d",
"startupWalletImplAddress": "0x8FD900677aabcbB368e0a27566cCd0C7435F1926",
"mainModuleDynamicAuth": "0x9e9Ee944fEB02F4D05B02950ca118027D2Db3cF2"
}
6 changes: 6 additions & 0 deletions scripts/deployment_artefacts/l1devnet_deploy/step5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"signerRootAdminPubKey": "0x0E2D55943f4EF07c336C12A85d083c20FF189182",
"signerAdminPubKey": "0xB3533118Ff0f823fAF916AC499bB2a3E9054A698",
"signerAddress": "0x1cE50560686b1297B6311F36B47dbe5d6E04D0f8",
"immutableSigner": "0xcff469E561D9dCe5B1185CD2AC1Fa961F8fbDe61"
}
5 changes: 5 additions & 0 deletions scripts/deployment_artefacts/l1devnet_deploy/step6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mainModuleDynamicAuth": "0x9e9Ee944fEB02F4D05B02950ca118027D2Db3cF2",
"walletImplLocatorContractAddress": "0x889b5e1B25351AB543bf6D81bFD0777EA02EC879",
"signerAddress": "0x1cE50560686b1297B6311F36B47dbe5d6E04D0f8"
}
3 changes: 1 addition & 2 deletions scripts/step1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ import { waitForInput } from './helper-functions';
**/
async function step1(): Promise<EnvironmentInfo> {
const env = loadEnvironmentInfo(hre.network.name);
const { network, submitterAddress, signerAddress, } = env;
const { network, submitterAddress } = env;
const multiCallAdminPubKey = process.env.MULTICALL_ADMIN_PUB_KEY;
const factoryAdminPubKey = process.env.FACTORY_ADMIN_PUB_KEY;

console.log(`[${network}] Starting deployment...`);
console.log(`[${network}] Submitter address ${submitterAddress}`);
console.log(`[${network}] Signer address ${signerAddress}`);
console.log(`[${network}] multiCallAdminPubKey ${multiCallAdminPubKey}`);
console.log(`[${network}] factoryAdminPubKey ${factoryAdminPubKey}`);

Expand Down
2 changes: 1 addition & 1 deletion scripts/step3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { waitForInput } from './helper-functions';
async function step3(): Promise<EnvironmentInfo> {
const env = loadEnvironmentInfo(hre.network.name);
const { network } = env;
const walletImplLocatorAddress = '0x09BfBa65266e35b7Aa481Ee6fddbE4bA8845C8Af';
const walletImplLocatorAddress = '0x889b5e1B25351AB543bf6D81bFD0777EA02EC879';

console.log(`[${network}] Starting deployment...`);
console.log(`[${network}] WalletImplLocator address ${walletImplLocatorAddress}`);
Expand Down
13 changes: 10 additions & 3 deletions scripts/step6.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as fs from 'fs';
import * as hre from 'hardhat';
import { Contract, ContractFactory, utils } from 'ethers';
import { newContractFactory, waitForInput } from './helper-functions';
Expand All @@ -10,8 +11,8 @@ import { newWalletOptions, WalletOptions } from './wallet-options';
async function step6(): Promise<EnvironmentInfo> {
const env = loadEnvironmentInfo(hre.network.name);
const { network, signerAddress, } = env;
const mainModuleDynamicAuthAddress = '0x38D64731246b62fd7A79731ff1cC4D579aA420D0';
const walletImplLocatorContractAddress = '0x09BfBa65266e35b7Aa481Ee6fddbE4bA8845C8Af';
const mainModuleDynamicAuthAddress = '0x9e9Ee944fEB02F4D05B02950ca118027D2Db3cF2';
const walletImplLocatorContractAddress = '0x889b5e1B25351AB543bf6D81bFD0777EA02EC879';

console.log(`[${network}] Starting deployment...`);
console.log(`[${network}] mainModuleDynamicAuth address ${mainModuleDynamicAuthAddress}`);
Expand All @@ -33,13 +34,19 @@ async function step6(): Promise<EnvironmentInfo> {
const tx = await walletImplLocator
.connect(wallets.getWallet())
.changeWalletImplementation(mainModuleDynamicAuthAddress, {
gasLimit: 30000000,
gasLimit: 10000000,
maxFeePerGas: 10000000000,
maxPriorityFeePerGas: 10000000000,
});
await tx.wait();
console.log(`[${network}] Wallet Impl Locator implementation changed to: ${mainModuleDynamicAuthAddress}`);

fs.writeFileSync('step6.json', JSON.stringify({
mainModuleDynamicAuth: mainModuleDynamicAuthAddress,
walletImplLocatorContractAddress: walletImplLocatorContractAddress,
signerAddress: signerAddress,
}, null, 1));

return env;
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/wallet-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class WalletOptions {
constructor(env: EnvironmentInfo, coldWallet: Signer, walletImplLocatorImplChanger: Signer) {
console.log(`[${env.network}] Using ledger for operations...`);
this.useLedger = true;
const accountIndex0 = 0;
const accountIndex0 = 10;
const derivationPath0 = `m/44'/60'/${accountIndex0.toString()}'/0/0`;
this.ledger = new LedgerSigner(hardhat.provider, derivationPath0);

Expand Down

0 comments on commit 06c155c

Please sign in to comment.