Skip to content

Commit

Permalink
Merge pull request #399 from ralexstokes/network-display
Browse files Browse the repository at this point in the history
make it clear where a `custom` network will load configuration when printing
  • Loading branch information
ralexstokes authored May 4, 2024
2 parents 5cf67a5 + cb02379 commit 0ead81b
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions ethereum-consensus/src/networks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl std::fmt::Display for Network {
Self::Sepolia => write!(f, "sepolia"),
Self::Goerli => write!(f, "goerli"),
Self::Holesky => write!(f, "holesky"),
Self::Custom(config_dir) => write!(f, "{config_dir}"),
Self::Custom(config_dir) => write!(f, "custom ({config_dir}/config.yaml)"),
}
}
}
Expand Down Expand Up @@ -70,21 +70,3 @@ impl TryFrom<Network> for Context {
pub fn typical_genesis_time(context: &Context) -> u64 {
context.min_genesis_time + context.genesis_delay
}

#[cfg(test)]
mod tests {
use super::*;

#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
struct File {
network: Network,
}

#[test]
fn test_serde() {
let file = File { network: Network::Custom("/path/to/foo.yaml".to_string()) };
let str = toml::to_string(&file).unwrap();
let recovered_file: File = toml::from_str(&str).unwrap();
assert_eq!(file, recovered_file);
}
}

0 comments on commit 0ead81b

Please sign in to comment.