Skip to content

Commit 4ffd56d

Browse files
authored
chore: Accumulated backports to v4-next (#22158)
BEGIN_COMMIT_OVERRIDE chore: backport - drop dead legacy oracle mappings (#22035) fix: backport timestamp and anvil fixes (#22110) fix(archiver): swallow error when rollup contract not yet finalized on L1 (#22156) END_COMMIT_OVERRIDE
2 parents 5152dd5 + 20899ce commit 4ffd56d

File tree

75 files changed

+811
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+811
-481
lines changed

docs/docs-developers/docs/aztec-js/how_to_pay_fees.md

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ This guide walks you through paying transaction fees on Aztec using various paym
2323
| Method | Use Case | Privacy | Requirements |
2424
| ------------------- | ----------------------------- | ------- | -------------------------- |
2525
| Fee Juice (default) | Account already has Fee Juice | Public | Funded account |
26-
#if(testnet)
27-
| Sponsored FPC | Testing, free transactions | Public | None (not on testnet) |
28-
#else
26+
#if(devnet)
2927
| Sponsored FPC | Testing, free transactions | Public | None |
28+
#else
29+
| Sponsored FPC | Testing, free transactions | Public | None (devnet and local only) |
3030
#endif
31-
| Private FPC | Pay with tokens privately | Private | Token balance, FPC address |
32-
| Public FPC | Pay with tokens publicly | Public | Token balance, FPC address |
3331
| Bridge + Claim | Bootstrap from L1 | Public | L1 ETH for gas |
3432

3533
## Mana and Fee Juice
@@ -118,20 +116,22 @@ console.log("Transaction fee:", receipt.transactionFee);
118116

119117
## Use Fee Payment Contracts
120118

121-
Fee Payment Contracts (FPC) pay fees on your behalf, typically accepting a different token than Fee Juice. Since Fee Juice is non-transferable on L2, FPCs are the most common fee payment method.
119+
Fee Payment Contracts (FPCs) pay Fee Juice on your behalf. FPCs must use Fee Juice exclusively on L2 during the setup phase; custom token contract functions cannot be called during setup on public networks. An FPC that accepts other tokens on L1 and bridges Fee Juice works on any network.
122120

123121
### Sponsored Fee Payment Contracts
124122

125123
#if(testnet)
126-
:::warning
127-
The Sponsored FPC is **not** deployed on testnet. To pay fees, you must either [bridge Fee Juice from L1](#bridge-fee-juice-from-l1) or deploy your own fee-paying contract.
124+
:::note
125+
The Sponsored FPC is not available on testnet or mainnet. It is only available on devnet and local network.
126+
:::
127+
#elif(mainnet)
128+
:::note
129+
The Sponsored FPC is not available on mainnet. It is only available on devnet and local network.
128130
:::
129-
130-
The Sponsored FPC pays for fees unconditionally without requiring payment in return. It is available on the local network and devnet (deployed by Aztec Labs), but **not on testnet**.
131-
#else
132-
The Sponsored FPC pays for fees unconditionally without requiring payment in return. It is available on both the local network and devnet (deployed by Aztec Labs).
133131
#endif
134132

133+
The Sponsored FPC pays fees unconditionally. It is only available on devnet and local network.
134+
135135
You can derive the Sponsored FPC address from its deployment parameters, register it with your wallet, and use it to pay for transactions:
136136

137137
#include_code deploy_sponsored_fpc_contract /docs/examples/ts/aztecjs_advanced/index.ts typescript
@@ -140,39 +140,6 @@ Here's a simpler example from the test suite:
140140

141141
#include_code sponsored_fpc_simple yarn-project/end-to-end/src/e2e_fees/sponsored_payments.test.ts typescript
142142

143-
### Use other Fee Paying Contracts
144-
145-
Third-party FPCs can pay for your fees using custom logic, such as accepting different tokens instead of Fee Juice.
146-
147-
#### Set gas settings
148-
149-
```typescript
150-
import { GasSettings } from "@aztec/stdlib/gas";
151-
152-
// node is from createAztecNodeClient() in the connection guide (see prerequisites)
153-
const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1.5); //adjust this to your needs
154-
const gasSettings = GasSettings.default({ maxFeesPerGas });
155-
```
156-
157-
Private FPCs enable fee payments without revealing the payer's identity onchain:
158-
159-
#include_code private_fpc_payment yarn-project/end-to-end/src/composed/e2e_local_network_example.test.ts typescript
160-
161-
Public FPCs can be used in the same way:
162-
163-
```typescript
164-
import { PublicFeePaymentMethod } from "@aztec/aztec.js/fee";
165-
166-
// wallet is from the connection guide; fpcAddress is the FPC contract address
167-
// senderAddress is the account paying; gasSettings is from the step above
168-
const paymentMethod = new PublicFeePaymentMethod(
169-
fpcAddress,
170-
senderAddress,
171-
wallet,
172-
gasSettings,
173-
);
174-
```
175-
176143
## Bridge Fee Juice from L1
177144

178145
Fee Juice is non-transferable on L2, but you can bridge it from L1, claim it on L2, and use it. This involves a few components that are part of a running network's infrastructure:

docs/docs-developers/docs/foundational-topics/fees.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,9 @@ Fee Juice uses an enshrined `FeeJuicePortal` contract on Ethereum for bridging,
8383

8484
An account with Fee Juice can pay for its transactions directly. A new account can even pay for its own deployment transaction, provided Fee Juice was bridged to its address before deployment.
8585

86-
Alternatively, accounts can use [fee-paying contracts (FPCs)](../aztec-js/how_to_pay_fees.md#use-fee-payment-contracts) to pay for transactions. FPCs accept tokens and pay fees in Fee Juice on behalf of users. Common patterns include:
86+
Alternatively, accounts can use [fee-paying contracts (FPCs)](../aztec-js/how_to_pay_fees.md#use-fee-payment-contracts) to pay for transactions. FPCs must use Fee Juice exclusively on L2 during the setup phase, but can accept other tokens on L1 and bridge Fee Juice.
8787

88-
- **Sponsored FPCs**: Pay fees unconditionally, enabling free transactions for users
89-
- **Token-accepting FPCs**: Accept a specific token in exchange for paying fees
90-
91-
FPCs can contain arbitrary logic to authorize fee payments and can operate privately or publicly.
88+
The **Sponsored FPC** pays fees unconditionally, enabling free transactions. It is only available on devnet and local network.
9289

9390
### Teardown phase
9491

docs/docs-developers/docs/resources/migration_notes.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,71 @@ Aztec is in active development. Each version may introduce breaking changes that
99

1010
## TBD
1111

12+
### [PXE] `simulateTx`, `executeUtility`, `profileTx`, and `proveTx` no longer accept `scopes: 'ALL_SCOPES'`
13+
14+
The `AccessScopes` type (`'ALL_SCOPES' | AztecAddress[]`) has been removed. The `scopes` field in `SimulateTxOpts`,
15+
`ExecuteUtilityOpts`, and `ProfileTxOpts` now requires an explicit `AztecAddress[]`. Callers that previously passed
16+
`'ALL_SCOPES'` must now specify which addresses will be in scope for the call.
17+
18+
**Migration:**
19+
20+
```diff
21+
+ const accounts = await pxe.getRegisteredAccounts();
22+
+ const scopes = accounts.map(a => a.address);
23+
24+
// simulateTx
25+
- await pxe.simulateTx(txRequest, { simulatePublic: true, scopes: 'ALL_SCOPES' });
26+
+ await pxe.simulateTx(txRequest, { simulatePublic: true, scopes });
27+
28+
// executeUtility
29+
- await pxe.executeUtility(call, { scopes: 'ALL_SCOPES' });
30+
+ await pxe.executeUtility(call, { scopes });
31+
32+
// profileTx
33+
- await pxe.profileTx(txRequest, { profileMode: 'full', scopes: 'ALL_SCOPES' });
34+
+ await pxe.profileTx(txRequest, { profileMode: 'full', scopes });
35+
36+
// proveTx
37+
- await pxe.proveTx(txRequest, 'ALL_SCOPES');
38+
+ await pxe.proveTx(txRequest, scopes);
39+
```
40+
41+
**Impact**: Any code passing `'ALL_SCOPES'` to `simulateTx`, `executeUtility`, `profileTx`, or `proveTx` will fail to compile. Replace with an explicit array of account addresses.
42+
43+
### [PXE] Capsule operations are now scope-enforced at the PXE level
44+
45+
The PXE now enforces that capsule operations can only access scopes that were authorized for the current execution. If a contract attempts to access a capsule scope that is not in its allowed scopes list, the PXE will throw an error:
46+
47+
```
48+
Scope 0x1234... is not in the allowed scopes list: [0xabcd...].
49+
```
50+
51+
The zero address (`AztecAddress::zero()`) is always allowed regardless of the scopes list, preserving backwards compatibility for contracts using the global scope.
52+
53+
**Impact**: Contracts that access capsules scoped to addresses not included in the transaction's authorized scopes will now fail at runtime. Ensure the correct scopes are passed when executing transactions.
54+
55+
## 4.2.0-aztecnr-rc.2
56+
57+
### Custom token FPCs removed from default public setup allowlist
58+
59+
Token contract functions (like `transfer_in_public` and `_increase_public_balance`) have been removed from the default public setup allowlist. FPCs that accept custom tokens (like the reference `FPC` contract) will not work on public networks, because their setup-phase calls to these functions will be rejected. Token class IDs change with each aztec-nr release, making it impractical to maintain them in the allowlist.
60+
61+
FPCs that use only Fee Juice still work on all networks, since FeeJuice is a protocol contract with a fixed address in the allowlist. Custom FPCs should only call protocol contract functions (AuthRegistry, FeeJuice) during setup.
62+
63+
`PublicFeePaymentMethod` and `PrivateFeePaymentMethod` in aztec.js are affected, since they use the reference `FPC` contract which calls Token functions during setup. Switch to `FeeJuicePaymentMethodWithClaim` (after [bridging Fee Juice from L1](../aztec-js/how_to_pay_fees.md#bridge-fee-juice-from-l1)) or write an FPC that uses Fee Juice natively.
64+
65+
**Migration:**
66+
67+
```diff
68+
- import { PublicFeePaymentMethod } from '@aztec/aztec.js/fee';
69+
- const paymentMethod = new PublicFeePaymentMethod(fpcAddress, senderAddress, wallet, gasSettings);
70+
+ import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
71+
+ const paymentMethod = new FeeJuicePaymentMethodWithClaim(senderAddress, claim);
72+
```
73+
74+
Similarly, the `fpc-public` and `fpc-private` CLI wallet payment methods use the reference Token-based FPC and will not work on public networks. Use `fee_juice` for direct Fee Juice payment, or `fpc-sponsored` on devnet and local network.
75+
76+
1277
### [Aztec.nr] Domain-separated tags on log emission
1378

1479
All logs emitted through the Aztec.nr framework now include a domain-separated tag at `fields[0]`. Each log category uses its own domain separator via `compute_log_tag(raw_tag, dom_sep)`:
@@ -118,6 +183,8 @@ The `DeployTxReceipt` and `DeployWaitOptions` types have been removed.
118183
+ from: address,
119184
+ });
120185
```
186+
187+
121188
### [aztec.js] `isContractInitialized` is now `initializationStatus` tri-state enum
122189

123190
`ContractMetadata.isContractInitialized` has been renamed to `ContractMetadata.initializationStatus` and changed from `boolean | undefined` to a `ContractInitializationStatus` enum with values `INITIALIZED`, `UNINITIALIZED`, and `UNKNOWN`.

docs/docs-developers/docs/tutorials/contract_tutorials/counter_contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ Your structure should look like this:
3535
| |-Nargo.toml
3636
```
3737

38-
The file `main.nr` will soon turn into our smart contract!
38+
The `aztec new` command creates a contract project with `Nargo.toml` and `src/main.nr`. The file `src/main.nr` will soon turn into our smart contract!
3939

40-
Add the following dependencies to `Nargo.toml` under the autogenerated content:
40+
Add the following dependency to `Nargo.toml` under the existing `aztec` dependency:
4141

4242
```toml
4343
[dependencies]

docs/docs-developers/docs/tutorials/contract_tutorials/recursive_verification.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ The proof generation script executes the circuit offchain and produces the proof
454454

455455
Create `scripts/generate_data.ts`:
456456

457-
#include_code generate_data /docs/examples/ts/recursive_verification/scripts/generate_data.ts typescript
457+
```js
458+
import circuitJson from "../circuit/target/hello_circuit.json" with { type: "json" };
459+
#include_code generate_data /docs/examples/ts/recursive_verification/scripts/generate_data.ts raw
460+
```
458461

459462
### Understanding the Proof Generation Pipeline
460463

docs/docs-developers/docs/tutorials/contract_tutorials/token_contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ cd bob_token
4444
yarn init
4545
# This is to ensure yarn uses node_modules instead of pnp for dependency installation
4646
yarn config set nodeLinker node-modules
47-
yarn add @aztec/aztec.js@#include_aztec_version @aztec/accounts@#include_aztec_version @aztec/test-wallet@#include_aztec_version @aztec/kv-store@#include_aztec_version
47+
yarn add @aztec/aztec.js@#include_aztec_version @aztec/accounts@#include_aztec_version @aztec/kv-store@#include_aztec_version
4848
aztec init
4949
```
5050

5151
## Contract structure
5252

53-
The `aztec init` command created a workspace with two crates: a `bob_token_contract` crate for your smart contract code and a `bob_token_test` crate for Noir tests. In `bob_token_contract/src/main.nr` we even have a proto-contract. Let's replace it with a simple starting point:
53+
The `aztec init` command created a contract project with `Nargo.toml` and `src/main.nr`. Let's replace the boilerplate in `src/main.nr` with a simple starting point:
5454

5555
```rust
5656
#include_code start /docs/examples/contracts/bob_token_contract/src/main.nr raw

docs/docs-participate/basics/fees.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ Aztec offers flexible fee payment:
6262
If you have $AZTEC, pay for your own transactions directly from your account.
6363

6464
### Sponsored Transactions
65-
Some applications pay fees on behalf of their users, enabling "free" transactions. The application covers the cost, not you.
66-
67-
### Fee-Paying Contracts
68-
Specialized contracts can accept other tokens and pay fees in $AZTEC for you. This is useful if you only hold other tokens.
65+
Fee-paying contracts can pay fees on your behalf. For example, on devnet and local network, a sponsored fee-paying contract covers transaction costs for free. FPCs can also accept other tokens on L1 and bridge $AZTEC to pay fees.
6966

7067
## Understanding Your Fee
7168

docs/examples/ts/recursive_verification/scripts/generate_data.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import circuitJson from "../../../../target/hello_circuit.json" with { type: "json" };
12
// docs:start:generate_data
23
import { Noir } from "@aztec/noir-noir_js";
3-
import circuitJson from "../../../../target/hello_circuit.json" with { type: "json" };
44
import { Barretenberg, UltraHonkBackend, deflattenFields } from "@aztec/bb.js";
55
import fs from "fs";
66
import { exit } from "process";
@@ -56,14 +56,14 @@ if (proofAsFields.length === 0) {
5656
const vkAsFields = recursiveArtifacts.vkAsFields;
5757

5858
console.log(`VK size: ${vkAsFields.length}`); // Should be 115
59-
console.log(`Proof size: ${proofAsFields.length}`); // Should be 508
59+
console.log(`Proof size: ${proofAsFields.length}`); // Should be ~500
6060
console.log(`Public inputs: ${mainProofData.publicInputs.length}`); // Should be 1
6161

6262
// Step 9: Save all data to JSON for contract interaction
6363
const data = {
6464
vkAsFields: vkAsFields, // 115 field elements - the verification key
6565
vkHash: recursiveArtifacts.vkHash, // Hash of VK - stored in contract
66-
proofAsFields: proofAsFields, // 508 field elements - the proof
66+
proofAsFields: proofAsFields, // ~500 field elements - the proof
6767
publicInputs: mainProofData.publicInputs.map((p: string) => p.toString()),
6868
};
6969

docs/examples/ts/token_bridge/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const INBOX_ABI = [
162162
type: "event",
163163
name: "MessageSent",
164164
inputs: [
165-
{ name: "l2BlockNumber", type: "uint256", indexed: true },
165+
{ name: "checkpointNumber", type: "uint256", indexed: true },
166166
{ name: "index", type: "uint256", indexed: false },
167167
{ name: "hash", type: "bytes32", indexed: true },
168168
{ name: "rollingHash", type: "bytes16", indexed: false },

docs/netlify.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,3 +805,13 @@
805805
# PXE: incompatible oracle version between contract and PXE
806806
from = "/errors/8"
807807
to = "/developers/docs/foundational-topics/pxe"
808+
809+
[[redirects]]
810+
# CLI: aztec dep version in Nargo.toml does not match the CLI version
811+
from = "/errors/9"
812+
to = "/developers/docs/aztec-nr/framework-description/dependencies#updating-your-aztec-dependencies"
813+
814+
[[redirects]]
815+
# PXE: capsule operation attempted with a scope not in the allowed scopes list
816+
from = "/errors/10"
817+
to = "/developers/docs/aztec-nr/framework-description/advanced/how_to_use_capsules"

0 commit comments

Comments
 (0)