* Implement Containers (Dictionary,Set,Array) on top of MerkleTree. And restructure the code.
- Reorganize the code grouping backends, middleware, frontend, (crypto) primitives.
- Add types Dictionary,Set,Array at the middleware layer, so that
it can be used both by the backend and frontend. The Dictionary, Set,
Array use the merkletree differently as specified at
f2575d1524/book/src/values.md (dictionary-array-set)
- The containers introduce the trait Container, which has the
method 'cm()'. At the current version this uses a merkletree
under the hood, and the method 'cm' returns the merkle root.
- Ideally neither frontend nor backend use the MerkleTree type, and they
use the wrappers {Dictionary,Set,Array}. Note that the current commit
the MerkleTree is used at the mock-backend to check internal values, but
not at the struct types.
- updated the spec's merkletree section updating the defined interface
- add github ci to run the tests
---------
Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>
Co-authored-by: Eduard S. <eduardsanou@posteo.net>
* Progress towards mock MainPod verification
* add MockMainPod.pub_statements logic so that when originid==SELF it is replaced by self.id()
* Basic op checking for mock MainPOD
* More op checking
* wip
* feat: add great boy example
* feat: put examples under cfg(test)
---------
Co-authored-by: Ahmad <root@ahmadafuni.com>
Co-authored-by: arnaucube <git@arnaucube.com>
* Progress towards mock MainPod verification
* add MockMainPod.pub_statements logic so that when originid==SELF it is replaced by self.id()
* Basic op checking for mock MainPOD
* More op checking
* Add TODO notes
---------
Co-authored-by: arnaucube <git@arnaucube.com>
Migrate fmt to use Display trait to simplify the usage of it.
Also with this, in the same snipped of code we can print types from
backend, middleware and frontend; which before needed to import the two
different `Printer` structs (frontend::Printer and mock_main::Printer).
Before:
```
let printer = mock_main::Printer { skip_none: false };
let mut w = io::stdout();
printer.fmt_mock_main_pod(&mut w, &pod).unwrap();
let printer = frontend::Printer { skip_none: false };
printer.fmt_main_pod_builder(&mut w, &pod_builder).unwrap();
```
now:
```
println!("{:#}", pod);
println!("{:#}", pod_builder);
```
And the equivalent to the old `skip_none: true`, now is done by just
using `println!("{}", pod);
* compute MainPod.id from pub_statements; and introduce the trait `ToFields`
Compute MainPod.id from pub_statements hash; for it, introduce the trait
`ToFields` at the middleware and implement it for the Statement related
types.
* cleaner statements tofield iter
Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>
---------
Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>