Skip to content

Commit

Permalink
chore: Add stage/stage-proofs/testnet/mainnet upgrade calldata (#2436)
Browse files Browse the repository at this point in the history
## What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.

---------

Co-authored-by: perekopskiy <[email protected]>
Co-authored-by: perekopskiy <[email protected]>
  • Loading branch information
3 people authored Sep 4, 2024
1 parent 85b7346 commit f260166
Show file tree
Hide file tree
Showing 6 changed files with 311 additions and 1 deletion.
5 changes: 5 additions & 0 deletions etc/upgrades/1720794961-decentralize-governance/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "decentralize-governance",
"creationTimestamp": 1720794961,
"protocolVersion": "0.24.2"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion infrastructure/protocol-upgrade/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
DefaultUpgradeFactory as DefaultUpgradeFactoryL1,
AdminFacetFactory,
GovernanceFactory,
StateTransitionManagerFactory
StateTransitionManagerFactory,
ChainAdminFactory
} from 'l1-contracts/typechain';
import { FacetCut } from 'l1-contracts/src.ts/diamondCut';
import { IZkSyncFactory } from '../pre-boojum/IZkSyncFactory';
Expand Down Expand Up @@ -207,6 +208,19 @@ function prepareGovernanceTxs(target: string, data: BytesLike): GovernanceTx {
};
}

function prepareChainAdminCalldata(target: string, data: BytesLike): string {
const call = {
target: target,
value: 0,
data: data
};

const chainAdmin = new ChainAdminFactory();
const calldata = chainAdmin.interface.encodeFunctionData('multicall', [[call], true]);

return calldata;
}

export function prepareTransparentUpgradeCalldataForNewGovernance(
oldProtocolVersion,
oldProtocolVersionDeadline,
Expand Down Expand Up @@ -249,6 +263,8 @@ export function prepareTransparentUpgradeCalldataForNewGovernance(
operation: governanceOperation
} = prepareGovernanceTxs(zksyncAddress, diamondProxyUpgradeCalldata);

const newExecuteChainUpgradeCalldata = prepareChainAdminCalldata(zksyncAddress, diamondProxyUpgradeCalldata);

const legacyScheduleTransparentOperation = adminFacet.interface.encodeFunctionData('executeUpgrade', [diamondCut]);
const { scheduleCalldata: legacyScheduleOperation, executeCalldata: legacyExecuteOperation } = prepareGovernanceTxs(
zksyncAddress,
Expand All @@ -260,6 +276,7 @@ export function prepareTransparentUpgradeCalldataForNewGovernance(
stmExecuteOperation,
scheduleTransparentOperation,
executeOperation,
newExecuteChainUpgradeCalldata,
diamondCut,
governanceOperation,
legacyScheduleOperation,
Expand Down

0 comments on commit f260166

Please sign in to comment.