-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #4410
- Loading branch information
Showing
59 changed files
with
1,033 additions
and
839 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
noir-projects/aztec-nr/aztec/src/history/contract_inclusion.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
noir-projects/aztec-nr/compressed-string/src/compressed_string.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
noir-projects/aztec-nr/compressed-string/src/field_compressed_string.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use dep::aztec::protocol_types::{utils::field::field_from_bytes, traits::{Serialize, Deserialize}}; | ||
|
||
// A Fixedsize Compressed String. | ||
// Essentially a special version of Compressed String for practical use. | ||
struct FieldCompressedString{ | ||
value: Field | ||
} | ||
|
||
impl Serialize<1> for FieldCompressedString { | ||
fn serialize(self) -> [Field; 1] { | ||
[self.value] | ||
} | ||
} | ||
|
||
impl Deserialize<1> for FieldCompressedString { | ||
fn deserialize(input: [Field; 1]) -> Self { | ||
Self { value: input[0] } | ||
} | ||
} | ||
|
||
impl FieldCompressedString { | ||
pub fn is_eq(self, other: FieldCompressedString) -> bool { | ||
self.value == other.value | ||
} | ||
|
||
pub fn from_field(input_field: Field) -> Self { | ||
Self { value: input_field } | ||
} | ||
|
||
pub fn from_string(input_string: str<31>) -> Self { | ||
Self { value: field_from_bytes(input_string.as_bytes(), true) } | ||
} | ||
|
||
pub fn to_bytes(self) -> [u8; 31] { | ||
let mut result = [0; 31]; | ||
let bytes = self.value.to_be_bytes(31); | ||
for i in 0..31 { | ||
result[i] = bytes[i]; | ||
} | ||
result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod compressed_string; | ||
mod field_compressed_string; | ||
|
||
use crate::compressed_string::{CompressedString}; | ||
use crate::compressed_string::FieldCompressedString; | ||
use crate::compressed_string::CompressedString; | ||
use crate::field_compressed_string::FieldCompressedString; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
mod easy_private_state; | ||
mod easy_private_uint; | ||
|
||
use crate::easy_private_uint::EasyPrivateUint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use dep::aztec::protocol_types::traits::{Serialize, Deserialize}; | ||
|
||
// A leaf in the tree. | ||
struct Leaf { | ||
next_change: Field, | ||
before: Field, | ||
after: Field, | ||
} | ||
|
||
impl Serialize<3> for Leaf { | ||
fn serialize(leaf: Leaf) -> [Field; 3] { | ||
[leaf.next_change, leaf.before, leaf.after] | ||
} | ||
} | ||
|
||
impl Deserialize<3> for Leaf { | ||
fn deserialize(serialized: [Field; 3]) -> Leaf { | ||
Leaf { next_change: serialized[0], before: serialized[1], after: serialized[2] } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
mod leaf; | ||
mod slow_map; | ||
mod slow_update_proof; | ||
|
||
use crate::leaf::Leaf; | ||
use crate::slow_map::SlowMap; | ||
use crate::slow_update_proof::{deserialize_slow_update_proof, SlowUpdateProof}; | ||
use dep::std::merkle::compute_merkle_root; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
noir-projects/aztec-nr/slow-updates-tree/src/slow_update_proof.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Subset of the MembershipProof that is needed for the slow update. | ||
struct SlowUpdateInner<N> { | ||
value: Field, // Value only really used for the private flow though :thinking: | ||
sibling_path: [Field; N], | ||
} | ||
|
||
// The slow update proof. Containing two merkle paths | ||
// One for the before and one for the after trees. | ||
// M = 2 * N + 4 | ||
struct SlowUpdateProof<N, M> { | ||
index: Field, | ||
new_value: Field, | ||
before: SlowUpdateInner<N>, | ||
after: SlowUpdateInner<N>, | ||
} | ||
|
||
pub fn deserialize_slow_update_proof<N, M>(serialized: [Field; M]) -> SlowUpdateProof<N, M> { | ||
SlowUpdateProof::deserialize(serialized) | ||
} | ||
|
||
impl<N, M> SlowUpdateProof<N, M> { | ||
pub fn serialize(self: Self) -> [Field; M] { | ||
let mut serialized = [0; M]; | ||
serialized[0] = self.index; | ||
serialized[1] = self.new_value; | ||
serialized[2] = self.before.value; | ||
serialized[3 + N] = self.after.value; | ||
|
||
for i in 0..N { | ||
serialized[3 + i] = self.before.sibling_path[i]; | ||
serialized[4 + N + i] = self.after.sibling_path[i]; | ||
} | ||
serialized | ||
} | ||
|
||
pub fn deserialize(serialized: [Field; M]) -> Self { | ||
let mut before_sibling_path = [0; N]; | ||
let mut after_sibling_path = [0; N]; | ||
|
||
for i in 0..N { | ||
before_sibling_path[i] = serialized[3 + i]; | ||
after_sibling_path[i] = serialized[4 + N + i]; | ||
} | ||
|
||
Self { | ||
index: serialized[0], | ||
new_value: serialized[1], | ||
before: SlowUpdateInner { value: serialized[2], sibling_path: before_sibling_path }, | ||
after: SlowUpdateInner { value: serialized[3 + N], sibling_path: after_sibling_path } | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...oir-contracts/contracts/contract_class_registerer_contract/src/events/class_registered.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...racts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...r-contracts/contracts/contract_instance_deployer_contract/src/events/instance_deployed.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.