Commit 3170d759 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #5539 from ethereum-optimism/jm/deploy-testing-fixes

Improvements to enable deployment practice
parents 9f934838 72e114c2
...@@ -8,6 +8,17 @@ PRIVATE_KEY_DEPLOYER= ...@@ -8,6 +8,17 @@ PRIVATE_KEY_DEPLOYER=
TENDERLY_PROJECT= TENDERLY_PROJECT=
TENDERLY_USERNAME= TENDERLY_USERNAME=
# Optional boolean to define if cast commands should be printed.
# Useful during migration testing # The following settings are useful for manually testing the migration scripts.
# Define if cast commands should be printed.
CAST_COMMANDS=1 CAST_COMMANDS=1
# Saves deployment artifacts when using the 'live' network
SAVE_DEPLOYMENTS=1
# Disable the live deployer so that transactions must be submitted manually
DISABLE_LIVE_DEPLOYER=true
# Sets the deployer's key to match the first default hardhat account
PRIVATE_KEY_DEPLOYER=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
...@@ -25,7 +25,7 @@ const config: HardhatUserConfig = { ...@@ -25,7 +25,7 @@ const config: HardhatUserConfig = {
local: { local: {
live: false, live: false,
url: 'http://localhost:8545', url: 'http://localhost:8545',
saveDeployments: false, saveDeployments: !!process.env.SAVE_DEPLOYMENTS || false,
accounts: [ accounts: [
'ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
], ],
......
...@@ -359,19 +359,19 @@ export const doOwnershipTransfer = async (opts: { ...@@ -359,19 +359,19 @@ export const doOwnershipTransfer = async (opts: {
* Check if the script should submit the transaction or wait for the deployer to do it manually. * Check if the script should submit the transaction or wait for the deployer to do it manually.
* *
* @param hre HardhatRuntimeEnvironment. * @param hre HardhatRuntimeEnvironment.
* @param ovveride Allow m * @param ovveride Allow manually disabling live transaction submission. Useful for testing.
* @returns True if the current step is the target step. * @returns True if the current step is the target step.
*/ */
export const liveDeployer = async (opts: { export const liveDeployer = async (opts: {
hre: HardhatRuntimeEnvironment hre: HardhatRuntimeEnvironment
disabled: string | undefined disabled: string | undefined
}): Promise<boolean> => { }): Promise<boolean> => {
let ret: boolean
if (!!opts.disabled) { if (!!opts.disabled) {
ret = false console.log('Setting live deployer to', false)
return false
} }
const { deployer } = await opts.hre.getNamedAccounts() const { deployer } = await opts.hre.getNamedAccounts()
ret = const ret =
deployer.toLowerCase() === opts.hre.deployConfig.controller.toLowerCase() deployer.toLowerCase() === opts.hre.deployConfig.controller.toLowerCase()
console.log('Setting live deployer to', ret) console.log('Setting live deployer to', ret)
return ret return ret
...@@ -447,6 +447,7 @@ export const doStep = async (opts: { ...@@ -447,6 +447,7 @@ export const doStep = async (opts: {
console.log(`Please execute step ${opts.step}...`) console.log(`Please execute step ${opts.step}...`)
console.log(`MSD address: ${opts.SystemDictator.address}`) console.log(`MSD address: ${opts.SystemDictator.address}`)
printJsonTransaction(tx) printJsonTransaction(tx)
printCastCommand(tx)
await printTenderlySimulationLink(opts.SystemDictator.provider, tx) await printTenderlySimulationLink(opts.SystemDictator.provider, tx)
} }
...@@ -547,8 +548,12 @@ export const printTenderlySimulationLink = async ( ...@@ -547,8 +548,12 @@ export const printTenderlySimulationLink = async (
*/ */
export const printCastCommand = (tx: ethers.PopulatedTransaction): void => { export const printCastCommand = (tx: ethers.PopulatedTransaction): void => {
if (process.env.CAST_COMMANDS) { if (process.env.CAST_COMMANDS) {
console.log( if (!!tx.value && tx.value.gt(0)) {
`cast send ${tx.to} ${tx.data} --from ${tx.from} --value ${tx.value}` console.log(
) `cast send ${tx.to} ${tx.data} --from ${tx.from} --value ${tx.value}`
)
} else {
console.log(`cast send ${tx.to} ${tx.data} --from ${tx.from} `)
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment