Commit 7e808e75 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: check-l2 checks for genesis magic

Add additional check for the genesis magic value.
This ensures that the L2OutputOracle's starting
block number is set correctly.
parent 2f2dc333
......@@ -131,6 +131,22 @@ const assertProxy = async (
}
}
// checks to make sure that the genesis magic value
// was set correctly
const checkGenesisMagic = async (
hre: HardhatRuntimeEnvironment,
provider: providers.Provider
) => {
const start = hre.deployConfig.l2OutputOracleStartingBlockNumber
const block = await provider.getBlock(start)
const extradata = block.extraData
const magic = '0x' + Buffer.from('BEDROCK').toString('hex')
if (extradata !== magic) {
throw new Error('magic value in extradata does not match')
}
}
const check = {
// LegacyMessagePasser
// - check version
......@@ -632,6 +648,8 @@ task('check-l2', 'Checks a freshly migrated L2 system for correct migration')
await checkPredeploys(hre, signer.provider)
}
await checkGenesisMagic(hre, signer.provider)
console.log()
// Check the currently configured predeploys
for (const [name, fn] of Object.entries(check)) {
......
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