Commit 6beca3f4 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into aj/fpp-server

parents 6851d171 0aa7e8c0
...@@ -33,14 +33,37 @@ const checkPredeploys = async ( ...@@ -33,14 +33,37 @@ const checkPredeploys = async (
provider: providers.Provider provider: providers.Provider
) => { ) => {
console.log('Checking predeploys are configured correctly') console.log('Checking predeploys are configured correctly')
const admin = hre.ethers.utils.hexConcat([
'0x000000000000000000000000',
predeploys.ProxyAdmin,
])
const codeReq = []
const slotReq = []
// First loop for requests
for (let i = 0; i < 2048; i++) { for (let i = 0; i < 2048; i++) {
const num = hre.ethers.utils.hexZeroPad('0x' + i.toString(16), 2) const num = hre.ethers.utils.hexZeroPad('0x' + i.toString(16), 2)
const addr = hre.ethers.utils.getAddress( const addr = hre.ethers.utils.getAddress(
hre.ethers.utils.hexConcat([prefix, num]) hre.ethers.utils.hexConcat([prefix, num])
) )
const code = await provider.getCode(addr) codeReq.push(provider.getCode(addr))
if (code === '0x') { slotReq.push(provider.getStorageAt(addr, adminSlot))
}
// Wait for all requests to finish
// The `JsonRpcBatchProvider` will batch requests in the background.
const codeRes = await Promise.all(codeReq)
const slotRes = await Promise.all(slotReq)
// Second loop for response checks
for (let i = 0; i < 2048; i++) {
const num = hre.ethers.utils.hexZeroPad('0x' + i.toString(16), 2)
const addr = hre.ethers.utils.getAddress(
hre.ethers.utils.hexConcat([prefix, num])
)
if (codeRes[i] === '0x') {
throw new Error(`no code found at ${addr}`) throw new Error(`no code found at ${addr}`)
} }
...@@ -52,13 +75,7 @@ const checkPredeploys = async ( ...@@ -52,13 +75,7 @@ const checkPredeploys = async (
continue continue
} }
const slot = await provider.getStorageAt(addr, adminSlot) if (slotRes[i] !== admin) {
const admin = hre.ethers.utils.hexConcat([
'0x000000000000000000000000',
predeploys.ProxyAdmin,
])
if (admin !== slot) {
throw new Error(`incorrect admin slot in ${addr}`) throw new Error(`incorrect admin slot in ${addr}`)
} }
...@@ -686,7 +703,9 @@ task('check-l2', 'Checks a freshly migrated L2 system for correct migration') ...@@ -686,7 +703,9 @@ task('check-l2', 'Checks a freshly migrated L2 system for correct migration')
if (args.l2RpcUrl !== '') { if (args.l2RpcUrl !== '') {
console.log('Using CLI URL for provider instead of hardhat network') console.log('Using CLI URL for provider instead of hardhat network')
const provider = new hre.ethers.providers.JsonRpcProvider(args.l2RpcUrl) const provider = new hre.ethers.providers.JsonRpcBatchProvider(
args.l2RpcUrl
)
signer = Wallet.createRandom().connect(provider) signer = Wallet.createRandom().connect(provider)
} }
......
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