Aztec 백서

Aztec

원문

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

l proofs throws from `BBNativeRollupProver.new` when it tries to stat an undefined path. Only a node running without real proofs falls back to WASM simulation, which is much slower. Type names keep the ACVM spelling (`NativeACVMSimulator`, `ACVMConfig`, `ACVMWitness`), since those describe the ACIR VM and its witness format rather than the tool that runs it. ### \[Protocol] Block header commits to a per-block tx effects tree[​](#protocol-block-header-commits-to-a-per-block-tx-effects-tree "Direct link to \[Protocol] Block header commits to a per-block tx effects tree") The L2 block header gains a `tx_effects_tree_root` field: the root of a per-block merkle tree with one leaf per transaction, where each leaf binds the transaction hash to a structured hash of its effects (note hashes, nullifiers, L2-to-L1 messages, public data writes, and logs). Holding a block header is now enough to verify that a transaction was included in that block and produced exactly a given set of effects with a short membership proof, instead of replaying the checkpoint's full sponge blob. The root is computed by the rollup circuits and is available on `BlockHeader` as `txEffectsTreeRoot`; `TxEffect.computeTxEffectLeaf()` and `Body.computeTxEffectsTreeRoot()` compute the leaves and root from published data. This is a breaking protocol change: the block header serialization grew by one field, so every transaction hash, verification key, contract artifact, canonical contract address, and the genesis constants change. Contracts must be recompiled against the updated `aztec-nr`. The PXE oracle interface version was bumped (30 → 31), as was the TXE oracle interface version (8 → 9), and existing PXE databases are re-initialized on next open (data schema version 14 → 15). Nodes resync their archiver, which now also stores the tx effects tree leaves of each block (archiver data schema version 9 → 10). ### \[npm] Packages moved to the `@aztec-labs` scope[​](#npm-packages-moved-to-the-aztec-labs-scope "Direct link to npm-packages-moved-to-the-aztec-labs-scope") Every package published from this repository is now scoped `@aztec-labs` instead of `@aztec`. Update your dependencies and imports: ``` -import { Contract } from '@aztec/aztec.js'; +import { Contract } from '@aztec-labs/aztec.js'; ``` ``` - "@aztec/aztec.js": "<version>", - "@aztec/accounts": "<version>", + "@aztec-labs/aztec.js": "<version>", + "@aztec-labs/accounts": "<version>", ``` Subpath imports are unaffected beyond the scope: `@aztec/foundation/log` becomes `@aztec-labs/foundation/log`. The `@aztec` scope keeps the packages published for earlier versions, so an existing project pinned to an older release continues to install unchanged. There is no `@aztec-labs` release of those older versions. The vendored viem fork is unchanged: it is still consumed as `"viem": "npm:@aztec/viem@<version>"`. ### \[npm] Foundation packages moved to the `@aztec-foundation` scope[​](#npm-foundation-packages-moved-to-the-aztec-foundation-scope "Direct link to npm-foundation-packages-moved-to-the-aztec-foundation-scope") The packages built by the foundation repository and consumed here - `bb.js`, `bb-avm-sim`, `cdb`, `wsdb`, `ipc-runtime`, the `noir-*` packages, `l1-artifacts`, `constants-codegen` and the protocol artifacts packages - are now scoped `@aztec-foundation` instead of `@aztec`. Update any direct dependency on them: ``` -import { Barretenberg } from '@aztec/bb.js'; +import { Barretenberg } from '@aztec-foundation/bb.js'; ``` ``` - "@aztec/bb.js": "<version>", - "@aztec/noir-noir_js": "<version>", + "@aztec-foundation/bb.js": "<version>", + "@aztec-foundation/noir-noir_js": "<version>", ``` Most projects reach these packages only through `@aztec-labs/*`, which carries the change for them; only a direct dependency needs updating. The `@aztec` scope keeps the packages published for earlier versions, so an existing project pinned to an older release continues to install unchanged. There is no `@aztec-foundation` release of those older versions: the scope starts at `6.0.0-nightly.20260901`. ### \[Aztec.nr] aztec-nr moved to `aztec-labs-eng/aztec-nr`[​](#aztecnr-aztec-nr-moved-to-aztec-labs-engaztec-nr "Direct link to aztecnr-aztec-nr-moved-to-aztec-labs-engaztec-nr") The aztec-nr crates are now published at <https://github.com/aztec-labs-eng/aztec-nr>. The previous repository, `AztecProtocol/aztec-nr`, has no tags from v6 onwards, so a project that only bumps its `tag` fails to compile with `Remote branch v6.x.x not found`. Update the `git` field of every aztec-nr dependency in your `Nargo.toml` files as well: ``` -aztec = { git = "https://github.com/AztecProtocol/aztec-nr", tag = "v5.2.0", directory = "aztec" } +aztec = { git = "https://github.com/aztec-labs-eng/aztec-nr", tag = "v<version>", directory = "aztec" } ``` `aztec compile` warns when a dependency still points at the previous repository. ### \[Aztec.nr] `DelayedPublicMutable` rejects delays below one hour[​](#aztecnr-delayedpublicmutable-rejects-delays-below-one-hour "Direct link to aztecnr-delayedpublicmutable-rejects-delays-below-one-hour") `DelayedPublicMutable` now enforces a minimum delay of one hour (`aztec::state_vars::DELAYED_PUBLIC_MUTABLE_MINIMUM_DELAY`, 3600 seconds). Declaring a state variable with a shorter initial delay fails to compile, and `schedule_delay_change` reverts when passed a shorter delay: ``` // Fails to compile: the delay is below DELAYED_PUBLIC_MUTABLE_MINIMUM_DELAY. paused: DelayedPublicMutable<bool, 300, Context>, ``` Shorter delays make the time window users have to read chain state, produce a proof and get it included too short, effectively limiting access to the system, which is an unintended side-effect of controlling the delay. Raise any initial delay below one hour - a delay of at least a couple of hours remains the recommendation. ### \[CLI] Removed `bridge-erc20`[​](#cli-removed-bridge-erc20 "Direct link to cli-removed-bridge-erc20") `aztec bridge-erc20` performed only the L1 half of a token bridge deposit: it approved the ERC20 and called `depositToAztecPublic` (or `depositToAztecPrivate`) on a TokenPortal you supplied, then printed a claim secret for you to redeem on L2 yourself. Using it required already having deployed your own L1 TokenPortal and its L2 counterpart. Use `L1ToL2TokenPortalManager` from `@aztec-labs/aztec.js/ethereum` instead, which is what the command wrapped: ``` import { L1ToL2TokenPortalManager } from '@aztec-labs/aztec.js/ethereum'; const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress, l1Client, logger); const { claimAmount, claimSecret } = await manager.bridgeTokensPublic(recipient, amount, mint); ``` Fee juice bridging is unaffected: keep using `aztec-wallet bridge-fee-juice`. ### \[CLI] Removed `get-canonical-sponsored-fpc-address`, replaced by a wallet alias[​](#cli-removed-get-canonical-sponsored-fpc-address-replaced-by-a-wallet-alias "Direct link to cli-removed-get-canonical-sponsored-fpc-address-replaced-by-a-wallet-alias") `aztec-wallet` now aliases the canonical SponsoredFPC as `contracts:SponsoredFPC` on startup, alongside the protocol and standard contracts, so commands can name it instead of taking its address: ``` aztec-wallet register-contract contracts:SponsoredFPC SponsoredFPC --salt 0 aztec-wallet send transfer --payment method=fpc-sponsored,fpc=contracts:SponsoredFPC ... ``` If you need the address itself (for a script or a non-wallet consumer), use `getSponsoredFPCAddress` from `@aztec-labs/cli/cli-utils`. ### \[CLI] Removed `inspect-contract`, `compute-selector`, `generate-secret-and-hash`, `parse-parameter-struct`, and `example-contracts`[​](#cli-removed-inspect-contract-compute-selector-generate-secret-and-hash-parse-parameter-struct-and-example-contracts "Direct link to cli-removed-inspect-contract-compute-selector-generate-secret-and-hash-parse-parameter-struct-and-example-contracts") The `aztec` CLI no longer includes these contract-inspection helpers, which predate the current tooling and had no remaining use: * `aztec inspect-contract`: contract class details and function selectors are available programmatically via `getContractClassFromArtifact` and `FunctionSelector.fromSignature` in `@aztec-labs/aztec.js`. * `aztec compute-selector`: use `FunctionSelector.fromSignature` from `@aztec-labs/aztec.js`. * `aztec generate-secret-and-hash`: use `Fr.random()` and `computeSecretHash` from `@aztec-labs/aztec.js`. * `aztec parse-parameter-struct`: no replacement. * `aztec example-contracts`: the list of example contracts is the set of subpath exports of `@aztec-labs/noir-contracts.js`. ### \[Aztec.js] Contract artifacts preserve the names of `#[abi(tag)]` globals[​](#aztecjs-contract-artifacts-preserve-the-names-of-abitag-globals "Direct link to aztecjs-contract-artifacts-preserve-the-names-of-abitag-globals") Globals exported from a Noir contract with `#[abi(tag)]` now keep their names in the artifact: entries in `ContractArtifact.outputs.globals` are `{ name, value }` objects as emitted by the compiler, where the names used to be stripped on load. This lets TypeScript read contract constants by name instead of duplicating their values: ``` #[abi(constants)] pub global EXPORTED_FIELD_CONSTANT: Field = 1234; #[abi(constants)] pub global EXPORTED_STRING_CONSTANT: str<8> = "exported"; ``` ``` import { getGlobalsByTag } from '@aztec-labs/aztec.js/abi'; const { EXPORTED_FIELD_CONSTANT, EXPORTED_STRING_CONSTANT } = getGlobalsByTag(MyContractArtifact, 'constants'); ``` There is no backwards compatibility path: artifacts compiled before Noir exported global names (with bare, unnamed entries) are rejected on load and must be recompiled with the current toolchain. The artifact hash commits to the contract artifact's ABI outputs (`ContractArtifact.outputs`), so adding names to `outputs.globals` changes the artifact hash, the contract class ID, and any addresses derived from it. The PXE data schema version was bumped accordingly, so existing PXE databases resync on first open. [Learn how to export globals under one or more tags and read them from TypeScript](/developers/testnet/docs/aztec-nr/framework-description/contract_artifact.md#exported-globals). ### \[Aztec.js] A function's return type is a single `returnType`, not a `returnTypes` list[​](#aztecjs-a-functions-return-type-is-a-single-returntype-not-a-returntypes-list "Direct link to aztecjs-a-functions-return-type-is-a-single-returntype-not-a-returntypes-list") `FunctionAbi.returnTypes` is deprecated in favor of the single optional `FunctionAbi.returnType`, since multiple return values are already expressed as one `tuple` type. Read it through `getFunctionReturnType(abi)`, which also resolves artifacts serialized before `returnType` existed. `FunctionCall.returnTypes` is likewise replaced by `FunctionCall.returnType`. `decodeFromAbi` now takes the single type a function returns (or `undefined`) instead of a list, and returns `undefined` for a function that returns nothing, where it previously returned `[]`. To decode a list of values, such as a function's arguments, use the new `decodeEachFromAbi`. **Migration:** ``` - decodeFromAbi(abi.returnTypes, values) + decodeFromAbi(getFunctionReturnType(abi), values) - decodeFromAbi(fn.parameters.map(param => param.type), args) as AbiDecoded[] + decodeEachFromAbi(fn.parameters.map(param => param.type), args) ``` ### \[Aztec.js] Protocol contracts removed from `@aztec-labs/noir-contracts.js`[​](#aztecjs-protocol-contracts-removed-from-aztec-labsnoir-contractsjs "Direct link to aztecjs-protocol-contracts-removed-from-aztec-labsnoir-contractsjs") `@aztec-labs/noir-contracts.js` no longer includes the protocol contracts: the `FeeJuice`, `ContractClassRegistry`, and `ContractInstanceRegistry` artifacts and typed wrappers have been removed from the package, so imports such as `@aztec-labs/noir-contracts.js/FeeJuice` no longer resolve. These names are also no longer available to the `aztec` CLI's contract-name lookup (e.g. in `aztec example-contracts`). Protocol contracts are distributed via `@aztec-labs/protocol-contracts` (artifacts and canonical deployment data), and typed wrappers for them are exported from `@aztec-labs/aztec.js/protocol`. The `aztec.js` wrappers are bound to the contract's canonical address, so attaching takes only the wallet: there is no address parameter. **Migration:** ``` - import { FeeJuiceContract } from '@aztec-labs/noir-contracts.js/FeeJuice'; + import { FeeJuiceContract } from '@aztec-labs/aztec.js/protocol'; - const feeJuice = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet); + const feeJuice = FeeJuiceContract.withWallet(wallet); ``` ### \[Aztec.js] Protocol contract wrappers: `at(wallet)` deprecated in favor of `withWallet(wallet)`[​](#aztecjs-protocol-contract-wrappers-atwallet-deprecated-in-favor-of-withwalletwallet "Direct link to aztecjs-protocol-contract-wrappers-atwallet-deprecated-in-favor-of-withwalletwallet") The protocol contract wrappers exported from `@aztec-labs/aztec.js/protocol` (`FeeJuiceContract`, `ContractClassRegistryContract`, `ContractInstanceRegistryContract`) rename their static `at(wallet)` to `withWallet(wallet)`. These wrappers are bound to the contract's canonical address, so their only parameter is the wallet to act through; `withWallet` states that directly and matches the existing `withWallet` instance method, whereas the one-argument `at` read as if it took an address. `at(wallet)` still works but is deprecated and will be removed in a future release. **Migration:** ``` - const feeJuice = FeeJuiceContract.at(wallet); + const feeJuice = FeeJuiceContract.withWallet(wallet); ``` ### \[Aztec.nr] Domain separators moved out of the protocol constants module[​](#aztecnr-domain-separators-moved-out-of-the-protocol-constants-module "Direct link to \[Aztec.nr] Domain separators moved out of the protocol constants module") Nine `DOM_SEP__*` domain separators that used to live in the protocol constants module (`aztec::protocol::constants`, generated from `noir-protocol-circuits`) have moved into the `aztec` crate, next to the code that uses them. None of them were ever protocol constants (each hash is computed per-contract), so they no longer belong on the protocol export. Two remain public, at a new path: | Constant | Old path | New path | | ---------------------------------- | ---------------------------- | --------------------------- | | `DOM_SEP__PARTIAL_NOTE_COMMITMENT` | `aztec::protocol::constants` | `aztec::note::partial_note` | | `DOM_SEP__NOTE_COMPLETION_LOG_TAG` | `aztec::protocol::constants` | `aztec::note::partial_note` | ``` - use aztec::protocol::constants::{DOM_SEP__NOTE_COMPLETION_LOG_TAG, DOM_SEP__PARTIAL_NOTE_COMMITMENT}; + use aztec::note::partial_note::{DOM_SEP__NOTE_COMPLETION_LOG_TAG, DOM_SEP__PARTIAL_NOTE_COMMITMENT}; ``` The other seven are now crate-internal (`pub(crate)`) and can no longer be imported from outside the `aztec` crate: `DOM_SEP__AUTHWIT_NULLIFIER`, `DOM_SEP__TX_NULLIFIER`, `DOM_SEP__SINGLE_USE_CLAIM_NULLIFIER`, `DOM_SEP__CONSTRAINED_MSG_NULLIFIER`, `DOM_SEP__ECDH_SUBKEY`, `DOM_SEP__ECDH_FIELD_MASK`, and `DOM_SEP__INITIALIZATION_NULLIFIER`. **Impact**: Contracts that use aztec-nr's high-level APIs (notes, authwit, state variables, message delivery, ECDH) are unaffected, since these separators are applied internally. A contract that imported one of these constants directly must either switch to the new `aztec::note::partial_note` path (for the two public ones) or, for the now-internal ones, call the corresponding aztec-nr helper instead of recomputing the hash by hand. The generated TypeScript `DomainSeparator` enum in `@aztec-labs/constants` / `@aztec-labs/stdlib` likewise no longer contains the seven removed members (their values were unused in TypeScript). ### \[Aztec Node] `GasPrice` renamed to `FeesPerGas` in `@aztec-labs/ethereum`[​](#aztec-node-gasprice-renamed-to-feespergas-in-aztec-labsethereum "Direct link to aztec-node-gasprice-renamed-to-feespergas-in-aztec-labsethereum") The `GasPrice` interface exported from `@aztec-labs/ethereum/l1-tx-utils` is now `FeesPerGas`, matching viem's name for the same thing, and the methods and fields carrying it are renamed to match. These values were never a price paid: they are the EIP-1559 caps a transaction is sent with (`maxFeePerGas`, `maxPriorityFeePerGas`, `maxFeePerBlobGas`), and what the transaction actually pays is decided at inclusion. The fields inside the type are unchanged. | Old | New | | ------------------------------------------- | --------------------------------------------- | | `GasPrice` | `FeesPerGas` | | `ReadOnlyL1TxUtils.getGasPrice()` | `ReadOnlyL1TxUtils.getFeesPerGas()` | | `L1TxState.gasPrice` | `L1TxState.feesPerGas` | | `L1TxState.gasPriceHistory` | `L1TxState.feesPerGasHistory` | | `TimedOutTxState.gasPriceHistory` | `TimedOutTxState.feesPerGasHistory` | | `TimedOutTxState.finalGasPrice` | `TimedOutTxState.finalFeesPerGas` | | `L1Deployer.sendTransaction()` → `gasPrice` | `L1Deployer.sendTransaction()` → `feesPerGas` | **Migration:** ``` - import type { GasPrice } from '@aztec-labs/ethereum/l1-tx-utils'; + import type { FeesPerGas } from '@aztec-labs/ethereum/l1-tx-utils'; - const gasPrice = await l1TxUtils.getGasPrice(gasConfig, true, 0); + const feesPerGas = await l1TxUtils.getFeesPerGas(gasConfig, true, 0); const { state } = await l1TxUtils.sendTransaction(request); - logger.info(`Sent at ${state.gasPrice.maxFeePerGas}`); + logger.info(`Sent at ${state.feesPerGas.maxFeePerGas}`); ``` **Impact**: A rename with no behavior change. Two on-disk formats move with it, neither of which needs operator action: * The node's L1 transaction state store writes the new key but still reads states written under the old one, so a node restarting on this version keeps monitoring transactions it sent before the upgrade. * Failed-L1-transaction debug records (written when `L1_TX_FAILED_STORE` is set) now use `sentFeesPerGas` and `sentFeesPerGasLadder` instead of `sentGasPrice` and `sentGasPriceLadder`. Records written before the upgrade keep the old keys, and parsing one through `FailedL1TxSchema` returns it without those fields, though the values are still present in the stored JSON under the old names. ## 5.2.0[​](#520 "Direct link to 5.2.0") ### \[Aztec.nr] Note types declared inside a contract must be `pub`[​](#aztecnr-note-types-declared-inside-a-contract-must-be-pub "Direct link to aztecnr-note-types-declared-inside-a-contract-must-be-pub") Noir v1.0.0-beta.25 enforces the caller's visibility when comptime code resolves a trait method into a typed expression. The `#[aztec]` macro resolves each note type's `NoteType::get_id` that way when it generates `compute_note_hash_and_nullifier`, so a note struct declared directly inside the `contract` module without `pub` no longer compiles: ``` error: Function `get_id` is private ┌─ .../aztec/src/macros/utils.nr:152:5 │ `get_id` is declared in `MyContract` ``` Note types declared in their own module are unaffected, since they are already `pub` for the contract to reach them. **Migration:** ``` #[derive(Packable, Eq)] #[note] - struct MyNote { + pub struct MyNote { owner: AztecAddress, } ``` ### \[Sequencer] A sequencer with p2p enabled no longer proposes while it has no connected peers[​](#sequencer-a-sequencer-with-p2p-enabled-no-longer-proposes-while-it-has-no-connected-peers "Direct link to \[Sequencer] A sequencer with p2p enabled no longer proposes while it has no connected peers") The sequencer skips building and proposing a checkpoint when p2p is enabled and it is connected to fewer than `SEQ_MIN_PEERS_TO_PROPOSE` peers (default `1`). Proposing into an empty peer set burns the slot and can publish a checkpoint whose transaction data nobody received. L1-only duties (governance and slashing votes, prune, inv
프로젝트로 돌아가기