Skip to content

Commit c2f0a92

Browse files
authored
chore: Accumulated backports to v4-next (#22416)
BEGIN_COMMIT_OVERRIDE feat(e2e): support running tests against legacy noir contract artifacts (#22388) chore: deflake p2p client test (#22385) fix: pass additionalScopes to executeUtility (#22411) fix(docs): backport PR #22419 — update networks page for Alpha phase, fix contract addresses and unstaking delay (#22424) chore: Reduce logging verbosity (#22423) END_COMMIT_OVERRIDE
2 parents 4108466 + b1e411e commit c2f0a92

File tree

24 files changed

+427
-89
lines changed

24 files changed

+427
-89
lines changed

docs/docs-developers/docs/foundational-topics/pxe/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,25 @@ The keystore securely stores cryptographic keys for registered accounts, includi
8787

8888
Oracles are pieces of data that are injected into a smart contract function from the client side. Learn more about [how oracles work](../../aztec-nr/framework-description/advanced/protocol_oracles.md).
8989

90+
## Oracle versioning
91+
92+
The set of oracles that the PXE exposes to private and utility functions is versioned, so that contracts can declare which oracles they expect to be available. Every contract compiled with `Aztec.nr` records the oracle version it was built against, and the PXE checks this version before executing any oracle call.
93+
94+
The version uses two components, `major.minor`, with the following compatibility rules:
95+
96+
- **`major`** must match exactly. A major bump is a breaking change — oracles were removed or their signatures changed — and a PXE on a different major cannot safely run the contract.
97+
- **`minor`** indicates additive changes (new oracles). The PXE uses a best-effort approach here: a contract compiled against a higher `minor` than the PXE supports is still allowed to run, and an error is only thrown if the contract actually invokes an oracle the PXE does not know about. In practice, a contract built with a newer Aztec.nr may not use any of the newly added oracles at all, in which case it runs fine on an older PXE.
98+
99+
The canonical version constants live in the PXE (`ORACLE_VERSION_MAJOR` / `ORACLE_VERSION_MINOR` in `yarn-project/pxe/src/oracle_version.ts`) and in Aztec.nr (`noir-projects/aztec-nr/aztec/src/oracle/version.nr`). The two are kept in lockstep as part of each release.
100+
101+
### Resolving a version mismatch
102+
103+
If you see an error like _"Oracle '…' not found. … The contract was compiled with Aztec.nr oracle version X.Y, but this private execution environment only supports up to A.B"_, the contract uses one or more oracles from a newer Aztec.nr than your PXE supports.
104+
105+
To fix it, upgrade the software that ships the PXE (sandbox, wallet, or whatever embeds `@aztec/pxe`) to a release whose Aztec.nr version is at least as new as the one the contract was compiled with.
106+
107+
If the PXE reports a version that _should_ include every oracle the contract needs but an oracle is still missing, that is a contract bug rather than a version problem and you should likely report it to the app developer.
108+
90109
## For developers
91110

92111
To learn how to develop on top of the PXE, refer to these guides:

docs/docs-participate/token/staking.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,18 @@ Slashing is managed through governance voting based on evidence collected both o
5656

5757
## Unstaking
5858

59-
When you want to withdraw your staked tokens, you must go through an unstaking process with a mandatory exit delay.
59+
When you want to withdraw your staked tokens, you must go through an unstaking process with mandatory delays.
6060

61-
#if(testnet)
62-
The exit delay for testnet is **2 days**.
63-
#else
64-
The exit delay for mainnet is **4 days**.
65-
#endif
61+
### Exit Delays
6662

67-
The exit delay exists to allow time for pending slashing conditions to be detected and to prevent validators from quickly exiting after misbehaving.
63+
| Delay Type | Alpha (Mainnet) | Testnet |
64+
|-----------|-----------------|---------|
65+
| **Staking Exit Delay** | 4 days | 2 days |
66+
| **Governance Withdrawal Delay** | ~38 days | ~1.6 days |
67+
68+
The **staking exit delay** is the minimum time after initiating withdrawal before you can claim your tokens. It allows time for pending slashing conditions to be detected.
69+
70+
If your tokens are deposited in the Governance Staking Escrow (GSE) for voting, the **governance withdrawal delay** also applies. This delay is calculated as `votingDelay/5 + votingDuration + executionDelay` to ensure voted-on proposals can be executed before voters exit. On mainnet this is approximately 38 days (0.6 + 7 + 30 days).
6871

6972
### How to Unstake
7073

docs/docs/networks.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ Not sure which network to use? Jump to our [Network Selection Guide](#network-se
4343
| **Fee Asset Handler** | N/A | [`0x5602c39a6e9c5ace589f64f754927bcda4f4bfc9`](https://sepolia.etherscan.io/address/0x5602c39a6e9c5ace589f64f754927bcda4f4bfc9) |
4444
| **Coin Issuer** | [`0x02fadf157d551aa6d761b2a2237d03af68e41ca6`](https://etherscan.io/address/0x02fadf157d551aa6d761b2a2237d03af68e41ca6) | [`0xe05d0a62045b4237556c1ec423e59eea9a24eaee`](https://sepolia.etherscan.io/address/0xe05d0a62045b4237556c1ec423e59eea9a24eaee) |
4545
| **Reward Distributor** | [`0x3d6a1b00c830c5f278fc5dfb3f6ff0b74db6dfe0`](https://etherscan.io/address/0x3d6a1b00c830c5f278fc5dfb3f6ff0b74db6dfe0) | [`0x030d2780e70f085c31d490268d3900d4cea16606`](https://sepolia.etherscan.io/address/0x030d2780e70f085c31d490268d3900d4cea16606) |
46-
| **Reward Booster** | [`0x7101a6703491a4d808aeabe9f62bc1dc6a20bdf4`](https://etherscan.io/address/0x7101a6703491a4d808aeabe9f62bc1dc6a20bdf4) | [`0x49711056D1EaDcDD3F2eF676DC8EA3F924fB916c`](https://sepolia.etherscan.io/address/0x49711056D1EaDcDD3F2eF676DC8EA3F924fB916c) |
46+
| **Reward Booster** | [`0x1cbb707bd7b4fd2bced6d96d84372fb428e93d80`](https://etherscan.io/address/0x1cbb707bd7b4fd2bced6d96d84372fb428e93d80) | [`0x49711056D1EaDcDD3F2eF676DC8EA3F924fB916c`](https://sepolia.etherscan.io/address/0x49711056D1EaDcDD3F2eF676DC8EA3F924fB916c) |
4747
| **Governance Proposer** | [`0x06ef1dcf87e419c48b94a331b252819fadbd63ef`](https://etherscan.io/address/0x06ef1dcf87e419c48b94a331b252819fadbd63ef) | [`0x01c7d4ca153748d2377968fef22894cb162e9480`](https://sepolia.etherscan.io/address/0x01c7d4ca153748d2377968fef22894cb162e9480) |
4848
| **Governance** | [`0x1102471eb3378fee427121c9efcea452e4b6b75e`](https://etherscan.io/address/0x1102471eb3378fee427121c9efcea452e4b6b75e) | [`0xcaf7447721447b22cd0076ac7c63877c3afd329f`](https://sepolia.etherscan.io/address/0xcaf7447721447b22cd0076ac7c63877c3afd329f) |
4949
| **Governance Staking Escrow** | [`0xa92ecfd0e70c9cd5e5cd76c50af0f7da93567a4f`](https://etherscan.io/address/0xa92ecfd0e70c9cd5e5cd76c50af0f7da93567a4f) | [`0xb6a38a51a6c1de9012f9d8ea9745ef957212eaac`](https://sepolia.etherscan.io/address/0xb6a38a51a6c1de9012f9d8ea9745ef957212eaac) |
5050
| **Staking Registry** | [`0x042dF8f42790d6943F41C25C2132400fd727f452`](https://etherscan.io/address/0x042dF8f42790d6943F41C25C2132400fd727f452) | [`0xC6EcC1832c8BF6a41c927BEb4E9ec610FBeDd1C2`](https://sepolia.etherscan.io/address/0xC6EcC1832c8BF6a41c927BEb4E9ec610FBeDd1C2) |
5151
| **Slash Factory** | N/A | [`0x9CF4a0094c8696d5110dd0f0cF3FA5deA174BB17`](https://sepolia.etherscan.io/address/0x9CF4a0094c8696d5110dd0f0cF3FA5deA174BB17) |
52-
| **Slasher** | [`0x91a3745c685c220595b997e53311ebf660144889`](https://etherscan.io/address/0x91a3745c685c220595b997e53311ebf660144889) | [`0xf6D0D42aCE06829bECB78C74F49879528fC632c1`](https://sepolia.etherscan.io/address/0xf6D0D42aCE06829bECB78C74F49879528fC632c1) |
53-
| **Tally Slashing Proposer** | [`0x7a318c3daa9f21f8fc8238c65755eb0394fbf189`](https://etherscan.io/address/0x7a318c3daa9f21f8fc8238c65755eb0394fbf189) | [`0x158eCC4B24675dc399031c7D144786e3da2060A8`](https://sepolia.etherscan.io/address/0x158eCC4B24675dc399031c7D144786e3da2060A8) |
54-
| **Honk Verifier** | N/A | [`0x800FbC88054ba6c228B7d822F1DCAf4d627E8F97`](https://sepolia.etherscan.io/address/0x800FbC88054ba6c228B7d822F1DCAf4d627E8F97) |
52+
| **Slasher** | [`0x64E6e9Bb9f1E33D319578B9f8a9C719Ca6D46eBb`](https://etherscan.io/address/0x64E6e9Bb9f1E33D319578B9f8a9C719Ca6D46eBb) | [`0xCF750B724558098E5db67B651f03a31AE2b252f4`](https://sepolia.etherscan.io/address/0xCF750B724558098E5db67B651f03a31AE2b252f4) |
53+
| **Tally Slashing Proposer** | [`0xa4a38fD0108C00983E75616b638Ff3321FD26958`](https://etherscan.io/address/0xa4a38fD0108C00983E75616b638Ff3321FD26958) | [`0x158eCC4B24675dc399031c7D144786e3da2060A8`](https://sepolia.etherscan.io/address/0x158eCC4B24675dc399031c7D144786e3da2060A8) |
54+
| **Honk Verifier** | [`0x70aedda427f26480d240bc0f4308cedec8d31348`](https://etherscan.io/address/0x70aedda427f26480d240bc0f4308cedec8d31348) | [`0x800FbC88054ba6c228B7d822F1DCAf4d627E8F97`](https://sepolia.etherscan.io/address/0x800FbC88054ba6c228B7d822F1DCAf4d627E8F97) |
5555
| **Register New Rollup Version Payload** | N/A | [`0x11f7Ab2324CA94af929A388477a7959E0108C3d6`](https://sepolia.etherscan.io/address/0x11f7Ab2324CA94af929A388477a7959E0108C3d6) |
56-
| **Slash Payload Cloneable** | N/A | [`0xe66d9eeBfF5490E6bfA263cF08028dE7d265321F`](https://sepolia.etherscan.io/address/0xe66d9eeBfF5490E6bfA263cF08028dE7d265321F) |
56+
| **Slash Payload Cloneable** | [`0xAA43220b7eb7c8Ffe75bc9C483f3C07b0a55B445`](https://etherscan.io/address/0xAA43220b7eb7c8Ffe75bc9C483f3C07b0a55B445) | [`0xe66d9eeBfF5490E6bfA263cF08028dE7d265321F`](https://sepolia.etherscan.io/address/0xe66d9eeBfF5490E6bfA263cF08028dE7d265321F) |
5757

5858
### L2 Contract Addresses
5959

docs/netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@
802802
[[redirects]]
803803
# PXE: incompatible oracle version between contract and PXE
804804
from = "/errors/8"
805-
to = "/developers/docs/foundational-topics/pxe"
805+
to = "/developers/docs/foundational-topics/pxe#oracle-versioning"
806806

807807
[[redirects]]
808808
# CLI: aztec dep version in Nargo.toml does not match the CLI version
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
/// The ORACLE_VERSION constant is used to check that the oracle interface is in sync between PXE and Aztec.nr. We need
2-
/// to version the oracle interface to ensure that developers get a reasonable error message if they use incompatible
3-
/// versions of Aztec.nr and PXE. The TypeScript counterpart is in `oracle_version.ts`.
1+
/// The oracle version constants are used to check that the oracle interface is in sync between PXE and Aztec.nr.
2+
/// We version the oracle interface as `major.minor` where:
3+
/// - `major` = backward-breaking changes (must match exactly between PXE and Aztec.nr)
4+
/// - `minor` = oracle additions (non-breaking; PXE minor >= contract minor)
5+
///
6+
/// The TypeScript counterparts are in `oracle_version.ts`.
47
///
58
/// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is
6-
/// called and if the oracle version is incompatible an error is thrown.
7-
pub global ORACLE_VERSION: Field = 22;
9+
/// called. If the major version is incompatible, an error is thrown immediately. The minor version is recorded by
10+
/// the PXE and used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw
11+
/// immediately if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency
12+
/// without actually using any of the new oracles then there is no reason to throw.
13+
pub global ORACLE_VERSION_MAJOR: Field = 22;
14+
pub global ORACLE_VERSION_MINOR: Field = 0;
815

916
/// Asserts that the version of the oracle is compatible with the version expected by the contract.
1017
pub fn assert_compatible_oracle_version() {
@@ -16,23 +23,23 @@ pub fn assert_compatible_oracle_version() {
1623
}
1724

1825
unconstrained fn assert_compatible_oracle_version_wrapper() {
19-
assert_compatible_oracle_version_oracle(ORACLE_VERSION);
26+
assert_compatible_oracle_version_oracle(ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR);
2027
}
2128

22-
#[oracle(aztec_utl_assertCompatibleOracleVersion)]
23-
unconstrained fn assert_compatible_oracle_version_oracle(version: Field) {}
29+
#[oracle(aztec_utl_assertCompatibleOracleVersionV2)]
30+
unconstrained fn assert_compatible_oracle_version_oracle(major: Field, minor: Field) {}
2431

2532
mod test {
26-
use super::{assert_compatible_oracle_version_oracle, ORACLE_VERSION};
33+
use super::{assert_compatible_oracle_version_oracle, ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR};
2734

2835
#[test]
2936
unconstrained fn compatible_oracle_version() {
30-
assert_compatible_oracle_version_oracle(ORACLE_VERSION);
37+
assert_compatible_oracle_version_oracle(ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR);
3138
}
3239

3340
#[test(should_fail_with = "Incompatible aztec cli version:")]
34-
unconstrained fn incompatible_oracle_version() {
35-
let arbitrary_incorrect_version = 318183437;
36-
assert_compatible_oracle_version_oracle(arbitrary_incorrect_version);
41+
unconstrained fn incompatible_oracle_version_major() {
42+
let arbitrary_incorrect_major = 318183437;
43+
assert_compatible_oracle_version_oracle(arbitrary_incorrect_major, ORACLE_VERSION_MINOR);
3744
}
3845
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use crate::{oracle::version::ORACLE_VERSION, test::helpers::test_environment::TestEnvironment};
1+
use crate::{
2+
oracle::version::{ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR},
3+
test::helpers::test_environment::TestEnvironment,
4+
};
25
use std::test::OracleMock;
36

47
#[test]
@@ -39,10 +42,10 @@ unconstrained fn private_public_and_utility_context_share_default_chain_id() {
3942

4043
#[test]
4144
unconstrained fn oracle_version_is_checked_upon_env_creation() {
42-
let mock = OracleMock::mock("aztec_utl_assertCompatibleOracleVersion");
45+
let mock = OracleMock::mock("aztec_utl_assertCompatibleOracleVersionV2");
4346

4447
let _env = TestEnvironment::new();
4548

4649
assert_eq(mock.times_called(), 1);
47-
assert_eq(mock.get_last_params::<Field>(), ORACLE_VERSION);
50+
assert_eq(mock.get_last_params::<(Field, Field)>(), (ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR));
4851
}
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
/// The ORACLE_VERSION constant is used to check that the oracle interface is in sync between PXE and Aztec.nr. We need
2-
/// to version the oracle interface to ensure that developers get a reasonable error message if they use incompatible
3-
/// versions of Aztec.nr and PXE. The TypeScript counterpart is in `oracle_version.ts`.
1+
/// The oracle version constants are used to check that the oracle interface is in sync between PXE and Aztec.nr.
2+
/// We version the oracle interface as `major.minor` where:
3+
/// - `major` = backward-breaking changes (must match exactly between PXE and Aztec.nr)
4+
/// - `minor` = oracle additions (non-breaking; PXE minor >= contract minor)
5+
///
6+
/// The TypeScript counterparts are in `oracle_version.ts`.
47
///
58
/// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is
6-
/// called and if the oracle version is incompatible an error is thrown.
7-
pub global ORACLE_VERSION: Field = 21;
9+
/// called. If the major version is incompatible, an error is thrown immediately. The minor version is recorded by
10+
/// the PXE and used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw
11+
/// immediately if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency
12+
/// without actually using any of the new oracles then there is no reason to throw.
13+
pub global ORACLE_VERSION_MAJOR: Field = 22;
14+
pub global ORACLE_VERSION_MINOR: Field = 0;
815

916
/// Asserts that the version of the oracle is compatible with the version expected by the contract.
1017
pub fn assert_compatible_oracle_version() {
@@ -16,23 +23,23 @@ pub fn assert_compatible_oracle_version() {
1623
}
1724

1825
unconstrained fn assert_compatible_oracle_version_wrapper() {
19-
assert_compatible_oracle_version_oracle(ORACLE_VERSION);
26+
assert_compatible_oracle_version_oracle(ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR);
2027
}
2128

22-
#[oracle(aztec_utl_assertCompatibleOracleVersion)]
23-
unconstrained fn assert_compatible_oracle_version_oracle(version: Field) {}
29+
#[oracle(aztec_utl_assertCompatibleOracleVersionV2)]
30+
unconstrained fn assert_compatible_oracle_version_oracle(major: Field, minor: Field) {}
2431

2532
mod test {
26-
use super::{assert_compatible_oracle_version_oracle, ORACLE_VERSION};
33+
use super::{assert_compatible_oracle_version_oracle, ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR};
2734

2835
#[test]
2936
unconstrained fn compatible_oracle_version() {
30-
assert_compatible_oracle_version_oracle(ORACLE_VERSION);
37+
assert_compatible_oracle_version_oracle(ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR);
3138
}
3239

3340
#[test(should_fail_with = "Incompatible aztec cli version:")]
34-
unconstrained fn incompatible_oracle_version() {
35-
let arbitrary_incorrect_version = 318183437;
36-
assert_compatible_oracle_version_oracle(arbitrary_incorrect_version);
41+
unconstrained fn incompatible_oracle_version_major() {
42+
let arbitrary_incorrect_major = 318183437;
43+
assert_compatible_oracle_version_oracle(arbitrary_incorrect_major, ORACLE_VERSION_MINOR);
3744
}
3845
}

yarn-project/aztec.js/src/contract/contract_function_interaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
130130
// docs:end:simulate
131131
if (this.functionDao.functionType == FunctionType.UTILITY) {
132132
const call = await this.getFunctionCall();
133+
const scopes = [...(options.additionalScopes ?? [])];
133134
const utilityResult = await this.wallet.executeUtility(call, {
134-
scopes: options.from === NO_FROM ? [] : [options.from],
135+
scopes: options.from === NO_FROM ? scopes : [options.from, ...scopes],
135136
authWitnesses: options.authWitnesses,
136137
});
137138

yarn-project/end-to-end/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ ultrahonk-bench-inputs
77
web/main.js*
88
consensys_web3signer_25.11.0
99
scripts/ha/postgres_data/
10+
.legacy-contracts/

yarn-project/end-to-end/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,30 @@ which will spawn the two processes.
2424
You can also run this by `docker-compose up` which will spawn 2 different containers for Anvil and the test runner.
2525

2626
You can run a single test by running `yarn test:compose <test_name>`.
27+
28+
## Running tests against legacy contract artifacts
29+
30+
To verify that contracts deployed from a previous release still work against the current stack, set
31+
`CONTRACT_ARTIFACTS_VERSION` to a published version of `@aztec/noir-contracts.js` / `@aztec/noir-test-contracts.js`:
32+
33+
```
34+
CONTRACT_ARTIFACTS_VERSION=4.1.3 yarn test:e2e src/e2e_amm.test.ts
35+
```
36+
37+
Only the JSON artifact files (`.../artifacts/*.json`) are redirected. The TypeScript wrapper classes
38+
(e.g. `TokenContract`) continue to load from the current workspace and use the current `@aztec/aztec.js` — so this
39+
exercises whether a deployed contract's ABI / bytecode / notes still work through the *new* client, not whether the
40+
legacy wrapper code still imports cleanly.
41+
42+
The first run downloads the pinned packages into `.legacy-contracts/<version>/node_modules/` (cached across runs). A
43+
startup banner and a per-redirect line are printed to stderr so you can confirm the legacy artifacts were actually
44+
loaded:
45+
46+
```
47+
[legacy-contracts][jest] CONTRACT_ARTIFACTS_VERSION=4.1.3
48+
[legacy-contracts][jest] redirecting @aztec/noir-contracts.js/artifacts/*.json -> .legacy-contracts/4.1.3/...
49+
[legacy-contracts][jest] redirected token_contract-Token.json -> /abs/.../.legacy-contracts/4.1.3/.../token_contract-Token.json
50+
```
51+
52+
When `CONTRACT_ARTIFACTS_VERSION` is unset the test run is byte-identical to the default behaviour. The cache is
53+
populated automatically on first use.

0 commit comments

Comments
 (0)