diff --git a/sdk/bittensor-core/src/timelock/mod.rs b/sdk/bittensor-core/src/timelock/mod.rs index 89652851fc..aec057443a 100644 --- a/sdk/bittensor-core/src/timelock/mod.rs +++ b/sdk/bittensor-core/src/timelock/mod.rs @@ -378,21 +378,19 @@ mod tests { #[test] fn inner_ciphertext_unwraps_user_data_envelope() { - let message = b"chain submit bytes"; - let reveal_round = 30_000_000; - let (envelope, round) = - encrypt_at_round(message, reveal_round).expect("Encryption should succeed"); - assert_eq!(round, reveal_round); - - let inner = inner_ciphertext(&envelope).expect("envelope should unwrap"); - assert_ne!(inner, envelope); - assert!(inner.len() < envelope.len()); - - let mut envelope_with_trailing_data = envelope; - envelope_with_trailing_data.push(0); + let expected = b"chain submit bytes".to_vec(); + let mut envelope = UserData { + encrypted_data: expected.clone(), + reveal_round: 30_000_000, + } + .encode(); + + assert_eq!(inner_ciphertext(&envelope).unwrap(), expected); + + envelope.push(0); assert!( - inner_ciphertext(&envelope_with_trailing_data).is_err(), - "a UserData envelope must consume all input bytes" + inner_ciphertext(&envelope).is_err(), + "trailing bytes must be rejected" ); }