chore: add statement and KV metadata to frontend PODs (#117)

* Add statement and KV metadata to frontend PODs

* Code review
This commit is contained in:
Ahmad Afuni 2025-03-07 14:35:25 +10:00 committed by GitHub
parent 02ec7c311b
commit 6627b46819
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 290 additions and 224 deletions

View file

@ -21,7 +21,7 @@ pub struct Dictionary {
impl Dictionary {
pub fn new(kvs: &HashMap<Hash, Value>) -> Result<Self> {
let kvs: HashMap<Value, Value> = kvs.into_iter().map(|(&k, &v)| (Value(k.0), v)).collect();
let kvs: HashMap<Value, Value> = kvs.iter().map(|(&k, &v)| (Value(k.0), v)).collect();
Ok(Self {
mt: MerkleTree::new(MAX_DEPTH, &kvs)?,
})
@ -75,7 +75,7 @@ pub struct Set {
impl Set {
pub fn new(set: &Vec<Value>) -> Result<Self> {
let kvs: HashMap<Value, Value> = set
.into_iter()
.iter()
.map(|e| {
let h = hash_value(e);
(Value::from(h), EMPTY)
@ -128,7 +128,7 @@ pub struct Array {
impl Array {
pub fn new(array: &Vec<Value>) -> Result<Self> {
let kvs: HashMap<Value, Value> = array
.into_iter()
.iter()
.enumerate()
.map(|(i, &e)| (Value::from(i as i64), e))
.collect();