Skip to content

Commit de5bf7c

Browse files
feat: Added tx hashes to upgrade yaml, disabled no_governance_prepare_gateway (#3448)
## What ❔ * Updated contracts to most recent one (including PR 1187 from contracts) * Added transaction hashes to the upgrade yaml file - so that tools can verify bytecodes * fix to governance_upgrade_timer_initial_delay - it was missing before. --------- Co-authored-by: Stanislav Bezkorovainyi <[email protected]>
1 parent 7305879 commit de5bf7c

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub struct GatewayEcosystemUpgradeInput {
1414
pub testnet_verifier: bool,
1515
pub contracts: GatewayUpgradeContractsConfig,
1616
pub tokens: GatewayUpgradeTokensConfig,
17+
pub governance_upgrade_timer_initial_delay: u64,
1718
}
1819

1920
impl ZkStackConfig for GatewayEcosystemUpgradeInput {}
@@ -32,6 +33,8 @@ impl GatewayEcosystemUpgradeInput {
3233
era_chain_id,
3334
testnet_verifier,
3435
owner_address: current_contracts_config.l1.governance_addr,
36+
// TODO: for local testing, even 0 is fine - but before prod, we should load it from some configuration.
37+
governance_upgrade_timer_initial_delay: 0,
3538
contracts: GatewayUpgradeContractsConfig {
3639
create2_factory_addr: initial_deployment_config.create2_factory_addr,
3740
create2_factory_salt: initial_deployment_config.create2_factory_salt,

zkstack_cli/crates/config/src/forge_interface/gateway_ecosystem_upgrade/output.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ pub struct GatewayEcosystemUpgradeOutput {
1818

1919
pub contracts_config: GatewayEcosystemUpgradeContractsOutput,
2020
pub deployed_addresses: GatewayEcosystemUpgradeDeployedAddresses,
21+
/// List of transactions that were executed during the upgrade.
22+
/// This is added later by the zkstack and not present in the toml file that solidity creates.
23+
#[serde(default)]
24+
pub transactions: Vec<String>,
2125
}
2226

2327
impl FileConfigWithDefaultName for GatewayEcosystemUpgradeOutput {

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

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use config::{
1616
};
1717
use ethers::{abi::parse_abi, contract::BaseContract, utils::hex};
1818
use lazy_static::lazy_static;
19+
use serde::Deserialize;
1920
use types::{BaseToken, ProverMode, WalletCreation};
2021
use xshell::Shell;
2122
use zksync_basic_types::commitment::L1BatchCommitmentMode;
@@ -85,6 +86,15 @@ pub async fn run(args: GatewayUpgradeArgs, shell: &Shell) -> anyhow::Result<()>
8586
Ok(())
8687
}
8788

89+
#[derive(Debug, Deserialize)]
90+
struct BroadcastFile {
91+
pub transactions: Vec<BroadcastFileTransactions>,
92+
}
93+
#[derive(Debug, Deserialize)]
94+
struct BroadcastFileTransactions {
95+
pub hash: String,
96+
}
97+
8898
async fn no_governance_prepare(
8999
init_args: &mut GatewayUpgradeArgsFinal,
90100
shell: &Shell,
@@ -143,10 +153,33 @@ async fn no_governance_prepare(
143153

144154
println!("done!");
145155

146-
let output = GatewayEcosystemUpgradeOutput::read(
156+
let l1_chain_id = era_config.l1_network.chain_id();
157+
158+
let broadcast_file: BroadcastFile = {
159+
let file_content = std::fs::read_to_string(
160+
ecosystem_config
161+
.link_to_code
162+
.join("contracts/l1-contracts")
163+
.join(format!(
164+
"broadcast/EcosystemUpgrade.s.sol/{}/run-latest.json",
165+
l1_chain_id
166+
)),
167+
)
168+
.context("Failed to read broadcast file")?;
169+
serde_json::from_str(&file_content).context("Failed to parse broadcast file")?
170+
};
171+
172+
173+
let mut output = GatewayEcosystemUpgradeOutput::read(
147174
shell,
148175
GATEWAY_UPGRADE_ECOSYSTEM_PARAMS.output(&ecosystem_config.link_to_code),
149176
)?;
177+
178+
// Add all the transaction hashes.
179+
for tx in broadcast_file.transactions {
180+
output.transactions.push(tx.hash);
181+
}
182+
150183
output.save_with_base_path(shell, &ecosystem_config.config)?;
151184

152185
Ok(())

0 commit comments

Comments
 (0)