Skip to content

Commit

Permalink
Merge branch 'development' into constitution-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed Jun 7, 2022
2 parents 2f4b8aa + 859b7d3 commit bb6f260
Show file tree
Hide file tree
Showing 30 changed files with 403 additions and 1,101 deletions.
1 change: 1 addition & 0 deletions .license.ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
./CODEOWNERS
./LICENSE
./Makefile
./RFC/src/CNAME
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@stringhandler @CjS77 @sdbondi
Empty file.
7 changes: 3 additions & 4 deletions applications/tari_app_grpc/proto/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ message CommitteeDefinitionFeatures {
}

message ContractDefinition {
bytes contract_id = 1;
bytes contract_name = 2;
bytes contract_issuer = 3;
ContractSpecification contract_spec = 4;
bytes contract_name = 1;
bytes contract_issuer = 2;
ContractSpecification contract_spec = 3;
}

message ContractSpecification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ impl TryFrom<grpc::ContractDefinition> for ContractDefinition {
type Error = String;

fn try_from(value: grpc::ContractDefinition) -> Result<Self, Self::Error> {
let contract_id = FixedHash::try_from(value.contract_id).map_err(|err| format!("{:?}", err))?;

let contract_name = vec_into_fixed_string(value.contract_name);

let contract_issuer =
Expand All @@ -132,7 +130,6 @@ impl TryFrom<grpc::ContractDefinition> for ContractDefinition {
.map_err(|err| err)?;

Ok(Self {
contract_id,
contract_name,
contract_issuer,
contract_spec,
Expand All @@ -142,12 +139,10 @@ impl TryFrom<grpc::ContractDefinition> for ContractDefinition {

impl From<ContractDefinition> for grpc::ContractDefinition {
fn from(value: ContractDefinition) -> Self {
let contract_id = value.contract_id.as_bytes().to_vec();
let contract_name = value.contract_name.as_bytes().to_vec();
let contract_issuer = value.contract_issuer.as_bytes().to_vec();

Self {
contract_id,
contract_name,
contract_issuer,
contract_spec: Some(value.contract_spec.into()),
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_app_utilities/src/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn either_to_node_id(either: Either<CommsPublicKey, NodeId>) -> NodeId {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct UniPublicKey(PublicKey);

impl FromStr for UniPublicKey {
Expand Down
18 changes: 9 additions & 9 deletions applications/tari_base_node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use clap::Parser;
use tari_app_utilities::common_cli_args::CommonCliArgs;

const DEFAULT_NETWORK: &str = "dibbler";

#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
#[clap(propagate_version = true)]
Expand All @@ -49,18 +47,20 @@ pub(crate) struct Cli {
#[clap(long)]
pub watch: Option<String>,
/// Supply a network (overrides existing configuration)
#[clap(long, default_value = DEFAULT_NETWORK, env = "TARI_NETWORK")]
pub network: String,
#[clap(long, env = "TARI_NETWORK")]
pub network: Option<String>,
}

impl Cli {
pub fn config_property_overrides(&self) -> Vec<(String, String)> {
let mut overrides = self.common.config_property_overrides();
overrides.push(("base_node.override_from".to_string(), self.network.clone()));
overrides.push(("p2p.seeds.override_from".to_string(), self.network.clone()));
overrides.push(("auto_update.override_from".to_string(), self.network.clone()));
#[cfg(features = "metrics")]
overrides.push(("metrics.override_from".to_string(), self.network.clone()));
if let Some(network) = &self.network {
overrides.push(("base_node.override_from".to_string(), network.clone()));
overrides.push(("p2p.seeds.override_from".to_string(), network.clone()));
overrides.push(("auto_update.override_from".to_string(), network.clone()));
#[cfg(features = "metrics")]
overrides.push(("metrics.override_from".to_string(), network.clone()));
}
overrides
}
}
4 changes: 3 additions & 1 deletion applications/tari_base_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ fn main_inner() -> Result<(), ExitError> {

#[cfg_attr(not(all(unix, feature = "libtor")), allow(unused_mut))]
let mut config = ApplicationConfig::load_from(&cfg)?;
config.base_node.network = Network::from_str(&cli.network)?;
if let Some(network) = &cli.network {
config.base_node.network = Network::from_str(network)?;
}
debug!(target: LOG_TARGET, "Using base node configuration: {:?}", config);

// Load or create the Node identity
Expand Down

0 comments on commit bb6f260

Please sign in to comment.