bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 67쪽
ility(call, { scopes: 'ALL_SCOPES' });
+ await pxe.executeUtility(call, { scopes });
// profileTx
- await pxe.profileTx(txRequest, { profileMode: 'full', scopes: 'ALL_SCOPES' });
+ await pxe.profileTx(txRequest, { profileMode: 'full', scopes });
// proveTx
- await pxe.proveTx(txRequest, 'ALL_SCOPES');
+ await pxe.proveTx(txRequest, scopes);
```
**Impact**: Any code passing `'ALL_SCOPES'` to `simulateTx`, `executeUtility`, `profileTx`, or `proveTx` will fail to compile. Replace with an explicit array of account addresses.
### \[PXE] Capsule operations are now scope-enforced at the PXE level[](#pxe-capsule-operations-are-now-scope-enforced-at-the-pxe-level "Direct link to \[PXE] Capsule operations are now scope-enforced at the PXE level")
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:
```
Scope 0x1234... is not in the allowed scopes list: [0xabcd...].
```
The zero address (`AztecAddress::zero()`) is always allowed regardless of the scopes list, preserving backwards compatibility for contracts using the global scope.
**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.
### \[aztec.js] `EmbeddedWalletOptions` now uses a unified `pxe` field[](#aztecjs-embeddedwalletoptions-now-uses-a-unified-pxe-field "Direct link to aztecjs-embeddedwalletoptions-now-uses-a-unified-pxe-field")
The `pxeConfig` and `pxeOptions` fields on `EmbeddedWalletOptions` have been deprecated in favor of a single `pxe` field that accepts both PXE configuration and dependency overrides (custom prover, store, simulator):
```
const wallet = await EmbeddedWallet.create(nodeUrl, {
- pxeConfig: { proverEnabled: true },
- pxeOptions: { proverOrOptions: myCustomProver },
+ pxe: {
+ proverEnabled: true,
+ proverOrOptions: myCustomProver,
+ },
});
```
The old fields still work but will be removed in a future release.
### \[Aztec.nr] Ephemeral arrays replace capsule arrays in PXE oracle interfaces[](#aztecnr-ephemeral-arrays-replace-capsule-arrays-in-pxe-oracle-interfaces "Direct link to \[Aztec.nr] Ephemeral arrays replace capsule arrays in PXE oracle interfaces")
Oracle interfaces between Aztec.nr and PXE now use a new `EphemeralArray` type (`aztec::ephemeral::EphemeralArray`) instead of `CapsuleArray`. Ephemeral arrays live in memory and are scoped by contract call frame, so they no longer need to be addressed by `(contract_address, scope)`. Several public message-discovery and validation functions lost their `recipient`, `scope`, and `contract_address` parameters as a result.
Most contracts are not affected, as the macro-generated `sync_state` and `process_message` functions handle these APIs automatically. Only contracts that call these functions directly need to update.
**Migration:**
```
attempt_note_discovery(
contract_address,
tx_hash,
unique_note_hashes_in_tx,
first_nullifier_in_tx,
- recipient,
compute_note_hash,
compute_note_nullifier,
owner,
storage_slot,
randomness,
note_type_id,
packed_note,
);
- enqueue_note_for_validation(contract_address, owner, storage_slot, randomness, note_nonce, packed_note, note_hash, nullifier, tx_hash, scope);
+ enqueue_note_for_validation(contract_address, owner, storage_slot, randomness, note_nonce, packed_note, note_hash, nullifier, tx_hash);
- enqueue_event_for_validation(contract_address, event_type_id, randomness, serialized_event, event_commitment, tx_hash, scope);
+ enqueue_event_for_validation(contract_address, event_type_id, randomness, serialized_event, event_commitment, tx_hash);
- validate_and_store_enqueued_notes_and_events(contract_address, scope);
+ validate_and_store_enqueued_notes_and_events(scope);
```
The `sync_inbox` function and the `OffchainInboxSync` type now return `EphemeralArray<OffchainMessageWithContext>` instead of `CapsuleArray<OffchainMessageWithContext>`. Custom message handlers that bind the returned array to an explicit type must update the type annotation.
**Impact**: Contracts that call the above functions directly (rather than relying on macro-generated code) will fail to compile until the trailing `recipient`, `scope`, and `contract_address` parameters are removed.
## 4.2.0-aztecnr-rc.2[](#420-aztecnr-rc2 "Direct link to 4.2.0-aztecnr-rc.2")
### \[Aztec.js] Removed `SingleKeyAccountContract`[](#aztecjs-removed-singlekeyaccountcontract "Direct link to aztecjs-removed-singlekeyaccountcontract")
The `SchnorrSingleKeyAccount` contract and its TypeScript wrapper `SingleKeyAccountContract` have been removed. This contract was insecure: it used `ivpk_m` (incoming viewing public key) as its Schnorr signing key, meaning anyone who received a user's viewing key could sign transactions on their behalf.
**Migration:**
```
- import { SingleKeyAccountContract } from '@aztec/accounts/single_key';
- const contract = new SingleKeyAccountContract(signingKey);
+ import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
+ const contract = new SchnorrAccountContract(signingKey);
```
**Impact**: If you were using `@aztec/accounts/single_key`, switch to `@aztec/accounts/schnorr` which uses separate keys for encryption and authentication.
### Custom token FPCs removed from default public setup allowlist[](#custom-token-fpcs-removed-from-default-public-setup-allowlist "Direct link to Custom token FPCs removed from default public setup allowlist")
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.
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.
`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](/developers/testnet/docs/aztec-js/how_to_pay_fees.md#bridge-fee-juice-from-l1)) or write an FPC that uses Fee Juice natively.
**Migration:**
```
- import { PublicFeePaymentMethod } from '@aztec/aztec.js/fee';
- const paymentMethod = new PublicFeePaymentMethod(fpcAddress, senderAddress, wallet, gasSettings);
+ import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
+ const paymentMethod = new FeeJuicePaymentMethodWithClaim(senderAddress, claim);
```
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.
### \[Aztec.nr] Domain-separated tags on log emission[](#aztecnr-domain-separated-tags-on-log-emission "Direct link to \[Aztec.nr] Domain-separated tags on log emission")
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)`:
* **Events** (`DOM_SEP__EVENT_LOG_TAG`): the event type ID is the raw tag.
* **Message delivery** (`DOM_SEP__UNCONSTRAINED_MSG_LOG_TAG`): the discovery tag is the raw tag.
* **Partial note completion logs** (`DOM_SEP__NOTE_COMPLETION_LOG_TAG`): the partial note's `commitment` field is the raw tag.
The low-level emit methods now take `tag` as an explicit first parameter and have been renamed with an `_unsafe` suffix. Previously the tag was included as `log[0]` — it has now been extracted into its own parameter, and `log` no longer contains it:
```
- context.emit_private_log(log, length);
+ context.emit_private_log_unsafe(tag, log, length);
- context.emit_raw_note_log(log, length, note_hash_counter);
+ context.emit_raw_note_log_unsafe(tag, log, length, note_hash_counter);
- context.emit_public_log(log);
+ context.emit_public_log_unsafe(tag, log);
```
Prefer the higher-level APIs (`emit` for events, `MessageDelivery` for messages) which handle tagging automatically.
### \[Aztec.nr] Public events no longer include the event type selector at the end of the payload[](#aztecnr-public-events-no-longer-include-the-event-type-selector-at-the-end-of-the-payload "Direct link to \[Aztec.nr] Public events no longer include the event type selector at the end of the payload")
`emit_event_in_public` previously appended the event type selector as the last field. It now prepends a domain-separated tag at `fields[0]` instead. The payload after the tag contains only the serialized event fields.
If you were reading public event directly from node logs (i.e. via `node.getPublicLogs` and not via `wallet.getPublicEvents`), update your parsing:
```
- // Old: fields = [serialized_event..., event_type_selector]
- const selector = EventSelector.fromField(fields[fields.length - 1]);
- const event = decodeFromAbi([abiType], fields);
+ // New: fields = [domain_separated_tag, serialized_event...]
+ const eventFields = log.getEmittedFieldsWithoutTag();
+ const event = decodeFromAbi([abiType], eventFields);
```
### \[Aztec.nr] Capsule operations are now addressed by scope[](#aztecnr-capsule-operations-are-now-addressed-by-scope "Direct link to \[Aztec.nr] Capsule operations are now addressed by scope")
All capsule operations (`store`, `load`, `delete`, `copy`) and `CapsuleArray` now require a `scope: AztecAddress` parameter. This scopes capsule storage by address, providing isolation between different accounts within the same PXE.
Contracts that use `CapsuleArray` directly also need to update.
**Migration:**
```
- let array: CapsuleArray<Field> = CapsuleArray::at(contract_address, slot);
+ let array: CapsuleArray<Field> = CapsuleArray::at(contract_address, slot, scope);
```
The low-level capsule functions are similarly affected:
```
- capsules::store(contract_address, slot, value);
+ capsules::store(contract_address, slot, value, scope);
- capsules::load(contract_address, slot);
+ capsules::load(contract_address, slot, scope);
- capsules::delete(contract_address, slot);
+ capsules::delete(contract_address, slot, scope);
- capsules::copy(contract_address, src_slot, dst_slot, num_entries);
+ capsules::copy(contract_address, src_slot, dst_slot, num_entries, scope);
```
If you need to stick the old, scope-less behavior, and you are really sure that that's what you need to use, you can use `scope = AztecAddress::zero()`.
### \[Aztec.nr] `process_message` utility function removed[](#aztecnr-process_message-utility-function-removed "Direct link to aztecnr-process_message-utility-function-removed")
The auto-generated `process_message` utility function has been removed. If you need to deliver offchain messages (messages not broadcast via onchain logs), use the `offchain_receive` utility function instead. This function is automatically injected by the `#[aztec]` macro and accepts messages into a persistent inbox scoped by recipient. These messages are then picked up and processed during `sync_state`.
**Impact**: Contracts that explicitly called `process_message` must switch to delivering messages via `offchain_receive` and letting `sync_state` handle processing.
### \[Aztec.nr] `CustomMessageHandler` type signature changed[](#aztecnr-custommessagehandler-type-signature-changed "Direct link to aztecnr-custommessagehandler-type-signature-changed")
The `CustomMessageHandler` function type now receives an additional `scope: AztecAddress` parameter:
```
type CustomMessageHandler = unconstrained fn(
AztecAddress, // contract_address
u64, // msg_type_id
u64, // msg_metadata
BoundedVec<Field, MAX_MESSAGE_CONTENT_LEN>, // msg_content
MessageContext, // message_context
+ AztecAddress, // scope
);
```
**Impact**: Contracts that implement a custom message handler must update the function signature.
### \[aztec.js] `isContractInitialized` is now `initializationStatus` tri-state enum[](#aztecjs-iscontractinitialized-is-now-initializationstatus-tri-state-enum "Direct link to aztecjs-iscontractinitialized-is-now-initializationstatus-tri-state-enum")
`ContractMetadata.isContractInitialized` has been renamed to `ContractMetadata.initializationStatus` and changed from `boolean | undefined` to a `ContractInitializationStatus` enum with values `INITIALIZED`, `UNINITIALIZED`, and `UNKNOWN`.
* `INITIALIZED`: the contract has been initialized (initialization nullifier found)
* `UNINITIALIZED`: the contract instance is registered but has not been initialized
* `UNKNOWN`: the instance is not registered and no public initialization nullifier was found
When the instance is not registered, the wallet now attempts to check the public initialization nullifier (computed from address alone) before returning `UNKNOWN`. Previously this case returned `undefined`.
**Migration:**
```
+ import { ContractInitializationStatus } from '@aztec/aztec.js/wallet';
const metadata = await wallet.getContractMetadata(address);
- if (metadata.isContractInitialized) {
+ if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
// contract is initialized
}
```
### \[Aztec.js] Use `NO_FROM` instead of `AztecAddress.ZERO` to bypass account contract entrypoint[](#aztecjs-use-no_from-instead-of-aztecaddresszero-to-bypass-account-contract-entrypoint "Direct link to aztecjs-use-no_from-instead-of-aztecaddresszero-to-bypass-account-contract-entrypoint")
When sending transactions that should not be mediated by an account contract (e.g., account contract self-deployments), use the explicit `NO_FROM` sentinel instead of `AztecAddress.ZERO`.
`NO_FROM` signals that the transaction should be executed directly via the `DefaultEntrypoint`. This replaces the brittle convention of passing `AztecAddress.ZERO` as the `from` field.
**Migration:**
```
- import { AztecAddress } from '@aztec/aztec.js';
+ import { NO_FROM } from '@aztec/aztec.js/account';
await contract.methods.my_method().send({
- from: AztecAddress.ZERO,
+ from: NO_FROM,
});
```
Note that `DefaultEntrypoint` only accepts a single call. If you need to execute multiple calls without account contract mediation (e.g., deploying an account contract and paying a fee in the same transaction), wrap them through `DefaultMultiCallEntrypoint` on the app side before sending:
```
import { NO_FROM } from "@aztec/aztec.js/account";
import { DefaultMultiCallEntrypoint } from "@aztec/entrypoints/multicall";
import { mergeExecutionPayloads } from "@aztec/stdlib/tx";
// Merge multiple execution payloads into one
const merged = mergeExecutionPayloads([deployPayload, feePayload]);
// Wrap through multicall so it becomes a single call for DefaultEntrypoint
const multicall = new DefaultMultiCallEntrypoint();
const chainInfo = await wallet.getChainInfo();
const wrappedPayload = await multicall.wrapExecutionPayload(merged, chainInfo);
// Send without account contract mediation
await wallet.sendTx(wrappedPayload, { from: NO_FROM });
```
Using other contracts for wrapping (for example, supporting more calls) is also supported, as long as the contract is registered in the wallet. This opens the door to different flows that do not use account entrypoints as the first call in the chain, including app sponsored FPCs.
**Impact**: Any code that passes `AztecAddress.ZERO` as the `from` option in `.send()`, `.simulate()`, or deploy options must switch to `NO_FROM`. Wallets use `DefaultEntrypoint` directly for `NO_FROM` transactions, instead of the `DefaultMultiCallEntrypoint` that was used internally before when specifying `AztecAddress.ZERO`.
### \[Aztec.js] `ExecuteUtilityOptions.scope` renamed to `scopes` and type changed to `AztecAddress[]`[](#aztecjs-executeutilityoptionsscope-renamed-to-scopes-and-type-changed-to-aztecaddress "Direct link to aztecjs-executeutilityoptionsscope-renamed-to-scopes-and-type-changed-to-aztecaddress")
The `scope` field in `ExecuteUtilityOptions` has been renamed to `scopes` and changed from a single `AztecAddress` to `AztecAddress[]`. This aligns the wallet's `executeUtility` API with the PXE API and `sendTx` in `Wallet`, which both accept an array of scopes.
**Migration:**
```
wallet.executeUtility(call, {
- scope: myAddress,
+ scopes: [myAddress],
});
```
**Impact**: Any code that calls `wallet.executeUtility` directly must update the options object. Wallets must update to adapt to the new interface
### \[Aztec.nr] `attempt_note_discovery` now takes two separate functions instead of one[](#aztecnr-attempt_note_discovery-now-takes-two-separate-functions-instead-of-one "Direct link to aztecnr-attempt_note_discovery-now-takes-two-separate-functions-instead-of-one")
The `attempt_note_discovery` function (and related discovery functions like `do_sync_state`, `process_message_ciphertext`) now takes separate `compute_note_hash` and `compute_note_nullifier` arguments instead of a single combined `compute_note_hash_and_nullifier`. The corresponding type aliases are now `ComputeNoteHash` and `ComputeNoteNullifier` (instead of `ComputeNoteHashAndNullifier`).
This split improves performance during nonce discovery: the note hash only needs to be computed once, while the old combined function recomputed it for every candidate nonce.
Most contracts are not affected, as the macro-generated `sync_state` and `process_message` functions handle this automatically. Only contracts that call `attempt_note_discovery` directly need to update.
**Migration:**
```
attempt_note_discovery(
contract_address,
tx_hash,
unique_note_hashes_in_tx,
first_nullifier_in_tx,
recipient,
- _compute_note_hash_and_nullifier,
+ _compute_note_hash,
+ _compute_note_nullifier,
owner,
storage_slot,
randomness,
note_type_id,
packed_note,
);
```
**Impact**: Contracts that call `attempt_note_discovery` or related discovery functions directly with a custom `_compute_note_hash_and_nullifier` argument. The old combined function is still generated (deprecated) but is no longer used by the framework. Additionally, if you had a custom `_compute_note_hash_and_nullifier` function then compilation will now fail as you'll need to also produce the corresponding `_compute_note_hash` and `_compute_note_nullifier` functions.
### Private initialization nullifier now includes `init_hash`[](#private-initialization-nullifier-now-includes-init_hash "Direct link to private-initialization-nullifier-now-includes-init_hash")
The private initialization nullifier is no longer derived from just the contract address. It is now computed as a Poseidon2 hash of `[address, init_hash]` using a dedicated domain separator. This prevents observers from determining whether a fully private contract has been initialized by simply knowing its address.
Note that `Wallet.getContractMetadata` now returns `initializationStatus: ContractInitializationStatus.UNKNOWN` when the wallet does not have the contract instance registered, since `init_hash` is needed to compute the nullifier and initialization status cannot be determined. Previously, this check worked for any address. Callers should check the enum value before branching on the initialization state.
If you use `assert_contract_was_initialized_by` or `assert_contract_was_not_initialized_by` from `aztec::history::deployment`, these now require an additional `init_hash: Field` parameter:
```
+ let instance = get_contract_insta프로젝트로 돌아가기