Skip to content

Commit 93b3eaa

Browse files
committed
fix(ev-deployer): make [contracts] section optional in config
Default to an empty ContractsConfig when the section is omitted, so a minimal config only needs [chain].
1 parent 6b85563 commit 93b3eaa

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

bin/ev-deployer/src/config.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub(crate) struct DeployConfig {
1111
/// Chain configuration.
1212
pub chain: ChainConfig,
1313
/// Contract configurations.
14+
#[serde(default)]
1415
pub contracts: ContractsConfig,
1516
}
1617

@@ -23,7 +24,7 @@ pub(crate) struct ChainConfig {
2324
}
2425

2526
/// All contract configurations.
26-
#[derive(Debug, Deserialize)]
27+
#[derive(Debug, Deserialize, Default)]
2728
pub(crate) struct ContractsConfig {
2829
/// `AdminProxy` contract config (optional).
2930
pub admin_proxy: Option<AdminProxyConfig>,
@@ -94,6 +95,17 @@ owner = "0x0000000000000000000000000000000000000000"
9495
assert!(config.validate().is_err());
9596
}
9697

98+
#[test]
99+
fn no_contracts_section() {
100+
let toml = r#"
101+
[chain]
102+
chain_id = 1
103+
"#;
104+
let config: DeployConfig = toml::from_str(toml).unwrap();
105+
config.validate().unwrap();
106+
assert!(config.contracts.admin_proxy.is_none());
107+
}
108+
97109
#[test]
98110
fn admin_proxy_only() {
99111
let toml = r#"

0 commit comments

Comments
 (0)