Skip to content

Commit

Permalink
add support for forkID in the tool 'deployVerifier'
Browse files Browse the repository at this point in the history
  • Loading branch information
krlosMata committed Jul 16, 2024
1 parent 7375833 commit 232149b
Show file tree
Hide file tree
Showing 16 changed files with 2,566 additions and 25 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/ClaimCompressor.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/FflonkVerifier.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonRollupManager.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonRollupManagerMock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonRollupManagerMockInternalTest.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonValidiumEtrog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMEtrog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMEtrogPrevious.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMExistentEtrog.json

Large diffs are not rendered by default.

1,244 changes: 1,244 additions & 0 deletions contracts/verifiers/FflonkVerifier_10.sol

Large diffs are not rendered by default.

1,244 changes: 1,244 additions & 0 deletions contracts/verifiers/FflonkVerifier_11.sol

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/v2/lib/PolygonRollupBaseEtrog.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ Generate Initialize transaction for hte bridge on L2
|`_gasTokenNetwork` | uint32 | Indicates the native network of the token address
|`_gasTokenMetadata` | bytes | Abi encoded gas token metadata

### _verifyOrigin
```solidity
function _verifyOrigin(
) internal returns (bytes gasTokenMetadata)
```




## Events
### SequenceBatches
```solidity
Expand Down
1 change: 1 addition & 0 deletions tools/deployVerifier/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy_verifier_parameters.json
36 changes: 36 additions & 0 deletions tools/deployVerifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Deploy verifier
Script to deploy `verifier` smart contract

## Install
```
npm i
```

## Setup
- Config file
- `realVerifier`: select between a real or a mock verifer
- `forkID`: Select fork to verifier to be deployed (if a real verfifier is selected)
- `deployerPvtKey`: private key deployer
- First option will load `deployerPvtKey`. Otherwise, `process.env.MNEMONIC` will be loaded from the `.env` file
- `maxFeePerGas`: set custom gas
- `maxPriorityFeePerGas`: set custom gas
- `multiplierGas`: set custom gas
- A network should be selected when running the script
- examples: `-- sepolia` or `--mainnet`
- This uses variables set in `hardhat.config.ts`
- Which uses some nvironment variables that should be set in `.env`
> All paths are from roor repository
## Usage
> All commands are done from root repository.
- Copy configuration file:
```
cp ./tools/deployVerifier/deploy_verifier_parameters.example ./tools/deployVerifier/deploy_verifier_parameters.json
```

- Set your parameters
- Run tool:
```
npx hardhat run ./tools/addRollupType/deployVerififer.ts --network sepolia
```
20 changes: 13 additions & 7 deletions tools/deployVerifier/deployVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,33 @@ async function main() {
[deployer] = await ethers.getSigners();
}

console.log("deploying with: ", deployer.address);
console.log("--> Deploying with: ", deployer.address);

/*
*Deployment pol
* Deployment Verifier
*/
const verifierName = `FflonkVerifier_${deployParameters.forkID}`;
let verifierContract;
if (deployParameters.realVerifier === true) {
const VerifierRollup = await ethers.getContractFactory("FflonkVerifier", deployer);
const VerifierRollup = await ethers.getContractFactory(verifierName, deployer);
console.log(`--> Deploying verifier: ${verifierName}`);
verifierContract = await VerifierRollup.deploy();
await verifierContract.waitForDeployment();
} else {
const VerifierRollupHelperFactory = await ethers.getContractFactory("VerifierRollupHelperMock", deployer);
console.log("Deploying verifier VerifierRollupHelperMock");
verifierContract = await VerifierRollupHelperFactory.deploy();
await verifierContract.waitForDeployment();
}
console.log("#######################\n");
// print contract address deployed
console.log("\n#######################");
console.log("Verifier deployed to:", verifierContract.target);
console.log("#######################\n");
console.log("verifierContract deployed to:", verifierContract.target);
console.log("you can verify the new verifierContract address with:");
console.log(`npx hardhat verify ${verifierContract.target} --network ${process.env.HARDHAT_NETWORK}\n`);
// print verification command line
console.log("#######################");
console.log("you can verify the new verifierContract address with the following command:");
console.log(`npx hardhat verify ${verifierContract.target} --network ${process.env.HARDHAT_NETWORK}`);
console.log("#######################");
}

main().catch((e) => {
Expand Down
1 change: 1 addition & 0 deletions tools/deployVerifier/deploy_verifier_parameters.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"realVerifier": true,
"forkID": 10,
"deployerPvtKey": "",
"maxFeePerGas":"",
"maxPriorityFeePerGas":"",
Expand Down

0 comments on commit 232149b

Please sign in to comment.