Skip to content

Conversation

@tnull
Copy link
Contributor

@tnull tnull commented Oct 31, 2025

We recently made some changes to StorableBuilder and KeyObfuscator. This just adds two upgrade tests that ensure backwards compatibility with Storables/keys that have been serialized/obfuscated on v0.3.1.

Co-authored by Claude AI.

tnull added 2 commits October 31, 2025 10:46
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.
@tnull tnull requested a review from tankyleo October 31, 2025 09:52
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 31, 2025

👋 Thanks for assigning @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tankyleo! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Copy link
Contributor

@tankyleo tankyleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}

@tankyleo
Copy link
Contributor

tankyleo commented Nov 3, 2025

All tests pass on my machine with rustc 1.90.0, including the two v031 compat tests introduced here.

@tnull tnull merged commit 862252c into lightningdevkit:main Nov 3, 2025
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants