Skip to content

fix: fmt & linter warnings #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/token_contract/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ pub contract Token {
* ===================== UNCONSTRAINED =======================
* ======================================================== */
#[utility]
unconstrained fn balance_of_private(owner: AztecAddress) -> u128 {
pub unconstrained fn balance_of_private(owner: AztecAddress) -> u128 {
storage.private_balances.at(owner).balance_of()
}

Expand Down
4 changes: 2 additions & 2 deletions src/token_contract/src/test/burn_public.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use aztec::oracle::random::random;

#[test]
unconstrained fn burn_public_success() {
let (env, token_contract_address, owner, recipient, mint_amount) =
let (env, token_contract_address, owner, _, mint_amount) =
utils::setup_and_mint_to_public_without_minter(/* with_account_contracts */ false);
let burn_amount = mint_amount / 10 as u128;

Expand All @@ -16,7 +16,7 @@ unconstrained fn burn_public_success() {

#[test]
unconstrained fn burn_public_decrease_total_supply() {
let (env, token_contract_address, owner, recipient, mint_amount) =
let (env, token_contract_address, owner, _, mint_amount) =
utils::setup_and_mint_to_public_without_minter(/* with_account_contracts */ false);
let burn_amount = mint_amount / 10 as u128;

Expand Down
8 changes: 4 additions & 4 deletions src/token_contract/src/test/mint_to_commitment.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::{test::utils, Token};
use aztec::oracle::random::random;
use uint_note::uint_note::{PartialUintNote, UintNote};
use uint_note::uint_note::PartialUintNote;

#[test]
unconstrained fn mint_to_commitment_success() {
// Setup without account contracts. We are not using authwits here, so dummy accounts are enough
let (env, token_contract_address, owner, recipient, minter) = utils::setup_with_minter(false);
let (env, token_contract_address, _, recipient, minter) = utils::setup_with_minter(false);

let commitment = Token::at(token_contract_address)
.initialize_transfer_commitment(recipient, recipient)
Expand Down Expand Up @@ -102,7 +102,7 @@ unconstrained fn mint_to_private_failure_total_supply_overflow() {

#[test(should_fail_with = "Invalid commitment 'context.storage_read(commitment.commitment())'")]
unconstrained fn mint_to_private_failure_invalid_commitments_random() {
let (env, token_contract_address, owner, recipient, minter) = utils::setup_with_minter(false);
let (env, token_contract_address, _, _, minter) = utils::setup_with_minter(false);

let mint_amount: u128 = 10_000;
env.impersonate(minter);
Expand All @@ -114,7 +114,7 @@ unconstrained fn mint_to_private_failure_invalid_commitments_random() {

#[test(should_fail_with = "Invalid commitment 'context.storage_read(commitment.commitment())'")]
unconstrained fn mint_to_private_failure_invalid_commitments_zero() {
let (env, token_contract_address, owner, recipient, minter) = utils::setup_with_minter(false);
let (env, token_contract_address, _, _, minter) = utils::setup_with_minter(false);

let mint_amount: u128 = 10_000;
env.impersonate(minter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::test::utils;
use crate::Token;
use authwit::cheatcodes as authwit_cheatcodes;
use aztec::oracle::random::random;
use uint_note::uint_note::{PartialUintNote, UintNote};
use uint_note::uint_note::PartialUintNote;

#[test]
unconstrained fn transfer_private_to_commitment() {
Expand Down
2 changes: 1 addition & 1 deletion src/token_contract/src/test/transfer_private_to_private.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::test::utils;
use crate::Token;
use authwit::cheatcodes as authwit_cheatcodes;
use aztec::note::constants::MAX_NOTES_PER_PAGE;
use uint_note::uint_note::{PartialUintNote, UintNote};
use uint_note::uint_note::UintNote;

#[test]
unconstrained fn transfer_private_on_behalf_of_other() {
Expand Down
1 change: 0 additions & 1 deletion src/token_contract/src/test/transfer_private_to_public.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::test::utils;
use crate::Token;
use authwit::cheatcodes as authwit_cheatcodes;
use aztec::{note::constants::MAX_NOTES_PER_PAGE, oracle::random::random};
use aztec::protocol_types::traits::ToField;
use uint_note::uint_note::UintNote;

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ unconstrained fn transfer_private_to_public_with_commitment() {
// Transfer tokens
let transfer_amount = mint_amount;
env.impersonate(owner);
let commitment = Token::at(token_contract_address)
let _ = Token::at(token_contract_address)
.transfer_private_to_public_with_commitment(owner, recipient, transfer_amount, 0)
.call(&mut env.private());
env.advance_block_by(1);
Expand Down Expand Up @@ -53,7 +53,7 @@ unconstrained fn transfer_private_to_public_with_commitment_and_non_zero_nonce()
// Transfer tokens
let transfer_amount = mint_amount;
env.impersonate(owner);
Token::at(token_contract_address)
let _ = Token::at(token_contract_address)
.transfer_private_to_public_with_commitment(owner, recipient, transfer_amount, random())
.call(&mut env.private());
}
Expand All @@ -80,7 +80,7 @@ unconstrained fn transfer_private_to_public_with_commitment_on_behalf_of_other()

// Transfer tokens
env.impersonate(recipient);
transfer_private_to_public_commitment_call_interface.call(&mut env.private());
let _ = transfer_private_to_public_commitment_call_interface.call(&mut env.private());
env.advance_block_by(1);

// Check balances
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{test::utils, Token};
use aztec::oracle::random::random;
use std::test::OracleMock;
use uint_note::uint_note::{PartialUintNote, UintNote};
use uint_note::uint_note::PartialUintNote;

/// Internal orchestration means that the calls to `initialize_transfer_commitment`
/// and `transfer_public_to_commitment` are done by the TOKEN contract itself.
Expand Down
2 changes: 0 additions & 2 deletions src/token_contract/src/test/transfer_public_to_private.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::{test::utils, Token};
use authwit::cheatcodes as authwit_cheatcodes;
use aztec::oracle::random::random;
use std::test::OracleMock;
use uint_note::uint_note::{PartialUintNote, UintNote};

#[test]
unconstrained fn transfer_public_to_private_success() {
Expand Down