Skip to content

Commit 2363db1

Browse files
committed
chore(zkstack): Follow ups form traits
Signed-off-by: Danil <[email protected]>
1 parent ef21c1a commit 2363db1

38 files changed

+93
-94
lines changed

zkstack_cli/crates/config/src/chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl ZkStackConfigTrait for ChainConfig {
312312
self.link_to_code().join(CONTRACTS_PATH)
313313
}
314314

315-
fn path_to_l1_foundry(&self) -> PathBuf {
315+
fn path_to_foundry_scripts(&self) -> PathBuf {
316316
self.contracts_path()
317317
.join(L1_CONTRACTS_FOUNDRY_INSIDE_CONTRACTS)
318318
}

zkstack_cli/crates/config/src/ecosystem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl ZkStackConfigTrait for EcosystemConfig {
338338
self.link_to_code().join(CONTRACTS_PATH)
339339
}
340340

341-
fn path_to_l1_foundry(&self) -> PathBuf {
341+
fn path_to_foundry_scripts(&self) -> PathBuf {
342342
self.contracts_path()
343343
.join(L1_CONTRACTS_FOUNDRY_INSIDE_CONTRACTS)
344344
}

zkstack_cli/crates/config/src/zkstack_config.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ impl ZkStackConfigTrait for ZkStackConfig {
6161
}
6262
}
6363

64-
fn path_to_l1_foundry(&self) -> PathBuf {
64+
fn path_to_foundry_scripts(&self) -> PathBuf {
6565
match self {
66-
ZkStackConfig::EcosystemConfig(ecosystem) => ecosystem.path_to_l1_foundry().clone(),
67-
ZkStackConfig::ChainConfig(chain) => chain.path_to_l1_foundry().clone(),
66+
ZkStackConfig::EcosystemConfig(ecosystem) => {
67+
ecosystem.path_to_foundry_scripts().clone()
68+
}
69+
ZkStackConfig::ChainConfig(chain) => chain.path_to_foundry_scripts().clone(),
6870
}
6971
}
7072
}
@@ -73,8 +75,11 @@ pub trait ZkStackConfigTrait {
7375
/// Link to the repository, please use it with a caution and prefer specific links
7476
fn link_to_code(&self) -> PathBuf;
7577

78+
/// Path to the directory with default configs inside the repository
7679
fn default_configs_path(&self) -> PathBuf;
80+
/// Path to the directory with contracts
7781
fn contracts_path(&self) -> PathBuf;
7882

79-
fn path_to_l1_foundry(&self) -> PathBuf;
83+
/// Path to the directory with L1 Foundry contracts
84+
fn path_to_foundry_scripts(&self) -> PathBuf;
8085
}

zkstack_cli/crates/zkstack/src/admin_functions.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub async fn make_permanent_rollup(
135135
(chain_admin_addr, diamond_proxy_address),
136136
)
137137
.unwrap();
138-
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
138+
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
139139
let forge = Forge::new(&foundry_contracts_path)
140140
.script(
141141
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
@@ -178,7 +178,7 @@ pub async fn governance_execute_calls(
178178
(Token::Bytes(encoded_calls), governance_address),
179179
)
180180
.unwrap();
181-
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
181+
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
182182
let forge = Forge::new(&foundry_contracts_path)
183183
.script(
184184
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
@@ -228,7 +228,7 @@ pub async fn ecosystem_admin_execute_calls(
228228
(Token::Bytes(encoded_calls), ecosystem_admin_addr),
229229
)
230230
.unwrap();
231-
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
231+
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
232232
let forge = Forge::new(&foundry_contracts_path)
233233
.script(
234234
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
@@ -273,7 +273,7 @@ pub async fn admin_execute_upgrade(
273273
),
274274
)
275275
.unwrap();
276-
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
276+
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
277277
let forge = Forge::new(&foundry_contracts_path)
278278
.script(
279279
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
@@ -318,7 +318,7 @@ pub async fn admin_schedule_upgrade(
318318
),
319319
)
320320
.unwrap();
321-
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
321+
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
322322
let forge = Forge::new(&foundry_contracts_path)
323323
.script(
324324
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
@@ -368,7 +368,7 @@ pub async fn admin_update_validator(
368368
),
369369
)
370370
.unwrap();
371-
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
371+
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
372372
let forge = Forge::new(&foundry_contracts_path)
373373
.script(
374374
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),

zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {
1919
let spinner = Spinner::new(MSG_ACCEPTING_ADMIN_SPINNER);
2020
accept_admin(
2121
shell,
22-
chain_config.path_to_l1_foundry(),
22+
chain_config.path_to_foundry_scripts(),
2323
contracts.l1.chain_admin_addr,
2424
&chain_config.get_wallets_config()?.governor,
2525
contracts.l1.diamond_proxy_addr,

zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ impl ChainCreateArgs {
8282
number_of_chains: u32,
8383
l1_network: &L1Network,
8484
possible_erc20: Vec<Erc20Token>,
85-
link_to_code: PathBuf,
8685
) -> anyhow::Result<ChainCreateArgsFinal> {
8786
let mut chain_name = self
8887
.chain_name
@@ -242,7 +241,6 @@ impl ChainCreateArgs {
242241
set_as_default,
243242
legacy_bridge: self.legacy_bridge,
244243
evm_emulator,
245-
link_to_code,
246244
update_submodules: self.update_submodules,
247245
tight_ports: self.tight_ports,
248246
})
@@ -261,7 +259,6 @@ pub struct ChainCreateArgsFinal {
261259
pub set_as_default: bool,
262260
pub legacy_bridge: bool,
263261
pub evm_emulator: bool,
264-
pub link_to_code: PathBuf,
265262
pub update_submodules: Option<bool>,
266263
pub tight_ports: bool,
267264
}

zkstack_cli/crates/zkstack/src/commands/chain/create.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub async fn create(
3535
ecosystem_config.list_of_chains().len() as u32,
3636
&ecosystem_config.l1_network,
3737
tokens,
38-
ecosystem_config.link_to_code(),
3938
)
4039
.context(MSG_ARGS_VALIDATOR_ERR)?;
4140

zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ async fn build_and_deploy(
144144
.await?;
145145
update_config(
146146
shell,
147-
&DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.output(&chain_config.path_to_l1_foundry()),
147+
&DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.output(&chain_config.path_to_foundry_scripts()),
148148
)?;
149149
Ok(())
150150
}
@@ -297,11 +297,11 @@ async fn call_forge(
297297
)
298298
.await?;
299299

300-
let foundry_contracts_path = chain_config.path_to_l1_foundry();
300+
let foundry_contracts_path = chain_config.path_to_foundry_scripts();
301301
let secrets = chain_config.get_secrets_config().await?;
302302
input.save(
303303
shell,
304-
DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.input(&chain_config.path_to_l1_foundry()),
304+
DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.input(&chain_config.path_to_foundry_scripts()),
305305
)?;
306306

307307
let mut forge = Forge::new(&foundry_contracts_path)

zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub async fn deploy_paymaster(
2727
broadcast: bool,
2828
) -> anyhow::Result<()> {
2929
let input = DeployPaymasterInput::new(chain_config)?;
30-
let foundry_contracts_path = chain_config.path_to_l1_foundry();
30+
let foundry_contracts_path = chain_config.path_to_foundry_scripts();
3131
input.save(
3232
shell,
3333
DEPLOY_PAYMASTER_SCRIPT_PARAMS.input(&foundry_contracts_path),

zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {
2222

2323
enable_evm_emulator(
2424
shell,
25-
&chain_config.path_to_l1_foundry(),
25+
&chain_config.path_to_foundry_scripts(),
2626
contracts.l1.chain_admin_addr,
2727
&chain_config.get_wallets_config()?.governor,
2828
contracts.l1.diamond_proxy_addr,

0 commit comments

Comments
 (0)