Add v0.3.1 backwards compatibility tests for StorableBuilder and KeyObfuscator#45
Merged
tnull merged 2 commits intolightningdevkit:mainfrom Nov 3, 2025
Merged
Conversation
We add a simple test that ensures we can still decode v0.3.1-encoded `Storable`s. Co-authored by Claude AI.
We add a simple test that ensures we can still deobfuscate v0.3.1-obfuscated keys. Co-authored by Claude AI.
|
👋 Thanks for assigning @tankyleo as a reviewer! |
|
🔔 1st Reminder Hey @tankyleo! This PR has been waiting for your review. |
tankyleo
approved these changes
Nov 3, 2025
Contributor
tankyleo
left a comment
There was a problem hiding this comment.
Reproduced v031_serialized and v031_obfuscated_key on v0.31 as in the snippet below.
snippet
use vss_client::util::key_obfuscator::KeyObfuscator;
use vss_client::util::storable_builder::{TestEntropyProvider, StorableBuilder, EntropySource};
use prost::Message;
fn main() {
let obfuscate = KeyObfuscator::new([0xAB; 32]);
let obfuscated = obfuscate.obfuscate("my_storage_key_v031_compat");
let v031_obfuscated_key = "nxrixRQPGawY+a9JFLThii0RgeADtEdSjh2YDgpZhBKOuw6GKr5UAIIwsQCathJlZsmuSku+RGB1/JuxFUMQGoAwa+M8tg";
assert_eq!(obfuscated, v031_obfuscated_key);
let test_entropy_provider = TestEntropyProvider;
let mut data_key = [0u8; 32];
test_entropy_provider.fill_bytes(&mut data_key);
let storable_builder = StorableBuilder::new(data_key, TestEntropyProvider);
let object = storable_builder.build(b"backward_compat_test_data".to_vec(), 42);
let mut buf = Vec::new();
object.encode(&mut buf).unwrap();
let v031_serialized = vec![
0x0a, 0x1d, 0x32, 0x19, 0xe9, 0xfb, 0x45, 0xd7, 0x42, 0xf5, 0x6c, 0x40, 0x1b, 0x74,
0x13, 0xe7, 0xae, 0x07, 0xfd, 0x81, 0xe1, 0x43, 0x3a, 0xf2, 0x86, 0x3c, 0xe8, 0x8f,
0x01, 0xf8, 0x6c, 0x12, 0x32, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x43, 0x68, 0x61, 0x32,
0x30, 0x50, 0x6f, 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35, 0x12, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x1a, 0x10, 0x87, 0x16, 0x35,
0x02, 0x26, 0x1e, 0x30, 0xec, 0x7c, 0xf1, 0x4b, 0x79, 0x70, 0xa2, 0x41, 0x16,
];
assert_eq!(buf, v031_serialized);
}
Contributor
|
All tests pass on my machine with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We recently made some changes to
StorableBuilderandKeyObfuscator. This just adds two upgrade tests that ensure backwards compatibility withStorables/keys that have been serialized/obfuscated on v0.3.1.Co-authored by Claude AI.