Skip to content

Commit

Permalink
chore: merge development to feature-dan2 (tari-project#6100)
Browse files Browse the repository at this point in the history
Description
---
Based on tari-project#6078 by @Cifko but with latest development updates - for some
reason I could not push to the PR directly
Update feature-dan2 from development

Motivation and Context
---
Keep feature branch in sync

Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other 

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->

---------

Co-authored-by: stringhandler <mikethetike@tari.com>
Co-authored-by: Martin Stefcek <35243812+Cifko@users.noreply.github.com>
Co-authored-by: Cifko <gcifko@gmail.com>
  • Loading branch information
4 people authored Jan 26, 2024
1 parent 69421f5 commit 01866d1
Show file tree
Hide file tree
Showing 45 changed files with 415 additions and 219 deletions.
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions applications/minotari_app_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ authors = ["The Tari Development Community"]
description = "This crate is to provide a single source for all cross application grpc files and conversions to and from tari::core"
repository = "https://github.com/tari-project/tari"
license = "BSD-3-Clause"
version = "1.0.0-pre.5"
version = "0.53.0-dan.0"
edition = "2018"

[dependencies]
tari_common_types = { path = "../../base_layer/common_types" }
tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_core = { path = "../../base_layer/core" }
tari_crypto = { version = "0.20" }
Expand All @@ -27,11 +27,13 @@ rcgen = "0.11.3"
subtle = { version = "2.5.0", features = ["core_hint_black_box"] }
thiserror = "1"
tokio = { version = "1.23", features = ["fs"] }
tonic = { version = "0.8.3", features = ["tls"]}
tonic = { version = "0.8.3", features = ["tls"] }
zeroize = "1"

[build-dependencies]
tonic-build = "0.8.4"

[package.metadata.cargo-machete]
ignored = ["prost"] # this is so we can run cargo machete without getting false positive about macro dependancies
ignored = [
"prost",
] # this is so we can run cargo machete without getting false positive about macro dependancies
1 change: 1 addition & 0 deletions applications/minotari_app_grpc/proto/sidechain_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ message SideChainFeature {
message ValidatorNodeRegistration {
bytes public_key = 1;
Signature signature = 2;
bytes claim_public_key = 3;
}

message TemplateRegistration {
Expand Down
5 changes: 3 additions & 2 deletions applications/minotari_app_grpc/proto/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,9 @@ message TransactionEventResponse {
message RegisterValidatorNodeRequest {
bytes validator_node_public_key = 1;
Signature validator_node_signature = 2;
uint64 fee_per_gram = 3;
string message = 4;
bytes validator_node_claim_public_key = 3;
uint64 fee_per_gram = 4;
string message = 5;
}

message RegisterValidatorNodeResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,21 @@ impl TryFrom<grpc::ValidatorNodeRegistration> for ValidatorNodeRegistration {
type Error = String;

fn try_from(value: grpc::ValidatorNodeRegistration) -> Result<Self, Self::Error> {
Ok(ValidatorNodeRegistration::new(ValidatorNodeSignature::new(
PublicKey::from_canonical_bytes(&value.public_key).map_err(|e| e.to_string())?,
value
.signature
.map(Signature::try_from)
.ok_or("signature not provided")??,
)))
let public_key =
PublicKey::from_canonical_bytes(&value.public_key).map_err(|e| format!("Invalid public key: {}", e))?;
let claim_public_key = PublicKey::from_canonical_bytes(&value.claim_public_key)
.map_err(|e| format!("Invalid claim public key: {}", e))?;

Ok(ValidatorNodeRegistration::new(
ValidatorNodeSignature::new(
public_key,
value
.signature
.map(Signature::try_from)
.ok_or("signature not provided")??,
),
claim_public_key,
))
}
}

Expand All @@ -102,6 +110,7 @@ impl From<ValidatorNodeRegistration> for grpc::ValidatorNodeRegistration {
Self {
public_key: value.public_key().to_vec(),
signature: Some(value.signature().into()),
claim_public_key: value.claim_public_key().to_vec(),
}
}
}
Expand Down
11 changes: 8 additions & 3 deletions applications/minotari_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minotari_app_utilities"
version = "1.0.0-pre.5"
version = "0.53.0-dan.0"
authors = ["The Tari Development Community"]
edition = "2018"
license = "BSD-3-Clause"
Expand All @@ -14,7 +14,9 @@ tari_utilities = { version = "0.7" }
minotari_app_grpc = { path = "../minotari_app_grpc", optional = true }

clap = { version = "3.2", features = ["derive", "env"] }
futures = { version = "^0.3.16", default-features = false, features = ["alloc"] }
futures = { version = "^0.3.16", default-features = false, features = [
"alloc",
] }
json5 = "0.4"
log = { version = "0.4.8", features = ["std"] }
rand = "0.8"
Expand All @@ -26,7 +28,10 @@ tonic = "0.8.3"


[build-dependencies]
tari_common = { path = "../../common", features = ["build", "static-application-info"] }
tari_common = { path = "../../common", features = [
"build",
"static-application-info",
] }
tari_features = { path = "../../common/tari_features" }

[features]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ pub fn setup_node_identity<P: AsRef<Path>>(
),
)),
Err(e) => {
debug!(target: LOG_TARGET, "Failed to load node identity: {}", e);
if !create_id {
let prompt = prompt("Node identity does not exist.\nWould you like to create one (Y/n)?");
if create_id {
warn!(target: LOG_TARGET, "Failed to load node identity: {}", e);
} else {
let prompt = prompt("Node identity does not exist.\nWould you like to to create one (Y/n)?");
if !prompt {
error!(
target: LOG_TARGET,
Expand All @@ -90,7 +91,6 @@ pub fn setup_node_identity<P: AsRef<Path>>(
));
};
}

debug!(target: LOG_TARGET, "Existing node id not found. {}. Creating new ID", e);

match create_new_node_identity(&identity_file, public_addresses, peer_features) {
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_console_wallet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minotari_console_wallet"
version = "1.0.0-pre.5"
version = "0.53.0-dan.0"
authors = ["The Tari Development Community"]
edition = "2018"
license = "BSD-3-Clause"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ pub async fn register_validator_node(
mut wallet_transaction_service: TransactionServiceHandle,
validator_node_public_key: PublicKey,
validator_node_signature: Signature,
validator_node_claim_public_key: PublicKey,
selection_criteria: UtxoSelectionCriteria,
fee_per_gram: MicroMinotari,
message: String,
Expand All @@ -211,6 +212,7 @@ pub async fn register_validator_node(
amount,
validator_node_public_key,
validator_node_signature,
validator_node_claim_public_key,
selection_criteria,
fee_per_gram,
message,
Expand Down Expand Up @@ -969,8 +971,9 @@ pub async fn command_runner(
args.validator_node_public_key.into(),
Signature::new(
args.validator_node_public_nonce.into(),
RistrettoSecretKey::from_vec(&args.validator_node_signature)?,
RistrettoSecretKey::from_vec(&args.validator_node_signature[0])?,
),
args.validator_node_claim_public_key.into(),
UtxoSelectionCriteria::default(),
config.fee_per_gram * uT,
args.message,
Expand Down
Loading

0 comments on commit 01866d1

Please sign in to comment.