Skip to content

Commit

Permalink
feat: validateRollupDeployedAtAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
gzeoneth committed Nov 19, 2024
1 parent 5ec4ee3 commit 07a83bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
15 changes: 5 additions & 10 deletions scripts/executeBoldUpgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ async function verifyPostUpgrade(params: VerificationParams) {
l1Rpc
)

const expectedRollupAddress = await boldAction.expectedRollupAddress(
config.contracts.upgradeExecutor,
config.settings.chainId
)

const rollupMigratedLogs = receipt.events!.filter(
event =>
event.topics[0] === boldAction.interface.getEventTopic('RollupMigrated')
Expand All @@ -160,11 +155,11 @@ async function verifyPostUpgrade(params: VerificationParams) {
const rollupMigratedLog = boldAction.interface.parseLog(rollupMigratedLogs[0])
.args as RollupMigratedEvent['args']

if (rollupMigratedLog.rollup !== expectedRollupAddress) {
throw new Error(
'RollupMigratedEvent rollup address does not match expected'
)
}
await boldAction.validateRollupDeployedAtAddress(
rollupMigratedLog.rollup,
config.contracts.upgradeExecutor,
config.settings.chainId
)

const boldRollup = RollupUserLogic__factory.connect(
rollupMigratedLog.rollup,
Expand Down
10 changes: 6 additions & 4 deletions src/rollup/BOLDUpgradeAction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,15 @@ contract BOLDUpgradeAction {
);
}

function isRollupDeployedAtAddress(
function validateRollupDeployedAtAddress(
address rollupAddress,
address deployer,
uint256 chainId
) external view returns (bool) {
return rollupAddress.code.length > 0
&& expectedRollupAddress(deployer, chainId) == rollupAddress;
) external view {
require(rollupAddress.code.length > 0, "ROLLUP_NOT_DEPLOYED");
require(
expectedRollupAddress(deployer, chainId) == rollupAddress, "ROLLUP_ADDRESS_MISMATCH"
);
}

function perform(
Expand Down

0 comments on commit 07a83bb

Please sign in to comment.