Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when loading trie from existing rocksdb #95

Open
hiasr opened this issue May 25, 2024 · 0 comments
Open

Error when loading trie from existing rocksdb #95

hiasr opened this issue May 25, 2024 · 0 comments

Comments

@hiasr
Copy link

hiasr commented May 25, 2024

When creating a tree from an existing db, the following error occurs:

thread 'main' panicked at .../rust_verkle/verkle-trie/src/database/generic.rs:145:72:
called `Result::unwrap()` on an `Err` value: InvalidData

If you run the following example twice, you will see the error on the second run.

fn test_rocksdb() {
    let keys = (0..1000).map(|_| generate_rand_address()); 
    let kvs = keys.clone().map(|key| (key, key));
    let db: VerkleDb<RocksDb> = VerkleDb::from_path("dbs/test_rocksdb");
    let mut trie = Trie::new(DefaultConfig::new(db));
    trie.insert(kvs.clone());
    trie.flush_database();
}

fn generate_rand_address() -> [u8; 32] {
    let mut rng = rand::thread_rng();
    let mut address = [0u8; 32];
    rng.fill_bytes(&mut address);
    address
}
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

No branches or pull requests

1 participant