@@ -12,17 +12,17 @@ use zksync_basic_types::L2ChainId;
1212
1313use crate :: {
1414 consts:: {
15- CONFIG_NAME , CONTRACTS_FILE , CONTRACTS_PATH , EN_CONFIG_FILE , GENERAL_FILE , GENESIS_FILE ,
16- L1_CONTRACTS_FOUNDRY_INSIDE_CONTRACTS , SECRETS_FILE , WALLETS_FILE ,
15+ CONFIG_NAME , CONTRACTS_FILE , EN_CONFIG_FILE , GENERAL_FILE , GENESIS_FILE ,
16+ L1_CONTRACTS_FOUNDRY , SECRETS_FILE , WALLETS_FILE ,
1717 } ,
1818 create_localhost_wallets,
1919 gateway:: GatewayConfig ,
2020 traits:: {
21- FileConfigTrait , FileConfigWithDefaultName , ReadConfig , ReadConfigWithBasePath , SaveConfig ,
22- SaveConfigWithBasePath ,
21+ FileConfigWithDefaultName , ReadConfig , ReadConfigWithBasePath , SaveConfig ,
22+ SaveConfigWithBasePath , ZkStackConfigTrait ,
2323 } ,
2424 ContractsConfig , EcosystemConfig , GatewayChainConfig , GeneralConfig , GenesisConfig ,
25- SecretsConfig , WalletsConfig , ZkStackConfigTrait , CONFIGS_PATH , GATEWAY_CHAIN_FILE ,
25+ SecretsConfig , WalletsConfig , GATEWAY_CHAIN_FILE ,
2626} ;
2727
2828/// Chain configuration file. This file is created in the chain
@@ -61,19 +61,19 @@ pub struct ChainConfig {
6161 pub chain_id : L2ChainId ,
6262 pub prover_version : ProverMode ,
6363 pub l1_network : L1Network ,
64+ pub self_path : PathBuf ,
65+ pub link_to_code : PathBuf ,
6466 pub rocks_db_path : PathBuf ,
6567 pub artifacts : PathBuf ,
6668 pub configs : PathBuf ,
6769 pub external_node_config_path : Option < PathBuf > ,
6870 pub l1_batch_commit_data_generator_mode : L1BatchCommitmentMode ,
6971 pub base_token : BaseToken ,
7072 pub wallet_creation : WalletCreation ,
73+ pub shell : OnceCell < Shell > ,
7174 pub legacy_bridge : Option < bool > ,
7275 pub evm_emulator : bool ,
7376 pub tight_ports : bool ,
74- shell : OnceCell < Shell > ,
75- self_path : PathBuf ,
76- link_to_code : PathBuf ,
7777}
7878
7979#[ derive( Debug , Clone ) ]
@@ -93,49 +93,6 @@ impl Serialize for ChainConfig {
9393}
9494
9595impl ChainConfig {
96- #[ allow( clippy:: too_many_arguments) ]
97- pub fn new (
98- id : u32 ,
99- name : String ,
100- chain_id : L2ChainId ,
101- prover_version : ProverMode ,
102- l1_network : L1Network ,
103- self_path : PathBuf ,
104- link_to_code : PathBuf ,
105- rocks_db_path : PathBuf ,
106- artifacts : PathBuf ,
107- configs : PathBuf ,
108- external_node_config_path : Option < PathBuf > ,
109- l1_batch_commit_data_generator_mode : L1BatchCommitmentMode ,
110- base_token : BaseToken ,
111- wallet_creation : WalletCreation ,
112- shell : OnceCell < Shell > ,
113- legacy_bridge : Option < bool > ,
114- evm_emulator : bool ,
115- tight_ports : bool ,
116- ) -> Self {
117- Self {
118- id,
119- name,
120- chain_id,
121- prover_version,
122- l1_network,
123- self_path,
124- link_to_code,
125- rocks_db_path,
126- artifacts,
127- configs,
128- external_node_config_path,
129- l1_batch_commit_data_generator_mode,
130- base_token,
131- wallet_creation,
132- shell,
133- legacy_bridge,
134- evm_emulator,
135- tight_ports,
136- }
137- }
138-
13996 pub ( crate ) fn get_shell ( & self ) -> & Shell {
14097 self . shell . get ( ) . expect ( "Not initialized" )
14198 }
@@ -161,6 +118,10 @@ impl ChainConfig {
161118 anyhow:: bail!( "Wallets configs has not been found" ) ;
162119 }
163120
121+ pub fn get_preexisting_ecosystem_contracts_path ( & self ) -> PathBuf {
122+ todo ! ( )
123+ }
124+
164125 pub fn get_contracts_config ( & self ) -> anyhow:: Result < ContractsConfig > {
165126 ContractsConfig :: read_with_base_path ( self . get_shell ( ) , & self . configs )
166127 }
@@ -201,6 +162,10 @@ impl ChainConfig {
201162 self . configs . join ( GATEWAY_CHAIN_FILE )
202163 }
203164
165+ pub fn path_to_l1_foundry ( & self ) -> PathBuf {
166+ self . link_to_code . join ( L1_CONTRACTS_FOUNDRY )
167+ }
168+
204169 pub fn save ( & self , shell : & Shell , path : impl AsRef < Path > ) -> anyhow:: Result < ( ) > {
205170 let config = self . get_internal ( ) ;
206171 config. save ( shell, path)
@@ -297,23 +262,4 @@ impl FileConfigWithDefaultName for ChainConfigInternal {
297262 const FILE_NAME : & ' static str = CONFIG_NAME ;
298263}
299264
300- impl FileConfigTrait for ChainConfigInternal { }
301-
302- impl ZkStackConfigTrait for ChainConfig {
303- fn link_to_code ( & self ) -> PathBuf {
304- self . link_to_code . clone ( )
305- }
306-
307- fn default_configs_path ( & self ) -> PathBuf {
308- self . link_to_code ( ) . join ( CONFIGS_PATH )
309- }
310-
311- fn contracts_path ( & self ) -> PathBuf {
312- self . link_to_code ( ) . join ( CONTRACTS_PATH )
313- }
314-
315- fn path_to_foundry_scripts ( & self ) -> PathBuf {
316- self . contracts_path ( )
317- . join ( L1_CONTRACTS_FOUNDRY_INSIDE_CONTRACTS )
318- }
319- }
265+ impl ZkStackConfigTrait for ChainConfigInternal { }
0 commit comments