feat: integrate mt in mock_sign (#23)

* feat: integrate mt in mock_sign

* fix: handle compile error

* fix: use PodClass::Main in MainPod origin
This commit is contained in:
Eduard S. 2025-02-05 11:24:35 +01:00 committed by GitHub
parent 4d16647d10
commit 085d5fff2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 51 additions and 81 deletions

View file

@ -1,4 +1,3 @@
// TODO: Move the SignedPod.id calculation to mock_signed
// TODO: Move the MainPod logic to mock_main and implement the MainPod trait
/*
use anyhow::Result;
@ -11,29 +10,6 @@ use std::iter;
use crate::merkletree::MerkleTree;
use crate::middleware::{Hash, Params, PodId, Value, NULL};
#[derive(Clone, Debug)]
pub struct SignedPod {
pub params: Params,
pub id: PodId,
pub kvs: MerkleTree,
}
impl SignedPod {
pub fn new(params: &Params, kvs: HashMap<Hash, Value>) -> Result<Self> {
let mt = MerkleTree::new(kvs);
let root = mt.root()?;
Ok(Self {
params: *params,
id: PodId(root),
kvs: mt,
})
}
pub fn is_null(&self) -> bool {
self.id.0 == NULL
}
}
#[derive(Clone, Debug)]
pub struct MainPod {
pub params: Params,