Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: new monero release for mr support in monero #6335

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

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 @@ -35,7 +35,7 @@ hex = "0.4.2"
hyper = "0.14.12"
jsonrpc = "0.12.0"
log = { version = "0.4.8", features = ["std"] }
monero = { version = "0.20.0" }
monero = { version = "0.21.0" }
reqwest = { version = "0.11.4", features = ["json"] }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.57"
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ledger-transport-hid = { git = "https://github.com/Zondax/ledger-rs", rev = "20e
lmdb-zero = "0.4.4"
log = "0.4"
log-mdc = "0.1.0"
monero = { version = "0.20.0", features = ["serde-crate"], optional = true }
monero = { version = "0.21.0", features = ["serde-crate"], optional = true }
newtype-ops = "0.1.4"
num-traits = "0.2.15"
num-derive = "0.3.3"
Expand Down
12 changes: 6 additions & 6 deletions base_layer/core/src/proof_of_work/monero_rx/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn verify_header(
let mut is_found = false;
let mut already_seen_mmfield = false;
for item in extra_field.0 {
if let SubField::MergeMining(Some(depth), merge_mining_hash) = item {
if let SubField::MergeMining(depth, merge_mining_hash) = item {
if already_seen_mmfield {
return Err(MergeMineError::ValidationError(
"More than one merge mining tag found in coinbase".to_string(),
Expand Down Expand Up @@ -327,7 +327,7 @@ pub fn insert_aux_chain_mr_and_info_into_block<T: AsRef<[u8]>>(

// Adding more than one merge mining tag is not allowed
for item in &extra_field.0 {
if let SubField::MergeMining(Some(_), _) = item {
if let SubField::MergeMining(_, _) = item {
return Err(MergeMineError::ValidationError(
"More than one merge mining tag in coinbase not allowed".to_string(),
));
Expand All @@ -348,7 +348,7 @@ pub fn insert_aux_chain_mr_and_info_into_block<T: AsRef<[u8]>>(
};
mt_params.to_varint()
};
extra_field.0.insert(0, SubField::MergeMining(Some(encoded), hash));
extra_field.0.insert(0, SubField::MergeMining(encoded, hash));
debug!(target: LOG_TARGET, "Inserted extra field: {:?}", extra_field);

block.miner_tx.prefix.extra = extra_field.into();
Expand Down Expand Up @@ -901,7 +901,7 @@ mod test {
// like trying to sneek it in. Later on, when we call `verify_header(&block_header)`, it should fail.
let mut extra_field = ExtraField::try_parse(&block.miner_tx.prefix.extra).unwrap();
let hash = monero::Hash::from_slice(hash.as_ref());
extra_field.0.insert(0, SubField::MergeMining(Some(VarInt(0)), hash));
extra_field.0.insert(0, SubField::MergeMining(VarInt(0), hash));
block.miner_tx.prefix.extra = extra_field.into();

// Trying to extract the Tari hash will fail because there are more than one merge mining tag
Expand Down Expand Up @@ -1009,7 +1009,7 @@ mod test {
let extra_field_after_tag = ExtraField::try_parse(&block.miner_tx.prefix.extra.clone()).unwrap();
assert_eq!(
&format!(
"ExtraField([MergeMining(Some(0), 0x{}), \
"ExtraField([MergeMining(0, 0x{}), \
TxPublicKey(06225b7ec0a6544d8da39abe68d8bd82619b4a7c5bdae89c3783b256a8fa4782), Nonce([246, 58, 168, \
109, 46, 133, 127, 7])])",
hex::encode(hash)
Expand Down Expand Up @@ -1267,7 +1267,7 @@ mod test {
assert!(res.is_err());
let field = res.unwrap_err();
let mm_tag = SubField::MergeMining(
Some(VarInt(0)),
VarInt(0),
Hash::from_slice(
hex::decode("9505c642ae2771f344caddde740ad1c238f7fc17f81c2c515b2cd6d3f2030c46")
.unwrap()
Expand Down
Loading