@openzeppelin/compact-deployer 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ file.
6
6
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## Unreleased
10
+
11
+ ### Fixed
12
+
13
+ - A fragmented deploy of a contract compiled with `--feature-zkir-v3` no longer fails its verifier-key insert with `expected header tag 'midnight:verifier-key[v6]:'`. Each key is inserted under the version the ledger accepts for it (#200)
14
+
9
15
  ## 0.3.0 (2026-09-24)
10
16
 
11
17
  ### Added
@@ -5,7 +5,12 @@
5
5
  * chain state for each, which costs a tx per circuit. This module assembles
6
6
  * many `VerifierKeyInsert`s into a single signed `MaintenanceUpdate`.
7
7
  */
8
- import { MaintenanceUpdate, type SignatureVerifyingKey, type SigningKey, Transaction } from '@midnightntwrk/ledger-v9';
8
+ import { ContractOperationVersionedVerifierKey, MaintenanceUpdate, type SignatureVerifyingKey, type SigningKey, Transaction } from '@midnightntwrk/ledger-v9';
9
+ /**
10
+ * `verifierKey` under the version its header declares. The ledger rejects a
11
+ * header that does not match the version, so it picks the version, not us.
12
+ */
13
+ export declare function versionedVerifierKey(circuitId: string, verifierKey: Uint8Array): ContractOperationVersionedVerifierKey;
9
14
  /**
10
15
  * One circuit's key. The absence of any other update shape is what
11
16
  * makes removal, replacement, and authority rotation unconstructible here.
@@ -9,8 +9,30 @@ import { getNetworkId } from '@midnight-ntwrk/midnight-js-network-id';
9
9
  import { ttlOneHour } from '@midnight-ntwrk/midnight-js-utils';
10
10
  import { ContractOperationVersionedVerifierKey, Intent, MaintenanceUpdate, signatureVerifyingKey, signData, Transaction, VerifierKeyInsert, } from '@midnightntwrk/ledger-v9';
11
11
  import { DeployError } from "../errors.js";
12
- /** Only ledger operation version the compiler emits keys for. */
13
- const VK_VERSION = 'v3';
12
+ /**
13
+ * Every verifier-key version the ledger accepts. The `Record` fails the build
14
+ * when a ledger bump adds or drops a version.
15
+ */
16
+ const VERIFIER_KEY_VERSIONS = Object.keys({
17
+ v3: true,
18
+ v4: true,
19
+ });
20
+ /**
21
+ * `verifierKey` under the version its header declares. The ledger rejects a
22
+ * header that does not match the version, so it picks the version, not us.
23
+ */
24
+ export function versionedVerifierKey(circuitId, verifierKey) {
25
+ const rejections = [];
26
+ for (const version of VERIFIER_KEY_VERSIONS) {
27
+ try {
28
+ return new ContractOperationVersionedVerifierKey(version, verifierKey);
29
+ }
30
+ catch (error) {
31
+ rejections.push(`${version}: ${error.message}`);
32
+ }
33
+ }
34
+ throw new DeployError(`Verifier key for circuit "${circuitId}" matches no ledger version (${rejections.join('; ')}).`);
35
+ }
14
36
  /** Verifying key for a signing key. The public half is the only part that may be logged. */
15
37
  export function verifyingKeyOf(signingKey) {
16
38
  return signatureVerifyingKey(signingKey);
@@ -37,7 +59,7 @@ export function buildInsertUpdate({ address, inserts, counter, signingKey, signe
37
59
  // An empty update would spend dust and change nothing.
38
60
  throw new DeployError('Refusing to build an empty maintenance update.');
39
61
  }
40
- const updates = inserts.map(({ circuitId, verifierKey }) => new VerifierKeyInsert(circuitId, new ContractOperationVersionedVerifierKey(VK_VERSION, verifierKey)));
62
+ const updates = inserts.map(({ circuitId, verifierKey }) => new VerifierKeyInsert(circuitId, versionedVerifierKey(circuitId, verifierKey)));
41
63
  // Sign the built update, then attach; `addSignature` returns the
42
64
  // signed value rather than mutating in place.
43
65
  const update = new MaintenanceUpdate(address, updates, counter);
@@ -1 +1 @@
1
- {"version":3,"file":"maintenance-tx.js","sourceRoot":"","sources":["../../src/services/maintenance-tx.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO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,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CACxC,CAAC;AACJ,CAAC;AAMD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,MAAM,GACY;IAClB,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACrE,OAAO,WAAW,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openzeppelin/compact-deployer",
3
3
  "description": "Forge-style deployer library for Midnight Compact contracts",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "keywords": [
6
6
  "compact",
7
7
  "midnight",