Skip to content

Commit

Permalink
docker works
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Jan 25, 2024
1 parent 95a7b0c commit daaaaac
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 193 deletions.
1 change: 0 additions & 1 deletion deployment/v2/3_deployContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ async function main() {
// save an ongoing deployment
ongoingDeployment.polygonRollupManagerContract = polygonRollupManagerContract?.target;
fs.writeFileSync(pathOngoingDeploymentJson, JSON.stringify(ongoingDeployment, null, 1));
console.log(polygonRollupManagerContract.deploymentTransaction());
deploymentBlockNumber = (await polygonRollupManagerContract?.deploymentTransaction().wait()).blockNumber;
} else {
// Expect the precalculate address matches de onogin deployment, sanity check
Expand Down
44 changes: 22 additions & 22 deletions deployment/v2/genesis.json

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions docker/scripts/deploy-docker.sh

This file was deleted.

16 changes: 0 additions & 16 deletions docker/scripts/deploy-dockerv2.sh

This file was deleted.

20 changes: 0 additions & 20 deletions docker/scripts/deploy_parameters_docker.json

This file was deleted.

8 changes: 6 additions & 2 deletions docker/scripts/fund-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ const DEFAULT_NUM_ACCOUNTS = 20;

async function main() {
const MNEMONIC = process.env.MNEMONIC || DEFAULT_MNEMONIC;
const currentProvider = new ethers.providers.JsonRpcProvider('http://localhost:8545');
const currentProvider = ethers.getDefaultProvider('http://localhost:8545');
const signerNode = await currentProvider.getSigner();
const numAccountsToFund = process.env.NUM_ACCOUNTS || DEFAULT_NUM_ACCOUNTS;

for (let i = 0; i < numAccountsToFund; i++) {
const pathWallet = `m/44'/60'/0'/0/${i}`;
const accountWallet = ethers.Wallet.fromMnemonic(MNEMONIC, pathWallet);
const accountWallet = ethers.HDNodeWallet.fromMnemonic(
ethers.Mnemonic.fromPhrase(MNEMONIC),
pathWallet
)

const params = [{
from: await signerNode.getAddress(),
to: accountWallet.address,
Expand Down
95 changes: 0 additions & 95 deletions docker/scripts/genesis_docker.json

This file was deleted.

12 changes: 4 additions & 8 deletions docker/scripts/v2/deploy-docker.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#!/bin/bash
sudo rm -rf docker/gethData/geth_data
rm deployment/deploy_ongoing.json
DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml up -d geth
sleep 5
node docker/scripts/fund-accounts.js
cp docker/scripts/deploy_parameters_docker.json deployment/deploy_parameters.json
cp docker/scripts/genesis_docker.json deployment/genesis.json
npx hardhat run deployment/testnet/prepareTestnet.js --network localhost
npx hardhat run deployment/2_deployPolygonZKEVMDeployer.js --network localhost
npx hardhat run deployment/3_deployContracts.js --network localhost
cp docker/scripts/v2/deploy_parameters_docker.json deployment/v2/deploy_parameters.json
npm run deploy:testnet:v2:localhost
mkdir docker/deploymentOutput
mv deployment/deploy_output.json docker/deploymentOutput
docker-compose -f docker/docker-compose.geth.yml down
mv deployment/v2/deploy_output.json docker/deploymentOutput
DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml down
sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .
# Let it readable for the multiplatform build coming later!
sudo chmod -R go+rxw docker/gethData
11 changes: 4 additions & 7 deletions docker/scripts/v2/deploy-dockerv2.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ sudo rm -rf docker/gethData/geth_data
DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml up -d geth
sleep 5
node docker/scripts/fund-accounts.js
cp docker/scripts/deploy_parameters_docker.json deployment/deploy_parameters.json
cp docker/scripts/genesis_docker.json deployment/genesis.json
npx hardhat run deployment/testnet/prepareTestnet.js --network localhost
npx hardhat run deployment/2_deployPolygonZKEVMDeployer.js --network localhost
npx hardhat run deployment/3_deployContracts.js --network localhost
cp docker/scripts/v2/deploy_parameters_docker.json deployment/v2/deploy_parameters.json
npm run deploy:testnet:v2:localhost
mkdir docker/deploymentOutput
mv deployment/deploy_output.json docker/deploymentOutput
docker compose -f docker/docker-compose.geth.yml down
mv deployment/v2/deploy_output.json docker/deploymentOutput
DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml down
sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .
# Let it readable for the multiplatform build coming later!
sudo chmod -R go+rxw docker/gethData
27 changes: 27 additions & 0 deletions docker/scripts/v2/deploy_parameters_docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"timelockAdminAddress": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"minDelayTimelock": 3600,
"salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
"initialZkEVMDeployerOwner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"admin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"trustedAggregator": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"trustedAggregatorTimeout": 604799,
"pendingStateTimeout": 604799,
"emergencyCouncilAddress": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"realVerifier": false,
"trustedSequencerURL": "http://zkevm-json-rpc:8123",
"networkName": "zkevm",
"description": "0.0.1",
"trustedSequencer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"chainID": 1001,
"adminZkEVM": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"forkID": 5,
"polTokenAddress": "",
"zkEVMDeployerAddress": "",
"gasTokenAddress": "",
"gasTokenNetwork": 0,
"deployerPvtKey": "",
"maxFeePerGas": "",
"maxPriorityFeePerGas": "",
"multiplierGas": ""
}
92 changes: 92 additions & 0 deletions docker/scripts/v2/genesis.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"solidity-docgen": "^0.5.17"
},
"scripts": {
"saveDeployment:goerli": "mkdir -p deployments/goerli_$(date +%s) && cp -r deployment/deploy_*.json deployments/goerli_$(date +%s) && cp .openzeppelin/goerli.json deployments/goerli_$(date +%s) && cp deployment/genesis.json deployments/goerli_$(date +%s)",
"saveDeployment:mainnet": "mkdir -p deployments/mainnet_$(date +%s) && cp -r deployment/deploy_*.json deployments/mainnet_$(date +%s) && cp .openzeppelin/mainnet.json deployments/mainnet_$(date +%s) && cp deployment/genesis.json deployments/mainnet_$(date +%s)",
"saveDeployment:goerli": "mkdir -p deployments/goerli_$(date +%s) && cp -r deployment/v2/deploy_*.json deployments/goerli_$(date +%s) && cp .openzeppelin/goerli.json deployments/goerli_$(date +%s) && cp deployment/v2/genesis.json deployments/goerli_$(date +%s)",
"saveDeployment:mainnet": "mkdir -p deployments/mainnet_$(date +%s) && cp -r deployment/v2/deploy_*.json deployments/mainnet_$(date +%s) && cp .openzeppelin/mainnet.json deployments/mainnet_$(date +%s) && cp deployment/v2/genesis.json deployments/mainnet_$(date +%s)",
"test": "npx hardhat test test/contracts/**.test.js",
"docgen": "npx solidity-docgen --solc-module solc-0.8 -t ./docs/templates -e ./contracts/verifiers,./contracts/mocks",
"prepare:testnet:ZkEVM:localhost": "npx hardhat run deployment/testnet/prepareTestnet.ts --network localhost",
Expand All @@ -74,16 +74,16 @@
"lint": "npx eslint ./test && npx eslint ./docker/scripts && npx eslint ./deployment && npx eslint ./src",
"lint:fix": "npx eslint ./test --fix && npx eslint ./docker/scripts --fix && npx eslint ./deployment --fix && npx eslint ./src --fix",
"compile": "npx hardhat compile",
"docker:contracts": "./docker/scripts/deploy-docker.sh",
"dockerv2:contracts": "./docker/scripts/deploy-dockerv2.sh",
"docker:contracts": "./docker/scripts/v2/deploy-docker.sh",
"dockerv2:contracts": "sudo ./docker/scripts/v2/deploy-dockerv2.sh",
"push:docker:contracts": "docker push hermeznetwork/geth-zkevm-contracts",
"update:genesis": "node deployment/1_createGenesis.js && node deployment/1_createGenesis.js --test --input ../docker/scripts/deploy_parameters_docker.json --out ../docker/scripts/genesis_docker.json",
"coverage": "npx hardhat coverage",
"gas:report": "REPORT_GAS=true npx hardhat test",
"gas:report:file": "rm -f .openzeppelin/unknown-31337.json && REPORT_GAS=true REPORT_GAS_FILE=true npx hardhat test",
"deploy:v2:localhost": "rm -f .openzeppelin/unknown-31337.json && npx ts-node deployment/v2/1_createGenesis.ts --test && npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network localhost && npx hardhat run deployment/v2/3_deployContracts.ts --network localhost && npx hardhat run deployment/v2/4_createRollup.ts --network localhost",
"deploy:testnet:v2:localhost": "rm -f deployment/v2/deploy_ongoing.json && npm run prepare:testnet:ZkEVM:localhost && npm run deploy:v2:localhost",
"deploy:v2:goerli": "npx ts-node deployment/v2/1_createGenesis.ts && npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network goerli && npx hardhat run deployment/v2/3_deployContracts.ts --network goerli && npx hardhat run deployment/v2/4_createRollup.ts --network goerli",
"deploy:v2:goerli": "npx ts-node deployment/v2/1_createGenesis.ts && npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network goerli && npx hardhat run deployment/v2/3_deployContracts.ts --network goerli && npx hardhat run deployment/v2/4_createRollup.ts --network goerli && npm run saveDeployment:goerli",
"deploy:testnet:v2:goerli": "rm -f deployment/v2/deploy_ongoing.json && npm run prepare:testnet:ZkEVM:goerli && npm run deploy:v2:goerli",
"verify:v2:goerli": "npx hardhat run deployment/v2/verifyContracts.js --network goerli"
}
Expand Down

0 comments on commit daaaaac

Please sign in to comment.