Skip to content

Commit

Permalink
feat!: dont store entire monero coinbase transaction (#5991)
Browse files Browse the repository at this point in the history
Description
---
only store the keccak state and not the entire monero coinbase
transaction

Motivation and Context
---
The monero coinbase transaction can be very large as it may contain
multiple coinbases. We only store the keccak inner hash state with half
of the hashed transaction. We hash the last part to verify its working.

How Has This Been Tested?
---
unit tests

fixes: #5891
  • Loading branch information
SWvheerden authored Dec 1, 2023
1 parent fc1e555 commit 23b10bf
Show file tree
Hide file tree
Showing 47 changed files with 535 additions and 195 deletions.
145 changes: 61 additions & 84 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions applications/minotari_app_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ edition = "2018"
tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_core = { path = "../../base_layer/core" }
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }
tari_script = { path = "../../infrastructure/tari_script" }
tari_utilities = { version = "0.6" }

argon2 = { version = "0.4.1", features = ["std", "password-hash"] }
base64 = "0.13.0"
borsh = "0.10"
borsh = "1.2"
chrono = { version = "0.4.19", default-features = false }
log = "0.4"
prost = "0.9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

use std::convert::{TryFrom, TryInto};

use borsh::BorshSerialize;
use tari_common_types::types::{Commitment, PublicKey};
use tari_core::{
borsh::FromBytes,
Expand Down Expand Up @@ -144,11 +143,12 @@ impl TryFrom<TransactionInput> for grpc::TransactionInput {
.map_err(|_| "Non-compact Transaction input should contain sender_offset_public_key".to_string())?
.to_vec(),
output_hash: Vec::new(),
covenant: input
.covenant()
.map_err(|_| "Non-compact Transaction input should contain covenant".to_string())?
.try_to_vec()
.map_err(|err| err.to_string())?,
covenant: borsh::to_vec(
&input
.covenant()
.map_err(|_| "Non-compact Transaction input should contain covenant".to_string())?,
)
.map_err(|err| err.to_string())?,
version: input.version as u32,
encrypted_data: input
.encrypted_data()
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_console_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_comms_dht = { path = "../../comms/dht" }
tari_contacts = { path = "../../base_layer/contacts" }
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }
tari_key_manager = { path = "../../base_layer/key_manager" }
tari_libtor = { path = "../../infrastructure/libtor", optional = true }
tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_merge_mining_proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tari_key_manager = { path = "../../base_layer/key_manager", features = ["key_ma
anyhow = "1.0.53"
crossterm = { version = "0.25.0" }
bincode = "1.3.1"
borsh = "0.10"
borsh = "1.2"
bytes = "1.1"
chrono = { version = "0.4.6", default-features = false }
clap = { version = "3.2", features = ["derive", "env"] }
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_merge_mining_proxy/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl InnerService {
let start = Instant::now();
let achieved_target = if self.config.check_tari_difficulty_before_submit {
trace!(target: LOG_TARGET, "Starting calculate achieved Tari difficultly");
let diff = randomx_difficulty(&tari_header, &self.randomx_factory, &gen_hash)?;
let diff = randomx_difficulty(&tari_header, &self.randomx_factory, &gen_hash, &self.consensus_manager)?;
trace!(
target: LOG_TARGET,
"Finished calculate achieved Tari difficultly - achieved {} vs. target {}",
Expand Down
4 changes: 2 additions & 2 deletions applications/minotari_miner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
minotari_app_utilities = { path = "../minotari_app_utilities" }
minotari_app_grpc = { path = "../minotari_app_grpc" }
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }
tari_utilities = { version = "0.6" }

base64 = "0.13.0"
borsh = "0.10"
borsh = "1.2"
bufstream = "0.1"
chrono = { version = "0.4.19", default-features = false }
clap = { version = "3.2", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions applications/minotari_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tari_comms = { path = "../../comms/core", features = ["rpc"] }
tari_common_types = { path = "../../base_layer/common_types" }
tari_comms_dht = { path = "../../comms/dht" }
tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] }
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }
tari_libtor = { path = "../../infrastructure/libtor", optional = true }
tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
tari_storage = {path="../../infrastructure/storage"}
Expand All @@ -26,7 +26,7 @@ tari_utilities = { version = "0.6" }
anyhow = "1.0.53"
async-trait = "0.1.52"
bincode = "1.3.1"
borsh = "0.10"
borsh = "1.2"
chrono = { version = "0.4.19", default-features = false }
clap = { version = "3.2", features = ["derive", "env"] }
console-subscriber = "0.1.8"
Expand Down
2 changes: 1 addition & 1 deletion base_layer/chat_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ crate-type = ["staticlib","cdylib"]
[dev-dependencies]
chrono = { version = "0.4.19", default-features = false }
rand = "0.8"
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }

[build-dependencies]
cbindgen = "0.24.3"
Expand Down
4 changes: 2 additions & 2 deletions base_layer/common_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ version = "0.53.0-pre.0"
edition = "2018"

[dependencies]
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }
tari_utilities = { version = "0.6" }
tari_common = { path = "../../common" }


chacha20poly1305 = "0.10.1"
borsh = "0.10"
borsh = "1.2"
digest = "0.10"
newtype-ops = "0.1"
once_cell = "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion base_layer/contacts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tari_common_sqlite = { path = "../../common_sqlite" }
tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_comms_dht = { path = "../../comms/dht" }
tari_crypto = { version = "0.19" }
tari_crypto = { version = "0.19.1" }
tari_p2p = { path = "../p2p", features = ["auto-update"] }
tari_service_framework = { path = "../service_framework" }
tari_shutdown = { path = "../../infrastructure/shutdown" }
Expand Down
Loading

0 comments on commit 23b10bf

Please sign in to comment.