Skip to content

Commit

Permalink
Merge branch 'main' into fix-stash-gen-key
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoviola authored Sep 11, 2024
2 parents 91f71f0 + 9f8845d commit dae3750
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
15 changes: 14 additions & 1 deletion crates/configuration/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ pub struct ParachainConfig {
genesis_overrides: Option<serde_json::Value>,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty", default)]
pub(crate) collators: Vec<NodeConfig>,
// Single collator config, added for backward compatibility
// with `toml` networks definitions from v1.
// This field can only be set loading an old `toml` definition
// with `[parachain.collator]` key.
// NOTE: if the file also contains multiple collators defined in
// `[[parachain.collators]], the single configuration will be added to the bottom.
collator: Option<NodeConfig>,
}

impl ParachainConfig {
Expand Down Expand Up @@ -253,7 +260,11 @@ impl ParachainConfig {

/// The collators of the parachain.
pub fn collators(&self) -> Vec<&NodeConfig> {
self.collators.iter().collect::<Vec<_>>()
let mut cols = self.collators.iter().collect::<Vec<_>>();
if let Some(col) = self.collator.as_ref() {
cols.push(col);
}
cols
}
}

Expand Down Expand Up @@ -312,6 +323,7 @@ impl<C: Context> Default for ParachainConfigBuilder<Initial, C> {
is_evm_based: false,
bootnodes_addresses: vec![],
collators: vec![],
collator: None,
},
validation_context: Default::default(),
errors: vec![],
Expand Down Expand Up @@ -1257,6 +1269,7 @@ mod tests {

assert_eq!(parachain.registration_strategy(), None);
assert_eq!(parachain.is_evm_based(), false);
assert_eq!(parachain.collators().len(), 1);
assert_eq!(parachain_evm.is_evm_based(), true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ default_db_snapshot = "https://storage.com/path/to/db_snapshot.tgz"
chain_spec_path = "/path/to/my/chain/spec.json"
cumulus_based = true

[[parachains.collators]]
[parachains.collator]
name = "john"
validator = true
invulnerable = true
Expand Down
10 changes: 1 addition & 9 deletions crates/orchestrator/src/network/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,7 @@ impl NetworkNode {
user_types: Option<serde_json::Value>,
) -> Result<PjsResult, anyhow::Error> {
let content = std::fs::read_to_string(file)?;
let code = pjs_build_template(self.ws_uri(), content.as_ref(), args, user_types);
tracing::trace!("Code to execute: {code}");

let value = match pjs_exec(code)? {
ReturnValue::Deserialized(val) => Ok(val),
ReturnValue::CantDeserialize(msg) => Err(msg),
};

Ok(value)
self.pjs(content, args, user_types).await
}

async fn fetch_metrics(&self) -> Result<(), anyhow::Error> {
Expand Down

0 comments on commit dae3750

Please sign in to comment.