diff options
| author | tv <tv@krebsco.de> | 2026-11-01 14:10:35 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 14:10:35 +0100 |
| commit | b9d7e46519cd2f283849f3ff4f4f49a0f924eab9 (patch) | |
| tree | bb89260462715c4be95ee8bb529ee89a38a18d4f /src/transport/wire.rs | |
| parent | 554ece6c10de5de245ac18c4de3bfae25e49314a (diff) | |
fixup: golden byte follows wire version
Diffstat (limited to 'src/transport/wire.rs')
| -rw-r--r-- | src/transport/wire.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/transport/wire.rs b/src/transport/wire.rs index 0ce8c33..7717200 100644 --- a/src/transport/wire.rs +++ b/src/transport/wire.rs @@ -605,6 +605,8 @@ mod tests { /// or a codec, the change is a new wire format: bump `VERSION` and take the new bytes. #[test] fn golden_bytes() { + // The version byte follows `VERSION`: bumped for a change to other messages. + let v = format!("{VERSION:02x}"); let epoch = Epoch { generation: 2, id: [3; 32], @@ -623,7 +625,7 @@ mod tests { }); assert_eq!( hex(&encode(&hello).unwrap()), - format!("0d0097a5737761726d{epoch_hex}01c403010203c3{}07", run("04")) + format!("{v}0097a5737761726d{epoch_hex}01c403010203c3{}07", run("04")) ); let reply = ParsedMessage::HelloReply(HelloReply { @@ -643,7 +645,7 @@ mod tests { assert_eq!( hex(&encode(&reply).unwrap()), format!( - "0d0199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}", + "{v}0199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}", run("04"), run("06") ) @@ -659,7 +661,7 @@ mod tests { }); assert_eq!( hex(&encode(&status).unwrap()), - format!("0d03969290c400{epoch_hex}01c3c2c2") + format!("{v}03969290c400{epoch_hex}01c3c2c2") ); let who = ParsedMessage::Who(IdentityProof { @@ -668,7 +670,7 @@ mod tests { }); assert_eq!( hex(&encode(&who).unwrap()), - format!("0d0692c420{}c440{}", "08".repeat(32), "09".repeat(64)) + format!("{v}0692c420{}c440{}", "08".repeat(32), "09".repeat(64)) ); let ParsedMessage::Me(proof) = decode( &encode(&ParsedMessage::Me(IdentityProof { @@ -682,12 +684,12 @@ mod tests { }; assert_eq!((proof.key, proof.signature), ([8; 32], [9; 64])); - assert_eq!(hex(&encode(&ParsedMessage::Ping(7)).unwrap()), "0d0807"); + assert_eq!(hex(&encode(&ParsedMessage::Ping(7)).unwrap()), format!("{v}0807")); let pong = ParsedMessage::Pong { nonce: u64::MAX, at: crate::clock::UnixMillis(5), }; - assert_eq!(hex(&encode(&pong).unwrap()), "0d0992cfffffffffffffffff05"); + assert_eq!(hex(&encode(&pong).unwrap()), format!("{v}0992cfffffffffffffffff05")); let ParsedMessage::Pong { nonce, at } = decode(&[VERSION, 9, 0x92, 0x2a, 0x07]).unwrap() else { panic!("not a PONG"); |
