Skip to content

Commit

Permalink
chore: fix sync scripts (#9423)
Browse files Browse the repository at this point in the history
There's some trailing references to noir_js_backend_barretenberg which
is blocking syncs.
  • Loading branch information
TomAFrench authored Oct 25, 2024
1 parent 30314ec commit 7766c8e
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 56 deletions.
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/authwit/src/cheatcodes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
let inner_hash =
compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);
let message_hash = compute_authwit_message_hash(target, chain_id, version, inner_hash);
let mut context = PublicContext::new(|| { panic(f"Provide args hash manually") });
let mut context = PublicContext::new(|| panic(f"Provide args hash manually"));
context.args_hash = Option::some(args_hash);
set_authorized(&mut context, message_hash, true);
cheatcodes::set_contract_address(current_contract);
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/dispatch/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ comptime fn size_in_fields(typ: Type) -> u32 {
comptime fn array_size_in_fields(typ: Type) -> Option<u32> {
typ.as_array().and_then(|typ: (Type, Type)| {
let (typ, element_size) = typ;
element_size.as_constant().map(|x: u32| { x * size_in_fields(typ) })
element_size.as_constant().map(|x: u32| x * size_in_fields(typ))
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ comptime mut global STUBS: UHashMap<Module, [Quoted], BuildHasherDefault<Poseido
pub(crate) comptime fn create_fn_abi_export(f: FunctionDefinition) -> Quoted {
let name = f.name();
let mut parameters =
f.parameters().map(|(name, typ): (Quoted, Type)| { quote { $name: $typ } }).join(quote {,});
f.parameters().map(|(name, typ): (Quoted, Type)| quote { $name: $typ }).join(quote {,});

let parameters_struct_name = f"{name}_parameters".quoted_contents();
let parameters = quote {
Expand Down Expand Up @@ -97,7 +97,7 @@ pub comptime fn stub_fn(f: FunctionDefinition) -> Quoted {
};

let fn_parameters_list =
fn_parameters.map(|(name, typ): (Quoted, Type)| { quote { $name: $typ } }).join(quote {,});
fn_parameters.map(|(name, typ): (Quoted, Type)| quote { $name: $typ }).join(quote {,});

let fn_name_str = fn_name.as_str_quote();

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ comptime fn generate_note_properties(s: StructDefinition) -> Quoted {
let non_header_fields = s.fields().filter(|(_, typ): (Quoted, Type)| typ != note_header_type);

let properties_types = non_header_fields
.map(|(name, _): (Quoted, Type)| { quote { $name: $property_selector_type } })
.map(|(name, _): (Quoted, Type)| quote { $name: $property_selector_type })
.join(quote {,});

// TODO #8694: Properly handle non-field types https://github.com/AztecProtocol/aztec-packages/issues/8694
Expand Down
6 changes: 3 additions & 3 deletions noir-projects/aztec-nr/aztec/src/macros/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ comptime fn signature_of_type(typ: Type) -> Quoted {
} else if typ.as_struct().is_some() {
let (s, _) = typ.as_struct().unwrap();
let field_signatures =
s.fields().map(|(_, typ): (Quoted, Type)| { signature_of_type(typ) }).join(quote {,});
s.fields().map(|(_, typ): (Quoted, Type)| signature_of_type(typ)).join(quote {,});
f"({field_signatures})".quoted_contents()
} else if typ.as_tuple().is_some() {
// Note that tuples are handled the same way as structs
let types = typ.as_tuple().unwrap();
let field_signatures = types.map(|typ: Type| { signature_of_type(typ) }).join(quote {,});
let field_signatures = types.map(|typ: Type| signature_of_type(typ)).join(quote {,});
f"({field_signatures})".quoted_contents()
} else {
panic(f"Unsupported type {typ}")
Expand Down Expand Up @@ -179,7 +179,7 @@ pub(crate) comptime fn compute_fn_selector(f: FunctionDefinition) -> Field {
// The signature will be "foo(Field,AztecAddress)".
let fn_name = f.name();
let args_signatures =
f.parameters().map(|(_, typ): (Quoted, Type)| { signature_of_type(typ) }).join(quote {,});
f.parameters().map(|(_, typ): (Quoted, Type)| signature_of_type(typ)).join(quote {,});
let signature_quote = quote { $fn_name($args_signatures) };
let signature_str_quote = signature_quote.as_str_quote();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl TestEnvironment {
}

unconstrained fn public_with_args_hash(_self: Self, args: [Field]) -> PublicContext {
let mut context = PublicContext::new(|| { panic(f"Provide args hash manually") });
let mut context = PublicContext::new(|| panic(f"Provide args hash manually"));
context.args_hash = Option::some(hash_args(args));
context
}
Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<let N: u32, let M: u32> Deployer<N, M> {
);
cheatcodes::advance_blocks_by(1);

let mut public_context = PublicContext::new(|| { panic(f"Provide args hash manually") });
let mut public_context = PublicContext::new(|| panic(f"Provide args hash manually"));

public_context
.call_public_function(
Expand Down Expand Up @@ -103,7 +103,7 @@ impl<let N: u32, let M: u32> Deployer<N, M> {
);
cheatcodes::advance_blocks_by(1);

let mut public_context = PublicContext::new(|| { panic(f"Provide args hash manually") });
let mut public_context = PublicContext::new(|| panic(f"Provide args hash manually"));

let _: T = public_context
.call_public_function(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,5 @@ pub fn get_pack_cards(
}

pub fn compute_deck_strength<let N: u32>(cards: [Card; N]) -> Field {
cards.fold(0, |acc, card: Card| { acc + card.strength as Field })
cards.fold(0, |acc, card: Card| acc + card.strength as Field)
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract DocsExample {
profiles: Map::new(
context,
4,
|context, slot| { PrivateMutable::new(context, slot) },
|context, slot| PrivateMutable::new(context, slot),
),
// docs:end:state_vars-MapPrivateMutable
// docs:start:storage-set-init
Expand All @@ -85,7 +85,7 @@ contract DocsExample {
minters: Map::new(
context,
8,
|context, slot| { PublicMutable::new(context, slot) },
|context, slot| PublicMutable::new(context, slot),
),
// docs:end:storage-minters-init
// docs:start:storage-public-immutable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use crate::{
abis::function_selector::FunctionSelector,
public_keys::{ToPoint, PublicKeys, NpkM, IvpkM, OvpkM, TpkM},
address::{
partial_address::PartialAddress, public_keys_hash::PublicKeysHash,
salted_initialization_hash::SaltedInitializationHash,
},
constants::{
AZTEC_ADDRESS_LENGTH, FUNCTION_TREE_HEIGHT, GENERATOR_INDEX__PUBLIC_KEYS_HASH,
GENERATOR_INDEX__CONTRACT_ADDRESS_V1, MAX_FIELD_VALUE,
}, contract_class_id::ContractClassId,
AZTEC_ADDRESS_LENGTH, FUNCTION_TREE_HEIGHT, GENERATOR_INDEX__CONTRACT_ADDRESS_V1,
GENERATOR_INDEX__PUBLIC_KEYS_HASH, MAX_FIELD_VALUE,
},
contract_class_id::ContractClassId,
hash::{poseidon2_hash_with_separator, private_functions_root_from_siblings},
merkle_tree::membership::MembershipWitness,
public_keys::{IvpkM, NpkM, OvpkM, PublicKeys, ToPoint, TpkM},
traits::{Deserialize, Empty, FromField, Serialize, ToField},
utils,
};
Expand All @@ -19,8 +20,8 @@ use crate::{
use dep::std::embedded_curve_ops::EmbeddedCurvePoint as Point;

use std::{
ec::{sqrt, pow},
embedded_curve_ops::{fixed_base_scalar_mul as derive_public_key, EmbeddedCurveScalar},
ec::{pow, sqrt},
embedded_curve_ops::{EmbeddedCurveScalar, fixed_base_scalar_mul as derive_public_key},
};

// Aztec address
Expand Down
1 change: 0 additions & 1 deletion noir/.rebuild_patterns_packages
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
^noir/noir-repo/noir_stdlib
^noir/noir-repo/tooling/noir_codegen
^noir/noir-repo/tooling/noir_js
^noir/noir-repo/tooling/noir_js_backend_barretenberg
^noir/noir-repo/tooling/noir_js_types
^noir/noir-repo/tooling/noirc_abi
^noir/noir-repo/tooling/noirc_abi_wasm
31 changes: 0 additions & 31 deletions noir/noir-repo/docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,37 +181,6 @@ export default {
membersWithOwnFile: ['Interface', 'Class', 'TypeAlias', 'Function'],
},
],
[
'docusaurus-plugin-typedoc',
{
id: 'noir_js_backend_barretenberg',
entryPoints: ['../tooling/noir_js_backend_barretenberg/src/index.ts'],
tsconfig: '../tooling/noir_js_backend_barretenberg/tsconfig.json',
entryPointStrategy: 'resolve',
out: 'processed-docs/reference/NoirJS/backend_barretenberg',
plugin: ['typedoc-plugin-markdown'],
name: 'backend_barretenberg',
disableSources: true,
excludePrivate: true,
skipErrorChecking: true,
sidebar: {
filteredIds: ['reference/NoirJS/backend_barretenberg/index'],
},
readme: 'none',
hidePageHeader: true,
hideBreadcrumbs: true,
hideInPageTOC: true,
useCodeBlocks: true,
typeDeclarationFormat: 'table',
propertiesFormat: 'table',
parametersFormat: 'table',
enumMembersFormat: 'table',
indexFormat: 'table',
outputFileStrategy: 'members',
memberPageTitle: '{name}',
membersWithOwnFile: ['Interface', 'Class', 'TypeAlias'],
},
],
[
'docusaurus-plugin-typedoc',
{
Expand Down
4 changes: 2 additions & 2 deletions noir/scripts/sync-in-fixup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eu
cd $(dirname $0)/../noir-repo

tmp=$(mktemp)
BACKEND_BARRETENBERG_PACKAGE_JSON=./tooling/noir_js_backend_barretenberg/package.json
BACKEND_BARRETENBERG_PACKAGE_JSON=./compiler/integration-tests/package.json

jq -r '.dependencies."@aztec/bb.js"' $BACKEND_BARRETENBERG_PACKAGE_JSON > ../bb-version
jq '.dependencies."@aztec/bb.js" = "portal:../../../../barretenberg/ts"' $BACKEND_BARRETENBERG_PACKAGE_JSON > $tmp && mv $tmp $BACKEND_BARRETENBERG_PACKAGE_JSON
Expand All @@ -15,4 +15,4 @@ YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

# Remove requirement for `wasm-opt` to be installed
sed -i "s/^require_command wasm-opt/#require_command wasm-opt/" ./tooling/noirc_abi_wasm/build.sh
sed -i "s/^require_command wasm-opt/#require_command wasm-opt/" ./acvm-repo/acvm_js/build.sh
sed -i "s/^require_command wasm-opt/#require_command wasm-opt/" ./acvm-repo/acvm_js/build.sh
4 changes: 2 additions & 2 deletions noir/scripts/sync-out-fixup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd $(dirname $0)/../noir-repo
BB_VERSION=$(cat ../bb-version)

tmp=$(mktemp)
BACKEND_BARRETENBERG_PACKAGE_JSON=./tooling/noir_js_backend_barretenberg/package.json
BACKEND_BARRETENBERG_PACKAGE_JSON=./compiler/integration-tests/package.json
jq --arg v $BB_VERSION '.dependencies."@aztec/bb.js" = $v' $BACKEND_BARRETENBERG_PACKAGE_JSON > $tmp && mv $tmp $BACKEND_BARRETENBERG_PACKAGE_JSON

# This script runs in CI which enforces immutable installs by default,
Expand All @@ -15,4 +15,4 @@ YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

# Add requirement for `wasm-opt` to be installed
sed -i "s/^#require_command wasm-opt/require_command wasm-opt/" ./tooling/noirc_abi_wasm/build.sh
sed -i "s/^#require_command wasm-opt/require_command wasm-opt/" ./acvm-repo/acvm_js/build.sh
sed -i "s/^#require_command wasm-opt/require_command wasm-opt/" ./acvm-repo/acvm_js/build.sh

0 comments on commit 7766c8e

Please sign in to comment.