Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,6 @@ contract DefaultEcosystemUpgrade is Script, DeployCTMAdditional {

addresses.bridgehub.bridgehubProxy = toml.readAddress("$.contracts.bridgehub_proxy_address");

addresses.transparentProxyAdmin = address(
uint160(uint256(vm.load(addresses.bridgehub.bridgehubProxy, ADMIN_SLOT)))
);
config.tokens.tokenWethAddress = toml.readAddress("$.tokens.token_weth_address");
newConfig.governanceUpgradeTimerInitialDelay = toml.readUint("$.governance_upgrade_timer_initial_delay");

Expand Down Expand Up @@ -733,6 +730,10 @@ contract DefaultEcosystemUpgrade is Script, DeployCTMAdditional {
address eraDiamondProxy = L1Bridgehub(addresses.bridgehub.bridgehubProxy).getZKChain(config.eraChainId);
(addresses.daAddresses.l1RollupDAValidator, ) = GettersFacet(eraDiamondProxy).getDAValidatorPair();

addresses.transparentProxyAdmin = address(
uint160(uint256(vm.load(ctm, ADMIN_SLOT)))
);

require(Ownable2StepUpgradeable(ctm).owner() == config.ownerAddress, "Incorrect owner");
}

Expand Down Expand Up @@ -1854,7 +1855,7 @@ contract DefaultEcosystemUpgrade is Script, DeployCTMAdditional {
}

/// @notice Tests that it is possible to upgrade a chain to the new version
function TESTONLY_prepareTestUpgradeChainCall() private returns (Call[] memory calls, address admin) {
function TESTONLY_prepareTestUpgradeChainCall() internal virtual returns (Call[] memory calls, address admin) {
address chainDiamondProxyAddress = L1Bridgehub(addresses.bridgehub.bridgehubProxy).getZKChain(
getSampleChainId()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ contract EcosystemUpgrade_v30_zksync_os_blobs is Script, DefaultEcosystemUpgrade
using stdToml for string;

uint256 internal sampleChainId;
address internal optionalCTM;

/// @notice E2e upgrade generation
function run() public virtual override {
Expand All @@ -114,6 +115,9 @@ contract EcosystemUpgrade_v30_zksync_os_blobs is Script, DefaultEcosystemUpgrade
}

function getSampleChainId() public view override returns (uint256) {
if (sampleChainId == 0) {
revert("Sample chain id is not set");
}
return sampleChainId;
}

Expand All @@ -124,20 +128,30 @@ contract EcosystemUpgrade_v30_zksync_os_blobs is Script, DefaultEcosystemUpgrade
string memory toml = vm.readFile(fullPath);

sampleChainId = toml.readUint("$.zksync_os.sample_chain_id");
if (sampleChainId == 0) {
optionalCTM = toml.readAddress("$.zksync_os.optional_ctm_address");
}

super.initialize(newConfigPath, _outputPath);
}

// Unlike the original one, we do not fetch the L1 da validator address
function setAddressesBasedOnBridgehub() internal override {
address ctm = IL1Bridgehub(addresses.bridgehub.bridgehubProxy).chainTypeManager(getSampleChainId());
address ctm;

if (sampleChainId == 0) {
ctm = optionalCTM;
require(ctm != address(0), "CTM address is not provided");
} else {
ctm = IL1Bridgehub(addresses.bridgehub.bridgehubProxy).chainTypeManager(getSampleChainId());
}

config.ownerAddress = Ownable2StepUpgradeable(ctm).owner();

addresses.stateTransition.chainTypeManagerProxy = ctm;
// We have to set the diamondProxy address here - as it is used by multiple constructors (for example L1Nullifier etc)
addresses.stateTransition.diamondProxy = IL1Bridgehub(addresses.bridgehub.bridgehubProxy).getZKChain(
getSampleChainId()
);

// In this upgrade, we never need to use this value, so set it to zer0.
addresses.stateTransition.diamondProxy = address(0);
uint256 ctmProtocolVersion = IChainTypeManager(ctm).protocolVersion();
require(
ctmProtocolVersion != getNewProtocolVersion(),
Expand Down Expand Up @@ -177,6 +191,10 @@ contract EcosystemUpgrade_v30_zksync_os_blobs is Script, DefaultEcosystemUpgrade

addresses.stateTransition.validatorTimelock = ChainTypeManagerBase(ctm).validatorTimelockPostV29();
require(Ownable2StepUpgradeable(ctm).owner() == config.ownerAddress, "Incorrect owner");

addresses.transparentProxyAdmin = address(
uint160(uint256(vm.load(ctm, ADMIN_SLOT)))
);
}

// Unlike the original one, we only deploy L1 contracts (no Gateway) and generate the upgrade data.
Expand Down Expand Up @@ -314,12 +332,12 @@ contract EcosystemUpgrade_v30_zksync_os_blobs is Script, DefaultEcosystemUpgrade

proposedUpgrade = ProposedUpgrade({
l2ProtocolUpgradeTx: transaction,
// Unused in zksync os context
bootloaderHash: config.contracts.bootloaderHash,
// Unused in zksync os context
defaultAccountHash: config.contracts.defaultAAHash,
// Unused in zksync os context
evmEmulatorHash: config.contracts.evmEmulatorHash,
// Unused in zksync os context, so we dont change it
bootloaderHash: bytes32(0),
// Unused in zksync os context, so we dont change it
defaultAccountHash: bytes32(0),
// Unused in zksync os context, so we dont change it
evmEmulatorHash: bytes32(0),
verifier: stateTransition.verifier,
verifierParams: VerifierParams({
recursionNodeLevelVkHash: bytes32(0),
Expand All @@ -336,4 +354,43 @@ contract EcosystemUpgrade_v30_zksync_os_blobs is Script, DefaultEcosystemUpgrade
function deployUsedUpgradeContract() internal virtual override returns (address) {
return deploySimpleContract("L1ZKsyncOSV30Upgrade", false);
}

function getFacetCutsForDeletion() internal override returns (Diamond.FacetCut[] memory facetCuts) {
// One mainnet, we do not provide any facet cuts for deletion.
// This may imply wrong behavior during the upgrade, but there are
// no existing zksync os chains on mainnet, so the upgrade will not be applied to any chain.
if (sampleChainId != 0) {
facetCuts = super.getFacetCutsForDeletion();
}
}

// Same, as in the base contract, but we use chain asset id of the ZK gateway chain (i.e. ZK)
function prepareCreateNewChainCall(uint256 chainId) public view override returns (Call[] memory result) {
require(addresses.bridgehub.bridgehubProxy != address(0), "bridgehubProxyAddress is zero in newConfig");

bytes32 newChainAssetId = L1Bridgehub(addresses.bridgehub.bridgehubProxy).baseTokenAssetId(gatewayConfig.chainId);
result = new Call[](1);
result[0] = Call({
target: addresses.bridgehub.bridgehubProxy,
value: 0,
data: abi.encodeCall(
IL1Bridgehub.createNewChain,
(
chainId,
addresses.stateTransition.chainTypeManagerProxy,
newChainAssetId,
5,
msg.sender,
abi.encode(newlyGeneratedData.diamondCutData, newlyGeneratedData.fixedForceDeploymentsData),
new bytes[](0)
)
)
});
}

function TESTONLY_prepareTestUpgradeChainCall() internal override returns (Call[] memory calls, address admin) {
if (sampleChainId != 0) {
(calls, admin) = super.TESTONLY_prepareTestUpgradeChainCall();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ old_protocol_version = "0x1d00000000"
priority_txs_l2_gas_limit = 2000000
max_expected_l1_gas_price = 50000000000
is_zk_sync_os = true
redeploy_da_manager = true

[contracts]
governance_min_delay = 0

max_number_of_chains = 100
create2_factory_salt = "0x55de3677ffea74c9815331db7f4c737a32c161db4cae7d47504a336c4c5bcfb5"
create2_factory_salt = "0x65de3677ffea74c9815331db7f4c737a32c161db4cae7d47504a336c4c5bcfb5"
create2_factory_addr = "0x4e59b44847b379578588920cA78FbF26c0B4956C"
validator_timelock_execution_delay = 0
genesis_root = "0x6ef70107782e23150da78ff573ce332747a988e77518739723924e4f5593be22"
genesis_root = "0x423c107626aff95d3d086eabd92132dc9485e021ae3cb4c7735d5e963578e3d0"
genesis_rollup_leaf_index = 0
genesis_batch_commitment = "0000000000000000000000000000000000000000000000000000000000000001"
recursion_node_level_vk_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
Expand All @@ -39,6 +40,7 @@ bridgehub_proxy_address = "0xfaf7f9079efe7e9b681aab926e7ca9801af4f993"
# Does not matter, a new one should be deployed
rollup_da_manager = "0xeb7c0daaddfb52afa05400b489e7497b271d6122"


governance_security_council_address = "0xed04b1ac422251851a3EC953Ff4395e5c2443647"
latest_protocol_version = 0x1e00000000
# Does not matter, unused
Expand Down
76 changes: 76 additions & 0 deletions l1-contracts/upgrade-envs/v0.30.0-zksync-os-blobs/mainnet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
era_chain_id = 324
testnet_verifier = false
# Unused
governance_upgrade_timer_initial_delay = 0
# Note, that this is NOT the owner of the bridgehub, but the owner of the zksync os CTM.
owner_address = "0xc66f0b45c05cf654eec093650fd67865e85e8566"

# This should always be false for non-loadtest environments.
support_l2_legacy_shared_bridge_test = false

old_protocol_version = "0x1d00000001"

priority_txs_l2_gas_limit = 2000000
max_expected_l1_gas_price = 30000000000
is_zk_sync_os = true
redeploy_da_manager = true

[contracts]
governance_min_delay = 0

max_number_of_chains = 100
create2_factory_salt = "0x95de5677ffea74c9815331db7f5c737a33c161db4cae7d47504a336c4c5bcfdc"
create2_factory_addr = "0x4e59b44847b379578588920cA78FbF26c0B4956C"
validator_timelock_execution_delay = 10800
genesis_root = "0x423c107626aff95d3d086eabd92132dc9485e021ae3cb4c7735d5e963578e3d0"
genesis_rollup_leaf_index = 0
genesis_batch_commitment = "0000000000000000000000000000000000000000000000000000000000000001"
recursion_node_level_vk_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
recursion_leaf_level_vk_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
recursion_circuits_set_vks_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
priority_tx_max_gas_limit = 72000000
diamond_init_pubdata_pricing_mode = 0
diamond_init_batch_overhead_l1_gas = 1000000
diamond_init_max_pubdata_per_batch = 120000
diamond_init_max_l2_gas_per_batch = 80000000
diamond_init_priority_tx_max_pubdata = 99000
diamond_init_minimal_l2_gas_price = 250000000
bootloader_hash = "0x0000000000000000000000000000000000000000000000000000000000000001"
default_aa_hash = "0x0000000000000000000000000000000000000000000000000000000000000001"
evm_emulator_hash = "0x0000000000000000000000000000000000000000000000000000000000000001"
bridgehub_proxy_address = "0x303a465B659cBB0ab36eE643eA362c509EEb5213"
# Does not matter, a new one should be deployed
rollup_da_manager = "0xE689e79a06D3D09f99C21E534cCF6a8b7C9b3C45"

# Does not matter
governance_security_council_address = "0xed04b1ac422251851a3EC953Ff4395e5c2443647"

latest_protocol_version = 0x1e00000000

# Unused as bytecode supplier is not supported in this upgrade.
l1_bytecodes_supplier_addr = "0xC9F20FC268Fc3e0e597660550033Bf2C24218fd8"

# Unused, since the upgrade is done for the ecosystem.
protocol_upgrade_handler_proxy_address = "0xE30Dca3047B37dc7d88849dE4A4Dc07937ad5Ab3"
protocol_upgrade_handler_implementation_address = "0x36625Bd3dDB469377C6e9893712158cA3c0cC14B"

[tokens]
token_weth_address = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"

[gateway]
chain_id = 9075

# On mainnet there are no existing zksync os chain, thus no operations that use it are available.
# I.e. chains will not be able to upgrade from v29.1, but it is okay, since there
# are no such chains in the first place.
[zksync_os]
sample_chain_id = 0
# Unlike stage or testnet, there is no sample chain to get the CTM from, so
# we have to provide it explicitly.
optional_ctm_address = "0x1adf137f59949c9081157d5de1e002d1c992071f"

[gateway.gateway_state_transition]
chain_type_manager_proxy_addr = "0x912B84EEEEBeca74d307b9a2b09c68332aa5426C"
rollup_da_manager = "0x5E12D7E0bB68029afbeC83ccB9E8eDE6019ef073"
chain_type_manager_proxy_admin = "0x0A8a176B6F5962122C6E8F8815278f873D74021f"
rollup_sl_da_validator = "0x595b8C88B9e5f3a4c596C3e81BE6e11D53Bb9200"

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.

Loading
Loading