Replies: 12 comments 17 replies
-
I'm looking at examples of how to use stratum/examples/ping-pong-without-noise/src/node.rs Lines 150 to 154 in 24b8b1d This is how stratum/protocols/v2/codec-sv2/src/decoder.rs Lines 219 to 225 in 24b8b1d Which means the stratum/protocols/v2/codec-sv2/src/decoder.rs Lines 213 to 215 in 24b8b1d As a consequence, when we call So I'm actually having issues with decoding a frame on this little code snippet: let message = Message::new();
let frame = StandardSv2Frame::<Message>::from_message(message, 0, 0, false)
.unwrap();
let mut encoder = Encoder::<Message>::new();
let encoded_frame = encoder.encode(frame).unwrap();
// BufReader to emulate TcpStream
let mut buf_reader = std::io::BufReader::new(encoded_frame);
// initialize decoder
let mut decoder = StandardDecoder::<Message>::new();
let decoder_buf = decoder.writable();
// this prints 11
println!("{}", encoded_frame.len());
// this prints 6
println!("{}", decoder_buf.len());
// read_exact from buf_reader into decoder_buf
buf_reader.read_exact(decoder_buf).unwrap();
// get decoded frame
// fails with: "called `Result::unwrap()` on an `Err` value: MissingBytes(5)"
let decoded_frame = decoder.next_frame().unwrap(); It seems |
Beta Was this translation helpful? Give feedback.
-
Error Variant NamingSuggestions for
|
Beta Was this translation helpful? Give feedback.
-
Uniform Spelling
|
Beta Was this translation helpful? Give feedback.
-
Imports
warning: unused import: `core::cmp`
--> v2/codec-sv2/src/error.rs:8:5
|
8 | use core::cmp;
| ^^^^^^^^^
|
Beta Was this translation helpful? Give feedback.
-
Use of
|
Beta Was this translation helpful? Give feedback.
-
Misc
|
Beta Was this translation helpful? Give feedback.
-
Closing in favor of #1129. |
Beta Was this translation helpful? Give feedback.
-
Actually, will keep open. But please keep #1129 in sync. |
Beta Was this translation helpful? Give feedback.
-
why are |
Beta Was this translation helpful? Give feedback.
-
what is the motivation behind these type aliases?
it seems all they are doing is adding a another confusing aspect is why this is only applied to |
Beta Was this translation helpful? Give feedback.
-
@Fi3, can you help me understand the initialization of the The unencrypted decoder initializes stratum/protocols/v2/codec-sv2/src/decoder.rs Lines 219 to 225 in e65cb32 What I do not understand is why the encrypted stratum/protocols/v2/codec-sv2/src/decoder.rs Lines 168 to 174 in e65cb32 The header size of the noise protocol is constant, right? If so, why don't we initialize the encrypted |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
this discussion should guide the documentation of
codec_sv2
, as described on #845Beta Was this translation helpful? Give feedback.
All reactions