Skip to content

Commit 21d0253

Browse files
committed
Remove more
Signed-off-by: Danil <[email protected]>
1 parent 6e3dc50 commit 21d0253

File tree

7 files changed

+9
-121
lines changed

7 files changed

+9
-121
lines changed
Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,14 @@
1-
use ethers::{
2-
prelude::U256,
3-
types::{Address, H256},
4-
};
1+
use ethers::types::{Address, H256};
52
use serde::{Deserialize, Serialize};
63
use zkstack_cli_types::{L1Network, VMOption};
7-
use zksync_basic_types::{protocol_version::ProtocolSemanticVersion, u256_to_h256};
4+
use zksync_basic_types::u256_to_h256;
85

96
use crate::{
107
forge_interface::deploy_ecosystem::input::InitialDeploymentConfig, traits::FileConfigTrait,
11-
ContractsGenesisConfig, WalletsConfig,
8+
WalletsConfig,
129
};
1310

1411
/// Part of the genesis config influencing `DeployGatewayCTMInput`.
15-
#[derive(Debug)]
16-
pub struct GenesisInput {
17-
pub bootloader_hash: Option<H256>,
18-
pub default_aa_hash: Option<H256>,
19-
pub evm_emulator_hash: Option<H256>,
20-
pub rollup_last_leaf_index: Option<u64>,
21-
pub genesis_commitment: H256,
22-
pub genesis_root_hash: H256,
23-
pub protocol_version: ProtocolSemanticVersion,
24-
}
25-
26-
impl GenesisInput {
27-
pub fn new(
28-
contract_genesis_config: &ContractsGenesisConfig,
29-
vmoption: VMOption,
30-
) -> anyhow::Result<Self> {
31-
let protocol_version = contract_genesis_config.protocol_semantic_version()?;
32-
match vmoption {
33-
VMOption::EraVM => Ok(Self {
34-
bootloader_hash: Some(contract_genesis_config.0.get("bootloader_hash")?),
35-
default_aa_hash: Some(contract_genesis_config.0.get("default_aa_hash")?),
36-
evm_emulator_hash: Some(
37-
contract_genesis_config
38-
.0
39-
.get_opt("evm_emulator_hash")?
40-
.unwrap_or_default(),
41-
),
42-
genesis_root_hash: contract_genesis_config.0.get("genesis_root")?,
43-
rollup_last_leaf_index: Some(
44-
contract_genesis_config.0.get("genesis_rollup_leaf_index")?,
45-
),
46-
genesis_commitment: contract_genesis_config.0.get("genesis_batch_commitment")?,
47-
protocol_version,
48-
}),
49-
VMOption::ZKSyncOsVM => {
50-
let one = u256_to_h256(U256::one());
51-
let genesis_root = contract_genesis_config.0.get("genesis_root")?;
52-
Ok(Self {
53-
genesis_root_hash: genesis_root,
54-
// Placeholders, not used in zkSync OS mode. But necessary to be provided.
55-
genesis_commitment: one,
56-
bootloader_hash: None,
57-
default_aa_hash: None,
58-
evm_emulator_hash: None,
59-
rollup_last_leaf_index: None,
60-
protocol_version,
61-
})
62-
}
63-
}
64-
}
65-
}
6612
6713
#[derive(Debug, Deserialize, Serialize, Clone)]
6814
pub struct DeployCTMConfig {
@@ -78,7 +24,6 @@ impl FileConfigTrait for DeployCTMConfig {}
7824
impl DeployCTMConfig {
7925
#[allow(clippy::too_many_arguments)]
8026
pub fn new(
81-
genesis_input: &GenesisInput,
8227
wallets_config: &WalletsConfig,
8328
initial_deployment_config: &InitialDeploymentConfig,
8429
testnet_verifier: bool,
@@ -97,14 +42,6 @@ impl DeployCTMConfig {
9742
// TODO verify correctnesss
9843
governance_security_council_address: wallets_config.governor.address,
9944
governance_min_delay: initial_deployment_config.governance_min_delay,
100-
bootloader_hash: genesis_input.bootloader_hash,
101-
default_aa_hash: genesis_input.default_aa_hash,
102-
evm_emulator_hash: genesis_input.evm_emulator_hash,
103-
// These values are not optional in genesis config with file based configuration
104-
genesis_batch_commitment: genesis_input.genesis_commitment,
105-
genesis_rollup_leaf_index: genesis_input.rollup_last_leaf_index,
106-
genesis_root: genesis_input.genesis_root_hash,
107-
latest_protocol_version: genesis_input.protocol_version.pack(),
10845
validator_timelock_execution_delay: initial_deployment_config
10946
.validator_timelock_execution_delay,
11047
avail_l1_da_validator_addr: l1_network.avail_l1_da_validator_addr(),
@@ -121,17 +58,6 @@ pub struct ContractsDeployCTMConfig {
12158
pub governance_security_council_address: Address,
12259
pub governance_min_delay: u64,
12360
pub validator_timelock_execution_delay: u64,
124-
pub genesis_root: H256,
125-
pub genesis_batch_commitment: H256,
126-
pub latest_protocol_version: U256,
127-
#[serde(skip_serializing_if = "Option::is_none")]
128-
pub genesis_rollup_leaf_index: Option<u64>,
129-
#[serde(skip_serializing_if = "Option::is_none")]
130-
pub bootloader_hash: Option<H256>,
131-
#[serde(skip_serializing_if = "Option::is_none")]
132-
pub default_aa_hash: Option<H256>,
133-
#[serde(skip_serializing_if = "Option::is_none")]
134-
pub evm_emulator_hash: Option<H256>,
13561
#[serde(skip_serializing_if = "Option::is_none")]
13662
pub avail_l1_da_validator_addr: Option<Address>,
13763
}

zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use ethers::{
66
};
77
use rand::Rng;
88
use serde::{Deserialize, Serialize};
9-
use zkstack_cli_types::VMOption;
109
use zksync_basic_types::L2ChainId;
1110

1211
use crate::{
@@ -101,7 +100,6 @@ pub struct DeployL1Config {
101100
pub support_l2_legacy_shared_bridge_test: bool,
102101
pub contracts: ContractsDeployL1Config,
103102
pub tokens: TokensDeployL1Config,
104-
pub is_zk_sync_os: bool,
105103
}
106104

107105
impl FileConfigTrait for DeployL1Config {}
@@ -113,10 +111,8 @@ impl DeployL1Config {
113111
initial_deployment_config: &InitialDeploymentConfig,
114112
era_chain_id: L2ChainId,
115113
support_l2_legacy_shared_bridge_test: bool,
116-
vm_option: VMOption,
117114
) -> Self {
118115
Self {
119-
is_zk_sync_os: vm_option.is_zksync_os(),
120116
era_chain_id,
121117
owner_address: wallets_config.governor.address,
122118
support_l2_legacy_shared_bridge_test,

zkstack_cli/crates/config/src/forge_interface/upgrade_ecosystem/input.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ use zkstack_cli_types::VMOption;
44
use zksync_basic_types::L2ChainId;
55

66
use crate::{
7-
forge_interface::{
8-
deploy_ctm::input::GenesisInput, deploy_ecosystem::input::InitialDeploymentConfig,
9-
},
10-
traits::FileConfigTrait,
7+
forge_interface::deploy_ecosystem::input::InitialDeploymentConfig, traits::FileConfigTrait,
118
CoreContractsConfig,
129
};
1310

@@ -45,7 +42,6 @@ impl FileConfigTrait for EcosystemUpgradeInput {}
4542
impl EcosystemUpgradeInput {
4643
#[allow(clippy::too_many_arguments)]
4744
pub fn new(
48-
new_genesis_input: &GenesisInput,
4945
current_contracts_config: &CoreContractsConfig,
5046
gateway_upgrade_config: &GatewayUpgradeContractsConfig,
5147
// It is expected to not change between the versions
@@ -67,12 +63,6 @@ impl EcosystemUpgradeInput {
6763
create2_factory_salt: initial_deployment_config.create2_factory_salt,
6864
governance_min_delay: initial_deployment_config.governance_min_delay,
6965
max_number_of_chains: initial_deployment_config.max_number_of_chains,
70-
// These values are not optional in genesis config with file based configuration
71-
genesis_batch_commitment: new_genesis_input.genesis_commitment,
72-
bootloader_hash: new_genesis_input.bootloader_hash,
73-
default_aa_hash: new_genesis_input.default_aa_hash,
74-
genesis_rollup_leaf_index: new_genesis_input.rollup_last_leaf_index,
75-
genesis_root: new_genesis_input.genesis_root_hash,
7666
bridgehub_proxy_address: current_contracts_config
7767
.core_ecosystem_contracts
7868
.bridgehub_proxy_addr,
@@ -89,14 +79,13 @@ impl EcosystemUpgradeInput {
8979
.ctm(vm_option)
9080
.validator_timelock_addr,
9181
governance_security_council_address: Address::zero(),
92-
latest_protocol_version: new_genesis_input.protocol_version.pack(),
93-
evm_emulator_hash: new_genesis_input.evm_emulator_hash,
9482
l1_bytecodes_supplier_addr: current_contracts_config
9583
.ctm(vm_option)
9684
.l1_bytecodes_supplier_addr,
9785
protocol_upgrade_handler_proxy_address: Address::zero(),
9886
rollup_da_manager: Address::zero(),
99-
validator_timelock_execution_delay: 0,
87+
validator_timelock_execution_delay: initial_deployment_config
88+
.validator_timelock_execution_delay,
10089
},
10190
gateway: gateway_upgrade_config.clone(),
10291
tokens: GatewayUpgradeTokensConfig {
@@ -119,11 +108,6 @@ pub struct EcosystemUpgradeContractsConfig {
119108
#[serde(skip_serializing_if = "Option::is_none")]
120109
pub create2_factory_addr: Option<Address>,
121110
pub validator_timelock_execution_delay: u64,
122-
pub genesis_root: H256,
123-
pub genesis_rollup_leaf_index: Option<u64>,
124-
pub genesis_batch_commitment: H256,
125-
pub bootloader_hash: Option<H256>,
126-
pub default_aa_hash: Option<H256>,
127111

128112
pub bridgehub_proxy_address: Address,
129113
pub shared_bridge_proxy_address: Address,
@@ -134,8 +118,6 @@ pub struct EcosystemUpgradeContractsConfig {
134118
pub old_validator_timelock: Address,
135119

136120
pub governance_security_council_address: Address,
137-
pub latest_protocol_version: U256,
138-
pub evm_emulator_hash: Option<H256>,
139121
pub l1_bytecodes_supplier_addr: Address,
140122
pub protocol_upgrade_handler_proxy_address: Address,
141123
pub rollup_da_manager: Address,

zkstack_cli/crates/zkstack/src/commands/ctm/commands/init_new_ctm.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@ use zkstack_cli_common::{
99
};
1010
use zkstack_cli_config::{
1111
forge_interface::{
12-
deploy_ctm::{
13-
input::{DeployCTMConfig, GenesisInput},
14-
output::DeployCTMOutput,
15-
},
12+
deploy_ctm::{input::DeployCTMConfig, output::DeployCTMOutput},
1613
deploy_ecosystem::input::InitialDeploymentConfig,
1714
script_params::DEPLOY_CTM_SCRIPT_PARAMS,
1815
},
1916
traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath},
20-
ContractsGenesisConfig, CoreContractsConfig, EcosystemConfig, ZkStackConfig,
17+
CoreContractsConfig, EcosystemConfig, ZkStackConfig,
2118
};
2219
use zkstack_cli_types::{L1Network, ProverMode, VMOption};
2320

@@ -173,14 +170,10 @@ pub async fn deploy_new_ctm(
173170
let mut contracts_config = config.get_contracts_config()?;
174171
let deploy_config_path =
175172
DEPLOY_CTM_SCRIPT_PARAMS.input(&config.path_to_foundry_scripts_for_ctm(vm_option));
176-
let genesis_config_path = config.default_genesis_path(vm_option);
177-
let default_genesis_config = ContractsGenesisConfig::read(shell, &genesis_config_path).await?;
178-
let default_genesis_input = GenesisInput::new(&default_genesis_config, vm_option)?;
179173

180174
let wallets_config = config.get_wallets()?;
181175
// For deploying ecosystem we only need genesis batch params
182176
let deploy_config = DeployCTMConfig::new(
183-
&default_genesis_input,
184177
&wallets_config,
185178
initial_deployment_config,
186179
config.prover_version == ProverMode::NoProofs,

zkstack_cli/crates/zkstack/src/commands/dev/commands/upgrades/default_ecosystem_upgrade.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use xshell::{cmd, Shell};
1111
use zkstack_cli_common::{ethereum::get_ethers_provider, forge::Forge, logger, spinner::Spinner};
1212
use zkstack_cli_config::{
1313
forge_interface::{
14-
deploy_ctm::input::GenesisInput,
1514
script_params::{
1615
ForgeScriptParams, FINALIZE_UPGRADE_SCRIPT_PARAMS, V29_UPGRADE_ECOSYSTEM_PARAMS,
1716
},
@@ -141,8 +140,6 @@ async fn no_governance_prepare(
141140
};
142141

143142
let genesis_config_path = ecosystem_config.default_genesis_path(vm_option);
144-
let default_genesis_config = ContractsGenesisConfig::read(shell, &genesis_config_path).await?;
145-
let default_genesis_input = GenesisInput::new(&default_genesis_config, vm_option)?;
146143
let current_contracts_config = ecosystem_config.get_contracts_config()?;
147144
let bridgehub_proxy_address = current_contracts_config
148145
.core_ecosystem_contracts
@@ -188,10 +185,6 @@ async fn no_governance_prepare(
188185
let ecosystem_upgrade_config_path = get_ecosystem_upgrade_params(upgrade_version)
189186
.input(&ecosystem_config.path_to_foundry_scripts_for_ctm(vm_option));
190187

191-
let mut new_genesis = default_genesis_input;
192-
let new_version = new_genesis.protocol_version;
193-
new_genesis.protocol_version = new_version;
194-
195188
let gateway_upgrade_config = get_gateway_state_transition_config(ecosystem_config).await?;
196189

197190
let upgrade_specific_config = match upgrade_version {
@@ -217,7 +210,6 @@ async fn no_governance_prepare(
217210
};
218211

219212
let ecosystem_upgrade = EcosystemUpgradeInput::new(
220-
&new_genesis,
221213
&current_contracts_config,
222214
&gateway_upgrade_config,
223215
&initial_deployment_config,

zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub async fn deploy_l1_core_contracts(
5151
initial_deployment_config,
5252
config.era_chain_id,
5353
support_l2_legacy_shared_bridge_test,
54-
vm_option,
5554
);
5655

5756
deploy_config.save(shell, deploy_config_path)?;

zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async fn init_ecosystem(
130130
)
131131
.await?;
132132

133-
// // If we are deploying non-zksync os ecosystem, but zksync os ecosystem config exists
133+
// If we are deploying non-zksync os ecosystem, but zksync os ecosystem config exists
134134
if !init_args.vm_option.is_zksync_os() && init_args.dev {
135135
rebuild_all_contracts(
136136
shell,

0 commit comments

Comments
 (0)