mirror of
https://github.com/logos-blockchain/logos-blockchain-simulations.git
synced 2026-01-07 15:43:09 +00:00
use uuid instead of payload datastructure
This commit is contained in:
parent
7f18bf4a98
commit
f84881aada
21
simlib/Cargo.lock
generated
21
simlib/Cargo.lock
generated
@ -256,15 +256,6 @@ version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.6.0"
|
||||
@ -1608,7 +1599,6 @@ name = "mixnet-sims"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"clap",
|
||||
"crossbeam",
|
||||
"ctrlc",
|
||||
@ -1627,6 +1617,7 @@ dependencies = [
|
||||
"sha2",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3162,6 +3153,16 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.0"
|
||||
|
||||
@ -4,4 +4,4 @@ members = [
|
||||
"mixnet-sims"
|
||||
|
||||
]
|
||||
resolver = "2"
|
||||
resolver = "2"
|
||||
|
||||
@ -23,4 +23,4 @@ futures = "0.3.31"
|
||||
rand_chacha = "0.3"
|
||||
multiaddr = "0.18"
|
||||
sha2 = "0.10"
|
||||
bincode = "1"
|
||||
uuid = { version = "1", features = ["fast-rng", "v4"] }
|
||||
|
||||
@ -27,12 +27,13 @@ use nomos_mix_message::mock::MockMixMessage;
|
||||
use rand::SeedableRng;
|
||||
use rand_chacha::ChaCha12Rng;
|
||||
use scheduler::{Interval, TemporalRelease};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
use sha2::{Digest, Sha256};
|
||||
use state::MixnodeState;
|
||||
use std::collections::HashSet;
|
||||
use std::{pin::pin, task::Poll, time::Duration};
|
||||
use stream_wrapper::CrossbeamReceiverStream;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MixMessage(Vec<u8>);
|
||||
@ -215,12 +216,8 @@ impl MixNode {
|
||||
self.blend_update_time_sender.send(elapsed).unwrap();
|
||||
}
|
||||
|
||||
fn build_message_payload(&self) -> Vec<u8> {
|
||||
let payload = MessagePayload {
|
||||
node_id: self.id.into(),
|
||||
step_id: self.state.step_id,
|
||||
};
|
||||
bincode::serialize(&payload).unwrap()
|
||||
fn build_message_payload(&self) -> [u8; 16] {
|
||||
Uuid::new_v4().into_bytes()
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,9 +289,3 @@ impl Node for MixNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct MessagePayload {
|
||||
node_id: [u8; 32],
|
||||
step_id: usize,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user