Skip to content

Commit

Permalink
Merge pull request #93 from dusk-network/vlopes11/microkelvin-hosted
Browse files Browse the repository at this point in the history
PoseidonTree canon and canon_host features
  • Loading branch information
vlopes11 authored Nov 6, 2020
2 parents 10151b2 + ff261cf commit 5dae040
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/dusk_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ jobs:
command: test
args: --release --features canon

test_nightly_canon_host:
name: Nightly tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --release --features canon_host

fmt:
name: Rustfmt
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.13.1] - 06-11-20
### Changed
- Feature split between `canon` and `canon_host` for constrained and unconstrained environments.
- Canon implementation for PoseidonTree.

## [0.13.0] - 04-11-20
### Changed
- PoseidonLeaf pos setter for API consistency with Phoenix
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poseidon252"
version = "0.13.0"
version = "0.13.1"
authors = [
"zer0 <[email protected]>", "vlopes11 <[email protected]>", "CPerezz <[email protected]>", "Kristoffer Ström <[email protected]>"
]
Expand All @@ -25,6 +25,7 @@ criterion = "0.3"

[features]
canon = ["canonical", "canonical_derive", "nstack", "microkelvin", "dusk-plonk/canon"]
canon_host = ["canon", "canonical/host"]

[profile.dev]
opt-level = 3
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ fn main() -> Result<()> {
}
```

## Canonical
The canonical implementations aim to make available a single representation of the Merkle tree to constrained (referred to as "hosted") and unconstrained (referred to as "host") environments.

For that, we rely on the features `canon` and `canon_host`.

`canon` feature will require all the crates needed for the Merkle tree to function.

`canon_host` feature will require `canon`, with the addition of the host environment implementations.

## Documentation
This crate contains info about all of the functions that the library provides as well as the
documentation regarding the data structures that it exports. To check it, please feel free to go to
Expand Down
5 changes: 2 additions & 3 deletions src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use anyhow::{anyhow, Result};

#[cfg(feature = "canon")]
use canonical::{Canon, Store};
use canonical_derive::Canon;
use dusk_plonk::prelude::BlsScalar;
use microkelvin::{Branch, Cardinality, Nth};
use nstack::NStack;
Expand Down Expand Up @@ -54,7 +53,7 @@ where
///
/// The `BlsScalar` borrow of the annotation must represent the root poseidon merkle opening
/// for the annotated subtree
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Canon)]
pub struct PoseidonTree<L, A, S, const DEPTH: usize>
where
L: PoseidonLeaf<S>,
Expand Down
1 change: 0 additions & 1 deletion src/tree/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

#![cfg(feature = "canon")]
use crate::tree::zk::merkle_opening;
use crate::tree::{
PoseidonAnnotation, PoseidonLeaf, PoseidonMaxAnnotation, PoseidonTree,
Expand Down

0 comments on commit 5dae040

Please sign in to comment.