Skip to content

Commit

Permalink
chore: skip formatting informattable comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed May 9, 2024
1 parent ef9cdde commit 848650d
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 32 deletions.
5 changes: 2 additions & 3 deletions noir-projects/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ test:
format:
FROM +build

# TODO: https://github.com/noir-lang/noir/issues/4980
# WORKDIR /usr/src/noir-projects/noir-protocol-circuits
# RUN nargo fmt --check
WORKDIR /usr/src/noir-projects/noir-protocol-circuits
RUN nargo fmt --check

WORKDIR /usr/src/noir-projects/noir-contracts
RUN nargo fmt --check
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelInitCircuitPrivateInputs;
use dep::types::PrivateKernelCircuitPublicInputs;

unconstrained fn main(input: PrivateKernelInitCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
unconstrained fn main(input: PrivateKernelInitCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
input.native_private_kernel_circuit_initial()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelInitCircuitPrivateInputs;
use dep::types::PrivateKernelCircuitPublicInputs;

fn main(input: PrivateKernelInitCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
fn main(input: PrivateKernelInitCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
input.native_private_kernel_circuit_initial()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelInnerCircuitPrivateInputs;
use dep::types::PrivateKernelCircuitPublicInputs;

unconstrained fn main(input: PrivateKernelInnerCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
unconstrained fn main(input: PrivateKernelInnerCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
input.native_private_kernel_circuit_inner()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelInnerCircuitPrivateInputs;
use dep::types::PrivateKernelCircuitPublicInputs;

fn main(input: PrivateKernelInnerCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
fn main(input: PrivateKernelInnerCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs {
input.native_private_kernel_circuit_inner()
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,19 @@ mod tests {
use dep::types::constants::{
MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX,
MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX,
MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX,
DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE
MAX_ENCRYPTED_LOGS_PER_TX, MAX_UNENCRYPTED_LOGS_PER_TX, DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE
};
use dep::types::{
abis::{
kernel_circuit_public_inputs::KernelCircuitPublicInputs, max_block_number::MaxBlockNumber,
note_hash::{NoteHash, ScopedNoteHash}, nullifier::{Nullifier, ScopedNullifier}, side_effect::SideEffect, gas::Gas
note_hash::{NoteHash, ScopedNoteHash}, nullifier::{Nullifier, ScopedNullifier},
side_effect::SideEffect, gas::Gas
},
grumpkin_private_key::GrumpkinPrivateKey,
hash::{compute_note_hash_nonce, compute_unique_siloed_note_hash, sha256_to_field, silo_note_hash, silo_nullifier},
hash::{
compute_note_hash_nonce, compute_unique_siloed_note_hash, sha256_to_field, silo_note_hash,
silo_nullifier
},
tests::{fixture_builder::FixtureBuilder, sort::sort_get_sorted_hints},
utils::{arrays::{array_eq, array_length}}, traits::{Empty, is_empty, is_empty_array}
};
Expand Down Expand Up @@ -132,10 +135,7 @@ mod tests {

// A helper function that uses the first nullifer in the previous kernel to compute the unique siloed
// note_hashes for the given note_hashes.
pub fn compute_output_note_hashes<N>(
self,
note_hashes: [ScopedNoteHash; N]
) -> [Field; N] {
pub fn compute_output_note_hashes<N>(self, note_hashes: [ScopedNoteHash; N]) -> [Field; N] {
let first_nullifier = self.previous_kernel.new_nullifiers.get_unchecked(0);
let mut unique_siloed_note_hashes = [0; N];
for i in 0..N {
Expand Down Expand Up @@ -305,13 +305,15 @@ mod tests {
public_inputs.end.unencrypted_log_preimages_length, unencrypted_log_preimages_length + prev_unencrypted_log_preimages_length
);

// noir-fmt:ignore
let hash_bytes: [u8; MAX_ENCRYPTED_LOGS_PER_TX * 32] = prev_encrypted_logs_hash
.to_be_bytes(32)
.append(&[0; MAX_ENCRYPTED_LOGS_PER_TX * 32 - 32])
.as_array();
let expected_encrypted_logs_hash = sha256_to_field(hash_bytes);
assert_eq(public_inputs.end.encrypted_logs_hash, expected_encrypted_logs_hash);

// noir-fmt:ignore
let hash_bytes: [u8; MAX_UNENCRYPTED_LOGS_PER_TX * 32] = prev_unencrypted_logs_hash
.to_be_bytes(32)
.append(unencrypted_logs_hash.to_be_bytes(32))
Expand Down Expand Up @@ -581,7 +583,6 @@ mod tests {
builder.previous_kernel.tx_context.gas_settings.teardown_gas_limits = Gas::new(300, 300);
let public_inputs = builder.execute();


let expected_gas_consumed = Gas::new(300, 300) // teardown gas
+ Gas::tx_overhead() // tx overhead
+ Gas::new(DA_GAS_PER_BYTE * DA_BYTES_PER_FIELD * 1, 0); // tx nullifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelTailToPublicCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

unconstrained fn main(input: PrivateKernelTailToPublicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
unconstrained fn main(input: PrivateKernelTailToPublicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.execute()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelTailToPublicCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

fn main(input: PrivateKernelTailToPublicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
fn main(input: PrivateKernelTailToPublicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.execute()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::private_kernel_lib::PrivateKernelTailCircuitPrivateInputs;
use dep::types::KernelCircuitPublicInputs;

fn main(input: PrivateKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs {
fn main(input: PrivateKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs {
input.native_private_kernel_circuit_tail()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelAppLogicCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

unconstrained fn main(input: PublicKernelAppLogicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
unconstrained fn main(input: PublicKernelAppLogicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.public_kernel_app_logic()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelAppLogicCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

fn main(input: PublicKernelAppLogicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
fn main(input: PublicKernelAppLogicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.public_kernel_app_logic()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelSetupCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

unconstrained fn main(input: PublicKernelSetupCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
unconstrained fn main(input: PublicKernelSetupCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.public_kernel_setup()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelSetupCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

fn main(input: PublicKernelSetupCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
fn main(input: PublicKernelSetupCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.public_kernel_setup()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelTailCircuitPrivateInputs;
use dep::types::KernelCircuitPublicInputs;

unconstrained fn main(input: PublicKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs {
unconstrained fn main(input: PublicKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs {
input.public_kernel_tail()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelTailCircuitPrivateInputs;
use dep::types::KernelCircuitPublicInputs;

fn main(input: PublicKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs {
fn main(input: PublicKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs {
input.public_kernel_tail()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::public_kernel_lib::PublicKernelTeardownCircuitPrivateInputs;
use dep::types::PublicKernelCircuitPublicInputs;

unconstrained fn main(input: PublicKernelTeardownCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
unconstrained fn main(input: PublicKernelTeardownCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs {
input.public_kernel_teardown()
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use dep::types::{
abis::append_only_tree_snapshot::AppendOnlyTreeSnapshot,
partial_state_reference::PartialStateReference,
mocked::AggregationObject,
traits::Empty
partial_state_reference::PartialStateReference, mocked::AggregationObject, traits::Empty
};
use crate::abis::constant_rollup_data::ConstantRollupData;

Expand Down Expand Up @@ -44,4 +42,4 @@ impl Empty for BaseOrMergeRollupPublicInputs {
out_hash : 0,
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ impl Empty for ConstantRollupData {
global_variables: GlobalVariables::empty(),
}
}
}
}
2 changes: 1 addition & 1 deletion noir/noir-repo/tooling/nargo_fmt/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ config! {
max_width: usize, 100, "Maximum width of each line";
tab_spaces: usize, 4, "Number of spaces per tab";
remove_nested_parens: bool, true, "Remove nested parens";
error_on_lost_comment: bool, true, "Error if unable to get comments";
error_on_lost_comment: bool, false, "Error if unable to get comments";
short_array_element_width_threshold: usize, 10, "Width threshold for an array element to be considered short";
array_width: usize, 100, "Maximum width of an array literal before falling back to vertical formatting";
fn_call_width: usize, 60, "Maximum width of the args of a function call before falling back to vertical formatting";
Expand Down

0 comments on commit 848650d

Please sign in to comment.