From 4370b0894ec40137eb725b38a1d360e25ae98c83 Mon Sep 17 00:00:00 2001 From: Nam Chu Hoai Date: Tue, 21 Nov 2023 16:26:22 +0300 Subject: [PATCH] Actually default to none policy (#2921) ### Description ### Drive-by changes ### Related issues ### Backward compatibility ### Testing --- rust/agents/relayer/src/settings/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rust/agents/relayer/src/settings/mod.rs b/rust/agents/relayer/src/settings/mod.rs index 18ea52dddb..a595f0899b 100644 --- a/rust/agents/relayer/src/settings/mod.rs +++ b/rust/agents/relayer/src/settings/mod.rs @@ -143,7 +143,7 @@ impl FromRawConf for RelayerSettings { raw_gas_payment_enforcement_path, &raw_gas_payment_enforcement, ); - let gas_payment_enforcement = gas_payment_enforcement_parser.into_array_iter().map(|itr| { + let mut gas_payment_enforcement = gas_payment_enforcement_parser.into_array_iter().map(|itr| { itr.filter_map(|policy| { let policy_type = policy.chain(&mut err).get_opt_key("type").parse_string().end(); let minimum_is_defined = matches!(policy.get_opt_key("minimum"), Ok(Some(_))); @@ -187,7 +187,11 @@ impl FromRawConf for RelayerSettings { matching_list, }) }).collect_vec() - }).unwrap_or_else(|_| vec![GasPaymentEnforcementConf::default()]); + }).unwrap_or_default(); + + if gas_payment_enforcement.is_empty() { + gas_payment_enforcement.push(GasPaymentEnforcementConf::default()); + } let whitelist = p .chain(&mut err)