Skip to content

Commit 7fe3a2a

Browse files
authored
chore: Accumulated backports to v4-next (#23291)
BEGIN_COMMIT_OVERRIDE feat(txe): add oracle versioning for test environment (#23285) feat: add basic gas settings to testenv (#23289) END_COMMIT_OVERRIDE
2 parents 8c30060 + adb656c commit 7fe3a2a

18 files changed

Lines changed: 716 additions & 77 deletions

File tree

docs/docs-developers/docs/aztec-nr/testing_contracts.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ aztec test
4141
2. Run `aztec test`
4242

4343
:::warning
44-
Always use `aztec test` instead of `nargo test`. The `TestEnvironment` requires the TXE (Test eXecution Environment) oracle resolver.
44+
Always use `aztec test` instead of `nargo test`. The `TestEnvironment` requires the test environment oracle resolver provided by the `aztec` CLI.
4545
:::
4646

4747
## Basic test structure
@@ -348,3 +348,25 @@ unconstrained fn test_missing_authwit() {
348348
}
349349

350350
```
351+
352+
## Test environment oracle versioning
353+
354+
The test environment uses an oracle interface to communicate between your Noir test code and the `aztec test` CLI. This interface is versioned so that mismatches between the Aztec.nr dependency used to compile the test and the CLI version are detected automatically.
355+
356+
The version uses two components, `major.minor`, with the same compatibility rules as [PXE oracle versioning](../foundational-topics/pxe/index.md#oracle-versioning):
357+
358+
- **`major`** must match exactly. A major bump means oracles were removed or had their signatures changed, and a test environment on a different major cannot safely run the test.
359+
- **`minor`** indicates additive changes (new oracles). The test environment uses a best-effort approach: a test compiled against a higher `minor` is still allowed to run, and an error is only thrown if the test actually invokes an oracle the test environment does not know about.
360+
361+
### Resolving a version mismatch
362+
363+
If you see an error like _"Incompatible test environment version: The test was compiled with a newer version of Aztec.nr than your test environment supports"_, the test uses oracles from a newer Aztec.nr than your `aztec test` CLI supports.
364+
365+
To fix it, make sure your `aztec` CLI version and the `aztec` dependency in the test crate's `Nargo.toml` are on the same release. Note that the test crate's Aztec.nr version can differ from the contract crate's version, depending on your project configuration. For example, if your CLI is on `v4.3.0`, the test crate's `Nargo.toml` should reference the matching tag:
366+
367+
```toml
368+
[dependencies]
369+
aztec = { git="https://github.com/AztecProtocol/aztec-nr", tag="v4.3.0", directory="aztec" }
370+
```
371+
372+
If the test environment reports a version that _should_ include every oracle the test needs but an oracle is still missing, this is likely a bug rather than a version problem.

docs/netlify.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,3 +818,13 @@
818818
# PXE: cross-contract utility call denied by execution hook
819819
from = "/errors/11"
820820
to = "/developers/docs/aztec-nr/debugging#cross-contract-utility-call-denied"
821+
822+
[[redirects]]
823+
# Incompatible oracle version between test and test environment
824+
from = "/errors/12"
825+
to = "/developers/docs/aztec-nr/testing_contracts#test-environment-oracle-versioning"
826+
827+
[[redirects]]
828+
# Unexpected error: how to report issues
829+
from = "/errors/13"
830+
to = "/developers/docs/aztec-nr/debugging#reporting-issues"

0 commit comments

Comments
 (0)