From 3c18926c8bc38396b29e547c917453374991def6 Mon Sep 17 00:00:00 2001 From: TomAFrench Date: Thu, 11 Jul 2024 19:26:04 +0000 Subject: [PATCH 1/8] chore: turn off elaborator --- avm-transpiler/scripts/compile_then_transpile.sh | 2 +- docs/docs/guides/smart_contracts/testing_contracts/index.md | 2 +- noir-projects/Dockerfile | 2 +- noir-projects/Dockerfile.test | 6 +++--- noir-projects/Earthfile | 4 ++-- noir-projects/noir-contracts/bootstrap.sh | 2 +- noir-projects/noir-protocol-circuits/bootstrap.sh | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/avm-transpiler/scripts/compile_then_transpile.sh b/avm-transpiler/scripts/compile_then_transpile.sh index d9008cc101c..21c4ab486b6 100755 --- a/avm-transpiler/scripts/compile_then_transpile.sh +++ b/avm-transpiler/scripts/compile_then_transpile.sh @@ -18,7 +18,7 @@ fi shift # remove the compile arg so we can inject --show-artifact-paths # Forward all arguments to nargo, tee output to console -artifacts_to_transpile=$($NARGO compile --use-legacy --show-artifact-paths $@ | tee /dev/tty | grep -oP 'Saved contract artifact to: \K.*') +artifacts_to_transpile=$($NARGO compile --show-artifact-paths $@ | tee /dev/tty | grep -oP 'Saved contract artifact to: \K.*') # NOTE: the output that is teed to /dev/tty will normally not be redirectable by the caller. # If the script is run via docker, however, the user will see this output on stdout and will be able to redirect. diff --git a/docs/docs/guides/smart_contracts/testing_contracts/index.md b/docs/docs/guides/smart_contracts/testing_contracts/index.md index 1a4e5d5f0fc..34535fa6e8b 100644 --- a/docs/docs/guides/smart_contracts/testing_contracts/index.md +++ b/docs/docs/guides/smart_contracts/testing_contracts/index.md @@ -46,7 +46,7 @@ This will be improved in the future with a dedicated command. By default, TXE runs at `http://localhost:8080`. Using `aztec-nargo`, contract tests can be run with: -`aztec-nargo test --use-legacy --silence-warnings --oracle-resolver http://host.docker.internal:8080` +`aztec-nargo test --silence-warnings --oracle-resolver http://host.docker.internal:8080` :::warning Since TXE tests are written in Noir and executed with `aztec-nargo`, they all run in parallel. This also means every test creates their own isolated environment, so state modifications are local to each one of them. diff --git a/noir-projects/Dockerfile b/noir-projects/Dockerfile index afc9663888c..5b28c93811a 100644 --- a/noir-projects/Dockerfile +++ b/noir-projects/Dockerfile @@ -22,7 +22,7 @@ RUN ./bootstrap.sh WORKDIR /usr/src/noir-projects/noir-protocol-circuits RUN ./bootstrap.sh WORKDIR /usr/src/noir-projects/aztec-nr -RUN nargo compile --use-legacy --silence-warnings +RUN nargo compile --silence-warnings FROM scratch COPY --from=builder /usr/src/noir-projects /usr/src/noir-projects \ No newline at end of file diff --git a/noir-projects/Dockerfile.test b/noir-projects/Dockerfile.test index a62829b1945..717d2b4deb9 100644 --- a/noir-projects/Dockerfile.test +++ b/noir-projects/Dockerfile.test @@ -22,7 +22,7 @@ WORKDIR /usr/src/noir-projects COPY . . # Build & test -RUN cd ./noir-protocol-circuits && ./bootstrap.sh && nargo test --use-legacy --silence-warnings +RUN cd ./noir-protocol-circuits && ./bootstrap.sh && nargo test --silence-warnings RUN cd /usr/src/yarn-project/txe && yarn start & \ # Wait for TXE to initialize @@ -31,10 +31,10 @@ RUN cd /usr/src/yarn-project/txe && yarn start & \ # We need to increase the timeout since all tests running in parallel hammer TXE at the same time, and processing slows down leading to timeouts # The only way we currently have to batch tests is via RAYON_NUM_THREADS, which is not ideal ./bootstrap.sh && \ - NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --use-legacy --silence-warnings --oracle-resolver http://localhost:8080 + NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080 RUN cd /usr/src/yarn-project/txe && yarn start & \ # Wait for TXE to initialize sleep 5 && \ cd ./aztec-nr && \ - NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --use-legacy --silence-warnings --oracle-resolver http://localhost:8080 \ No newline at end of file + NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080 \ No newline at end of file diff --git a/noir-projects/Earthfile b/noir-projects/Earthfile index c5a24bd0a85..94369527ad5 100644 --- a/noir-projects/Earthfile +++ b/noir-projects/Earthfile @@ -60,7 +60,7 @@ test: # Wait for TXE to initialize sleep 5 && \ cd /usr/src/noir-projects/aztec-nr && \ - NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --use-legacy --silence-warnings --oracle-resolver http://localhost:8080 + NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080 RUN cd /usr/src/yarn-project/txe && yarn start & \ # Wait for TXE to initialize @@ -68,7 +68,7 @@ test: cd /usr/src/noir-projects/noir-contracts && \ # We need to increase the timeout since all tests running in parallel hammer TXE at the same time and processing slows down, leading to timeouts # The only way we currently have to batch tests is via RAYON_NUM_THREADS, which is not ideal - NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --use-legacy --silence-warnings --oracle-resolver http://localhost:8080 + NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080 format: FROM +build diff --git a/noir-projects/noir-contracts/bootstrap.sh b/noir-projects/noir-contracts/bootstrap.sh index 19de570b329..3eb62c4530f 100755 --- a/noir-projects/noir-contracts/bootstrap.sh +++ b/noir-projects/noir-contracts/bootstrap.sh @@ -17,7 +17,7 @@ fi echo "Compiling contracts..." NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo} -$NARGO compile --silence-warnings --use-legacy +$NARGO compile --silence-warnings echo "Transpiling contracts..." scripts/transpile.sh \ No newline at end of file diff --git a/noir-projects/noir-protocol-circuits/bootstrap.sh b/noir-projects/noir-protocol-circuits/bootstrap.sh index 155bc7948cf..fca6dd29e0f 100755 --- a/noir-projects/noir-protocol-circuits/bootstrap.sh +++ b/noir-projects/noir-protocol-circuits/bootstrap.sh @@ -20,7 +20,7 @@ node ./generate_variants.js echo "Compiling protocol circuits..." NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo} -$NARGO compile --silence-warnings --use-legacy +$NARGO compile --silence-warnings BB_HASH=${BB_HASH:-$(cd ../../ && git ls-tree -r HEAD | grep 'barretenberg/cpp' | awk '{print $3}' | git hash-object --stdin)} echo Using BB hash $BB_HASH From f0724c9581c60242baa2a4439565cbd6ed2d8206 Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 12 Jul 2024 14:41:00 +0000 Subject: [PATCH 2/8] potential fix --- noir/noir-repo/aztec_macros/src/utils/constants.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/noir-repo/aztec_macros/src/utils/constants.rs b/noir/noir-repo/aztec_macros/src/utils/constants.rs index 2178f7a2526..6bbc5c96dfa 100644 --- a/noir/noir-repo/aztec_macros/src/utils/constants.rs +++ b/noir/noir-repo/aztec_macros/src/utils/constants.rs @@ -1,3 +1,3 @@ pub const FUNCTION_TREE_HEIGHT: u32 = 5; pub const MAX_CONTRACT_PRIVATE_FUNCTIONS: usize = 2_usize.pow(FUNCTION_TREE_HEIGHT); -pub const SELECTOR_PLACEHOLDER: &str = "SELECTOR_PLACEHOLDER"; +pub const SELECTOR_PLACEHOLDER: &str = ""; From a16dafcdab909ed1c36575f4573addbb3459d766 Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 12 Jul 2024 14:58:17 +0000 Subject: [PATCH 3/8] sneaky fix --- noir/noir-repo/aztec_macros/src/transforms/note_interface.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/noir/noir-repo/aztec_macros/src/transforms/note_interface.rs b/noir/noir-repo/aztec_macros/src/transforms/note_interface.rs index 49525fc2ae1..1369e6515b7 100644 --- a/noir/noir-repo/aztec_macros/src/transforms/note_interface.rs +++ b/noir/noir-repo/aztec_macros/src/transforms/note_interface.rs @@ -100,7 +100,9 @@ pub fn generate_note_interface_impl(module: &mut SortedModule) -> Result<(), Azt }) .collect::, _>>()?; let [note_serialized_len, note_bytes_len]: [_; 2] = - note_interface_generics.try_into().unwrap(); + note_interface_generics.try_into().expect( + "NoteInterface must be generic over 2 types, NOTE_FIELDS_LEN and NOTE_BYTES_LEN", + ); // Automatically inject the header field if it's not present let (header_field_name, _) = if let Some(existing_header) = From 6f3c58409490b7257c234d40415d536e3d307387 Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 12 Jul 2024 16:39:51 +0000 Subject: [PATCH 4/8] removed legacy flag from boxes --- boxes/boxes/react/package.json | 2 +- boxes/boxes/vanilla/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boxes/boxes/react/package.json b/boxes/boxes/react/package.json index ddf98a6fef8..8e574163eb5 100644 --- a/boxes/boxes/react/package.json +++ b/boxes/boxes/react/package.json @@ -6,7 +6,7 @@ "type": "module", "main": "./dist/index.js", "scripts": { - "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile --use-legacy --silence-warnings", + "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile --silence-warnings", "codegen": "${AZTEC_BUILDER:-aztec-builder} codegen src/contracts/target -o artifacts", "clean": "rm -rf ./dist .tsbuildinfo ./artifacts ./src/contracts/target", "prep": "yarn clean && yarn compile && yarn codegen", diff --git a/boxes/boxes/vanilla/package.json b/boxes/boxes/vanilla/package.json index f590df2b6d3..4a1edf8abe5 100644 --- a/boxes/boxes/vanilla/package.json +++ b/boxes/boxes/vanilla/package.json @@ -5,7 +5,7 @@ "version": "0.1.0", "type": "module", "scripts": { - "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile --use-legacy --silence-warnings", + "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compilev --silence-warnings", "codegen": "${AZTEC_BUILDER:-aztec-builder} codegen src/contracts/target -o artifacts", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts ./src/contracts/target", "prep": "yarn clean && yarn compile && yarn codegen && tsc -b", From 3db4479f3584f6468ccb40625b239b4e296cd807 Mon Sep 17 00:00:00 2001 From: Gregorio Juliana Date: Mon, 15 Jul 2024 15:10:22 +0200 Subject: [PATCH 5/8] Update boxes/boxes/vanilla/package.json Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> --- boxes/boxes/vanilla/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boxes/boxes/vanilla/package.json b/boxes/boxes/vanilla/package.json index 4a1edf8abe5..045d0e976fa 100644 --- a/boxes/boxes/vanilla/package.json +++ b/boxes/boxes/vanilla/package.json @@ -5,7 +5,7 @@ "version": "0.1.0", "type": "module", "scripts": { - "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compilev --silence-warnings", + "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile --silence-warnings", "codegen": "${AZTEC_BUILDER:-aztec-builder} codegen src/contracts/target -o artifacts", "clean": "rm -rf ./dest .tsbuildinfo ./artifacts ./src/contracts/target", "prep": "yarn clean && yarn compile && yarn codegen && tsc -b", From aabcc05a644c827567463342c6398f28701b0cdf Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 16 Jul 2024 08:39:41 +0000 Subject: [PATCH 6/8] offline selector computation --- .../src/transforms/contract_interface.rs | 67 ++++++++++--------- .../aztec_macros/src/utils/constants.rs | 1 - 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs b/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs index e79cee66407..f0aa946c238 100644 --- a/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs +++ b/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs @@ -1,15 +1,18 @@ +use acvm::acir::AcirField; + use noirc_errors::Location; use noirc_frontend::ast::{Ident, NoirFunction, UnresolvedTypeData}; use noirc_frontend::{ graph::CrateId, - macros_api::{FileId, HirContext, HirExpression, HirLiteral, HirStatement}, + macros_api::{FieldElement, FileId, HirContext, HirExpression, HirLiteral, HirStatement}, parse_program, parser::SortedModule, Type, }; +use tiny_keccak::{Hasher, Keccak}; + use crate::utils::{ - constants::SELECTOR_PLACEHOLDER, errors::AztecMacroError, hir_utils::{collect_crate_structs, get_contract_module_data, signature_of_type}, }; @@ -64,11 +67,6 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call .join(", "); let fn_return_type: noirc_frontend::ast::UnresolvedType = func.return_type(); - let fn_selector = format!( - "dep::aztec::protocol_types::abis::function_selector::FunctionSelector::from_signature(\"{}\")", - SELECTOR_PLACEHOLDER - ); - let parameters = func.parameters(); let is_void = if matches!(fn_return_type.typ, UnresolvedTypeData::Unit) { "Void" } else { "" }; let is_static = if is_static_call { "Static" } else { "" }; @@ -160,7 +158,7 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call let fn_body = format!( "{} - let selector = {}; + let selector = dep::aztec::protocol_types::abis::function_selector::FunctionSelector::from_field(0); dep::aztec::context::{}{}{}CallInterface {{ target_contract: self.target_contract, selector, @@ -172,7 +170,6 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call {} }}", args, - fn_selector, aztec_visibility, is_static, is_void, @@ -291,27 +288,34 @@ pub fn generate_contract_interface( Ok(()) } -fn compute_fn_signature(fn_name: &str, parameters: &[Type]) -> String { - format!( +fn compute_fn_signature_hash(fn_name: &str, parameters: &[Type]) -> u32 { + let signature = format!( "{}({})", fn_name, parameters.iter().map(signature_of_type).collect::>().join(",") - ) + ); + let mut keccak = Keccak::v256(); + let mut result = [0u8; 32]; + keccak.update(signature.as_bytes()); + keccak.finalize(&mut result); + // Take the first 4 bytes of the hash and convert them to an integer + // If you change the following value you have to change NUM_BYTES_PER_NOTE_TYPE_ID in l1_note_payload.ts as well + let num_bytes_per_note_type_id = 4; + u32::from_be_bytes(result[0..num_bytes_per_note_type_id].try_into().unwrap()) } // Updates the function signatures in the contract interface with the actual ones, replacing the placeholder. -// This is done by locating the contract interface struct, its functions (stubs) and assuming the last statement of each -// is the constructor for a CallInterface. This constructor has a selector field that holds a -// FunctionSelector::from_signature function that receives the signature as a string literal. +// This is done by locating the contract interface struct, its functions (stubs) and assuming the second to last statement of each +// is a let statement initializing the selector with a FunctionSelector::from_field call. pub fn update_fn_signatures_in_contract_interface( crate_id: &CrateId, context: &mut HirContext, ) -> Result<(), (AztecMacroError, FileId)> { - if let Some((name, _, file_id)) = get_contract_module_data(context, crate_id) { + if let Some((struct_name, _, file_id)) = get_contract_module_data(context, crate_id) { let maybe_interface_struct = collect_crate_structs(crate_id, context).iter().find_map(|struct_id| { let r#struct = context.def_interner.get_struct(*struct_id); - if r#struct.borrow().name.0.contents == name { + if r#struct.borrow().name.0.contents == struct_name { Some(r#struct) } else { None @@ -329,7 +333,7 @@ pub fn update_fn_signatures_in_contract_interface( continue; } - let fn_signature = compute_fn_signature( + let fn_signature_hash = compute_fn_signature_hash( name, &fn_parameters .iter() @@ -381,14 +385,12 @@ pub fn update_fn_signatures_in_contract_interface( context.def_interner.expression(¤t_fn_signature_expression_id); match current_fn_signature_expression { - HirExpression::Literal(HirLiteral::Str(signature)) => { - if signature != SELECTOR_PLACEHOLDER { + HirExpression::Literal(HirLiteral::Integer(value, _)) => { + if !value.is_zero() { Err(( AztecMacroError::CouldNotGenerateContractInterface { secondary_message: Some(format!( - "Function signature argument must be a placeholder: {}", - SELECTOR_PLACEHOLDER - )), + "Function signature argument must be a placeholder with value 0")), }, file_id, )) @@ -397,20 +399,25 @@ pub fn update_fn_signatures_in_contract_interface( } } _ => Err(( - AztecMacroError::CouldNotAssignStorageSlots { + AztecMacroError::CouldNotGenerateContractInterface { secondary_message: Some( - "Function signature argument must be a literal string".to_string(), + "Function signature argument must be a literal field element" + .to_string(), ), }, file_id, )), }?; - context - .def_interner - .update_expression(current_fn_signature_expression_id, |expr| { - *expr = HirExpression::Literal(HirLiteral::Str(fn_signature)) - }); + context.def_interner.update_expression( + current_fn_signature_expression_id, + |expr| { + *expr = HirExpression::Literal(HirLiteral::Integer( + FieldElement::from(fn_signature_hash as u128), + false, + )) + }, + ); } } } diff --git a/noir/noir-repo/aztec_macros/src/utils/constants.rs b/noir/noir-repo/aztec_macros/src/utils/constants.rs index 6bbc5c96dfa..3e93b2aa545 100644 --- a/noir/noir-repo/aztec_macros/src/utils/constants.rs +++ b/noir/noir-repo/aztec_macros/src/utils/constants.rs @@ -1,3 +1,2 @@ pub const FUNCTION_TREE_HEIGHT: u32 = 5; pub const MAX_CONTRACT_PRIVATE_FUNCTIONS: usize = 2_usize.pow(FUNCTION_TREE_HEIGHT); -pub const SELECTOR_PLACEHOLDER: &str = ""; From edd3ef6b123efe4b8a280f171f8a11ee805577d4 Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 16 Jul 2024 08:50:42 +0000 Subject: [PATCH 7/8] fix --- .../aztec_macros/src/transforms/contract_interface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs b/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs index f0aa946c238..56107de77c5 100644 --- a/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs +++ b/noir/noir-repo/aztec_macros/src/transforms/contract_interface.rs @@ -389,8 +389,8 @@ pub fn update_fn_signatures_in_contract_interface( if !value.is_zero() { Err(( AztecMacroError::CouldNotGenerateContractInterface { - secondary_message: Some(format!( - "Function signature argument must be a placeholder with value 0")), + secondary_message: Some( + "Function signature argument must be a placeholder with value 0".to_string()), }, file_id, )) From 0ce48b86fab8746f62e4cacae8c4ba5d7c3de5ab Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 16 Jul 2024 12:54:19 +0000 Subject: [PATCH 8/8] updated assertions --- .../src/e2e_blacklist_token_contract/access_control.test.ts | 4 ++-- .../end-to-end/src/e2e_blacklist_token_contract/burn.test.ts | 4 ++-- .../src/e2e_blacklist_token_contract/minting.test.ts | 4 ++-- .../src/e2e_blacklist_token_contract/shielding.test.ts | 2 +- .../src/e2e_blacklist_token_contract/transfer_private.test.ts | 4 ++-- .../src/e2e_blacklist_token_contract/transfer_public.test.ts | 4 ++-- .../src/e2e_blacklist_token_contract/unshielding.test.ts | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts index 4c1400caffe..5167717d5b3 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts @@ -73,14 +73,14 @@ describe('e2e_blacklist_token_contract access control', () => { const newRole = new Role().withAdmin().withAdmin(); await expect( t.asset.withWallet(t.other).methods.update_roles(AztecAddress.random(), newRole.toNoirStruct()).prove(), - ).rejects.toThrow("Assertion failed: caller is not admin 'caller_roles.is_admin'"); + ).rejects.toThrow(/Assertion failed: caller is not admin .*/); }); it('revoke minter from non admin', async () => { const noRole = new Role(); await expect( t.asset.withWallet(t.other).methods.update_roles(t.admin.getAddress(), noRole.toNoirStruct()).prove(), - ).rejects.toThrow("Assertion failed: caller is not admin 'caller_roles.is_admin'"); + ).rejects.toThrow(/Assertion failed: caller is not admin .*/); }); }); }); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts index 6c6d95ab7be..bd77461fa84 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts @@ -112,7 +112,7 @@ describe('e2e_blacklist_token_contract burn', () => { it('burn from blacklisted account', async () => { await expect(asset.methods.burn_public(blacklisted.getAddress(), 1n, 0).prove()).rejects.toThrow( - "Assertion failed: Blacklisted: Sender '!from_roles.is_blacklisted'", + /Assertion failed: Blacklisted: Sender/, ); }); }); @@ -224,7 +224,7 @@ describe('e2e_blacklist_token_contract burn', () => { it('burn from blacklisted account', async () => { await expect(asset.methods.burn(blacklisted.getAddress(), 1n, 0).prove()).rejects.toThrow( - "Assertion failed: Blacklisted: Sender '!from_roles.is_blacklisted'", + /Assertion failed: Blacklisted: Sender .*/, ); }); }); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts index b3b7eef247d..6c7d700364c 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts @@ -67,7 +67,7 @@ describe('e2e_blacklist_token_contract mint', () => { it('mint to blacklisted entity', async () => { await expect( asset.withWallet(wallets[1]).methods.mint_public(blacklisted.getAddress(), 1n).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Recipient '!to_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Recipient/); }); }); }); @@ -139,7 +139,7 @@ describe('e2e_blacklist_token_contract mint', () => { it('mint and try to redeem at blacklist', async () => { await expect(asset.methods.redeem_shield(blacklisted.getAddress(), amount, secret).prove()).rejects.toThrow( - "Assertion failed: Blacklisted: Recipient '!to_roles.is_blacklisted'", + /Assertion failed: Blacklisted: Recipient .*/, ); }); }); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts index 8898eb47798..de9a3e1529d 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts @@ -135,7 +135,7 @@ describe('e2e_blacklist_token_contract shield + redeem_shield', () => { it('shielding from blacklisted account', async () => { await expect( asset.withWallet(blacklisted).methods.shield(blacklisted.getAddress(), 1n, secretHash, 0).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Sender '!from_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Sender .*/); }); }); }); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts index 75f8c919bad..88c74d23676 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts @@ -170,13 +170,13 @@ describe('e2e_blacklist_token_contract transfer private', () => { it('transfer from a blacklisted account', async () => { await expect( asset.methods.transfer(blacklisted.getAddress(), wallets[0].getAddress(), 1n, 0).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Sender '!from_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Sender .*/); }); it('transfer to a blacklisted account', async () => { await expect( asset.methods.transfer(wallets[0].getAddress(), blacklisted.getAddress(), 1n, 0).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Recipient '!to_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Recipient .*/); }); }); }); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts index b1854b7677b..58d2d762fa2 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts @@ -153,13 +153,13 @@ describe('e2e_blacklist_token_contract transfer public', () => { it('transfer from a blacklisted account', async () => { await expect( asset.methods.transfer_public(blacklisted.getAddress(), wallets[0].getAddress(), 1n, 0n).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Sender '!from_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Sender .*/); }); it('transfer to a blacklisted account', async () => { await expect( asset.methods.transfer_public(wallets[0].getAddress(), blacklisted.getAddress(), 1n, 0n).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Recipient '!to_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Recipient .*/); }); }); }); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts index 4d877859f53..f00aa0bdbbe 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts @@ -130,13 +130,13 @@ describe('e2e_blacklist_token_contract unshielding', () => { it('unshield from blacklisted account', async () => { await expect( asset.methods.unshield(blacklisted.getAddress(), wallets[0].getAddress(), 1n, 0).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Sender '!from_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Sender .*/); }); it('unshield to blacklisted account', async () => { await expect( asset.methods.unshield(wallets[0].getAddress(), blacklisted.getAddress(), 1n, 0).prove(), - ).rejects.toThrow("Assertion failed: Blacklisted: Recipient '!to_roles.is_blacklisted'"); + ).rejects.toThrow(/Assertion failed: Blacklisted: Recipient .*/); }); }); });