Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion zkstack_cli/crates/config/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl ZkStackConfigTrait for ChainConfig {
self.link_to_code().join(CONTRACTS_PATH)
}

fn path_to_l1_foundry(&self) -> PathBuf {
fn path_to_foundry_scripts(&self) -> PathBuf {
self.contracts_path()
.join(L1_CONTRACTS_FOUNDRY_INSIDE_CONTRACTS)
}
Expand Down
2 changes: 1 addition & 1 deletion zkstack_cli/crates/config/src/ecosystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl ZkStackConfigTrait for EcosystemConfig {
self.link_to_code().join(CONTRACTS_PATH)
}

fn path_to_l1_foundry(&self) -> PathBuf {
fn path_to_foundry_scripts(&self) -> PathBuf {
self.contracts_path()
.join(L1_CONTRACTS_FOUNDRY_INSIDE_CONTRACTS)
}
Expand Down
13 changes: 9 additions & 4 deletions zkstack_cli/crates/config/src/zkstack_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ impl ZkStackConfigTrait for ZkStackConfig {
}
}

fn path_to_l1_foundry(&self) -> PathBuf {
fn path_to_foundry_scripts(&self) -> PathBuf {
match self {
ZkStackConfig::EcosystemConfig(ecosystem) => ecosystem.path_to_l1_foundry().clone(),
ZkStackConfig::ChainConfig(chain) => chain.path_to_l1_foundry().clone(),
ZkStackConfig::EcosystemConfig(ecosystem) => {
ecosystem.path_to_foundry_scripts().clone()
}
ZkStackConfig::ChainConfig(chain) => chain.path_to_foundry_scripts().clone(),
}
}
}
Expand All @@ -73,8 +75,11 @@ pub trait ZkStackConfigTrait {
/// Link to the repository, please use it with a caution and prefer specific links
fn link_to_code(&self) -> PathBuf;

/// Path to the directory with default configs inside the repository
fn default_configs_path(&self) -> PathBuf;
/// Path to the directory with contracts
fn contracts_path(&self) -> PathBuf;

fn path_to_l1_foundry(&self) -> PathBuf;
/// Path to the directory with L1 Foundry contracts
fn path_to_foundry_scripts(&self) -> PathBuf;
}
12 changes: 6 additions & 6 deletions zkstack_cli/crates/zkstack/src/admin_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub async fn make_permanent_rollup(
(chain_admin_addr, diamond_proxy_address),
)
.unwrap();
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
let forge = Forge::new(&foundry_contracts_path)
.script(
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
Expand Down Expand Up @@ -178,7 +178,7 @@ pub async fn governance_execute_calls(
(Token::Bytes(encoded_calls), governance_address),
)
.unwrap();
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
let forge = Forge::new(&foundry_contracts_path)
.script(
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
Expand Down Expand Up @@ -228,7 +228,7 @@ pub async fn ecosystem_admin_execute_calls(
(Token::Bytes(encoded_calls), ecosystem_admin_addr),
)
.unwrap();
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
let forge = Forge::new(&foundry_contracts_path)
.script(
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
Expand Down Expand Up @@ -273,7 +273,7 @@ pub async fn admin_execute_upgrade(
),
)
.unwrap();
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
let forge = Forge::new(&foundry_contracts_path)
.script(
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
Expand Down Expand Up @@ -318,7 +318,7 @@ pub async fn admin_schedule_upgrade(
),
)
.unwrap();
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
let forge = Forge::new(&foundry_contracts_path)
.script(
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
Expand Down Expand Up @@ -368,7 +368,7 @@ pub async fn admin_update_validator(
),
)
.unwrap();
let foundry_contracts_path = ecosystem_config.path_to_l1_foundry();
let foundry_contracts_path = ecosystem_config.path_to_foundry_scripts();
let forge = Forge::new(&foundry_contracts_path)
.script(
&ACCEPT_GOVERNANCE_SCRIPT_PARAMS.script(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {
let spinner = Spinner::new(MSG_ACCEPTING_ADMIN_SPINNER);
accept_admin(
shell,
chain_config.path_to_l1_foundry(),
chain_config.path_to_foundry_scripts(),
contracts.l1.chain_admin_addr,
&chain_config.get_wallets_config()?.governor,
contracts.l1.diamond_proxy_addr,
Expand Down
3 changes: 0 additions & 3 deletions zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ impl ChainCreateArgs {
number_of_chains: u32,
l1_network: &L1Network,
possible_erc20: Vec<Erc20Token>,
link_to_code: PathBuf,
) -> anyhow::Result<ChainCreateArgsFinal> {
let mut chain_name = self
.chain_name
Expand Down Expand Up @@ -242,7 +241,6 @@ impl ChainCreateArgs {
set_as_default,
legacy_bridge: self.legacy_bridge,
evm_emulator,
link_to_code,
update_submodules: self.update_submodules,
tight_ports: self.tight_ports,
})
Expand All @@ -261,7 +259,6 @@ pub struct ChainCreateArgsFinal {
pub set_as_default: bool,
pub legacy_bridge: bool,
pub evm_emulator: bool,
pub link_to_code: PathBuf,
pub update_submodules: Option<bool>,
pub tight_ports: bool,
}
Expand Down
1 change: 0 additions & 1 deletion zkstack_cli/crates/zkstack/src/commands/chain/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub async fn create(
ecosystem_config.list_of_chains().len() as u32,
&ecosystem_config.l1_network,
tokens,
ecosystem_config.link_to_code(),
)
.context(MSG_ARGS_VALIDATOR_ERR)?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async fn build_and_deploy(
.await?;
update_config(
shell,
&DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.output(&chain_config.path_to_l1_foundry()),
&DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.output(&chain_config.path_to_foundry_scripts()),
)?;
Ok(())
}
Expand Down Expand Up @@ -297,11 +297,11 @@ async fn call_forge(
)
.await?;

let foundry_contracts_path = chain_config.path_to_l1_foundry();
let foundry_contracts_path = chain_config.path_to_foundry_scripts();
let secrets = chain_config.get_secrets_config().await?;
input.save(
shell,
DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.input(&chain_config.path_to_l1_foundry()),
DEPLOY_L2_CONTRACTS_SCRIPT_PARAMS.input(&chain_config.path_to_foundry_scripts()),
)?;

let mut forge = Forge::new(&foundry_contracts_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub async fn deploy_paymaster(
broadcast: bool,
) -> anyhow::Result<()> {
let input = DeployPaymasterInput::new(chain_config)?;
let foundry_contracts_path = chain_config.path_to_l1_foundry();
let foundry_contracts_path = chain_config.path_to_foundry_scripts();
input.save(
shell,
DEPLOY_PAYMASTER_SCRIPT_PARAMS.input(&foundry_contracts_path),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {

enable_evm_emulator(
shell,
&chain_config.path_to_l1_foundry(),
&chain_config.path_to_foundry_scripts(),
contracts.l1.chain_admin_addr,
&chain_config.get_wallets_config()?.governor,
contracts.l1.diamond_proxy_addr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub async fn run(convert_to_gw_args: ConvertToGatewayArgs, shell: &Shell) -> any
let mut output = grant_gateway_whitelist(
shell,
&args,
&chain_config.path_to_l1_foundry(),
&chain_config.path_to_foundry_scripts(),
mode_chain_governor.clone(),
chain_config.chain_id.as_u64(),
chain_contracts_config
Expand Down Expand Up @@ -198,7 +198,7 @@ pub async fn run(convert_to_gw_args: ConvertToGatewayArgs, shell: &Shell) -> any
revoke_gateway_whitelist(
shell,
&args,
&chain_config.path_to_l1_foundry(),
&chain_config.path_to_foundry_scripts(),
mode_chain_governor,
chain_config.chain_id.as_u64(),
chain_contracts_config
Expand Down Expand Up @@ -230,15 +230,15 @@ pub async fn gateway_vote_preparation(
) -> anyhow::Result<DeployGatewayCTMOutput> {
input.save(
shell,
GATEWAY_VOTE_PREPARATION.input(&chain_config.path_to_l1_foundry()),
GATEWAY_VOTE_PREPARATION.input(&chain_config.path_to_foundry_scripts()),
)?;

let calldata = GATEWAY_VOTE_PREPARATION_ABI
.encode("prepareForGWVoting", ctm_chain_id)
.unwrap();

let mut forge: zkstack_cli_common::forge::ForgeScript =
Forge::new(&config.path_to_l1_foundry())
Forge::new(&config.path_to_foundry_scripts())
.script(&GATEWAY_VOTE_PREPARATION.script(), forge_args.clone())
.with_ffi()
.with_rpc_url(l1_rpc_url)
Expand All @@ -252,6 +252,6 @@ pub async fn gateway_vote_preparation(

DeployGatewayCTMOutput::read(
shell,
GATEWAY_VOTE_PREPARATION.output(&chain_config.path_to_l1_foundry()),
GATEWAY_VOTE_PREPARATION.output(&chain_config.path_to_foundry_scripts()),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> {
set_transaction_filterer(
shell,
&args,
&chain_config.path_to_l1_foundry(),
&chain_config.path_to_foundry_scripts(),
AdminScriptMode::Broadcast(chain_config.get_wallets_config()?.governor),
chain_config.chain_id.as_u64(),
chain_contracts_config
Expand Down Expand Up @@ -89,10 +89,10 @@ pub async fn deploy_gateway_tx_filterer(
) -> anyhow::Result<GatewayTxFiltererOutput> {
input.save(
shell,
DEPLOY_GATEWAY_TX_FILTERER.input(&chain_config.path_to_l1_foundry()),
DEPLOY_GATEWAY_TX_FILTERER.input(&chain_config.path_to_foundry_scripts()),
)?;

let mut forge = Forge::new(&config.path_to_l1_foundry())
let mut forge = Forge::new(&config.path_to_foundry_scripts())
.script(&DEPLOY_GATEWAY_TX_FILTERER.script(), forge_args.clone())
.with_ffi()
.with_rpc_url(l1_rpc_url)
Expand All @@ -110,6 +110,6 @@ pub async fn deploy_gateway_tx_filterer(

GatewayTxFiltererOutput::read(
shell,
DEPLOY_GATEWAY_TX_FILTERER.output(&chain_config.path_to_l1_foundry()),
DEPLOY_GATEWAY_TX_FILTERER.output(&chain_config.path_to_foundry_scripts()),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub async fn run(
let withdrawal_params = gateway_zk_client
.get_finalize_withdrawal_params(migraiton_tx, 0)
.await?;
let foundry_contracts_path = ZkStackConfig::from_file(shell)?.path_to_l1_foundry();
let foundry_contracts_path = ZkStackConfig::from_file(shell)?.path_to_foundry_scripts();

finish_migrate_chain_from_gateway(
shell,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ pub(crate) async fn notify_server(
let calls = get_notify_server_calls(
shell,
&args,
&chain_config.path_to_l1_foundry(),
&chain_config.path_to_foundry_scripts(),
NotifyServerCallsArgs {
l1_bridgehub_addr: contracts.ecosystem_contracts.bridgehub_proxy_addr,
l2_chain_id: chain_config.chain_id.as_u64(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct GrantGatewayWhitelistCalldataArgs {
}

pub async fn run(shell: &Shell, args: GrantGatewayWhitelistCalldataArgs) -> anyhow::Result<()> {
let foundry_path = ZkStackConfig::from_file(shell)?.path_to_l1_foundry();
let foundry_path = ZkStackConfig::from_file(shell)?.path_to_foundry_scripts();
let result = grant_gateway_whitelist(
shell,
// We do not care about forge args that much here, since
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub async fn run(args: MigrateFromGatewayArgs, shell: &Shell) -> anyhow::Result<
let start_migrate_from_gateway_call = start_migrate_chain_from_gateway(
shell,
&args.forge_args,
&ecosystem_config.path_to_l1_foundry(),
&ecosystem_config.path_to_foundry_scripts(),
crate::admin_functions::AdminScriptMode::OnlySave,
chain_contracts_config
.ecosystem_contracts
Expand Down Expand Up @@ -170,7 +170,7 @@ pub async fn run(args: MigrateFromGatewayArgs, shell: &Shell) -> anyhow::Result<
finish_migrate_chain_from_gateway(
shell,
args.forge_args.clone(),
&ecosystem_config.path_to_l1_foundry(),
&ecosystem_config.path_to_foundry_scripts(),
ecosystem_config
.get_wallets()?
.deployer
Expand All @@ -194,7 +194,7 @@ pub async fn run(args: MigrateFromGatewayArgs, shell: &Shell) -> anyhow::Result<
set_da_validator_pair(
shell,
&args.forge_args,
&ecosystem_config.path_to_l1_foundry(),
&ecosystem_config.path_to_foundry_scripts(),
crate::admin_functions::AdminScriptMode::Broadcast(
chain_config.get_wallets_config()?.governor,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct MigrateFromGatewayCalldataArgs {
///
pub async fn run(shell: &Shell, params: MigrateFromGatewayCalldataArgs) -> anyhow::Result<()> {
let forge_args = Default::default();
let contracts_foundry_path = ZkStackConfig::from_file(shell)?.path_to_l1_foundry();
let contracts_foundry_path = ZkStackConfig::from_file(shell)?.path_to_foundry_scripts();

if !params.no_cross_check {
let state = get_gateway_migration_state(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub async fn run(args: MigrateToGatewayArgs, shell: &Shell) -> anyhow::Result<()
let (chain_admin, calls) = get_migrate_to_gateway_calls(
shell,
&args.forge_args,
&chain_config.path_to_l1_foundry(),
&chain_config.path_to_foundry_scripts(),
MigrateToGatewayParams {
l1_rpc_url: l1_url.clone(),
l1_bridgehub_addr: chain_contracts_config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl MigrateToGatewayCalldataArgs {
///
pub async fn run(shell: &Shell, params: MigrateToGatewayCalldataArgs) -> anyhow::Result<()> {
let forge_args = Default::default();
let contracts_foundry_path = ZkStackConfig::from_file(shell)?.path_to_l1_foundry();
let contracts_foundry_path = ZkStackConfig::from_file(shell)?.path_to_foundry_scripts();

let should_cross_check = !params.no_cross_check.unwrap_or_default();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub async fn run(
}
}
}
let contracts_foundry_path = ZkStackConfig::from_file(shell)?.path_to_l1_foundry();
let contracts_foundry_path = ZkStackConfig::from_file(shell)?.path_to_foundry_scripts();

let result = get_notify_server_calls(
shell,
Expand Down
8 changes: 4 additions & 4 deletions zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub async fn init(
let spinner = Spinner::new(MSG_ACCEPTING_ADMIN_SPINNER);
accept_admin(
shell,
ecosystem_config.path_to_l1_foundry(),
ecosystem_config.path_to_foundry_scripts(),
contracts_config.l1.chain_admin_addr,
&chain_config.get_wallets_config()?.governor,
contracts_config.l1.diamond_proxy_addr,
Expand All @@ -129,7 +129,7 @@ pub async fn init(
let chain_contracts = chain_config.get_contracts_config()?;
set_token_multiplier_setter(
shell,
ecosystem_config.path_to_l1_foundry(),
ecosystem_config.path_to_foundry_scripts(),
&chain_config.get_wallets_config()?.governor,
chain_contracts
.l1
Expand All @@ -154,7 +154,7 @@ pub async fn init(
if chain_config.evm_emulator {
enable_evm_emulator(
shell,
&ecosystem_config.path_to_l1_foundry(),
&ecosystem_config.path_to_foundry_scripts(),
contracts_config.l1.chain_admin_addr,
&chain_config.get_wallets_config()?.governor,
contracts_config.l1.diamond_proxy_addr,
Expand Down Expand Up @@ -184,7 +184,7 @@ pub async fn init(
set_da_validator_pair(
shell,
&init_args.forge_args,
&ecosystem_config.path_to_l1_foundry(),
&ecosystem_config.path_to_foundry_scripts(),
crate::admin_functions::AdminScriptMode::Broadcast(
chain_config.get_wallets_config()?.governor,
),
Expand Down
Loading
Loading