@aztec-labs/stdlib 6.0.0-nightly.20261003 → 6.0.0-nightly.20261004
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.
|
@@ -37,8 +37,9 @@ export declare function validateCheckpoint(checkpoint: Checkpoint, opts: {
|
|
|
37
37
|
* - Archive root chaining between consecutive blocks
|
|
38
38
|
* - Consistent slot number across all blocks
|
|
39
39
|
* - Global variables (slot, timestamp, coinbase, feeRecipient, gasFees) match checkpoint header for each block
|
|
40
|
+
* - No tx hash appears more than once across all blocks of the checkpoint
|
|
40
41
|
*/
|
|
41
42
|
export declare function validateCheckpointStructure(checkpoint: Checkpoint, opts?: {
|
|
42
43
|
maxBlocksPerCheckpoint?: number;
|
|
43
44
|
}): void;
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jaGVja3BvaW50L3ZhbGlkYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLFVBQVUsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBSXpGLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRWxELHFCQUFhLHlCQUEwQixTQUFRLEtBQUs7YUFHaEMsZ0JBQWdCLEVBQUUsZ0JBQWdCO2FBQ2xDLElBQUksRUFBRSxVQUFVO0lBSGxDLFlBQ0UsT0FBTyxFQUFFLE1BQU0sRUFDQyxnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDbEMsSUFBSSxFQUFFLFVBQVUsRUFJakM7Q0FDRjtBQUVEOzs7Ozs7O0dBT0c7QUFDSCx3QkFBZ0Isa0JBQWtC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AC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,GACA,IAAI,CAIN;AAED
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/checkpoint/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAIzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,yBAA0B,SAAQ,KAAK;aAGhC,gBAAgB,EAAE,gBAAgB;aAClC,IAAI,EAAE,UAAU;IAHlC,YACE,OAAO,EAAE,MAAM,EACC,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,UAAU,EAIjC;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE;IACJ,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,GACA,IAAI,CAIN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,UAAU,EACtB,IAAI,GAAE;IAAE,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7C,IAAI,CAqFN"}
|
|
@@ -34,6 +34,7 @@ export class CheckpointValidationError extends Error {
|
|
|
34
34
|
* - Archive root chaining between consecutive blocks
|
|
35
35
|
* - Consistent slot number across all blocks
|
|
36
36
|
* - Global variables (slot, timestamp, coinbase, feeRecipient, gasFees) match checkpoint header for each block
|
|
37
|
+
* - No tx hash appears more than once across all blocks of the checkpoint
|
|
37
38
|
*/ export function validateCheckpointStructure(checkpoint, opts = {}) {
|
|
38
39
|
const { maxBlocksPerCheckpoint = MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT } = opts;
|
|
39
40
|
const { blocks, number, slot } = checkpoint;
|
|
@@ -44,6 +45,7 @@ export class CheckpointValidationError extends Error {
|
|
|
44
45
|
throw new CheckpointValidationError(`Checkpoint has ${blocks.length} blocks, exceeding limit of ${maxBlocksPerCheckpoint}`, number, slot);
|
|
45
46
|
}
|
|
46
47
|
const firstBlock = blocks[0];
|
|
48
|
+
const seenTxHashes = new Set();
|
|
47
49
|
if (!checkpoint.header.lastArchiveRoot.equals(firstBlock.header.lastArchive.root)) {
|
|
48
50
|
throw new CheckpointValidationError(`Checkpoint lastArchiveRoot does not match first block's lastArchive root`, number, slot);
|
|
49
51
|
}
|
|
@@ -67,6 +69,13 @@ export class CheckpointValidationError extends Error {
|
|
|
67
69
|
throw new CheckpointValidationError(`Block ${block.number} lastArchive root does not match archive root of block ${prev.number}`, number, slot);
|
|
68
70
|
}
|
|
69
71
|
}
|
|
72
|
+
for (const txEffect of block.body.txEffects){
|
|
73
|
+
const txHash = txEffect.txHash.toString();
|
|
74
|
+
if (seenTxHashes.has(txHash)) {
|
|
75
|
+
throw new CheckpointValidationError(`Tx ${txHash} in block ${block.number} appears more than once in the checkpoint`, number, slot);
|
|
76
|
+
}
|
|
77
|
+
seenTxHashes.add(txHash);
|
|
78
|
+
}
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
81
|
/** Validates checkpoint blocks gas limits */ function validateCheckpointBlocksLimits(checkpoint, opts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec-labs/stdlib",
|
|
3
|
-
"version": "6.0.0-nightly.
|
|
3
|
+
"version": "6.0.0-nightly.20261004",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
95
|
"@aztec-foundation/bb.js": "6.0.0-nightly.20261001",
|
|
96
96
|
"@aztec-foundation/noir-noirc_abi": "6.0.0-nightly.20261001",
|
|
97
|
-
"@aztec-labs/blob-lib": "6.0.0-nightly.
|
|
98
|
-
"@aztec-labs/constants": "6.0.0-nightly.
|
|
99
|
-
"@aztec-labs/ethereum": "6.0.0-nightly.
|
|
100
|
-
"@aztec-labs/foundation": "6.0.0-nightly.
|
|
97
|
+
"@aztec-labs/blob-lib": "6.0.0-nightly.20261004",
|
|
98
|
+
"@aztec-labs/constants": "6.0.0-nightly.20261004",
|
|
99
|
+
"@aztec-labs/ethereum": "6.0.0-nightly.20261004",
|
|
100
|
+
"@aztec-labs/foundation": "6.0.0-nightly.20261004",
|
|
101
101
|
"@google-cloud/storage": "^7.15.0",
|
|
102
102
|
"axios": "^1.15.1",
|
|
103
103
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -56,6 +56,7 @@ export function validateCheckpoint(
|
|
|
56
56
|
* - Archive root chaining between consecutive blocks
|
|
57
57
|
* - Consistent slot number across all blocks
|
|
58
58
|
* - Global variables (slot, timestamp, coinbase, feeRecipient, gasFees) match checkpoint header for each block
|
|
59
|
+
* - No tx hash appears more than once across all blocks of the checkpoint
|
|
59
60
|
*/
|
|
60
61
|
export function validateCheckpointStructure(
|
|
61
62
|
checkpoint: Checkpoint,
|
|
@@ -77,6 +78,7 @@ export function validateCheckpointStructure(
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
const firstBlock = blocks[0];
|
|
81
|
+
const seenTxHashes = new Set<string>();
|
|
80
82
|
|
|
81
83
|
if (!checkpoint.header.lastArchiveRoot.equals(firstBlock.header.lastArchive.root)) {
|
|
82
84
|
throw new CheckpointValidationError(
|
|
@@ -131,6 +133,18 @@ export function validateCheckpointStructure(
|
|
|
131
133
|
);
|
|
132
134
|
}
|
|
133
135
|
}
|
|
136
|
+
|
|
137
|
+
for (const txEffect of block.body.txEffects) {
|
|
138
|
+
const txHash = txEffect.txHash.toString();
|
|
139
|
+
if (seenTxHashes.has(txHash)) {
|
|
140
|
+
throw new CheckpointValidationError(
|
|
141
|
+
`Tx ${txHash} in block ${block.number} appears more than once in the checkpoint`,
|
|
142
|
+
number,
|
|
143
|
+
slot,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
seenTxHashes.add(txHash);
|
|
147
|
+
}
|
|
134
148
|
}
|
|
135
149
|
}
|
|
136
150
|
|