Skip to content
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

Real Upgrade Parameters #670

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
806af16
fmt
godzillaba Jun 3, 2024
5b93303
wip
godzillaba Jun 3, 2024
418b2e7
upgrade test script
godzillaba Jun 4, 2024
17de8c7
sepolia test
godzillaba Jun 4, 2024
2465452
nova test
godzillaba Jun 4, 2024
c8edb9f
wip
godzillaba Jun 4, 2024
ebf8dd4
finish checks
godzillaba Jun 12, 2024
dd58b8b
fmt
godzillaba Jun 12, 2024
fa98c54
remove deployed contracts
godzillaba Jun 12, 2024
3fe1734
Merge branch 'main' into upgrade-action-test-improvements
godzillaba Jun 12, 2024
77585a6
move config to ts file
godzillaba Jun 12, 2024
1643ea9
separate config files
godzillaba Jun 12, 2024
89b4e79
fix ts error
godzillaba Jun 12, 2024
70cadda
stricter types
godzillaba Jun 12, 2024
58c1ad5
fmt
godzillaba Jun 12, 2024
cc23c57
update real parameters
godzillaba Jun 13, 2024
316c1bd
Move configs to ts files (#669)
godzillaba Jun 13, 2024
9732ce4
solgen
godzillaba Jun 13, 2024
d137e4d
Merge branch 'upgrade-action-test-improvements' into real-upgrade-par…
godzillaba Jun 13, 2024
c6eb374
Merge branch 'main' into upgrade-action-test-improvements
godzillaba Jun 13, 2024
c7e3985
Merge branch 'upgrade-action-test-improvements' into real-upgrade-par…
godzillaba Jun 13, 2024
bac331a
Merge branch 'main' into real-upgrade-parameters
godzillaba Jun 13, 2024
d824ba5
set grace period sepolia
godzillaba Jun 13, 2024
e17495c
keep sepolia whitelist and short confirm period
godzillaba Jun 17, 2024
f51801f
update grace period
godzillaba Jun 17, 2024
6265a50
checked sepolia validators
godzillaba Jun 17, 2024
edfa405
checked arb1 validators
godzillaba Jun 17, 2024
d27762f
checked nova validators
godzillaba Jun 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
upgrade test script
godzillaba committed Jun 4, 2024
commit 418b2e7946ecda7aa8c3cd0f3692275e781084b6
13 changes: 2 additions & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -233,9 +233,6 @@ jobs:
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: Start anvil
run: anvil --fork-url ${{ secrets.L1_RPC }} &

- name: Install packages
run: yarn

@@ -246,11 +243,5 @@ jobs:
run: |
cp ./.env-sample ./.env

- name: Deploy bold dependencies
run: yarn script:bold-prepare

- name: Populate state hash lookup
run: yarn script:bold-populate-lookup

- name: Execute and verify bold upgrade
run: yarn script:bold-local-execute
- name: Test upgrade
run: L1_RPC=${{ secrets.L1_RPC }} yarn test:upgrade
1 change: 1 addition & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@
"test:storage": "./test/storage/test.bash",
"test:signatures": "./test/signatures/test-sigs.bash",
"test:e2e": "hardhat test test/e2e/*.ts",
"test:upgrade": "./scripts/testUpgrade.bash",
"postinstall": "patch-package",
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
61 changes: 28 additions & 33 deletions contracts/scripts/testLocalExecuteBoldUpgrade.ts
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@ import { Config, DeployedContracts, getConfig, getJsonFile } from './common'
import {
BOLDUpgradeAction__factory,
EdgeChallengeManager,
EdgeChallengeManager__factory, RollupUserLogic, RollupUserLogic__factory
EdgeChallengeManager__factory,
RollupUserLogic,
RollupUserLogic__factory,
} from '../build/types'
import { abi as UpgradeExecutorAbi } from './files/UpgradeExecutor.json'
import dotenv from 'dotenv'
import {
RollupMigratedEvent
} from '../build/types/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction'
import { RollupMigratedEvent } from '../build/types/src/rollup/BOLDUpgradeAction.sol/BOLDUpgradeAction'
import { abi as OldRollupAbi } from './files/OldRollupUserLogic.json'
import { JsonRpcProvider } from '@ethersproject/providers'
import { getAddress } from 'ethers/lib/utils'
@@ -27,21 +27,22 @@ type VerificationParams = {
receipt: ContractReceipt
}

async function getPreUpgradeState(
l1Rpc: JsonRpcProvider,
config: Config
) {
async function getPreUpgradeState(l1Rpc: JsonRpcProvider, config: Config) {
const oldRollupContract = new Contract(
config.contracts.rollup,
OldRollupAbi,
l1Rpc
)
const zombieCount = await oldRollupContract.zombieCount()

const stakerCount = await oldRollupContract.stakerCount()

const stakers: string[] = []
for (let i = 0; i < stakerCount; i++) {
stakers.push(await oldRollupContract.getStakerAddress(i))
}

return {
zombieCount,
stakerCount,
stakers,
}
}

@@ -101,10 +102,7 @@ async function verifyPostUpgrade(params: VerificationParams) {
l1Rpc
)

const newRollup = RollupUserLogic__factory.connect(
parsedLog.rollup,
l1Rpc
)
const newRollup = RollupUserLogic__factory.connect(parsedLog.rollup, l1Rpc)

await checkBridge(params)
await checkOldRollup(params)
@@ -115,7 +113,10 @@ async function verifyPostUpgrade(params: VerificationParams) {
async function checkSequencerInbox(params: VerificationParams) {
const { l1Rpc, config, deployedContracts } = params
// make sure the impl was updated
if (await getProxyImpl(l1Rpc, config.contracts.sequencerInbox) !== deployedContracts.seqInbox) {
if (
(await getProxyImpl(l1Rpc, config.contracts.sequencerInbox)) !==
deployedContracts.seqInbox
) {
throw new Error('SequencerInbox was not upgraded')
}

@@ -124,13 +125,12 @@ async function checkSequencerInbox(params: VerificationParams) {
}

async function checkBridge(params: VerificationParams) {
const {
l1Rpc,
config,
deployedContracts
} = params
const { l1Rpc, config, deployedContracts } = params
// make sure the impl was updated
if (await getProxyImpl(l1Rpc, config.contracts.bridge) !== deployedContracts.bridge) {
if (
(await getProxyImpl(l1Rpc, config.contracts.bridge)) !==
deployedContracts.bridge
) {
throw new Error('Bridge was not upgraded')
}
}
@@ -154,13 +154,11 @@ async function checkOldRollup(params: VerificationParams) {
throw new Error('Old rollup has stakers')
}

// ensure there are the right number of zombies
if (
!(await oldRollupContract.zombieCount()).eq(
preUpgradeState.zombieCount.add(preUpgradeState.stakerCount)
)
) {
throw new Error('Old rollup has wrong number of zombies')
// ensure that the old stakers are now zombies
for (const staker of preUpgradeState.stakers) {
if (!(await oldRollupContract.isZombie(staker))) {
throw new Error('Old staker is not a zombie')
}
}

// ensure old rollup was upgraded
@@ -321,10 +319,7 @@ async function main() {
throw new Error('No boldAction contract deployed')
}

const preUpgradeState = await getPreUpgradeState(
l1Rpc,
config
)
const preUpgradeState = await getPreUpgradeState(l1Rpc, config)
const receipt = await perform(l1Rpc, config, deployedContracts)
await verifyPostUpgrade({
l1Rpc,
11 changes: 11 additions & 0 deletions contracts/scripts/testUpgrade.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

anvil --fork-url $L1_RPC > /dev/null &

anvil_pid=$!

yarn script:bold-prepare && \
yarn script:bold-populate-lookup && \
yarn script:bold-local-execute

kill $anvil_pid