-
Notifications
You must be signed in to change notification settings - Fork 4
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
Deployment improvement #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,33 +16,39 @@ async function main() { | |
const attemptsDeployProxy = 5; | ||
// Load provider | ||
let currentProvider = ethers.provider; | ||
if (deployParameters.multiplierGas || deployParameters.maxFeePerGas) { | ||
if (process.env.HARDHAT_NETWORK !== 'hardhat') { | ||
currentProvider = new ethers.providers.JsonRpcProvider(`https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}`); | ||
if (deployParameters.maxPriorityFeePerGas && deployParameters.maxFeePerGas) { | ||
console.log(`Hardcoded gas used: MaxPriority${deployParameters.maxPriorityFeePerGas} gwei, MaxFee${deployParameters.maxFeePerGas} gwei`); | ||
const FEE_DATA = { | ||
maxFeePerGas: ethers.utils.parseUnits(deployParameters.maxFeePerGas, 'gwei'), | ||
maxPriorityFeePerGas: ethers.utils.parseUnits(deployParameters.maxPriorityFeePerGas, 'gwei'), | ||
}; | ||
currentProvider.getFeeData = async () => FEE_DATA; | ||
} else { | ||
console.log('Multiplier gas used: ', deployParameters.multiplierGas); | ||
async function overrideFeeData() { | ||
const feedata = await ethers.provider.getFeeData(); | ||
return { | ||
maxFeePerGas: feedata.maxFeePerGas.mul(deployParameters.multiplierGas).div(1000), | ||
maxPriorityFeePerGas: feedata.maxPriorityFeePerGas.mul(deployParameters.multiplierGas).div(1000), | ||
if (process.env.HARDHAT_NETWORK === 'localhost') { | ||
currentProvider = new ethers.providers.JsonRpcProvider('https://127.0.0.1:8454'); | ||
} else { | ||
if (deployParameters.multiplierGas || deployParameters.maxFeePerGas) { | ||
if (process.env.HARDHAT_NETWORK !== 'hardhat') { | ||
currentProvider = new ethers.providers.JsonRpcProvider(`https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}`); | ||
if (deployParameters.maxPriorityFeePerGas && deployParameters.maxFeePerGas) { | ||
console.log(`Hardcoded gas used: MaxPriority${deployParameters.maxPriorityFeePerGas} gwei, MaxFee${deployParameters.maxFeePerGas} gwei`); | ||
const FEE_DATA = { | ||
maxFeePerGas: ethers.utils.parseUnits(deployParameters.maxFeePerGas, 'gwei'), | ||
maxPriorityFeePerGas: ethers.utils.parseUnits(deployParameters.maxPriorityFeePerGas, 'gwei'), | ||
}; | ||
currentProvider.getFeeData = async () => FEE_DATA; | ||
} else { | ||
console.log('Multiplier gas used: ', deployParameters.multiplierGas); | ||
async function overrideFeeData() { | ||
const feedata = await ethers.provider.getFeeData(); | ||
return { | ||
maxFeePerGas: feedata.maxFeePerGas.mul(deployParameters.multiplierGas).div(1000), | ||
maxPriorityFeePerGas: feedata.maxPriorityFeePerGas.mul(deployParameters.multiplierGas).div(1000), | ||
}; | ||
} | ||
currentProvider.getFeeData = overrideFeeData; | ||
} | ||
currentProvider.getFeeData = overrideFeeData; | ||
} | ||
} | ||
} | ||
// Load deployer | ||
let deployer; | ||
if (deployParameters.deployerPvtKey) { | ||
deployer = new ethers.Wallet(deployParameters.deployerPvtKey, currentProvider); | ||
} else if (process.env.HARDHAT_NETWORK === 'localhost') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This option makes it easier to deploy to the localhost... |
||
[deployer] = (await ethers.getSigners()); | ||
} else if (process.env.MNEMONIC) { | ||
deployer = ethers.Wallet.fromMnemonic(process.env.MNEMONIC, 'm/44\'/60\'/0\'/0/0').connect(currentProvider); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ async function main() { | |
* deploy proxy | ||
* Do not initialize directlythe proxy since we want to deploy the same code on L2 and this will alter the bytecode deployed of the proxy | ||
*/ | ||
const transparentProxyFactory = await ethers.getContractFactory('TransparentUpgradeableProxy', deployer); | ||
const transparentProxyFactory = await ethers.getContractFactory('@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy', deployer); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the side effects of having two compiled contracts: (one from foundry and one from hardhat) is that we need to specifiy it more in detail |
||
const initializeEmptyDataProxy = '0x'; | ||
const deployTransactionProxy = (transparentProxyFactory.getDeployTransaction( | ||
bridgeImplementationAddress, | ||
|
@@ -155,7 +155,7 @@ async function main() { | |
/* | ||
*Deployment Global exit root manager | ||
*/ | ||
const PolygonZkEVMGlobalExitRootL2Factory = await ethers.getContractFactory('PolygonZkEVMGlobalExitRootL2', deployer); | ||
const PolygonZkEVMGlobalExitRootL2Factory = await ethers.getContractFactory('@RealityETH/zkevm-contracts/contracts/PolygonZkEVMGlobalExitRootL2.sol:PolygonZkEVMGlobalExitRootL2', deployer); | ||
let polygonZkEVMGlobalExitRootL2; | ||
for (let i = 0; i < attemptsDeployProxy; i++) { | ||
try { | ||
|
@@ -180,7 +180,7 @@ async function main() { | |
expect(await upgrades.erc1967.getAdminAddress(polygonZkEVMGlobalExitRootL2.address)).to.be.equal(proxyAdminAddress); | ||
expect(await upgrades.erc1967.getAdminAddress(proxyBridgeAddress)).to.be.equal(proxyAdminAddress); | ||
|
||
const timelockContractFactory = await ethers.getContractFactory('PolygonZkEVMTimelock', deployer); | ||
const timelockContractFactory = await ethers.getContractFactory('@RealityETH/zkevm-contracts/contracts/PolygonZkEVMTimelock.sol:PolygonZkEVMTimelock', deployer); | ||
const timelockContract = await timelockContractFactory.deploy( | ||
minDelayTimelock, | ||
[timelockAddress], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding config for localhost... not sure why it worked before without this helper