Skip to content

Commit 3456cfa

Browse files
committed
refactor(pxe)!: derive oracle interfaces from registry and introduce aztec_misc_ prefix (#23840)
(cherry picked from commit 585829d)
1 parent 3dd0b4f commit 3456cfa

25 files changed

Lines changed: 126 additions & 270 deletions

File tree

avm-transpiler/src/transpile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ fn handle_foreign_call(
563563
"aztec_avm_revert" => handle_revert(avm_instrs, destinations, inputs),
564564
"aztec_avm_storageRead" => handle_storage_read(avm_instrs, destinations, inputs),
565565
"aztec_avm_storageWrite" => handle_storage_write(avm_instrs, destinations, inputs),
566-
"aztec_utl_log" => handle_debug_log(avm_instrs, destinations, inputs),
566+
"aztec_misc_log" => handle_debug_log(avm_instrs, destinations, inputs),
567567
// Getters.
568568
_ if inputs.is_empty() && destinations.len() == 1 => {
569569
handle_getter_instruction(avm_instrs, function, destinations, inputs);
@@ -1341,7 +1341,7 @@ fn handle_debug_log(
13411341
) {
13421342
// We need to handle two flavors here:
13431343
//
1344-
// #[oracle(aztec_utl_log)]
1344+
// #[oracle(aztec_misc_log)]
13451345
// unconstrained fn log_oracle<let M: u32, let N: u32>(
13461346
// log_level: u8,
13471347
// msg: str<M>,
@@ -1351,7 +1351,7 @@ fn handle_debug_log(
13511351
//
13521352
// and
13531353
//
1354-
//#[oracle(aztec_utl_log)]
1354+
//#[oracle(aztec_misc_log)]
13551355
// unconstrained fn log_slice_oracle<let M: u32>(log_level: u8, msg: str<M>, args: [Field]) {}
13561356
//
13571357
// Luckily, these two flavors have both 4 arguments, since noir inserts a length field for slices before the slice.

noir-projects/aztec-nr/aztec/src/messages/encryption/aes128.nr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,10 @@ mod test {
504504

505505
// Mock random values for deterministic test
506506
let eph_sk = 0x1358d15019d4639393d62b97e1588c095957ce74a1c32d6ec7d62fe6705d9538;
507-
let _ = OracleMock::mock("aztec_utl_getRandomField").returns(eph_sk).times(1);
507+
let _ = OracleMock::mock("aztec_misc_getRandomField").returns(eph_sk).times(1);
508508

509509
let randomness = 0x0101010101010101010101010101010101010101010101010101010101010101;
510-
let _ = OracleMock::mock("aztec_utl_getRandomField").returns(randomness).times(1000000);
510+
let _ = OracleMock::mock("aztec_misc_getRandomField").returns(randomness).times(1000000);
511511

512512
// Encrypt the message
513513
let encrypted_message = BoundedVec::from_array(AES128::encrypt(plaintext, recipient, contract_address));

noir-projects/aztec-nr/aztec/src/messages/logs/utils.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mod test {
6565
let random_tag = 42;
6666
let _ = OracleMock::mock("aztec_prv_getSenderForTags").returns(Option::some(sender));
6767
let _ = OracleMock::mock("aztec_prv_getAppTaggingSecret").returns(Option::<Field>::none());
68-
let _ = OracleMock::mock("aztec_utl_getRandomField").returns(random_tag);
68+
let _ = OracleMock::mock("aztec_misc_getRandomField").returns(random_tag);
6969
assert_eq(compute_discovery_tag(recipient, Option::none()), random_tag);
7070
}
7171

noir-projects/aztec-nr/aztec/src/oracle/random.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ pub unconstrained fn random() -> Field {
66
rand_oracle()
77
}
88

9-
#[oracle(aztec_utl_getRandomField)]
9+
#[oracle(aztec_misc_getRandomField)]
1010
unconstrained fn rand_oracle() -> Field {}

noir-projects/aztec-nr/aztec/src/oracle/version.nr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
///
66
/// The TypeScript counterparts are in `oracle_version.ts`.
77
///
8-
/// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is
8+
/// @dev Whenever a contract function or Noir test is run, the `aztec_misc_assertCompatibleOracleVersion` oracle is
99
/// called. If the major version is incompatible, an error is thrown immediately. The minor version is recorded by
1010
/// the PXE and used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw
1111
/// immediately if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency
1212
/// without actually using any of the new oracles then there is no reason to throw.
13-
pub global ORACLE_VERSION_MAJOR: Field = 28;
13+
pub global ORACLE_VERSION_MAJOR: Field = 29;
1414
pub global ORACLE_VERSION_MINOR: Field = 0;
1515

1616
/// Asserts that the version of the oracle is compatible with the version expected by the contract.
@@ -26,7 +26,7 @@ unconstrained fn assert_compatible_oracle_version_wrapper() {
2626
assert_compatible_oracle_version_oracle(ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR);
2727
}
2828

29-
#[oracle(aztec_utl_assertCompatibleOracleVersion)]
29+
#[oracle(aztec_misc_assertCompatibleOracleVersion)]
3030
unconstrained fn assert_compatible_oracle_version_oracle(major: Field, minor: Field) {}
3131

3232
mod test {

noir-projects/aztec-nr/aztec/src/standard_addresses.nr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
use protocol_types::{address::AztecAddress, traits::FromField};
33

44
pub global STANDARD_AUTH_REGISTRY_ADDRESS: AztecAddress = AztecAddress::from_field(
5-
0x02d06fabf56d3b3efd3d6f804b515e716f05fbd0bce2ffdf2e2d50660b0c8641,
5+
0x2e1c8ae9471649da39ea42c4abb17ecb7028ae1e5e23bd35fd4251a69658a2e1,
66
);
77

88
pub global STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS: AztecAddress = AztecAddress::from_field(
9-
0x2dd1c425d31f2c38b0468ec3e09fcf4bd066b289bea69e9ec7b2f5cf32dd2bd7,
9+
0x0e169f6f6864aadf1eeafdef9af209f951f997f0b5187af191af7b271334aa20,
1010
);
1111

1212
pub global STANDARD_PUBLIC_CHECKS_ADDRESS: AztecAddress = AztecAddress::from_field(
13-
0x1a19f689c95f22ac9adf9dfc3ba634802c038b094f27bbc482bdbf0d33e70740,
13+
0x106479f2993a73b878821b4cd0098c9bd48164b32e9b567df009732dabaa65e2,
1414
);
1515

1616
pub global STANDARD_HANDSHAKE_REGISTRY_ADDRESS: AztecAddress = AztecAddress::from_field(
17-
0x20e98e7deb9b3d957a321b6ccd84df520322f0cf448643999fc4fbd84521d957,
17+
0x04ee9dc0b25d393c804ab6a6fc34223f3ca914a9a9043bdc6cd877efc9067383,
1818
);

noir-projects/aztec-nr/aztec/src/test/helpers/test_environment/test/misc.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ unconstrained fn private_public_and_utility_context_share_default_chain_id() {
4545

4646
#[test]
4747
unconstrained fn oracle_version_is_checked_upon_env_creation() {
48-
let mock = OracleMock::mock("aztec_utl_assertCompatibleOracleVersion");
48+
let mock = OracleMock::mock("aztec_misc_assertCompatibleOracleVersion");
4949

5050
let _env = TestEnvironment::new();
5151

noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/oracle/version.nr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
///
66
/// The TypeScript counterparts are in `oracle_version.ts`.
77
///
8-
/// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is
8+
/// @dev Whenever a contract function or Noir test is run, the `aztec_misc_assertCompatibleOracleVersion` oracle is
99
/// called. If the major version is incompatible, an error is thrown immediately. The minor version is recorded by
1010
/// the PXE and used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw
1111
/// immediately if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency
1212
/// without actually using any of the new oracles then there is no reason to throw.
13-
pub global ORACLE_VERSION_MAJOR: Field = 28;
13+
pub global ORACLE_VERSION_MAJOR: Field = 29;
1414
pub global ORACLE_VERSION_MINOR: Field = 0;
1515

1616
/// Asserts that the version of the oracle is compatible with the version expected by the contract.
@@ -26,7 +26,7 @@ unconstrained fn assert_compatible_oracle_version_wrapper() {
2626
assert_compatible_oracle_version_oracle(ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR);
2727
}
2828

29-
#[oracle(aztec_utl_assertCompatibleOracleVersion)]
29+
#[oracle(aztec_misc_assertCompatibleOracleVersion)]
3030
unconstrained fn assert_compatible_oracle_version_oracle(major: Field, minor: Field) {}
3131

3232
mod test {

noir-projects/noir-contracts/contracts/protocol/aztec_sublib/src/standard_addresses.nr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
use protocol_types::{address::AztecAddress, traits::FromField};
33

44
pub global STANDARD_AUTH_REGISTRY_ADDRESS: AztecAddress = AztecAddress::from_field(
5-
0x02d06fabf56d3b3efd3d6f804b515e716f05fbd0bce2ffdf2e2d50660b0c8641,
5+
0x2e1c8ae9471649da39ea42c4abb17ecb7028ae1e5e23bd35fd4251a69658a2e1,
66
);
77

88
pub global STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS: AztecAddress = AztecAddress::from_field(
9-
0x2dd1c425d31f2c38b0468ec3e09fcf4bd066b289bea69e9ec7b2f5cf32dd2bd7,
9+
0x0e169f6f6864aadf1eeafdef9af209f951f997f0b5187af191af7b271334aa20,
1010
);
1111

1212
pub global STANDARD_PUBLIC_CHECKS_ADDRESS: AztecAddress = AztecAddress::from_field(
13-
0x1a19f689c95f22ac9adf9dfc3ba634802c038b094f27bbc482bdbf0d33e70740,
13+
0x106479f2993a73b878821b4cd0098c9bd48164b32e9b567df009732dabaa65e2,
1414
);
1515

1616
pub global STANDARD_HANDSHAKE_REGISTRY_ADDRESS: AztecAddress = AztecAddress::from_field(
17-
0x20e98e7deb9b3d957a321b6ccd84df520322f0cf448643999fc4fbd84521d957,
17+
0x04ee9dc0b25d393c804ab6a6fc34223f3ca914a9a9043bdc6cd877efc9067383,
1818
);
1.45 KB
Binary file not shown.

0 commit comments

Comments
 (0)