Skip to content

Commit

Permalink
fix mining-proxy config files
Browse files Browse the repository at this point in the history
NOTE! mining-proxy is currently broken. The handshake does not finalize,
possibly because it wasn't added support for elligator swift and related
maintenence

fmt
  • Loading branch information
lorbax committed Jun 21, 2024
1 parent 9947112 commit 4c0a6b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ use crate::{
Error, ShortTxId,
};
use alloc::vec::Vec;
use serde::{ser, ser::SerializeTuple, ser::SerializeSeq, Deserialize, Deserializer, Serialize};
use serde::{
ser,
ser::{SerializeSeq, SerializeTuple},
Deserialize, Deserializer, Serialize,
};

#[derive(Debug, Clone)]
pub struct Seq064K<'s, T: Clone + Serialize + TryFromBSlice<'s>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
upstreams = [
{ channel_kind = "Extended", address = "0.0.0.0", port = 34265, pub_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"}
{ channel_kind = "Extended", address = "0.0.0.0", port = 34254, pub_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"}
]
listen_address = "127.0.0.1"
listen_mining_port = 34255
Expand Down
27 changes: 14 additions & 13 deletions utils/message-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,18 @@ mod test {
net::{setup_as_downstream, setup_as_upstream},
};
use codec_sv2::{Frame, Sv2Frame};
use key_utils::Secp256k1PublicKey;
use roles_logic_sv2::{
common_messages_sv2::{Protocol, SetupConnection},
job_declaration_sv2::DeclareMiningJob,
mining_sv2::{
CloseChannel, NewExtendedMiningJob, OpenExtendedMiningChannel,
OpenExtendedMiningChannelSuccess, SetCustomMiningJob, SetTarget, NewMiningJob,
CloseChannel, NewExtendedMiningJob, NewMiningJob, OpenExtendedMiningChannel,
OpenExtendedMiningChannelSuccess, SetCustomMiningJob, SetTarget,
},
job_declaration_sv2::DeclareMiningJob,
common_messages_sv2::{SetupConnection, Protocol},
parsers::{CommonMessages, Mining},
};
use std::{io::Write, convert::TryInto};
use std::{convert::TryInto, io::Write};
use tokio::join;
use key_utils::Secp256k1PublicKey;

// The following test see that the composition serialise fist and deserialize
// second is the identity function (on an example message)
Expand Down Expand Up @@ -600,8 +600,6 @@ mod test {
assert!(message_new == message);
}



#[test]
fn test_serialize_and_deserialize_6_dmj() {
let short_tx_id_inner_: Vec<u8> = vec![0, 1, 2, 3, 4, 5];
Expand All @@ -616,7 +614,7 @@ mod test {
coinbase_prefix: binary_sv2::B064K::try_from(prefix_inner_as_ref).unwrap(),
coinbase_suffix: binary_sv2::B064K::try_from(prefix_inner_as_ref).unwrap(),
tx_short_hash_nonce: 1,
tx_short_hash_list: binary_sv2::Seq064K::new(vec![short_tx_id]).unwrap(),
tx_short_hash_list: binary_sv2::Seq064K::new(vec![short_tx_id]).unwrap(),
tx_hash_list_hash: binary_sv2::U256::try_from(vec![1_u8; 32]).unwrap(),
excess_data: binary_sv2::B064K::try_from(prefix_inner_as_ref).unwrap(),
};
Expand All @@ -632,15 +630,18 @@ mod test {

#[test]
fn test_serialize_and_deserialize_7_nmj() {
let inner_: Vec<u8> = vec![141,193,6,239,151,79,49,202,237,183,207,121,56,40,107,153,235,208,66,215,81,186,3,16,215,110,130,182,37,198,98,251];
let inner_: Vec<u8> = vec![
141, 193, 6, 239, 151, 79, 49, 202, 237, 183, 207, 121, 56, 40, 107, 153, 235, 208, 66,
215, 81, 186, 3, 16, 215, 110, 130, 182, 37, 198, 98, 251,
];
let inner = inner_.as_slice();
let message = NewMiningJob {
let message = NewMiningJob {
channel_id: 1,
job_id: 2,
min_ntime: binary_sv2::Sv2Option::try_from(vec![]).unwrap(),
version: 536870912,
merkle_root: binary_sv2::B032::try_from(inner).unwrap(),
};
};
let message_as_serde_value = serde_json::to_value(message.clone()).unwrap();
let message_as_string = serde_json::to_string(&message_as_serde_value).unwrap();
let message_new: NewMiningJob = serde_json::from_str(&message_as_string).unwrap();
Expand Down Expand Up @@ -845,7 +846,7 @@ mod test {
"translator_sv2",
"--",
"-c",
"translator/config-examples/tproxy-config-hosted-pool-example.toml"
"translator/config-examples/tproxy-config-hosted-pool-example.toml",
],
ExternalCommandConditions::new_with_timer_secs(10)
.continue_if_std_out_have("PROXY INITIALIZED")
Expand Down

0 comments on commit 4c0a6b1

Please sign in to comment.