From a244a4a6be3516c127ab1726e24b28c36679d745 Mon Sep 17 00:00:00 2001 From: sklppy88 Date: Wed, 28 Aug 2024 20:26:44 +0000 Subject: [PATCH] removing ownednote from value note and uint note --- .../aztec-nr/uint-note/src/uint_note.nr | 30 ++++--------------- .../aztec-nr/value-note/src/value_note.nr | 20 ------------- 2 files changed, 5 insertions(+), 45 deletions(-) diff --git a/noir-projects/aztec-nr/uint-note/src/uint_note.nr b/noir-projects/aztec-nr/uint-note/src/uint_note.nr index c431cb36c705..213863378153 100644 --- a/noir-projects/aztec-nr/uint-note/src/uint_note.nr +++ b/noir-projects/aztec-nr/uint-note/src/uint_note.nr @@ -10,11 +10,6 @@ use dep::aztec::{ }; use dep::std::{embedded_curve_ops::multi_scalar_mul, hash::from_field_unsafe}; -trait OwnedNote { - fn new(amount: U128, owner_npk_m_hash: Field) -> Self; - fn get_amount(self) -> U128; -} - global UINT_NOTE_LEN: Field = 3; // 3 plus a header. global UINT_NOTE_BYTES_LEN: Field = 3 * 32 + 64; @@ -65,16 +60,16 @@ impl NoteInterface for UintNote { impl UintNote { // TODO: Merge this func with `compute_note_hiding_point`. I (benesjan) didn't do it in the initial PR to not have // to modify macros and all the related funcs in it. - fn to_note_hiding_point(self) -> IntNoteHidingPoint { - IntNoteHidingPoint::new(self.compute_note_hiding_point()) + fn to_note_hiding_point(self) -> UintNoteHidingPoint { + UintNoteHidingPoint::new(self.compute_note_hiding_point()) } } -struct IntNoteHidingPoint { +struct UintNoteHidingPoint { inner: Point } -impl IntNoteHidingPoint { +impl UintNoteHidingPoint { fn new(point: Point) -> Self { Self { inner: point } } @@ -100,7 +95,7 @@ impl IntNoteHidingPoint { } } -impl Serialize for IntNoteHidingPoint { +impl Serialize for UintNoteHidingPoint { fn serialize(self) -> [Field; POINT_LENGTH] { self.inner.serialize() } @@ -113,18 +108,3 @@ impl Eq for UintNote { (self.randomness == other.randomness) } } - -impl OwnedNote for UintNote { - fn new(amount: U128, owner_npk_m_hash: Field) -> Self { - Self { - value: amount, - npk_m_hash: owner_npk_m_hash, - randomness: unsafe_rand(), - header: NoteHeader::empty(), - } - } - - fn get_amount(self) -> U128 { - self.value - } -} diff --git a/noir-projects/aztec-nr/value-note/src/value_note.nr b/noir-projects/aztec-nr/value-note/src/value_note.nr index d1d39741e0f6..38809bc7e543 100644 --- a/noir-projects/aztec-nr/value-note/src/value_note.nr +++ b/noir-projects/aztec-nr/value-note/src/value_note.nr @@ -13,11 +13,6 @@ global VALUE_NOTE_LEN: Field = 3; // 3 plus a header. // VALUE_NOTE_LEN * 32 + 32(storage_slot as bytes) + 32(note_type_id as bytes) global VALUE_NOTE_BYTES_LEN: Field = 3 * 32 + 64; -trait OwnedNote { - fn new(amount: U128, owner_npk_m_hash: Field) -> Self; - fn get_amount(self) -> U128; -} - // docs:start:value-note-def #[aztec(note)] struct ValueNote { @@ -105,21 +100,6 @@ impl Eq for ValueNote { } } -impl OwnedNote for ValueNote { - fn new(value: U128, owner_npk_m_hash: Field) -> Self { - Self { - value: value.to_field(), - npk_m_hash: owner_npk_m_hash, - randomness: unsafe_rand(), - header: NoteHeader::empty(), - } - } - - fn get_amount(self) -> U128 { - U128::from_field(self.value) - } -} - struct ValueNoteHidingPoint { inner: Point }