Aztec 백서

Aztec

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 63쪽

TestAccountsData()`, are now initializerless Schnorr accounts (`schnorr_initializerless`). An initializerless account has no onchain deployment transaction: its address commits to the signing public key (through `immutables_hash`) and its contract state is materialized locally in the PXE, so these accounts are usable right away. Because their address is derived differently from a regular Schnorr account, register them with `createSchnorrInitializerlessAccount` rather than `createSchnorrAccount`. **Migration:** ``` const [alice] = await getInitialTestAccountsData(); - await wallet.createSchnorrAccount(alice.secret, alice.salt); + await wallet.createSchnorrInitializerlessAccount(alice.secret, alice.salt); ``` ### \[Aztec.js] `AccountContract` interface adds `getImmutablesHash()`[​](#aztecjs-accountcontract-interface-adds-getimmutableshash "Direct link to aztecjs-accountcontract-interface-adds-getimmutableshash") The `AccountContract` interface now declares `getImmutablesHash(): Promise<Fr | undefined>`, which returns the hash of the account's immutable instantiation parameters committed into its address, or `undefined` if the feature is not used. `getAccountContractAddress()` and `AccountManager.create()` call it to derive the address when an `immutablesHash` is not passed explicitly, so the address of an initializerless account is now resolved from the contract itself. Account contracts that extend `DefaultAccountContract` inherit a default implementation that returns `undefined` and need no changes. ### \[Aztec.js] Wallets validate declared gas limits against the network's per-tx admission limit[​](#aztecjs-wallets-validate-declared-gas-limits-against-the-networks-per-tx-admission-limit "Direct link to \[Aztec.js] Wallets validate declared gas limits against the network's per-tx admission limit") Wallets now reject a transaction whose declared `gasLimits` exceed the network's per-tx admission limit (the node-advertised `txsLimits.gas`), throwing before the tx is sent — e.g. `Declared DA gas limit (X) exceeds the maximum this network allows per tx (Y)`. When you declare no gas limits, the wallet fills in the network's admission limits for you. This mirrors the node's inbound `GasLimitsValidator`, surfacing the rejection locally instead of on submission. **Impact**: Transactions that previously over-declared gas (and were silently skipped by the proposer) now fail fast with a descriptive error. Declare limits at or below `txsLimits.gas`, or declare none and let the wallet fill them in. ### \[Aztec.js] `estimateGas` / `estimatedGasPadding` simulate options and the `estimatedGas` result field removed[​](#aztecjs-estimategas--estimatedgaspadding-simulate-options-and-the-estimatedgas-result-field-removed "Direct link to aztecjs-estimategas--estimatedgaspadding-simulate-options-and-the-estimatedgas-result-field-removed") The `estimateGas` and `estimatedGasPadding` fee options are gone, and the `estimatedGas` field on simulation results is replaced by `gasUsed` (the raw gas the simulation consumed). Apps that want explicit gas limits read `gasUsed` and pad it themselves; otherwise the wallet fills in the network's admission limits automatically. **Migration:** ``` - const { estimatedGas } = await contract.methods.foo(args).simulate({ - from, - fee: { estimateGas: true, estimatedGasPadding: 0.1 }, - }); - const gasLimits = estimatedGas.gasLimits; + const { gasUsed } = await contract.methods.foo(args).simulate({ from, includeMetadata: true }); + const gasLimits = gasUsed.totalGas.mul(1.1); // pad yourself ``` ### \[Aztec.js] `getGasLimits` moved to `@aztec/wallet-sdk` and is no longer exported from `@aztec/aztec.js`[​](#aztecjs-getgaslimits-moved-to-aztecwallet-sdk-and-is-no-longer-exported-from-aztecaztecjs "Direct link to aztecjs-getgaslimits-moved-to-aztecwallet-sdk-and-is-no-longer-exported-from-aztecaztecjs") `getGasLimits` is no longer exported from `@aztec/aztec.js`. It now lives in `@aztec/wallet-sdk/base-wallet`, takes the simulated `gasUsed` and the network's per-tx admission limit, and clamps the padded estimates to it. If the simulated usage already exceeds the network limit, it throws immediately rather than returning a limit the node would reject. **Migration:** ``` - import { getGasLimits } from '@aztec/aztec.js'; - const { gasLimits, teardownGasLimits } = getGasLimits(simulationResult, 0.1); + import { getGasLimits } from '@aztec/wallet-sdk/base-wallet'; + const { txsLimits } = await node.getNodeInfo(); + const { gasLimits, teardownGasLimits } = getGasLimits(simulationResult.gasUsed, Gas.from(txsLimits.gas), 0.1); ``` ### \[Aztec.js / PXE] `NodeInfo.txsLimits` is now required[​](#aztecjs--pxe-nodeinfotxslimits-is-now-required "Direct link to aztecjs--pxe-nodeinfotxslimits-is-now-required") `NodeInfo` now carries a required `txsLimits` field: every node advertises the maximum gas a single tx may declare (`{ gas: { daGas, l2Gas } }`) and wallets rely on it for fallback gas limits. Clients built against this version cannot talk to nodes that predate the field. ### \[Aztec.js] `GasSettings.fallback` requires explicit `gasLimits`[​](#aztecjs-gassettingsfallback-requires-explicit-gaslimits "Direct link to aztecjs-gassettingsfallback-requires-explicit-gaslimits") `GasSettings.fallback` no longer supplies a default value for `gasLimits`. Callers must pass the network's per-tx admission limit explicitly — read it from the node's `txsLimits.gas`. **Migration:** ``` - const settings = GasSettings.fallback({ maxFeesPerGas }); + const { txsLimits } = await node.getNodeInfo(); + const settings = GasSettings.fallback({ gasLimits: Gas.from(txsLimits.gas), maxFeesPerGas }); ``` ### \[Aztec.js / stdlib] Removed legacy fallback gas constants[​](#aztecjs--stdlib-removed-legacy-fallback-gas-constants "Direct link to \[Aztec.js / stdlib] Removed legacy fallback gas constants") The following exports have been removed from `@aztec/stdlib`: * `APPROXIMATE_MAX_DA_GAS_PER_BLOCK` * `FALLBACK_TEARDOWN_L2_GAS_LIMIT` * `FALLBACK_TEARDOWN_DA_GAS_LIMIT` **Impact**: Any code that imported these symbols must switch to the live node-advertised limits via the node's `txsLimits.gas`. ### \[Aztec.nr] `messages::message_delivery` module moved to `messages::delivery`[​](#aztecnr-messagesmessage_delivery-module-moved-to-messagesdelivery "Direct link to aztecnr-messagesmessage_delivery-module-moved-to-messagesdelivery") The `message_delivery` module has been renamed to `delivery`. Update imports accordingly: ``` - use aztec::messages::message_delivery::MessageDelivery; + use aztec::messages::delivery::MessageDelivery; ``` ### \[Node JSON-RPC] Method prefixes changed to `aztec_*` and `aztecAdmin_*`[​](#node-json-rpc-method-prefixes-changed-to-aztec_-and-aztecadmin_ "Direct link to node-json-rpc-method-prefixes-changed-to-aztec_-and-aztecadmin_") All Aztec node JSON-RPC method prefixes have changed: * `node_*` → `aztec_*` (public node methods, port 8080) * `nodeAdmin_*` → `aztecAdmin_*` (admin methods, port 8880) * `nodeDebug_*` → `aztecDebug_*` (debug methods, port 8080, local-network or `--node-debug` only) * `p2p_*` namespace removed; P2P queries are on `aztec_*`: `getPeers`, `getCheckpointAttestationsForSlot`, `getProposalsForSlot` * New archiver sync helpers on `aztec_*`: `getL1Constants`, `getSyncedL2SlotNumber`, `getSyncedL2EpochNumber`, `getSyncedL1Timestamp` If you call the node RPC directly (e.g. via `curl` or a custom client), update all method names accordingly. Clients created via `createAztecNodeClient`, `createAztecNodeAdminClient`, and `createAztecNodeDebugClient` are updated automatically. ### \[Node RPC] `registerContractFunctionSignatures` moved to the debug API[​](#node-rpc-registercontractfunctionsignatures-moved-to-the-debug-api "Direct link to node-rpc-registercontractfunctionsignatures-moved-to-the-debug-api") `registerContractFunctionSignatures` is no longer part of the main node JSON-RPC API (`aztec_` namespace). It is now a debug-only method exposed under the `aztecDebug_` namespace, which is only mounted when the node runs with debug endpoints enabled (`--node-debug`, always on in the in-process sandbox). This removes an unauthenticated write to node memory from prod-like nodes. Clients that registered public function signatures over `aztec_registerContractFunctionSignatures` should call `aztecDebug_registerContractFunctionSignatures` against a debug-enabled node instead. In the PXE, this is now driven by an optional debug client: pass a `nodeDebug` client (e.g. `createAztecNodeDebugClient(nodeUrl)`) when creating the PXE to keep named public-execution traces; when it is absent, signature registration is skipped. Client-side error enrichment from the contract ABI is unaffected. ### \[Aztec.nr] `get_pending_tagged_logs` oracle interface updated (oracle version 28)[​](#aztecnr-get_pending_tagged_logs-oracle-interface-updated-oracle-version-28 "Direct link to aztecnr-get_pending_tagged_logs-oracle-interface-updated-oracle-version-28") The `aztec_utl_getPendingTaggedLogs` oracle now takes an additional `provided_secrets` parameter of type `EphemeralArray<ProvidedSecret>`. This lets apps pass tagging secrets that PXE cannot derive on its own (e.g. handshake-derived secrets) alongside the secrets PXE manages internally. ### \[Aztec.nr] `set_sender_for_tags` oracle removed[​](#aztecnr-set_sender_for_tags-oracle-removed "Direct link to aztecnr-set_sender_for_tags-oracle-removed") The `set_sender_for_tags` oracle has been removed. Contracts that used it to override the sender for discovery tag derivation should now use the `with_sender` builder method on `MessageDelivery`: ``` - use aztec::oracle::notes::set_sender_for_tags; + use aztec::messages::delivery::MessageDelivery; - unsafe { set_sender_for_tags(some_address) }; - note.deliver(MessageDelivery::onchain_constrained()); + note.deliver(MessageDelivery::onchain_constrained().with_sender(some_address)); ``` When `with_sender` is not called, `MessageDelivery` uses the wallet-supplied default sender. ### \[Aztec.nr] `MessageDelivery` API syntax change[​](#aztecnr-messagedelivery-api-syntax-change "Direct link to aztecnr-messagedelivery-api-syntax-change") `MessageDelivery` variants are now accessed via constructor functions instead of dot notation: ``` - MessageDelivery.OFFCHAIN + MessageDelivery::offchain() - MessageDelivery.ONCHAIN_UNCONSTRAINED + MessageDelivery::onchain_unconstrained() - MessageDelivery.ONCHAIN_CONSTRAINED + MessageDelivery::onchain_constrained() ``` ### \[Aztec.js] `getTxReceipt` returns a lifecycle union and takes `GetTxReceiptOptions`[​](#aztecjs-gettxreceipt-returns-a-lifecycle-union-and-takes-gettxreceiptoptions "Direct link to aztecjs-gettxreceipt-returns-a-lifecycle-union-and-takes-gettxreceiptoptions") `AztecNode.getTxReceipt` now takes an optional `GetTxReceiptOptions` argument and returns a `PendingTxReceipt | DroppedTxReceipt | MinedTxReceipt` union instead of a single `TxReceipt` class. Mined-only fields (`transactionFee`, `blockHash`, `blockNumber`, `txIndexInBlock`, and the execution result) are only guaranteed once the transaction is mined, so narrow with `isMined()`, `isPending()`, or `isDropped()` before reading variant-specific fields. The full `TxEffect` is attached only when you request it via `{ includeTxEffect: true }`. `AztecNode.getTxEffect` is deprecated. Replace direct calls with `getTxReceipt(txHash, { includeTxEffect: true })` and read the `.txEffect` field. `TxReceipt.empty()` and `TxReceipt.schema` no longer exist, since `TxReceipt` is now a union type rather than a class. Use `DroppedTxReceipt.empty()` and `TxReceiptSchema` instead. ``` - const effect = await node.getTxEffect(txHash); - if (effect) { - console.log(effect.data.nullifiers.length); - } + const receipt = await node.getTxReceipt(txHash, { includeTxEffect: true }); + if (receipt.isMined() && receipt.txEffect) { + console.log(receipt.txEffect.nullifiers.length); + } - const empty = TxReceipt.empty(); - const schema = TxReceipt.schema; + const empty = DroppedTxReceipt.empty(); + const schema = TxReceiptSchema; ``` **Impact**: This is a breaking change to the public node RPC with no wire back-compat. Callers that read mined fields off a bare receipt must narrow with the `is*` guards first, callers of `getTxEffect` should migrate to `getTxReceipt`, and references to `TxReceipt.empty()` / `TxReceipt.schema` must move to `DroppedTxReceipt.empty()` / `TxReceiptSchema`. ### \[Aztec.js] `ExtendedDirectionalAppTaggingSecret` renamed to `AppTaggingSecret`[​](#aztecjs-extendeddirectionalapptaggingsecret-renamed-to-apptaggingsecret "Direct link to aztecjs-extendeddirectionalapptaggingsecret-renamed-to-apptaggingsecret") `ExtendedDirectionalAppTaggingSecret` has been renamed to `AppTaggingSecret`. **Migration:** ``` - import { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs'; + import { AppTaggingSecret } from '@aztec/stdlib/logs'; - ExtendedDirectionalAppTaggingSecret.fromString(value) + AppTaggingSecret.fromString(value) ``` **Impact**: Code importing or referencing `ExtendedDirectionalAppTaggingSecret` should update to `AppTaggingSecret`. ### \[Protocol] Remaining protocol-contract addresses compacted to 1-3[​](#protocol-remaining-protocol-contract-addresses-compacted-to-1-3 "Direct link to \[Protocol] Remaining protocol-contract addresses compacted to 1-3") After the `auth_registry`, `public_checks`, and `multi_call_entrypoint` demotions freed up address slots `1`, `4`, and `6`, the three remaining protocol contracts have been compacted into the lowest slots: `ContractClassRegistry` moves from `3` to `1`, `ContractInstanceRegistry` stays at `2`, and `FeeJuice` moves from `5` to `3`. Code that hardcoded the previous values must be updated. `MAX_PROTOCOL_CONTRACTS` is unchanged (still `11`); only the assigned addresses moved. ### \[Aztec.nr] `multi_call_entrypoint` demoted from protocol contract[​](#aztecnr-multi_call_entrypoint-demoted-from-protocol-contract "Direct link to aztecnr-multi_call_entrypoint-demoted-from-protocol-contract") `multi_call_entrypoint` is no longer a protocol contract; its address is derived from its artifact rather than hardcoded at `6`, and PXE no longer auto-registers it. It is now a standard contract that PXE *preloads*: both `createPXE` and `EmbeddedWallet` preload the standard MultiCallEntrypoint automatically (and `EmbeddedWallet` additionally preloads `AuthRegistry`). **If you use the standard PXE or `EmbeddedWallet`, no changes are needed** — multicall keeps working out of the box. To preload a different set of standard contracts (for example to also preload `PublicChecks`, which is not preloaded by default), a wallet or app passes its own `preloadedContractsProvider` through the wallet's PXE options: ``` const wallet = await EmbeddedWallet.create(node, { pxe: { preloadedContractsProvider: { // EmbeddedWallet's built-in default preloads only MultiCallEntrypoint + AuthRegistry. // A custom provider REPLACES that default (it is not additive), so re-list the ones you // still want and add the extras — here, PublicChecks. getPreloadedContracts: async () => [ await getStandardMultiCallEntrypoint(), await getStandardAuthRegistry(), await getStandardPublicChecks(), ], }, }, }); ``` The provider *replaces* the default list (it is not additive), so include every standard contract you want available. ### \[Aztec.nr] `public_checks` demoted from protocol contract[​](#aztecnr-public_checks-demoted-from-protocol-contract "Direct link to aztecnr-public_checks-demoted-from-protocol-contract") `public_checks` is no longer a protocol contract. Its address is now derived from its artifact rather than hardcoded at `6`. The aztec-nr constant has moved and been renamed: ``` - use protocol_types::constants::PUBLIC_CHECKS_ADDRESS; + use crate::standard_addresses::STANDARD_PUBLIC_CHECKS_ADDRESS; ``` Unlike MultiCallEntrypoint and AuthRegistry, `PublicChecks` is **not** preloaded by `createPXE` or `EmbeddedWallet`. If your contract uses `privately_check_timestamp` or `privately_check_block_number`, `PublicChecks` must be deployed and made available to your PXE — either include it in a custom `preloadedContractsProvider` (see the `multi_call_entrypoint` note above) or register it directly: ``` import { getStandardPublicChecks } from "@aztec/standard-contracts/public-checks"; const { instance, artifact } = await getStandardPublicChecks(); await pxe.registerContract({ instance, artifact }); ``` For browser bundles, import from `@aztec/standard-contracts/public-checks/lazy` instead. Deploy `PublicChecks` once per fresh rollup: `aztec-wallet deploy public_checks_contract@PublicChecks --salt 1 --universal -f <fee-paying-account>`. ### \[Aztec.nr] `auth_registry` demoted from protocol contract[​](#aztecnr-auth_registry-demoted-from-protocol-contract "Direct link to aztecnr-auth_registry-demoted-from-protocol-contract") `auth_registry` is no longer a protocol contract. Its address is now derived from its artifact rather than hardcoded at `1`. The aztec-nr constant has moved and been renamed: ``` - use protocol_types::constants::CANONICAL_AUTH_REGISTRY_ADDRESS; + use crate::standard_addresses::STANDARD_AUTH_REGISTRY_ADDRESS; ``` PXE no longer auto-registers `AuthRegistry` on startup. `EmbeddedWallet` preloads it automatically (alongside the MultiCallEntrypoint — see the `multi_call_entrypoint` note above), so apps using the standard wallet need no changes. If you use a PXE setup that doesn't preload it, add it to a custom `preloadedContractsProvider` or register it explicitly: ``` import { getStandardAuthRegistry } from "@aztec/standard-contracts/auth-registry"; const { instance, artifact } = await getStandardAuthRegistry(); await pxe.registerContract({ instance, artifact }); ``` For browser bundles, import from `@aztec/standard-contracts/auth-registry/lazy` instead. Deploy `AuthRegistry` once per fresh rollup: `aztec-wallet deploy auth_registry_contract@AuthRegistry --salt 1 --universal -f <fee-paying-account>`. ### \[Aztec.nr] `public_checks` helpers moved to `aztec-nr`[​](#aztecnr-public_checks-helpers-moved-to-aztec-nr "Direct link to aztecnr-public_checks-helpers-moved-to-aztec-nr") The `privately_check_timestamp`, `privately_check_block_number`, and related caller helpers previously in `noir-contracts/contracts/protocol/public_checks_contract/src/utils.nr` are now in `aztec-nr/aztec/src/public_checks.nr`. Consumer contracts should update their imports: ``` - use public_checks::utils::privately_check_timestamp; + use aztec::public_checks::privately_check_timestamp; ``` ### \[Aztec Node / Aztec.js / CLI] Log retrieval API consolidated to two tag-based methods[​](#aztec-node--aztecjs--cli-log-retrieval-api-consolidated-to-two-tag-based-methods "Direct link to \[Aztec Node / Aztec.js / CLI] Log retrieval API consolidated to two tag-based methods") The four log-retrieval methods on `AztecNode` have been collapsed into two. `getContractClassLogs` and the `LogFilter`-shaped `getPublicLogs` are removed entirely; the surviving methods are `getPrivateLogsByTags(query)` and `getPublicLogsByTags(query)`, both taking a single query object and returning `LogResult[][]` (one inner array per requested tag, in input order). **Removed methods on `AztecNode`:** | Removed | Replacement | | ------------------------------------------------------------------------- | ----------------------------------------------------- | | `getPublicLogs(filter: LogFilter)` | `getPublicLogsByTags({ contractAddress, tags, ... })` | | `getContractClassLogs(filter: LogFilter)` | none — RPC removed; no production consumer existed | | `getPrivateLogsByTags(tags, page?, referenceBlock?)` | `getPrivateLogsByTags({ tags, ... })` | | `getPublicLogsByTagsFromContract(contract, tags, page?, referenceBlock?)` | `getPublicLogsByTags({ contractAddress, tags, ..
프로젝트로 돌아가기