Skip to content

Commit

Permalink
feat: m of n scripting poc (#6377)
Browse files Browse the repository at this point in the history
Description
---

Apply m_of_n_feature branch

- PR #4751
- PRs #4759, #4776, #4798, #4822

Motivation and Context
---

Add m-of-n scripting ability

How Has This Been Tested?
---

**Note:** Not tested yet

What process can a PR reviewer use to test or verify this change?
---

Code review

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

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

<!-- 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 -->
  • Loading branch information
hansieodendaal authored Jun 28, 2024
1 parent 59a3440 commit fc744d0
Show file tree
Hide file tree
Showing 28 changed files with 2,326 additions and 68 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

28 changes: 25 additions & 3 deletions applications/minotari_app_utilities/src/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ use tari_common::exit_codes::{ExitCode, ExitError};
use tari_common_types::{
emoji::EmojiId,
tari_address::TariAddress,
types::{BlockHash, PublicKey},
types::{BlockHash, PrivateKey, PublicKey, Signature},
};
use tari_comms::{peer_manager::NodeId, types::CommsPublicKey};
use tari_utilities::hex::Hex;
use tari_utilities::hex::{Hex, HexError};
use thiserror::Error;
use tokio::{runtime, runtime::Runtime};

Expand Down Expand Up @@ -95,7 +95,7 @@ impl From<UniPublicKey> for PublicKey {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum UniNodeId {
PublicKey(PublicKey),
NodeId(NodeId),
Expand Down Expand Up @@ -140,6 +140,28 @@ impl TryFrom<UniNodeId> for PublicKey {
}
}

#[derive(Debug, Clone)]
pub struct UniSignature(Signature);

impl FromStr for UniSignature {
type Err = HexError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let data = s.split(',').collect::<Vec<_>>();
let signature = PrivateKey::from_hex(data[0])?;
let public_nonce = PublicKey::from_hex(data[1])?;

let signature = Signature::new(public_nonce, signature);
Ok(Self(signature))
}
}

impl From<UniSignature> for Signature {
fn from(id: UniSignature) -> Self {
id.0
}
}

impl From<UniNodeId> for NodeId {
fn from(id: UniNodeId) -> Self {
match id {
Expand Down
1 change: 0 additions & 1 deletion applications/minotari_console_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ serde = "1.0.136"
serde_json = "1.0.79"
sha2 = "0.10"
strum = "0.22"
strum_macros = "0.22"
thiserror = "1.0.26"
tonic = "0.8.3"
unicode-segmentation = "1.6.0"
Expand Down
Loading

0 comments on commit fc744d0

Please sign in to comment.