Aztec 백서

Aztec

원문

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

alidation) are unaffected, and setups that disable p2p entirely (sandbox, local network, single node) still propose as before. A peerless node also warns periodically, stops filing data-withholding slashing offenses, and rejects incoming transactions until it reconnects. **Impact**: set `SEQ_MIN_PEERS_TO_PROPOSE=0` to restore the previous behaviour. Fixing the underlying peer connectivity is the real remedy. ### \[Node API] JSON-RPC internal errors now return code `-32603`[​](#node-api-json-rpc-internal-errors-now-return-code--32603 "Direct link to node-api-json-rpc-internal-errors-now-return-code--32603") The JSON-RPC server returned `-32600` ("Invalid Request") for internal server failures. It now returns `-32603` ("Internal error"), which is what the JSON-RPC 2.0 specification defines for that case. Genuine malformed-request errors still return `-32600`. **Impact**: clients that branch on `-32600` to detect an internal server failure must also handle `-32603`. ### \[Node API] `GET /status` now returns a JSON body with per-component health[​](#node-api-get-status-now-returns-a-json-body-with-per-component-health "Direct link to node-api-get-status-now-returns-a-json-body-with-per-component-health") The status endpoint previously set only an HTTP status code and returned no body. It now responds with `application/json` describing per-component health, for example: ``` { "ok": true, "components": { "p2p": { "healthy": true, "enabled": true, "connectedPeers": 12 } } } ``` `StatusCheckFn` widens from `() => boolean | Promise<boolean>` to also allow a structured result, and the new `ComponentStatus` / `ServerStatus` / `ServerStatusFn` types plus `SafeJsonRpcServer.getStatus()` are exported. The p2p component fails the check when the connected peer count is below `P2P_HEALTH_MIN_PEERS` (default `0`, which never fails). **Impact**: consumers that only read the HTTP status code are unaffected. Custom status callbacks that returned a bare boolean keep working. ### \[Aztec.js] `deserializeArrayFromVector` removed from `@aztec/foundation/serialize`[​](#aztecjs-deserializearrayfromvector-removed-from-aztecfoundationserialize "Direct link to aztecjs-deserializearrayfromvector-removed-from-aztecfoundationserialize") `deserializeArrayFromVector` has been deleted from `@aztec/foundation`'s serialization helpers and is no longer exported. **Impact**: decode length-prefixed vectors with `BufferReader` (`reader.readVector(...)`) instead. ## 5.1.0[​](#510 "Direct link to 5.1.0") ### \[Aztec.nr] Canonical HandshakeRegistry re-pinned at a new address[​](#aztecnr-canonical-handshakeregistry-re-pinned-at-a-new-address "Direct link to \[Aztec.nr] Canonical HandshakeRegistry re-pinned at a new address") The canonical `HandshakeRegistry` has been re-pinned so that it includes the owner's address in its `PrivateMutable` initialization nullifiers, keeping the handshake state of accounts that share keys independent. The registry moves to a new address. Handshakes established with the previous registry instance are not visible to the new one and must be re-established. The other standard contracts keep their addresses. ### \[Aztec.nr] Note property selectors are typed and use packed-layout indices[​](#aztecnr-note-property-selectors-are-typed-and-use-packed-layout-indices "Direct link to \[Aztec.nr] Note property selectors are typed and use packed-layout indices") The selectors in the generated `properties()` used the field's position in the note struct declaration, which pointed at the wrong packed field for any note with an earlier field packing to more than one `Field` (a `Point`, an array, a nested struct). Selector indices are now the field's offset in the note's packed representation, so `select`/`sort` criteria constrain the field they name. Breaking changes: * `PropertySelector<T>` carries the selected property's type. Hand-constructed literals need a type annotation, e.g. `let selector: PropertySelector<Field> = PropertySelector { index: 0, offset: 0, length: 32 };`. * `select`/`sort` reject properties that pack to more than one `Field` at compile time. * `select` takes its value typed as the property's type. Cast the value if a mixed-type comparison was intentional. * `properties()` cannot be used with a custom `Packable` layout. Define property selectors manually for such notes. * Every note field type must implement `Packable`, even when the note's own `Packable` is hand-written. ## 5.0.1[​](#501 "Direct link to 5.0.1") ### \[Aztec.nr] History note nullification helpers renamed and restricted to own-contract notes[​](#aztecnr-history-note-nullification-helpers-renamed-and-restricted-to-own-contract-notes "Direct link to \[Aztec.nr] History note nullification helpers renamed and restricted to own-contract notes") The `history::note` helpers that recompute a note's nullifier have been renamed with a `local_` prefix and now assert that the note belongs to the executing contract: | Old | New | | ---------------------------------- | ---------------------------------------- | | `assert_note_was_valid_by` | `assert_local_note_was_valid_by` | | `assert_note_was_nullified_by` | `assert_local_note_was_nullified_by` | | `assert_note_was_not_nullified_by` | `assert_local_note_was_not_nullified_by` | These helpers derive the note's nullifier from the executing contract's app-siloed nullifier key, and it is not possible for a contract to retrieve the app-siloed nullifier for a different contract, as this would constitute leakage of key material. These helpers incorrectly used the local contract's key siloing, which for a note of a different contract resulted in the non-inclusion check passing unconditionally and wrongly reporting a nullified note as not nullified. The helpers now assert `contract_address == context.this_address()` and fail with "Note nullification history is only supported for the executing contract's own notes" otherwise. **Impact**: Update call sites to the new names. Own-contract usage (the common case) is unaffected beyond the rename. `assert_note_existed_by` is unchanged and still supports notes of any contract, since note-hash inclusion involves no keys. ### \[Aztec.nr] `set_as_fee_payer` now asserts it is called during the setup phase[​](#aztecnr-set_as_fee_payer-now-asserts-it-is-called-during-the-setup-phase "Direct link to aztecnr-set_as_fee_payer-now-asserts-it-is-called-during-the-setup-phase") `PrivateContext::set_as_fee_payer` now asserts that execution is still in the setup (non-revertible) phase, i.e. that `end_setup` has not yet been called by any function in the transaction. Electing a fee payer in the revertible phase was never safe: compensation collected by the fee payer after `end_setup` can be discarded if a public call later reverts, while the protocol still debits the fee payer's fee-juice balance. **Impact**: A transaction in which `set_as_fee_payer` runs after the setup phase has ended now fails with `fee payer must be elected during the setup phase`. Standard fee payment flows, which call `set_as_fee_payer` before or together with `end_setup`, are unaffected. ### \[PXE] Stores are now selected by `(l1ChainId, rollupAddress, schemaVersion)` instead of being wiped on mismatch[​](#pxe-stores-are-now-selected-by-l1chainid-rollupaddress-schemaversion-instead-of-being-wiped-on-mismatch "Direct link to pxe-stores-are-now-selected-by-l1chainid-rollupaddress-schemaversion-instead-of-being-wiped-on-mismatch") Previously, connecting a PXE or embedded wallet to a different or redeployed rollup, or bumping the store schema version, wiped the existing on-disk store in place. That meant master account keys could be destroyed simply by pointing a wallet at a different network. PXE data stores now exist per `(l1ChainId, rollupAddress, schemaVersion)` triple, and switching networks (or upgrading) selects or creates the matching store instead of overwriting previous ones. The embedded wallet's `wallet_data` store is partitioned the same way, so accounts and aliases are per network: switching networks starts with an empty account list until accounts are re-imported, and switching back finds the originals intact. **Impact**: The first start after upgrading to this version begins with a fresh, empty store; the pre-upgrade data is not deleted. On Node.js environments (lmdb-v2) pre-upgrade data stays at `<dataDirectory>/<name>` while new per-identity `pxe_data` stores live under `<dataDirectory>/<name>-stores/`. The embedded Node.js wallet previously stored data in cwd-relative, rollup-address-suffixed directories instead (`pxe_data_<rollupAddress>/pxe_data` for the PXE store, `wallet_data_<rollupAddress>/wallet_data` for the wallet store): if you used it before this release, that is where the old data lives. The embedded wallet now defaults its data root to `aztec-wallet-data/`, with per-identity wallet stores under `<dataDirectory>/wallet_data-stores/` on Node.js and OPFS store names prefixed `wallet_data_` in the browser. Browser apps can enumerate and clean up `pxe_data` and `wallet_data` stores for networks no longer in use with the new `listStores()` / `deleteStore()` utilities: ``` import { deleteStore, listStores } from "@aztec/kv-store/sqlite-opfs"; const names = await listStores(); await deleteStore(names[0]); ``` This change also removes `createStore` from `@aztec/kv-store/sqlite-opfs` and `@aztec/kv-store/deprecated/indexeddb`: stores are now opened by name with `AztecSQLiteOPFSStore.open` / `AztecIndexedDBStore.open`. ## 5.0.0[​](#500 "Direct link to 5.0.0") ### \[PXE] Local PXE database is reset on upgrade[​](#pxe-local-pxe-database-is-reset-on-upgrade "Direct link to \[PXE] Local PXE database is reset on upgrade") The persisted tagging stores now key every entry by the self-describing `<kind>:<secret>:<app>` form of `AppTaggingSecret`; unconstrained secrets previously used a two-part `<secret>:<app>` key. This bumps the PXE data schema version, and there is no forward migration for the old keys: on first open the PXE clears any database whose stored schema version differs from the current one. The wipe resets the entire PXE store, not just the tagging data, because all of it shares one backing database. **Impact**: On upgrade your local PXE state is reset. You must re-register accounts and re-sync from genesis. Wallets should surface a "your local state was reset, please re-register accounts and re-sync" path. ### \[Aztec.nr] `TestEnvironmentOptions::with_tagging_secret_strategy` replaced[​](#aztecnr-testenvironmentoptionswith_tagging_secret_strategy-replaced "Direct link to aztecnr-testenvironmentoptionswith_tagging_secret_strategy-replaced") `TestEnvironmentOptions::with_tagging_secret_strategy` is now `with_default_tag_secret_strategy_all_modes` for tests that want the same default wallet strategy for both onchain delivery modes. The new naming reflects that these helpers configure the TXE default wallet strategy hook; contract-fixed delivery derivations bypass that default. For mode-specific defaults and hook semantics, see the [`resolveTaggingSecretStrategy` test helper docs](/developers/testnet/docs/foundational-topics/pxe/execution_hooks.md#resolvetaggingsecretstrategy). ### \[Aztec.nr] L1-to-L2 message consumption takes the secret as an array[​](#aztecnr-l1-to-l2-message-consumption-takes-the-secret-as-an-array "Direct link to \[Aztec.nr] L1-to-L2 message consumption takes the secret as an array") `PrivateContext::consume_l1_to_l2_message` and `PublicContext::consume_l1_to_l2_message` now take the message secret as an arbitrary-length array `[Field; N]` instead of a single `Field`, so a consumer can derive its secret hash from more than one field. The helpers `compute_secret_hash` and `compute_l1_to_l2_message_nullifier` are likewise now generic over the secret length. A single-field secret behaves exactly as before (the hashes are unchanged for `N = 1`) — just wrap it in an array. **Migration:** ``` - context.consume_l1_to_l2_message(content, secret, sender, leaf_index); + context.consume_l1_to_l2_message(content, [secret], sender, leaf_index); ``` ``` - let secret_hash = compute_secret_hash(secret); + let secret_hash = compute_secret_hash([secret]); ``` **Impact**: Contracts that consume L1-to-L2 messages, or that call `compute_secret_hash` / `compute_l1_to_l2_message_nullifier`, must wrap their single-field secret in an array. Already-deployed contracts are unaffected: their unchanged bytecode keeps working, as PXE serves the previous L1-to-L2 membership-witness oracle through a compatibility adaptor. ### \[Aztec.js] `computeL1ToL2MessageNullifier` replaced by `computeFeeJuiceMessageNullifier`[​](#aztecjs-computel1tol2messagenullifier-replaced-by-computefeejuicemessagenullifier "Direct link to aztecjs-computel1tol2messagenullifier-replaced-by-computefeejuicemessagenullifier") The `@aztec/stdlib` helper `computeL1ToL2MessageNullifier(contract, messageHash, secret)`, which returned the siloed message nullifier, has been removed. Its replacement `computeFeeJuiceMessageNullifier(messageHash, secret)` returns the **unsiloed** nullifier — siloing now happens at the point where the nullifier is looked up. `getL1ToL2MessageWitness` accordingly takes an optional `{ contractAddress, nullifier }` (unsiloed) and silos internally. `computeSecretHash` is unchanged, and `getNonNullifiedL1ToL2MessageWitness` keeps the same signature. **Migration:** ``` - const nullifier = await computeL1ToL2MessageNullifier(contract, messageHash, secret); + // computeFeeJuiceMessageNullifier returns the UNSILOED nullifier; silo it before looking it up, or hand the + // unsiloed value to getL1ToL2MessageWitness which silos for you. + const nullifier = await siloNullifier(contract, await computeFeeJuiceMessageNullifier(messageHash, secret)); ``` **Impact**: Only affects code calling these low-level messaging helpers directly - most integrations use `getNonNullifiedL1ToL2MessageWitness`, which is unchanged. ### \[Aztec.js] Account signing keys are no longer derived from the privacy secret[​](#aztecjs-account-signing-keys-are-no-longer-derived-from-the-privacy-secret "Direct link to \[Aztec.js] Account signing keys are no longer derived from the privacy secret") Schnorr account signing keys used to be derived from the account's privacy secret (via the now-removed `deriveSigningKey`), which meant the ownership key could be reconstructed from a value the PXE holds. The relationship is now reversed: the signing key is the root, and the privacy secret is derived from it with `deriveSecretKeyFromSigningKey` (exported from `@aztec/accounts/utils`). As a result: * `deriveSigningKey` is removed. * `getSchnorrAccountContractAddress` and `getSchnorrInitializerlessAccountContractAddress` now take the signing key first and an optional secret: `(signingPrivateKey, salt, secretKey?)`. When `secretKey` is omitted it is derived from the signing key. * The embedded wallet's `createSchnorrAccount` and `createSchnorrInitializerlessAccount` now require an explicit signing key argument. **Migration:** ``` - import { deriveSigningKey } from '@aztec/stdlib/keys'; - const signingKey = deriveSigningKey(secret); - const address = await getSchnorrAccountContractAddress(secret, salt, signingKey); + import { GrumpkinScalar } from '@aztec/aztec.js/fields'; + const signingKey = GrumpkinScalar.random(); // supply your own signing key + const address = await getSchnorrAccountContractAddress(signingKey, salt, secret); ``` **Impact**: Account addresses change, since both the signing key and the privacy secret feed the address. Code that derived the signing key from the secret, or passed the secret first to the address helpers, no longer compiles. ### \[Aztec.nr] `MessageContext` removed: message processing uses `ResolvedTx`[​](#aztecnr-messagecontext-removed-message-processing-uses-resolvedtx "Direct link to aztecnr-messagecontext-removed-message-processing-uses-resolvedtx") `aztec::messages::processing::MessageContext` has been removed in favor of the new `ResolvedTx`, which carries the same `tx_hash`, `unique_note_hashes_in_tx`, and `first_nullifier_in_tx`, plus `block_number` and `block_hash`. The offchain handoff type `OffchainMessageWithContext` is likewise renamed to `OffchainMessageWithTx`. This affects contracts that implement a custom message handler (registered via `AztecConfig::custom_message_handler`): the handler's context parameter is now a `ResolvedTx`. **Migration:** ``` use aztec::messages::processing::{ - enqueue_event_for_validation, MessageContext, + enqueue_event_for_validation, ResolvedTx, }; unconstrained fn handle_my_message( // ... - message_context: MessageContext, + resolved_tx: ResolvedTx, scope: AztecAddress, ) { - // ...message_context.tx_hash... + // ...resolved_tx.tx_hash... } ``` ### \[PXE] `pxe.updateContract` removed and `pxe.registerContract` no longer takes an artifact[​](#pxe-pxeupdatecontract-removed-and-pxeregistercontract-no-longer-takes-an-artifact "Direct link to pxe-pxeupdatecontract-removed-and-pxeregistercontract-no-longer-takes-an-artifact") Registering classes and instances are now separate, unvalidated operations. `registerContractClass(artifact)` registers a class, `registerContract(instance)` registers an instance and no longer takes an artifact. `registerContract` does not check that PXE knows the contract's artifact: a missing artifact surfaces only when the contract is later simulated. **Migration:** * `pxe.registerContract` now takes the instance directly (its address preimage) and returns the derived address. Register the class separately via `registerContractClass`: ``` - await pxe.registerContract({ instance, artifact }); + await pxe.registerContractClass(artifact); + await pxe.registerContract(instance); ``` If you were calling it without an artifact, just drop the wrapping object: `pxe.registerContract({ instance })` becomes `pxe.registerContract(instance)`. The `wallet.registerContract(instance, artifact?, secretKeyOrKeys?)` convenience is unchanged and performs both registrations for you. * To make a new class's code available after an onchain upgrade, register the new artifact instead of calling `updateContract`: ``` - await pxe.updateContract(address, newArtifact); + await pxe.registerContractClass(newArtifact); ``` The new class is used automatically once the upgrade takes effect on chain; no further PXE action is needed. Registering it beforehand is harmless: until the update activates, the node still resolves the contract's current class to the previous one, so it keeps running its old code. * `pxe.getContractInstance(address)` and `wallet.getContractMetadata(address).instance` now return the contract's **address preimage**, which no longer includes `currentContractClassId`. ### \[Aztec.js] `AccountWithSecretKey` removed, read account keys from the `AccountManager` or PXE[​](#aztecjs-accountwithsecretkey-removed-read-account-keys-from-the-accountmanager-or-pxe "Direct link to aztecjs-accountwithsecretkey-removed-read-account-keys-from-the-accountmanager-or-pxe") `AccountWithSecretKey` was a thin wrapper that bundled an account's transaction signer with its master secret key, used mainly to print or export the secret. It has been removed, and `AccountManager.getAccount()` now returns the plain `Account` signer. The wrapper's extra methods are no longer available on that value: * `getSecretKey()`: read it from the `AccountManager`, which still exposes `getSecretKey()`. * `getEncryptionSecret()`: this was unused and has been removed. To recover an account's encryption (address) secret, pass its master incoming viewing secret key to `computeAddressSecret`. You can read that key, along with the account's other master secret keys, from `pxe.getAccountSecretKeys(address)`. **Migration:** ``` - import { AccountWithSecretKey } from '@aztec/aztec.js/account'; - - const account = await accountManage
프로젝트로 돌아가기