Skip to content

Commit

Permalink
Script create new rollup, first iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
ignasirv committed Nov 20, 2024
1 parent a4b0c93 commit b7f88a9
Show file tree
Hide file tree
Showing 8 changed files with 537 additions and 7 deletions.
2 changes: 2 additions & 0 deletions deployment/v2/4_createRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ async function main() {
outputJson.rollupAddress = newZKEVMAddress;
outputJson.verifierAddress = verifierContract.target;
outputJson.consensusContract = consensusContract;
outputJson.consensusContractAddress = PolygonconsensusContract.target;
outputJson.rollupTypeId = newRollupTypeID;

// Rewrite updated genesis in case of vanilla client
if (isVanillaClient) {
Expand Down
8 changes: 4 additions & 4 deletions tools/addRollupType/addRollupType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {

/*
* Check deploy parameters
* Check that every necessary parameter is fullfilled
* Check that every necessary parameter is fulfilled
*/
const mandatoryDeploymentParameters = [
"description",
Expand Down Expand Up @@ -50,11 +50,11 @@ async function main() {
programVKey,
} = addRollupParameters;

const supportedConensus = ["PolygonZkEVMEtrog", "PolygonValidiumEtrog", "PolygonPessimisticConsensus"];
const supportedConsensus = ["PolygonZkEVMEtrog", "PolygonValidiumEtrog", "PolygonPessimisticConsensus"];
const isPessimistic = consensusContract === "PolygonPessimisticConsensus";

if (!supportedConensus.includes(consensusContract)) {
throw new Error(`Consensus contract not supported, supported contracts are: ${supportedConensus}`);
if (!supportedConsensus.includes(consensusContract)) {
throw new Error(`Consensus contract not supported, supported contracts are: ${supportedConsensus}`);
}

// Load provider
Expand Down
6 changes: 3 additions & 3 deletions tools/addRollupType/addRollupTypeTimelock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ async function main() {
const salt = addRollupParameters.timelockSalt || ethers.ZeroHash;
const predecessor = addRollupParameters.predecessor || ethers.ZeroHash;

const supportedConensus = [
const supportedConsensus = [
"PolygonZkEVMEtrog",
"PolygonValidiumEtrog",
"PolygonValidiumStorageMigration",
"PolygonPessimisticConsensus",
];
const isPessimistic = consensusContract === "PolygonPessimisticConsensus";

if (!supportedConensus.includes(consensusContract)) {
throw new Error(`Consensus contract not supported, supported contracts are: ${supportedConensus}`);
if (!supportedConsensus.includes(consensusContract)) {
throw new Error(`Consensus contract not supported, supported contracts are: ${supportedConsensus}`);
}

// Load provider
Expand Down
4 changes: 4 additions & 0 deletions tools/createNewRollup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
create_new_rollup.json
genesis.json
genesis_sovereign.json
create_new_rollup_output.json
48 changes: 48 additions & 0 deletions tools/createNewRollup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Add Rollup Type
Script to call `createNewRollup` function

## Install
```
npm i
```

## Setup
- Config file
- `trustedSequencerURL`: Sequencer URL of the new created rollup
- `networkName`: Network name of the new created rollup
- `trustedSequencer`: Sequencer address of the new created rollup
- `chainID`: ChainID of the rollup, must be a new one, can not have more than 32 bits
- `rollupAdminAddress`: Admin address of the new created rollup
- `consensusContractName`: select between consensus contract. Supported: `["PolygonZkEVMEtrog", "PolygonValidiumEtrog", "PolygonPessimisticConsensus"]` This is the name of the consensus of the rollupType of the rollup to be created
- `gasTokenAddress`: Address of the native gas token of the rollup, zero if ether
- `deployerPvtKey`: Not mandatory, used to deploy from specific wallet
- `maxFeePerGas(optional)`: string, Set `maxFeePerGas`, must define aswell `maxPriorityFeePerGas` to use it
- `maxPriorityFeePerGas(optional)`: string, Set `maxPriorityFeePerGas`, must define aswell `maxFeePerGas` to use it
- `multiplierGas(optional)`: number, Gas multiplier with 3 decimals. If `maxFeePerGas` and `maxPriorityFeePerGas` are set, this will not take effect
- `rollupManagerAddress`: Address of deployed rollupManager contract
- `isVanillaClient`: Flag for vanilla/sovereign clients handling
- `sovereignParams`:
- `bridgeManager`: bridge manager address
- `sovereignWETHAddress`: sovereign WETH address
- `sovereignWETHAddressIsNotMintable`: Flag to indicate if the wrapped ETH is not mintable
- `globalExitRootUpdater`: Address of globalExitRootUpdater for sovereign chains

## Usage
> All commands are done from root repository.
### Call 'addNewRollupType' from an EOA

- Copy configuration files:
```
cp ./tools/createNewRollup/create_new_rollup.json.example ./tools/createNewRollup/create_new_rollup.json
```

```
cp ./tools/addRollupType/genesis.json.example ./tools/addRollupType/genesis.json
```

- Set your parameters
- Run tool:
```
npx hardhat run ./tools/addRollupType/createNewRollup.ts --network sepolia
```
Loading

0 comments on commit b7f88a9

Please sign in to comment.