Skip to content

Commit a6f9c99

Browse files
committed
use new zkstack-out
1 parent bc1b4db commit a6f9c99

File tree

7 files changed

+50
-46
lines changed

7 files changed

+50
-46
lines changed

contracts

Submodule contracts updated 130 files

zkstack_cli/crates/zkstack/src/abi.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ abigen!(
1313
);
1414

1515
abigen!(
16-
ChainTypeManagerAbi,
17-
"../../../contracts/l1-contracts/zkstack-out/IChainTypeManagerForZKStack.sol/IChainTypeManagerForZKStack.json",
16+
IChainTypeManagerAbi,
17+
"../../../contracts/l1-contracts/zkstack-out/IChainTypeManager.sol/IChainTypeManager.json",
1818
event_derives(serde::Deserialize, serde::Serialize)
1919
);
2020

2121
abigen!(
2222
ValidatorTimelockAbi,
23-
"../../../contracts/l1-contracts/zkstack-out/IValidatorTimelockForZKStack.sol/IValidatorTimelockForZKStack.json",
23+
"../../../contracts/l1-contracts/zkstack-out/IValidatorTimelock.sol/IValidatorTimelock.json",
2424
event_derives(serde::Deserialize, serde::Serialize)
2525
);
2626

@@ -62,21 +62,15 @@ abigen!(
6262
event_derives(serde::Deserialize, serde::Serialize)
6363
);
6464

65-
abigen!(
66-
DeployPaymasterAbi,
67-
"../../../contracts/l1-contracts/zkstack-out/DeployPaymaster.s.sol/DeployPaymaster.json",
68-
event_derives(serde::Deserialize, serde::Serialize)
69-
);
70-
7165
abigen!(
7266
IDeployPaymasterAbi,
7367
"../../../contracts/l1-contracts/zkstack-out/IDeployPaymaster.sol/IDeployPaymaster.json",
7468
event_derives(serde::Deserialize, serde::Serialize)
7569
);
7670

7771
abigen!(
78-
GatewayVotePreparationAbi,
79-
"../../../contracts/l1-contracts/zkstack-out/GatewayVotePreparation.s.sol/GatewayVotePreparation.json",
72+
IGatewayVotePreparationAbi,
73+
"../../../contracts/l1-contracts/zkstack-out/IGatewayVotePreparation.sol/IGatewayVotePreparation.json",
8074
event_derives(serde::Deserialize, serde::Serialize)
8175
);
8276

@@ -87,8 +81,8 @@ abigen!(
8781
);
8882

8983
abigen!(
90-
EnableEvmEmulatorAbi,
91-
"../../../contracts/l1-contracts/zkstack-out/EnableEvmEmulator.s.sol/EnableEvmEmulator.json",
84+
IEnableEvmEmulatorAbi,
85+
"../../../contracts/l1-contracts/zkstack-out/IEnableEvmEmulator.sol/IEnableEvmEmulator.json",
9286
event_derives(serde::Deserialize, serde::Serialize)
9387
);
9488

zkstack_cli/crates/zkstack/src/commands/chain/gateway/convert_to_gateway.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use zkstack_cli_config::{
2222
use zkstack_cli_types::ProverMode;
2323

2424
use crate::{
25-
abi::{BridgehubAbi, GATEWAYVOTEPREPARATIONABI_ABI},
25+
abi::{BridgehubAbi, IGATEWAYVOTEPREPARATIONABI_ABI},
2626
admin_functions::{
2727
governance_execute_calls, grant_gateway_whitelist, revoke_gateway_whitelist,
2828
AdminScriptMode,
@@ -217,7 +217,7 @@ pub async fn gateway_vote_preparation(
217217
.bridgehub_proxy_addr;
218218

219219
let gateway_vote_preparation_contract =
220-
BaseContract::from(GATEWAYVOTEPREPARATIONABI_ABI.clone());
220+
BaseContract::from(IGATEWAYVOTEPREPARATIONABI_ABI.clone());
221221
let calldata = gateway_vote_preparation_contract
222222
.encode("run", (bridgehub_proxy, ctm_chain_id))
223223
.unwrap();

zkstack_cli/crates/zkstack/src/commands/chain/gateway/gateway_common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use super::{
3030
notify_server_calldata::{get_notify_server_calls, NotifyServerCallsArgs},
3131
};
3232
use crate::{
33-
abi::{BridgehubAbi, ChainTypeManagerAbi, IChainAssetHandlerAbi, ZkChainAbi},
33+
abi::{BridgehubAbi, IChainAssetHandlerAbi, IChainTypeManagerAbi, ZkChainAbi},
3434
commands::chain::{admin_call_builder::AdminCallBuilder, utils::send_tx},
3535
consts::DEFAULT_EVENTS_BLOCK_RANGE,
3636
};
@@ -189,7 +189,7 @@ pub(crate) async fn get_gateway_migration_state(
189189
let l1_bridgehub = BridgehubAbi::new(l1_bridgehub_addr, l1_provider.clone());
190190

191191
let l1_ctm_address = l1_bridgehub.chain_type_manager(l2_chain_id.into()).await?;
192-
let l1_ctm = ChainTypeManagerAbi::new(l1_ctm_address, l1_provider.clone());
192+
let l1_ctm = IChainTypeManagerAbi::new(l1_ctm_address, l1_provider.clone());
193193

194194
let current_sl_from_l1 = l1_bridgehub
195195
.settlement_layer(l2_chain_id.into())
@@ -377,7 +377,7 @@ pub(crate) async fn get_gateway_migration_state(
377377

378378
async fn get_latest_notification_event_from_l1(
379379
l2_chain_id: u64,
380-
l1_ctm: ChainTypeManagerAbi<Provider<Http>>,
380+
l1_ctm: IChainTypeManagerAbi<Provider<Http>>,
381381
l1_provider: Arc<Provider<Http>>,
382382
) -> anyhow::Result<Option<GatewayMigrationNotification>> {
383383
logger::info("Searching for the latest migration notifications...");

zkstack_cli/crates/zkstack/src/commands/chain/gateway/migrate_to_gateway_calldata.rs

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use std::{path::Path, sync::Arc};
33
use anyhow::Context;
44
use clap::Parser;
55
use ethers::{
6+
abi::parse_abi,
7+
contract::Contract,
68
prelude::Http,
79
providers::{Middleware, Provider},
810
};
@@ -19,7 +21,7 @@ use super::{
1921
messages::message_for_gateway_migration_progress_state,
2022
};
2123
use crate::{
22-
abi::{BridgehubAbi, ChainTypeManagerAbi, ValidatorTimelockAbi, ZkChainAbi},
24+
abi::{BridgehubAbi, IChainTypeManagerAbi, ValidatorTimelockAbi, ZkChainAbi},
2325
admin_functions::{
2426
admin_l1_l2_tx, enable_validator_via_gateway, finalize_migrate_to_gateway,
2527
set_da_validator_pair_via_gateway, AdminScriptMode, AdminScriptOutput,
@@ -133,7 +135,7 @@ impl MigrateToGatewayConfig {
133135
);
134136
}
135137

136-
let gw_ctm = ChainTypeManagerAbi::new(ctm_gw_address, gw_provider.clone());
138+
let gw_ctm = IChainTypeManagerAbi::new(ctm_gw_address, gw_provider.clone());
137139
let gw_ctm_protocol_version = gw_ctm.protocol_version().await?;
138140
if gw_ctm_protocol_version != protocol_version {
139141
// The migration would fail anyway since CTM has checks to ensure that the protocol version is the same
@@ -240,27 +242,35 @@ pub(crate) async fn get_migrate_to_gateway_calls(
240242
result.extend(da_validator_encoding_result.calls.into_iter());
241243
}
242244

243-
let is_validator_enabled =
244-
if get_minor_protocol_version(context.protocol_version)?.is_pre_interop_fast_blocks() {
245-
// In previous versions, we need to check if the validator is enabled
246-
context
247-
.gw_validator_timelock
248-
.validators(context.l2_chain_id.into(), context.validator)
249-
.await?
250-
} else {
251-
context
252-
.gw_validator_timelock
253-
.has_role_for_chain_id(
254-
context.l2_chain_id.into(),
255-
context
256-
.gw_validator_timelock
257-
.committer_role()
258-
.call()
259-
.await?,
260-
context.validator,
261-
)
262-
.await?
263-
};
245+
let is_validator_enabled = if get_minor_protocol_version(context.protocol_version)?
246+
.is_pre_interop_fast_blocks()
247+
{
248+
// In previous versions, we need to check if the validator is enabled
249+
let legacy_validator_timelock = Contract::new(
250+
context.gw_validator_timelock_addr,
251+
parse_abi(&[
252+
"function validators(uint256 _chainId, address _validator) external view returns (bool)",
253+
])?,
254+
context.gw_provider.clone(),
255+
);
256+
legacy_validator_timelock
257+
.method::<_, bool>("validators", (context.l2_chain_id, context.validator))?
258+
.call()
259+
.await?
260+
} else {
261+
context
262+
.gw_validator_timelock
263+
.has_role_for_chain_id(
264+
context.l2_chain_id.into(),
265+
context
266+
.gw_validator_timelock
267+
.committer_role()
268+
.call()
269+
.await?,
270+
context.validator,
271+
)
272+
.await?
273+
};
264274

265275
// 4. If validator is not yet present, please include.
266276
if !is_validator_enabled {

zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use zkstack_cli_common::{
1010
use zkstack_cli_config::forge_interface::script_params::ENABLE_EVM_EMULATOR_PARAMS;
1111

1212
use crate::{
13-
abi::ENABLEEVMEMULATORABI_ABI,
13+
abi::IENABLEEVMEMULATORABI_ABI,
1414
messages::MSG_ENABLING_EVM_EMULATOR,
1515
utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner},
1616
};
@@ -24,7 +24,7 @@ pub async fn enable_evm_emulator(
2424
forge_args: &ForgeScriptArgs,
2525
l1_rpc_url: String,
2626
) -> anyhow::Result<()> {
27-
let enable_evm_emulator_contract = BaseContract::from(ENABLEEVMEMULATORABI_ABI.clone());
27+
let enable_evm_emulator_contract = BaseContract::from(IENABLEEVMEMULATORABI_ABI.clone());
2828
let calldata = enable_evm_emulator_contract
2929
.encode("chainAllowEvmEmulation", (admin, target_address))
3030
.unwrap();

zkstack_cli/crates/zkstack/src/utils/addresses.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use zksync_basic_types::{
66
};
77
use zksync_system_constants::{L2_BRIDGEHUB_ADDRESS, L2_CHAIN_ASSET_HANDLER_ADDRESS};
88

9-
use crate::{abi::ChainTypeManagerAbi, utils::protocol_version::get_minor_protocol_version};
9+
use crate::{abi::IChainTypeManagerAbi, utils::protocol_version::get_minor_protocol_version};
1010

1111
pub(crate) fn apply_l1_to_l2_alias(addr: Address) -> Address {
1212
let offset: Address = "1111000000000000000000000000000000001111".parse().unwrap();
@@ -22,7 +22,7 @@ pub(crate) async fn precompute_chain_address_on_gateway(
2222
new_l2_admin: Address,
2323
protocol_version: U256,
2424
gateway_diamond_cut: Vec<u8>,
25-
gw_ctm: ChainTypeManagerAbi<Provider<ethers::providers::Http>>,
25+
gw_ctm: IChainTypeManagerAbi<Provider<ethers::providers::Http>>,
2626
) -> anyhow::Result<Address> {
2727
let ctm_data = encode(&[
2828
Token::FixedBytes(base_token_asset_id.0.into()),

0 commit comments

Comments
 (0)