crate-crypto / rust-verkle

Apache License 2.0
118 stars 41 forks source link

Why Value type is [u8;32]? #55

Closed GrapeBaBa closed 2 years ago

GrapeBaBa commented 2 years ago

What is the purpose or limitation for value is only 32 bytes?

   pub type Value = [u8; 32];

    /// Inserts a single value
    /// This method will implicitly compute the new root
    fn insert_single(&mut self, key: Key, value: Value) {
        self.insert(vec![(key, value)].into_iter())
    }
kevaundray commented 2 years ago

Great question. This is an ethereum specific limitation noted in https://notes.ethereum.org/@vbuterin/verkle_tree_eip#Tree-embedding

If you have a structure that is more than 32 bytes, you can always hash it with a collision resistant hash function like sha256 to produce 32 bytes