Skip to content

Commit

Permalink
[aptos] unify on all yaml files ending with the yaml extension
Browse files Browse the repository at this point in the history
  • Loading branch information
davidiw authored and aptos-bot committed May 11, 2022
1 parent 5275a0a commit 84db3d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions crates/aptos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ cargo run --package aptos -- \\
--local-repository-dir .
```
3. The last command will produce a `bob.yaml` file that should be distributed to other participants for `genesis.blob` generation.
### Generating a Genesis and Waypoint
`genesis.blob` and the waypoint can be generated after obtaining the `Layout` file, each of the individual `ValidatorConfiguration` files, and the framework release. It is important to validate that the `ValidatorConfiguration` provided in the earlier stage is the same as in the distribution for generating the `genesis.blob`. If there is a mismatch, inform all participants.
Expand Down
8 changes: 4 additions & 4 deletions crates/aptos/src/common/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl CliConfig {

/// Loads the config from the current working directory
pub fn load() -> CliTypedResult<Self> {
let config_file = Self::aptos_folder()?.join("config.yml");
let config_file = Self::aptos_folder()?.join("config.yaml");
if !config_file.exists() {
return Err(CliError::ConfigNotFoundError(format!("{:?}", config_file)));
}
Expand All @@ -176,7 +176,7 @@ impl CliConfig {
}
}

/// Saves the config to ./.aptos/config.yml
/// Saves the config to ./.aptos/config.yaml
pub fn save(&self) -> CliTypedResult<()> {
let aptos_folder = Self::aptos_folder()?;

Expand All @@ -194,11 +194,11 @@ impl CliConfig {
}

// Save over previous config file
let config_file = aptos_folder.join("config.yml");
let config_file = aptos_folder.join("config.yaml");
let config_bytes = serde_yaml::to_string(&self).map_err(|err| {
CliError::UnexpectedError(format!("Failed to serialize config {}", err))
})?;
write_to_file(&config_file, "config.yml", config_bytes.as_bytes())?;
write_to_file(&config_file, "config.yaml", config_bytes.as_bytes())?;
Ok(())
}

Expand Down
8 changes: 4 additions & 4 deletions crates/aptos/src/genesis/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Client {
pub fn get<T: DeserializeOwned>(&self, name: &str) -> CliTypedResult<T> {
match self {
Client::Local(local_repository_path) => {
let path = local_repository_path.join(format!("{}.yml", name));
let path = local_repository_path.join(format!("{}.yaml", name));
let mut file = std::fs::File::open(path.as_path())
.map_err(|e| CliError::IO(path.display().to_string(), e))?;

Expand All @@ -150,7 +150,7 @@ impl Client {
from_yaml(&contents)
}
Client::Github(client) => {
from_base64_encoded_yaml(&client.get_file(&format!("{}.yml", name))?)
from_base64_encoded_yaml(&client.get_file(&format!("{}.yaml", name))?)
}
}
}
Expand All @@ -159,15 +159,15 @@ impl Client {
pub fn put<T: Serialize + ?Sized>(&self, name: &str, input: &T) -> CliTypedResult<()> {
match self {
Client::Local(local_repository_path) => {
let path = local_repository_path.join(format!("{}.yml", name));
let path = local_repository_path.join(format!("{}.yaml", name));
write_to_file(
path.as_path(),
&path.display().to_string(),
to_yaml(input)?.as_bytes(),
)?;
}
Client::Github(client) => {
client.put(&format!("{}.yml", name), &to_base64_encoded_yaml(input)?)?;
client.put(&format!("{}.yaml", name), &to_base64_encoded_yaml(input)?)?;
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/aptos/src/genesis/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use move_core_types::account_address::AccountAddress;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

const PRIVATE_KEYS_FILE: &str = "private-keys.yml";
const PRIVATE_KEYS_FILE: &str = "private-keys.yaml";

/// Generate account key, consensus key, and network key for a validator
#[derive(Parser)]
Expand Down

0 comments on commit 84db3d0

Please sign in to comment.