Aztec 백서

Aztec

원문

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

ns rather than throwing: ``` // Throws BadRequestError when a proposed entry exists at the resolved number: await node.getCheckpoint("proposed", { includeAttestations: true }); await node.getCheckpoint("proposed", { includeL1PublishInfo: true }); // And when a by-number / by-slot lookup falls back to a proposed entry: await node.getCheckpoint({ number: N }, { includeAttestations: true }); // → throws if N is matched only in the proposed store ``` If your code asks for `includeAttestations` / `includeL1PublishInfo` and might land on a proposed entry, gate the call on `getCheckpoint(param)` first, then re-issue with the include flags only after confirming the result is from the confirmed store (e.g. by checking that the tag-based equivalent returns the same checkpoint number). **Impact**: Wallet, indexer, and tooling code that called `node.getCheckpoint('proposed')` or `node.getCheckpoint('latest')` will need to update their tag. Any code relying on the old "proposed = latest confirmed" alias should switch to `'checkpointed'`. Code that combined `'proposed'` (or by-number/by-slot fallbacks) with `includeAttestations` / `includeL1PublishInfo` will now throw at runtime; gate those flags as described above. ### \[Aztec Node] `feeAssetPriceModifier` now correctly populated on confirmed checkpoints[​](#aztec-node-feeassetpricemodifier-now-correctly-populated-on-confirmed-checkpoints "Direct link to aztec-node-feeassetpricemodifier-now-correctly-populated-on-confirmed-checkpoints") Confirmed checkpoints previously reported `feeAssetPriceModifier = 0n` regardless of the value observed on L1, because the archiver dropped the field on checkpoint confirmation. The field is now persisted and returned correctly on `CheckpointResponse`. Any wallet or indexer logic that special-cased `0n` as a sentinel for "no modifier" will need to be updated; it is now a valid value in its own right. ### \[CLI] `aztec-up` no longer exposes transitive npm bins on PATH[​](#cli-aztec-up-no-longer-exposes-transitive-npm-bins-on-path "Direct link to cli-aztec-up-no-longer-exposes-transitive-npm-bins-on-path") The `aztec-up` installer used to add `$HOME/.aztec/current/node_modules/.bin` to your shell `PATH`, which put \~40 transitive npm bins (`jest`, `tsc`, `tsserver`, `semver`, `uuid`, `json5`, ...) onto your interactive shell and silently shadowed your own installed versions of those tools. Only the seven `@aztec/*`-owned bins (`aztec`, `aztec-wallet`, `bb`, `bb-cli`, `blob-client`, `noir-codegen`, `txe`) are now exposed. If you had an Aztec version installed before this release, your shell profile (`~/.bashrc` or `~/.zshrc`) still contains the old `PATH` line. Re-run the installer once (replacing `[VERSION]` with whichever toolchain version you're on, e.g. `4.2.0`) to replace it: ``` VERSION=[VERSION] bash -i <(curl -sL https://install.aztec.network) ``` Open a fresh shell and confirm the leak is gone: ``` echo $PATH ``` `$HOME/.aztec/current/node_modules/.bin` should no longer appear in the output. You'll also see your own `jest`, `tsc`, etc. again instead of the ones bundled with the Aztec toolchain. ### \[Protocol] Domain separators introduced for merkle-node, block-headers, and blob hashes[​](#protocol-domain-separators-introduced-for-merkle-node-block-headers-and-blob-hashes "Direct link to \[Protocol] Domain separators introduced for merkle-node, block-headers, and blob hashes") Several protocol hashes that previously used bare `poseidon2_hash` are now domain-separated via `poseidon2_hash_with_separator`. This is a security hardening change — it prevents a value produced by one hash context from being reinterpreted in another (e.g. a sibling path from one tree being transported to another). **New domain separators:** * `DOM_SEP__MERKLE_HASH` — sibling-pair hash for append-only trees (note-hash, L1→L2, archive, VK tree, and the balanced/unbalanced tree hash helpers in `@aztec/foundation/trees`). * `DOM_SEP__NULLIFIER_MERKLE`, `DOM_SEP__PUBLIC_DATA_MERKLE`, `DOM_SEP__WRITTEN_SLOTS_MERKLE`, `DOM_SEP__RETRIEVED_BYTECODES_MERKLE` — per-tree sibling-pair hash for each indexed tree. Each tree uses its own separator so sibling paths are non-transportable across trees. * `DOM_SEP__BLOCK_HEADERS_HASH` — used when accumulating block headers into `blockHeadersHash`. * `DOM_SEP__BLOB_HASHED_Y_LIMBS`, `DOM_SEP__BLOB_CHALLENGE_Z`, `DOM_SEP__BLOB_Z_ACC`, `DOM_SEP__BLOB_GAMMA_ACC`, `DOM_SEP__BLOB_GAMMA_FINAL` — blob accumulator and challenge derivations. **⚠️<!-- --> Hard-coded test constants will no longer match.** Every value derived from any of the hashes above is new in this release. This includes (non-exhaustively): * **All merkle tree roots** — note-hash, nullifier, public-data, L1→L2 message, archive, VK, and the AVM-internal written-slots and retrieved-bytecodes (class-ids) trees. * **Genesis constants** — `GENESIS_BLOCK_HEADER_HASH`, `GENESIS_ARCHIVE_ROOT`, `AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_ROOT`, `AVM_RETRIEVED_BYTECODES_TREE_INITIAL_ROOT`. * **Every block hash and archive root** — they commit to tree roots and the new block-headers-hash. * **Protocol contract addresses** — their derivation depends on the private-function tree root. * **Blob commitments / challenges** — any test that pins `z`, `gamma`, or the accumulator outputs. Regenerate these values from a fresh build of this release — do not copy them from previous release fixtures. **If you re-implement any of these hashes off-circuit** (e.g. a wallet that computes nullifier low-leaf membership, or an indexer that derives block hashes / tree roots), update the call sites: ``` // Merkle sibling-pair hash (append-only trees) - poseidon2Hash([left, right]) + poseidon2HashWithSeparator([left, right], DomainSeparator.MERKLE_HASH) // Indexed-tree sibling-pair hash — pick the matching tree separator - poseidon2Hash([left, right]) + poseidon2HashWithSeparator([left, right], DomainSeparator.NULLIFIER_MERKLE) + // or PUBLIC_DATA_MERKLE, WRITTEN_SLOTS_MERKLE, RETRIEVED_BYTECODES_MERKLE ``` `poseidon2HashWithSeparator` is exported from `@aztec/foundation/crypto/poseidon`; the `DomainSeparator` enum and the matching `DOM_SEP__*` constants are defined in `@aztec/constants`. The new entries listed above are additions — existing separator names are unchanged. For TypeScript consumers, `@aztec/stdlib/hash` exports ready-made helpers that wrap the right separator: `computeMerkleHash` (append-only), `computeNullifierMerkleHash`, and `computePublicDataMerkleHash`. Prefer these over calling `poseidon2HashWithSeparator` directly so the separator choice stays colocated with the tree. ### \[Aztec.nr] `emit_private_log_unsafe` / `emit_raw_note_log_unsafe` are deprecated[​](#aztecnr-emit_private_log_unsafe--emit_raw_note_log_unsafe-are-deprecated "Direct link to aztecnr-emit_private_log_unsafe--emit_raw_note_log_unsafe-are-deprecated") `emit_private_log_unsafe` and `emit_raw_note_log_unsafe` are deprecated and will be removed in a future release. Migrate to the new `emit_private_log_vec_unsafe` / `emit_raw_note_log_vec_unsafe` functions, which take a `BoundedVec<Field, PRIVATE_LOG_CIPHERTEXT_LEN>` instead of the `(log: [Field; PRIVATE_LOG_CIPHERTEXT_LEN], length: u32)` pair. ``` - context.emit_private_log_unsafe(tag, log, length); + context.emit_private_log_vec_unsafe(tag, bounded_vec_log); - context.emit_raw_note_log_unsafe(tag, log, length, note_hash_counter); + context.emit_raw_note_log_vec_unsafe(tag, bounded_vec_log, note_hash_counter); ``` If you were manually padding an array and passing a shorter length, you can now create a `BoundedVec` from just the meaningful fields: ``` - let padded = payload.concat([0; PRIVATE_LOG_CIPHERTEXT_LEN - 2]); - context.emit_private_log_unsafe(tag, padded, 2); + let log = BoundedVec::from_array(payload); + context.emit_private_log_vec_unsafe(tag, log); ``` If you were passing the full array, wrap it with `BoundedVec::from_array`: ``` - context.emit_private_log_unsafe(tag, ciphertext, ciphertext.len()); + context.emit_private_log_vec_unsafe(tag, BoundedVec::from_array(ciphertext)); ``` ### \[aztec-nr] Nullifier membership witness oracle returns split types[​](#aztec-nr-nullifier-membership-witness-oracle-returns-split-types "Direct link to \[aztec-nr] Nullifier membership witness oracle returns split types") `get_nullifier_membership_witness` and `get_low_nullifier_membership_witness` now return `(NullifierLeafPreimage, MembershipWitness<NULLIFIER_TREE_HEIGHT>)` instead of the bundled `NullifierMembershipWitness` struct (which has been removed). If you were using these oracle functions directly (e.g. in `schnorr_account_contract`'s `lookup_validity`), update your code to destructure the tuple: ``` - let witness = get_low_nullifier_membership_witness(block_header, siloed_nullifier); - let nullifier_value = witness.leaf_preimage.nullifier; - let index = witness.index; - let path = witness.path; + let (leaf_preimage, witness) = get_low_nullifier_membership_witness(block_header, siloed_nullifier); + let nullifier_value = leaf_preimage.nullifier; + let index = witness.leaf_index; + let path = witness.sibling_path; ``` Note the field renames: `index` is now `leaf_index`, and `path` is now `sibling_path` (matching the protocol circuit's `MembershipWitness` type). This has been done because this is the format expected by the functionality in protocol circuits and given that this is sensitive security-wise it made sense to reuse that functionality in Aztec.nr. ### \[L1 Contracts] Empire slasher removed, slasher config simplified[​](#l1-contracts-empire-slasher-removed-slasher-config-simplified "Direct link to \[L1 Contracts] Empire slasher removed, slasher config simplified") The empire slashing model has been removed. Only the tally-based slashing model remains, and it has been renamed from `TallySlashingProposer` to `SlashingProposer`. **L1 contract changes:** * `SlasherFlavor` enum removed from `ISlasher.sol` * `RollupConfigInput.slasherFlavor` (enum) replaced with `slasherEnabled` (bool) * `TallySlashingProposer` contract renamed to `SlashingProposer` * `TallySlasherDeploymentExtLib` library renamed to `SlasherDeploymentExtLib` * `SlashFactory` periphery contract removed * `SLASHING_PROPOSER_TYPE` constant removed from `SlashingProposer` * All `TallySlashingProposer__` error prefixes renamed to `SlashingProposer__` **Environment variable changes:** ``` - AZTEC_SLASHER_FLAVOR=tally # was: "tally" | "empire" | "none" + AZTEC_SLASHER_ENABLED=true # now a boolean ``` **Removed environment variables:** `SLASH_MIN_PENALTY_PERCENTAGE`, `SLASH_MAX_PENALTY_PERCENTAGE` **Removed from deploy outputs:** `slashFactoryAddress` **Node admin API:** `getSlashPayloads()` method removed. **TypeScript config changes:** ``` - slasherFlavor: 'tally' | 'none' + slasherEnabled: boolean ``` `slashMinPenaltyPercentage` and `slashMaxPenaltyPercentage` removed from `SlasherConfig`. ### \[Aztec Node] `getTxByHash`, `getTxsByHash` and `getPendingTxs` no longer return tx proofs by default[​](#aztec-node-gettxbyhash-gettxsbyhash-and-getpendingtxs-no-longer-return-tx-proofs-by-default "Direct link to aztec-node-gettxbyhash-gettxsbyhash-and-getpendingtxs-no-longer-return-tx-proofs-by-default") `AztecNode.getTxByHash`, `AztecNode.getTxsByHash` and `AztecNode.getPendingTxs` (also exposed on the P2P API) now take an optional `GetTxByHashOptions` argument with an `includeProof` flag. The proof is stripped from returned txs unless `includeProof: true` is passed, cutting roughly 35-52KB per tx over the wire. **Migration:** ``` - const tx = await node.getTxByHash(txHash); + const tx = await node.getTxByHash(txHash, { includeProof: true }); - const txs = await node.getPendingTxs(limit, after); + const txs = await node.getPendingTxs(limit, after, { includeProof: true }); ``` **Impact**: Callers that read the proof off returned txs (eg to re-broadcast or validate them) must now pass `{ includeProof: true }` explicitly; by default the returned txs carry an empty proof. ### \[aztec.js] `DeployMethod.send()` always returns `{ contract, receipt, instance }`[​](#aztecjs-deploymethodsend-always-returns--contract-receipt-instance- "Direct link to aztecjs-deploymethodsend-always-returns--contract-receipt-instance-") The `returnReceipt` option in deploy wait options has been removed. `DeployMethod.send()` now always returns an object with `contract`, `receipt`, and `instance` at the top level, provided the user waits for the transaction to be included. The `DeployTxReceipt` and `DeployWaitOptions` types have been removed. **Migration:** ``` - const { - receipt: { contract, instance }, - } = await MyContract.deploy(wallet, ...args).send({ - from: address, - wait: { returnReceipt: true }, - }); + const { contract, instance } = await MyContract.deploy(wallet, ...args).send({ + from: address, + }); ``` ### \[CLI] `aztec init` now scaffolds a Counter example template[​](#cli-aztec-init-now-scaffolds-a-counter-example-template "Direct link to cli-aztec-init-now-scaffolds-a-counter-example-template") `aztec init` previously created a blank contract crate. It now scaffolds a runnable **Counter** example contract with a constructor, `increment`, and `get_counter` functions, plus a test suite, so new developers have a working starting point ([#22751](https://github.com/AztecProtocol/aztec-packages/pull/22751)). * `aztec init` — scaffolds the Counter example (new default). * `aztec new <NAME>` — still scaffolds a blank contract, either as a new standalone project or as a new crate added to an existing workspace. **Impact**: any scripts, CI jobs, or onboarding docs that ran `aztec init` expecting an empty contract starting point now get the Counter example. Use `aztec new <NAME>` for the blank scaffold. The existing Counter tutorial under [`docs/tutorials/contract_tutorials`](/developers/testnet/docs/tutorials/contract_tutorials/counter_contract.md) is unaffected because it uses `aztec new`. ## 4.3.0[​](#430 "Direct link to 4.3.0") ### `aztec new` and `aztec init` now create a 2-crate workspace[​](#aztec-new-and-aztec-init-now-create-a-2-crate-workspace "Direct link to aztec-new-and-aztec-init-now-create-a-2-crate-workspace") `aztec new` and `aztec init` now create a workspace with two crates instead of a single contract crate: * A `contract` crate (type = "contract") for your smart contract code * A `test` crate (type = "lib") for Noir tests, which depends on the contract crate The new project structure looks like: ``` my_project/ ├── Nargo.toml # [workspace] members = ["contract", "test"] ├── contract/ │ ├── src/main.nr │ └── Nargo.toml # type = "contract" └── test/ ├── src/lib.nr └── Nargo.toml # type = "lib" ``` **What changed:** * The `--contract` and `--lib` flags have been removed from `aztec new` and `aztec init`. These commands now always create a contract workspace. * Contract code is now at `contract/src/main.nr` instead of `src/main.nr`. * The `Nargo.toml` in the project root is now a workspace file. Contract dependencies go in `contract/Nargo.toml`. * Tests should be written in the separate `test` crate (`test/src/lib.nr`) and import the contract by package name (e.g., `use my_contract::MyContract;`) instead of using `crate::`. ### `aztec new` crate directories are now named after the contract[​](#aztec-new-crate-directories-are-now-named-after-the-contract "Direct link to aztec-new-crate-directories-are-now-named-after-the-contract") `aztec new` and `aztec init` now name the generated crate directories after the contract instead of using generic `contract/` and `test/` names. For example, `aztec new counter` now creates: ``` counter/ ├── Nargo.toml # [workspace] members = ["counter_contract", "counter_test"] ├── counter_contract/ │ ├── src/main.nr │ └── Nargo.toml # type = "contract" └── counter_test/ ├── src/lib.nr └── Nargo.toml # type = "lib" ``` This enables adding multiple contracts to a single workspace. Running `aztec new <name>` inside an existing workspace (a directory with a `Nargo.toml` containing `[workspace]`) now adds a new `<name>_contract` and `<name>_test` crate pair to the workspace instead of creating a new directory. **What changed:** * Crate directories are now `<name>_contract/` and `<name>_test/` instead of `contract/` and `test/`. * Contract code is now at `<name>_contract/src/main.nr` instead of `contract/src/main.nr`. * Contract dependencies go in `<name>_contract/Nargo.toml` instead of `contract/Nargo.toml`. * Tests import the contract by its new crate name (e.g., `use counter_contract::Main;` instead of `use counter::Main;`). ### \[CLI] `--name` flag removed from `aztec new` and `aztec init`[​](#cli---name-flag-removed-from-aztec-new-and-aztec-init "Direct link to cli---name-flag-removed-from-aztec-new-and-aztec-init") The `--name` flag has been removed from both `aztec new` and `aztec init`. For `aztec new`, the positional argument now serves as both the contract name and the directory name. For `aztec init`, the directory name is always used as the contract name. **Migration:** ``` - aztec new my_project --name counter + aztec new counter ``` ``` - aztec init --name counter + aztec init ``` **Impact**: If you were using `--name` to set a contract name different from the directory name, rename your directory or use `aztec new` with the desired contract name directly. ## 4.2.0[​](#420 "Direct link to 4.2.0") ### \[Aztec.js] `GasSettings.default()` renamed to `GasSettings.fallback()`[​](#aztecjs-gassettingsdefault-renamed-to-gassettingsfallback "Direct link to aztecjs-gassettingsdefault-renamed-to-gassettingsfallback") `GasSettings.default()` has been renamed to `GasSettings.fallback()` to clarify that these gas limits are not protocol defaults — the protocol has no concept of "default" gas settings. `fallback()` is a convenience for cases where gas estimation is not being used, but callers should prefer estimating gas via simulation for accurate limits. The old `DEFAULT_GAS_LIMIT` and `DEFAULT_TEARDOWN_GAS_LIMIT` constants have been removed. Gas limits are now derived from protocol-level maximums (`MAX_PROCESSABLE_L2_GAS`, `MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT`) rather than arbitrary fixed values. A new `GasSettings.forEstimation()` method provides intentionally high gas limits for use during simulation. These limits exceed protocol maximums so the simulation doesn't hit gas caps — you must pass `skipTxValidation: true` when simulating with them, then use the results to set accurate gas limits on the actual transaction. `EmbeddedWallet` does this by default. **Migration:** ``` - import { DEFAULT_GAS_LIMIT, DEFAULT_TEARDOWN_GAS_LIMIT } from '@aztec/constants'; - const settings = GasSettings.default({ maxFeesPerGas }); + const settings = GasSettings.fallback({ maxFeesPerGas }); ``` **Impact**: Any code referencing `GasSettings.default()`, `DEFAULT_GAS_LIMIT`, or `DEFAULT_TEARDOWN_GAS_LIMIT` will fail to compile. ### \[PXE] `simulateTx`, `executeUtility`, `profileTx`, and `proveTx` no longer accept `scopes: 'ALL_SCOPES'`[​](#pxe-simulatetx-executeutility-profiletx-and-provetx-no-longer-accept-scopes-all_scopes "Direct link to pxe-simulatetx-executeutility-profiletx-and-provetx-no-longer-accept-scopes-all_scopes") The `AccessScopes` type (`'ALL_SCOPES' | AztecAddress[]`) has been removed. The `scopes` field in `SimulateTxOpts`, `ExecuteUtilityOpts`, and `ProfileTxOpts` now requires an explicit `AztecAddress[]`. Callers that previously passed `'ALL_SCOPES'` must now specify which addresses will be in scope for the call. **Migration:** ``` + const accounts = await pxe.getRegisteredAccounts(); + const scopes = accounts.map(a => a.address); // simulateTx - await pxe.simulateTx(txRequest, { simulatePublic: true, scopes: 'ALL_SCOPES' }); + await pxe.simulateTx(txRequest, { simulatePublic: true, scopes }); // executeUtility - await pxe.executeUt
프로젝트로 돌아가기