Skip to content

Commit

Permalink
chore: remove unused imports (#8766)
Browse files Browse the repository at this point in the history
Some may remain, but we're getting a lot of false positives until
#8760 is merged,
since a re-exported private struct is considered an error, and therefore
the import of said struct is considered unused.

---------

Co-authored-by: thunkar <gregojquiros@gmail.com>
  • Loading branch information
nventuro and Thunkar authored Sep 25, 2024
1 parent b9a1f59 commit 420dd64
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 27 deletions.
26 changes: 8 additions & 18 deletions noir-projects/aztec-nr/authwit/src/auth.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use dep::aztec::protocol_types::{
},
hash::poseidon2_hash_with_separator
};
use dep::aztec::{prelude::Deserialize, context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};
use dep::aztec::{context::{PrivateContext, PublicContext, gas::GasOpts}, hash::hash_args_array};

/**
* Authenticaion witness helper library
Expand Down Expand Up @@ -215,11 +215,7 @@ pub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf
* @param on_behalf_of The address that have authorized the current call
* @param inner_hash The hash of the message to authorize
*/
pub fn assert_inner_hash_valid_authwit(
context: &mut PrivateContext,
on_behalf_of: AztecAddress,
inner_hash: Field
) {
pub fn assert_inner_hash_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress, inner_hash: Field) {
// We perform a static call here and not a standard one to ensure that the account contract cannot re-enter.
let result: Field = context.static_call_private_function(
on_behalf_of,
Expand Down Expand Up @@ -247,7 +243,10 @@ pub fn assert_inner_hash_valid_authwit(
* @param on_behalf_of The address that have authorized the current call
*/
// docs:start:assert_current_call_valid_authwit_public
pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress) {
pub fn assert_current_call_valid_authwit_public(
context: &mut PublicContext,
on_behalf_of: AztecAddress
) {
let inner_hash = compute_inner_authwit_hash(
[(*context).msg_sender().to_field(), (*context).selector().to_field(), (*context).get_args_hash()]
);
Expand All @@ -266,11 +265,7 @@ pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_
*
* @param on_behalf_of The address that have authorized the `inner_hash`
*/
pub fn assert_inner_hash_valid_authwit_public(
context: &mut PublicContext,
on_behalf_of: AztecAddress,
inner_hash: Field
) {
pub fn assert_inner_hash_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress, inner_hash: Field) {
let result: Field = context.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime {
Expand Down Expand Up @@ -346,12 +341,7 @@ pub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field)
* @param version The version of the chain that the message is being consumed on
* @param inner_hash The hash of the "inner" message that is being consumed
*/
pub fn compute_authwit_message_hash(
consumer: AztecAddress,
chain_id: Field,
version: Field,
inner_hash: Field
) -> Field {
pub fn compute_authwit_message_hash(consumer: AztecAddress, chain_id: Field, version: Field, inner_hash: Field) -> Field {
poseidon2_hash_with_separator(
[
consumer.to_field(),
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/authwit/src/entrypoint/app.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dep::aztec::protocol_types::{
traits::{Hash, Serialize}
};

use crate::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES};
use crate::entrypoint::function_call::FunctionCall;

// FUNCTION_CALL_SIZE * ACCOUNT_MAX_CALLS + 1
global APP_PAYLOAD_SIZE: u32 = 21;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod test {
};

use crate::{
note::{note_header::NoteHeader, note_interface::{NoteInterface, PartialNote, NullifiableNote}},
note::{note_header::NoteHeader, note_interface::{NoteInterface, NullifiableNote}},
encrypted_logs::incoming_body::EncryptedLogIncomingBody, event::event_interface::EventInterface,
context::PrivateContext, keys::public_keys::IvpkM
};
Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
hash::{BuildHasherDefault, poseidon2::Poseidon2Hasher}
};
use protocol_types::meta::{flatten_to_fields, pack_from_fields};
use crate::note::{note_header::NoteHeader, note_getter_options::PropertySelector, note_interface::NoteInterface};
use crate::note::{note_header::NoteHeader, note_getter_options::PropertySelector};

comptime global NOTE_HEADER_TYPE = type_of(NoteHeader::empty());

Expand Down Expand Up @@ -374,7 +374,7 @@ pub comptime fn note(s: StructDefinition) -> Quoted {
pub comptime fn note_custom_interface(s: StructDefinition) -> Quoted {
let (common, note_type_id) = common_note_annotation(s);
let serialized_len_type = fresh_type_variable();
let note_interface_impl = s.as_type().get_trait_impl(quote { NoteInterface<$serialized_len_type> }.as_trait_constraint());
let note_interface_impl = s.as_type().get_trait_impl(quote { crate::note::note_interface::NoteInterface<$serialized_len_type> }.as_trait_constraint());
let name = s.name();

let note_serialized_len = note_interface_impl.expect(f"Note {name} must implement NoteInterface trait").trait_generic_args()[0].as_constant().unwrap();
Expand Down
1 change: 0 additions & 1 deletion noir-projects/aztec-nr/aztec/src/state_vars/storage.nr
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ pub trait Storage<T> where T: Serialize<N> + Deserialize<N> {
pub struct Storable {
slot: Field,
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ contract CardGame {
use crate::game::{PLAYABLE_CARDS, PlayerEntry, Game};
use dep::aztec::macros::{storage::storage, functions::{private, public, internal}};

use value_note::value_note::ValueNote;

#[storage]
struct Storage<Context> {
collections: Map<AztecAddress, Deck<Context>, Context>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use dep::aztec::prelude::FunctionSelector;
use dep::aztec::protocol_types;
use dep::aztec::protocol_types::{
contract_class_id::ContractClassId,
constants::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use dep::aztec::prelude::FunctionSelector;
use dep::aztec::protocol_types;
use dep::aztec::protocol_types::{
contract_class_id::ContractClassId,
constants::{
Expand Down

0 comments on commit 420dd64

Please sign in to comment.