Skip to content

Commit

Permalink
config: rename CometbftConfig to Config
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabaluev committed Dec 14, 2023
1 parent 325285d commit 341c741
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! This module contains types which correspond to the following config files:
//!
//! - `config.toml`: `config::CometbftConfig`
//! - `config.toml`: `config::Config`
//! - `node_key.rs`: `config::node_key::NodeKey`
//! - `priv_validator_key.rs`: `config::priv_validator_key::PrivValidatorKey`
Expand All @@ -20,7 +20,7 @@ use crate::{net, node_key::NodeKey, prelude::*, Error};

/// CometBFT `config.toml` file
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct CometbftConfig {
pub struct Config {
/// TCP or UNIX socket address of the ABCI application,
/// or the name of an ABCI application compiled in with the CometBFT binary.
pub proxy_app: net::Address,
Expand Down Expand Up @@ -104,7 +104,7 @@ pub struct CometbftConfig {
pub fastsync: FastsyncConfig,
}

impl CometbftConfig {
impl Config {
/// Parse CometBFT `config.toml`
pub fn parse_toml<T: AsRef<str>>(toml_string: T) -> Result<Self, Error> {
let res = toml::from_str(toml_string.as_ref()).map_err(Error::toml)?;
Expand Down
2 changes: 1 addition & 1 deletion config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! CometBFT Configuration Utilities
//!
//! This crate defines the [`CometbftConfig`] type, which is used by
//! This crate defines the [`Config`] type, which is used by
//! crates such as `cometbft-rpc` to perform operations based on
//! a common configuration type.
Expand Down
10 changes: 5 additions & 5 deletions config/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ fn read_fixture(name: &str) -> String {
fs::read_to_string(PathBuf::from("./tests/support/config/").join(name)).unwrap()
}

/// Parse an example `config.toml` file to a `CometbftConfig` struct
/// Parse an example `config.toml` file to a `Config` struct
#[allow(clippy::cognitive_complexity)]
#[test]
fn config_toml_parser() {
let config_toml = read_fixture("config.toml");
let config = CometbftConfig::parse_toml(config_toml).unwrap();
let config = Config::parse_toml(config_toml).unwrap();

// main base config options

Expand Down Expand Up @@ -236,15 +236,15 @@ fn priv_validator_secp256k1_json_parser() {
);
}

/// Parse an example `config.toml` file to a `CometbftConfig` struct, then
/// Parse an example `config.toml` file to a `Config` struct, then
/// serialize it and parse again.
#[test]
fn parsing_roundtrip() {
let config_toml = read_fixture("config.toml");
let config = CometbftConfig::parse_toml(config_toml).unwrap();
let config = Config::parse_toml(config_toml).unwrap();

let written_config_toml = toml::to_string(&config).unwrap();
let written_config = CometbftConfig::parse_toml(&written_config_toml).unwrap();
let written_config = Config::parse_toml(&written_config_toml).unwrap();

assert_eq!(
config, written_config,
Expand Down

0 comments on commit 341c741

Please sign in to comment.