@forestrie/receipt-verify 0.8.0 → 0.8.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.
@@ -1 +1 @@
1
- {"version":3,"file":"freshen-receipt.d.ts","sourceRoot":"","sources":["../src/freshen-receipt.ts"],"names":[],"mappings":"AA+CA,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,uBAAuB,CAAC;AAI/B,MAAM,MAAM,mBAAmB,GAAG;IAChC,iEAAiE;IACjE,eAAe,EAAE,UAAU,CAAC;IAC5B;uEACmE;IACnE,SAAS,EAAE,UAAU,CAAC;IACtB;;mFAE+E;IAC/E,iBAAiB,EAAE,SAAS,0BAA0B,EAAE,CAAC;IACzD;iEAC6D;IAC7D,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;IAC/B;wDACoD;IACpD,qBAAqB,EAAE,UAAU,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,wEAAwE;IACxE,OAAO,EAAE,UAAU,CAAC;IACpB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AASF;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAmJ/B"}
1
+ {"version":3,"file":"freshen-receipt.d.ts","sourceRoot":"","sources":["../src/freshen-receipt.ts"],"names":[],"mappings":"AA+CA,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,uBAAuB,CAAC;AAI/B,MAAM,MAAM,mBAAmB,GAAG;IAChC,iEAAiE;IACjE,eAAe,EAAE,UAAU,CAAC;IAC5B;uEACmE;IACnE,SAAS,EAAE,UAAU,CAAC;IACtB;;mFAE+E;IAC/E,iBAAiB,EAAE,SAAS,0BAA0B,EAAE,CAAC;IACzD;iEAC6D;IAC7D,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;IAC/B;wDACoD;IACpD,qBAAqB,EAAE,UAAU,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,wEAAwE;IACxE,OAAO,EAAE,UAAU,CAAC;IACpB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AASF;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAyJ/B"}
@@ -138,6 +138,13 @@ export async function freshenReceipt(input) {
138
138
  store.set(fullIndices[k], oldPath[k]);
139
139
  }
140
140
  for (const link of links) {
141
+ // A base-0 link (treeSize1 === 0) has no from-peaks to climb — a 0→N
142
+ // consistency proof carries `paths: []` (the whole accumulator is its
143
+ // right-peaks). Skip it: it contributes no store nodes, and calling
144
+ // `peakMMRIndexes(-1n)` would throw (`posHeight(0)`, FOR-414). A genesis-
145
+ // rooted `.sth` chain always starts with such a link.
146
+ if (link.treeSize1 === 0n)
147
+ continue;
141
148
  const fromPeaks = peakMMRIndexes(link.treeSize1 - 1n);
142
149
  fromPeaks.forEach((peakIndex, j) => {
143
150
  const climb = link.paths[j];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forestrie/receipt-verify",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Offline SCITT grant receipt verification (ADR-0045)",
@@ -200,6 +200,12 @@ export async function freshenReceipt(
200
200
  store.set(fullIndices[k]!, oldPath[k]!);
201
201
  }
202
202
  for (const link of links) {
203
+ // A base-0 link (treeSize1 === 0) has no from-peaks to climb — a 0→N
204
+ // consistency proof carries `paths: []` (the whole accumulator is its
205
+ // right-peaks). Skip it: it contributes no store nodes, and calling
206
+ // `peakMMRIndexes(-1n)` would throw (`posHeight(0)`, FOR-414). A genesis-
207
+ // rooted `.sth` chain always starts with such a link.
208
+ if (link.treeSize1 === 0n) continue;
203
209
  const fromPeaks = peakMMRIndexes(link.treeSize1 - 1n);
204
210
  fromPeaks.forEach((peakIndex, j) => {
205
211
  const climb = link.paths[j];