• Matthew Slipper's avatar
    ctb, testmig: Add migration test script, migration dictator cleanups (#3812) · 8333f0f2
    Matthew Slipper authored
    * ctb, testmig: Add migration test script, migration dictator cleanups
    
    Adds a Python script to test the migration end-to-end. Currently, it will:
    
    1. Download a DTL and L2Geth archive from GCS
    2. Spin up a forked L1
    3. Set state slots so that the deployer owns the legacy system
    4. Perform the migration
    
    Also includes some fixes to make the migration dictator work, there were a couple of small changes that still needed to be implemented.
    
    * bindings: regenerate
    
    * update deploy configs
    
    * bindingz
    8333f0f2
hardhat.config.js 842 Bytes
require('dotenv').config()

const isForkModeEnabled = !!process.env.FORK_URL
const forkUrl = process.env.FORK_URL
const forkStartingBlock =
  parseInt(process.env.FORK_STARTING_BLOCK, 10) || undefined
const gasPrice = parseInt(process.env.GAS_PRICE, 10) || 0

const config = {
  networks: {
    hardhat: {
      gasPrice,
      initialBaseFeePerGas: 0,
      chainId: process.env.FORK_CHAIN_ID ? Number(process.env.FORK_CHAIN_ID) : 31337
    },
  },
  analytics: { enabled: false },
}

if (isForkModeEnabled) {
  console.log(`Running hardhat in a fork mode! URL: ${forkUrl}`)
  if (forkStartingBlock) {
    console.log(`Starting block: ${forkStartingBlock}`)
  }
  config.networks.hardhat.forking = {
    url: forkUrl,
    blockNumber: forkStartingBlock,
  }
} else {
  console.log('Running with a fresh state...')
}

module.exports = config