Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/p2pool-randomx-support' …
Browse files Browse the repository at this point in the history
…into feature/p2pool-randomx-support
  • Loading branch information
ksrichard committed Sep 4, 2024
2 parents 20dd598 + 1a1ad73 commit 135aee6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 83 deletions.
23 changes: 22 additions & 1 deletion applications/minotari_node/log4rs_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ appenders:
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [Thread:{I}] {l:5} {m} // {f}:{L}{n}"


# An appender named "base_layer" that writes to a file with a custom pattern encoder
base_layer:
kind: rolling_file
Expand All @@ -71,6 +70,23 @@ appenders:
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}"

# An appender named "base_layer" that writes to a file with a custom pattern encoder
grpc:
kind: rolling_file
path: "{{log_dir}}/log/base_node/grpc.log"
policy:
kind: compound
trigger:
kind: size
limit: 10mb
roller:
kind: fixed_window
base: 1
count: 5
pattern: "{{log_dir}}/log/base_node/grpc.{}.log"
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}"

# An appender named "other" that writes to a file with a custom pattern encoder
other:
kind: rolling_file
Expand Down Expand Up @@ -104,6 +120,11 @@ loggers:
- other
additive: false

minotari::base_node::grpc:
level: debug
appenders:
- grpc

# Route log events sent to the "core" logger to the "base_layer" appender
c:
level: debug
Expand Down
2 changes: 2 additions & 0 deletions applications/minotari_node/src/grpc/base_node_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer {
let page_iter =
NonOverlappingIntegerPairIter::new(start_height, end_height.saturating_add(1), GET_DIFFICULTY_PAGE_SIZE)
.map_err(|e| obscure_error_if_true(report_error_flag, Status::invalid_argument(e)))?;

debug!(target: LOG_TARGET, "Starting GetNetworkDifficulty request from {} to {}", start_height, end_height);
task::spawn(async move {
for (start, end) in page_iter {
// headers are returned by height
Expand Down
82 changes: 0 additions & 82 deletions base_layer/core/src/transactions/key_manager/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
}

pub async fn get_random_key(&self) -> Result<KeyAndId<PublicKey>, KeyManagerServiceError> {
#[cfg(feature = "ledger")]
{
debug!(target: LOG_TARGET, "get_random_key: wallet type {}", self.wallet_type);
}
match &*self.wallet_type {
WalletType::Ledger(ledger) => {
#[cfg(not(feature = "ledger"))]
Expand Down Expand Up @@ -258,10 +254,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
}

pub async fn get_public_key_at_key_id(&self, key_id: &TariKeyId) -> Result<PublicKey, KeyManagerServiceError> {
#[cfg(feature = "ledger")]
{
debug!(target: LOG_TARGET, "get_public_key_at_key_id: key_id {}, wallet type {}", key_id, self.wallet_type);
}
match key_id {
KeyId::Managed { branch, index } => {
if let WalletType::Ledger(ledger) = &*self.wallet_type {
Expand Down Expand Up @@ -728,15 +720,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
secret_key_id: &TariKeyId,
public_key: &PublicKey,
) -> Result<CommsDHKE, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"get_diffie_hellman_shared_secret: secret_key_id {}, wallet type {}",
secret_key_id,
self.wallet_type
);
}
if let WalletType::Ledger(ledger) = &*self.wallet_type {
if let KeyId::Managed { branch, index } = secret_key_id {
match TransactionKeyManagerBranch::from_key(branch) {
Expand Down Expand Up @@ -775,20 +758,10 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
secret_key_id: &TariKeyId,
public_key: &PublicKey,
) -> Result<DomainSeparatedHash<Blake2b<U64>>, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"get_diffie_hellman_stealth_domain_hasher: secret_key_id {}, wallet type {}",
secret_key_id,
self.wallet_type
);
}
match &*self.wallet_type {
WalletType::Ledger(ledger) => match secret_key_id {
KeyId::Managed { branch, index } => match TransactionKeyManagerBranch::from_key(branch) {
TransactionKeyManagerBranch::OneSidedSenderOffset => {
debug!(target: LOG_TARGET, "get_diffie_hellman_stealth_domain_hasher: {}", self.wallet_type);
#[cfg(not(feature = "ledger"))]
{
Err(TransactionError::LedgerNotSupported(format!(
Expand Down Expand Up @@ -871,15 +844,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
txi_version: &TransactionInputVersion,
script_message: &[u8; 32],
) -> Result<ComAndPubSignature, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"get_script_signature: script_key_id {}, wallet type {}",
script_key_id,
self.wallet_type
);
}
let commitment = self.get_commitment(commitment_mask_key_id, value).await?;
let commitment_private_key = self.get_private_key(commitment_mask_key_id).await?;

Expand Down Expand Up @@ -1064,17 +1028,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
script_key_ids: &[TariKeyId],
sender_offset_key_ids: &[TariKeyId],
) -> Result<PrivateKey, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"get_script_offset: script_key_ids {:?}, sender_offset_key_ids {:?}, wallet type {}",
script_key_ids,
sender_offset_key_ids,
self.wallet_type
);
}

match &*self.wallet_type {
WalletType::DerivedKeys | WalletType::ProvidedKeys(_) => {
let mut total_script_private_key = PrivateKey::default();
Expand Down Expand Up @@ -1233,15 +1186,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
private_key_id: &TariKeyId,
challenge: &[u8],
) -> Result<CheckSigSchnorrSignature, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"sign_script_message: private_key_id {}, wallet type {}",
private_key_id,
self.wallet_type
);
}
match &*self.wallet_type {
WalletType::Ledger(ledger) => {
#[cfg(not(feature = "ledger"))]
Expand Down Expand Up @@ -1287,16 +1231,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
nonce_key_id: &TariKeyId,
challenge: &[u8; 64],
) -> Result<Signature, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"sign_with_nonce_and_challenge: private_key_id {}, nonce_key_id {}, wallet type {}",
private_key_id,
nonce_key_id,
self.wallet_type
);
}
match &*self.wallet_type {
WalletType::Ledger(ledger) => {
#[cfg(not(feature = "ledger"))]
Expand Down Expand Up @@ -1417,16 +1351,6 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
script: &TariScript,
receiver_address: &TariAddress,
) -> Result<ComAndPubSignature, TransactionError> {
#[cfg(feature = "ledger")]
{
debug!(
target: LOG_TARGET,
"get_one_sided_metadata_signature: commitment_mask_key_id {}, sender_offset_key_id {}, wallet type {}",
commitment_mask_key_id,
sender_offset_key_id,
self.wallet_type
);
}
match &*self.wallet_type {
WalletType::DerivedKeys | WalletType::ProvidedKeys(_) => {
let metadata_signature_message = TransactionOutput::metadata_signature_message_from_script_and_common(
Expand Down Expand Up @@ -1456,17 +1380,11 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
#[cfg(feature = "ledger")]
{
let sender_offset_key_index = sender_offset_key_id.managed_index().ok_or_else(|| {
debug!(target: LOG_TARGET, "Invalid key id {:?}", sender_offset_key_id);
TransactionError::KeyManagerError("Invalid index for sender offset".to_string())
})?;

let commitment_mask = self.get_private_key(commitment_mask_key_id).await?;

debug!(
target: LOG_TARGET,
"get_one_sided_metadata_signature: (ledger) account {}",
ledger.account,
);
let comm_and_pub_sig = ledger_get_one_sided_metadata_signature(
ledger.account,
ledger.network,
Expand Down
1 change: 1 addition & 0 deletions src/nodeenv
Submodule nodeenv added at a6585e

0 comments on commit 135aee6

Please sign in to comment.