Skip to content

Commit

Permalink
circuit: Fixes for #232
Browse files Browse the repository at this point in the history
  • Loading branch information
moCello committed Aug 9, 2024
1 parent 47ceb25 commit 788525e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions circuits/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `Serializable` trait implementation for `OutputNoteInfo` [#232]
- Add `Clone` and `PartialEq` derives for `TxCircuit` [#232]
- Add `PartialEq` derive for `InputNoteInfo` [#232]
- Add associated const `TxCircuit::SIZE`
- Add associated const `InputNoteInfo::SIZE`
- Add `PartialEq` derive for `OutputNoteInfo` [#232]
- Add `dusk-bls12_381` dependency [#235]
- Add `"plonk"` feature to add the `dusk-plonk` dependency [#235]
Expand Down
8 changes: 6 additions & 2 deletions circuits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ pub struct TxCircuit<const H: usize, const I: usize> {
}

impl<const H: usize, const I: usize> TxCircuit<H, I> {
const SIZE: usize = I * InputNoteInfo::<H>::SIZE
/// The size of a `TxCircuit`.
pub const SIZE: usize = I * InputNoteInfo::<H>::SIZE
+ OUTPUT_NOTES * OutputNoteInfo::SIZE
+ 2 * BlsScalar::SIZE
+ 2 * u64::SIZE
Expand Down Expand Up @@ -102,8 +103,10 @@ impl<const H: usize, const I: usize> TxCircuit<H, I> {
}

let mut input_notes_info = Vec::new();
let mut bytes = bytes;
for _ in 0..I {
input_notes_info.push(InputNoteInfo::from_slice(bytes)?);
bytes = &bytes[InputNoteInfo::<H>::SIZE..];
}

let mut reader = &bytes[I * InputNoteInfo::<H>::SIZE..];
Expand Down Expand Up @@ -217,7 +220,8 @@ pub struct InputNoteInfo<const H: usize> {
}

impl<const H: usize> InputNoteInfo<H> {
const SIZE: usize = (1 + H * ARITY) * Item::SIZE
/// The size of an `InputNoteInfo`
pub const SIZE: usize = (1 + H * ARITY) * Item::SIZE
+ H * (u32::BITS as usize / 8)
+ Note::SIZE
+ JubJubAffine::SIZE
Expand Down

0 comments on commit 788525e

Please sign in to comment.