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

The reference-trie version 0.29.1 on crates.io refers to an older version. #207

Open
wanyvic opened this issue Nov 25, 2023 · 1 comment

Comments

@wanyvic
Copy link

wanyvic commented Nov 25, 2023

The reference-trie version 0.29.1 on crates.io is using an older version of trie-db (0.27.0), which is inconsistent with the version specified in the Cargo.toml file. This inconsistency may lead to ambiguity when importing external crates.

https://crates.io/crates/reference-trie/0.29.1/dependencies

trie-db = { path = "../../trie-db", default-features = false, version = "0.28.0" }

@wanyvic
Copy link
Author

wanyvic commented Nov 25, 2023

I tried to import reference-trie 0.29.1 and trie-db 0.28.0 into my code and wrote a demo, but I encountered a compilation error.
demo:

use hash_db::Hasher;
use memory_db::{HashKey, MemoryDB};
use reference_trie::{RefHasher, RefSecTrieDBMut, RefTrieDBBuilder};
use trie_db::{DBValue, Trie, TrieMut};

fn main() {
    let mut memdb = MemoryDB::<RefHasher, HashKey<_>, DBValue>::default();
    let mut root = Default::default();
    {
        let mut t = RefSecTrieDBMut::new(&mut memdb, &mut root);
        t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap();
    }
    let t = RefTrieDBBuilder::new(&memdb, &root).build();
    assert_eq!(
        t.get(&RefHasher::hash(&[0x01u8, 0x23])).unwrap().unwrap(),
        vec![0x01u8, 0x23],
    );
}

compilation error:

   --> src/main.rs:12:11
    |
12  |         t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap();
    |           ^^^^^^ method not found in `SecTrieDBMut<'_, ExtensionLayout>`

The reason for the error is that the version of trie-db used by the reference-trie crate is 0.27.0, which conflicts with the version specified in the Cargo.toml file mentioned in

trie-db = { path = "../../trie-db", default-features = false, version = "0.28.0" }
.

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