Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mainnet fork test #192

Merged
merged 13 commits into from
Feb 12, 2024
Merged
4 changes: 4 additions & 0 deletions contracts/v2/consensus/validium/PolygonDataCommittee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import "../../interfaces/IDataAvailabilityProtocol.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

/*
* Contract responsible managing the data committee that will verify that the data sent for a validium is singed by a committee
* It is advised to give the owner of the contract to a timelock contract once the data committee is set
*/
contract PolygonDataCommittee is
IDataAvailabilityProtocol,
IPolygonDataCommitteeErrors,
Expand Down
1 change: 1 addition & 0 deletions contracts/v2/consensus/validium/PolygonValidiumEtrog.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "../../interfaces/IPolygonValidium.sol";
* The sequenced state is deterministic and can be precalculated before it's actually verified by a zkProof.
* The aggregators will be able to verify the sequenced state with zkProofs and therefore make available the withdrawals from L2 network.
* To enter and exit of the L2 network will be used a PolygonZkEVMBridge smart contract that will be deployed in both networks.
* It is advised to use timelocks for the admin address in case of Validium since if can change the dataAvailabilityProtocol
*/
contract PolygonValidiumEtrog is PolygonRollupBaseEtrog, IPolygonValidium {
using SafeERC20Upgradeable for IERC20Upgradeable;
Expand Down
4 changes: 2 additions & 2 deletions deployment/testnet/prepareTestnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function main() {
to: trustedSequencer,
value: minEtherBalance,
};
await deployer.sendTransaction(params);
await (await deployer.sendTransaction(params)).wait();
}
const tokensBalance = ethers.parseEther("100000");
await (await polTokenContract.transfer(trustedSequencer, tokensBalance)).wait();
Expand All @@ -128,7 +128,7 @@ async function main() {
to: trustedAggregator,
value: minEtherBalance,
};
await deployer.sendTransaction(params);
await (await deployer.sendTransaction(params)).wait();
}

deployParameters.polTokenAddress = polTokenContract.target;
Expand Down
9 changes: 6 additions & 3 deletions deployment/v2/4_createRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ async function main() {
adminZkEVM,
forkID,
consensusContract,
dataAvailabilityProtocol,
} = createRollupParameters;

const supportedConensus = ["PolygonZkEVMEtrog", "PolygonValidiumEtrog"];
Expand All @@ -73,6 +72,8 @@ async function main() {
throw new Error(`Consensus contract not supported, supported contracts are: ${supportedConensus}`);
}

const dataAvailabilityProtocol = createRollupParameters.dataAvailabilityProtocol || "PolygonDataCommittee";

const supporteDataAvailabilityProtocols = ["PolygonDataCommittee"];

if (
Expand Down Expand Up @@ -276,6 +277,8 @@ async function main() {
throw new Error("polygonDataCommittee contract has not been deployed");
}
}
await polygonDataCommittee?.waitForDeployment();

// Load data commitee
const PolygonValidiumContract = (await PolygonconsensusFactory.attach(newZKEVMAddress)) as PolygonValidium;
// add data commitee to the consensus contract
Expand All @@ -284,8 +287,8 @@ async function main() {
await PolygonValidiumContract.setDataAvailabilityProtocol(polygonDataCommittee?.target as any)
).wait();

// Setup data commitee to 0
await (await polygonDataCommittee?.setupCommittee(0, [], "0x")).wait();
// // Setup data commitee to 0
// await (await polygonDataCommittee?.setupCommittee(0, [], "0x")).wait();
} else {
await (await polygonDataCommittee?.transferOwnership(adminZkEVM)).wait();
}
Expand Down
1 change: 1 addition & 0 deletions deployment/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ A new folder will be created witth the following name `deployments/${network}_$(
- `maxFeePerGas`:string, Set `maxFeePerGas`, must define aswell `maxPriorityFeePerGas` to use it
- `maxPriorityFeePerGas`:string, Set `maxPriorityFeePerGas`, must define aswell `maxFeePerGas` to use it
- `multiplierGas`: number, Gas multiplier with 3 decimals. If `maxFeePerGas` and `maxPriorityFeePerGas` are set, this will not take effect
- `dataAvailabilityProtocol`: string, Data availability protocol, only mandatory/used when consensus contract is a Validiums, currently the only supported value is: `PolygonDataCommittee`

## Notes

Expand Down
8 changes: 4 additions & 4 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const config: HardhatUserConfig = {
},
},
polygonZKEVMTestnet: {
url: "https://rpc.public.zkevm-test.net",
url: "https://rpc.cardona.zkevm-rpc.com",
accounts: {
mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC,
path: "m/44'/60'/0'/0",
Expand Down Expand Up @@ -268,10 +268,10 @@ const config: HardhatUserConfig = {
},
{
network: "polygonZKEVMTestnet",
chainId: 1442,
chainId: 2442,
urls: {
apiURL: "https://api-testnet-zkevm.polygonscan.com/api",
browserURL: "https://testnet-zkevm.polygonscan.com/",
apiURL: "https://explorer-ui.cardona.zkevm-rpc.com/api",
browserURL: "https://explorer-ui.cardona.zkevm-rpc.com",
},
},
{
Expand Down
17 changes: 17 additions & 0 deletions tools/addRollupType/addRollupMainnet/add_rollup_type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"consensusContract": "PolygonValidiumEtrog",
"polygonRollupManagerAddress": "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2",
"polygonZkEVMBridgeAddress": "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe",
"polygonZkEVMGlobalExitRootAddress": "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb",
"polTokenAddress": "0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6",
"verifierAddress": "0x1C3A3da552b8662CD69538356b1E7c2E9CC1EBD8",
"description": "Type: Validium, Version: etrog, genesis: /ipfs/QmUXnRoPbUmZuEZCGyiHjEsoNcFVu3hLtSvhpnfBS2mAYU",
"forkID": 7,
"rollupCompatibilityID": 0,
"timelockDelay": 864000,
"timelockSalt": "",
"deployerPvtKey": "",
"maxFeePerGas":"",
"maxPriorityFeePerGas":"",
"multiplierGas": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"genesis": "0xe3a7d8bae497945ba8ddc51c69564f60ad4c1a990b9c7bdbd27f7929bfa8f272",
"verifierAddress": "0x1C3A3da552b8662CD69538356b1E7c2E9CC1EBD8",
"consensusContract": "PolygonValidiumEtrog",
"scheduleData": "0x01d5062a0000000000000000000000005132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d2f000000000000000000000000000000000000000000000000000000000000000144f34eb8eb0000000000000000000000009cf80f7eb1c76ec5ae7a88b417e373449b73ac300000000000000000000000001c3a3da552b8662cd69538356b1e7c2e9cc1ebd800000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000e3a7d8bae497945ba8ddc51c69564f60ad4c1a990b9c7bdbd27f7929bfa8f27200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000005d547970653a2056616c696469756d2c2056657273696f6e3a206574726f672c2067656e657369733a202f697066732f516d55586e526f5062556d5a75455a43477969486a45736f4e6346567533684c74537668706e664253326d41595500000000000000000000000000000000000000000000000000000000000000",
"executeData": "0x134008d30000000000000000000000005132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000144f34eb8eb0000000000000000000000009cf80f7eb1c76ec5ae7a88b417e373449b73ac300000000000000000000000001c3a3da552b8662cd69538356b1e7c2e9cc1ebd800000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000e3a7d8bae497945ba8ddc51c69564f60ad4c1a990b9c7bdbd27f7929bfa8f27200000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000005d547970653a2056616c696469756d2c2056657273696f6e3a206574726f672c2067656e657369733a202f697066732f516d55586e526f5062556d5a75455a43477969486a45736f4e6346567533684c74537668706e664253326d41595500000000000000000000000000000000000000000000000000000000000000"
}
22 changes: 22 additions & 0 deletions tools/addRollupType/addRollupMainnet/deploy_output_mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"polygonZkEVMAddress": "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2",
"polygonZkEVMBridgeAddress": "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe",
"polygonZkEVMGlobalExitRootAddress": "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb",
"maticTokenAddress": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
"verifierAddress": "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9",
"zkEVMDeployerContract": "0xCB19eDdE626906eB1EE52357a27F62dd519608C2",
"deployerAddress": "0x7c280C055CBf830F77D6DA3a6363e961E0B91C7d",
"timelockContractAddress": "0xEf1462451C30Ea7aD8555386226059Fe837CA4EF",
"deploymentBlockNumber": 16896721,
"genesisRoot": "0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9",
"trustedSequencer": "0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800",
"trustedSequencerURL": "https://zkevm-rpc.com/",
"chainID": 1101,
"networkName": "polygon zkEVM",
"admin": "0x242daE44F5d8fb54B198D03a94dA45B5a4413e21",
"trustedAggregator": "0xdA87c4a76922598Ac0272F4D9503a35071D686eA",
"proxyAdminAddress": "0x0F99738B2Fc14D77308337f3e2596b63aE7BCC4A",
"forkID": 4,
"salt": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"version": "v1.1.0-fork.4"
}
Loading
Loading