@aztec/stdlib 0.0.1-commit.0b941701 → 0.0.1-commit.18ccd8f0
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/dest/block/block_hash.d.ts +11 -11
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +10 -10
- package/dest/block/block_parameter.d.ts +4 -4
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -2
- package/dest/block/in_block.d.ts +8 -8
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +4 -4
- package/dest/contract/contract_address.js +1 -1
- package/dest/contract/contract_class_id.d.ts +1 -1
- package/dest/contract/contract_class_id.js +1 -1
- package/dest/contract/private_function.js +1 -1
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/epoch-helpers/index.d.ts +3 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +4 -0
- package/dest/hash/hash.js +2 -2
- package/dest/hash/map_slot.d.ts +1 -1
- package/dest/hash/map_slot.d.ts.map +1 -1
- package/dest/hash/map_slot.js +4 -3
- package/dest/interfaces/aztec-node.d.ts +4 -4
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +3 -3
- package/dest/interfaces/block-builder.d.ts +3 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +2 -2
- package/dest/interfaces/validator.d.ts +2 -2
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/logs/extended_public_log.d.ts +2 -2
- package/dest/logs/log_id.d.ts +6 -6
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +5 -5
- package/dest/logs/siloed_tag.d.ts +1 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -3
- package/dest/p2p/block_proposal.d.ts +10 -3
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +10 -3
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/tests/mocks.d.ts +6 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +4 -3
- package/dest/tx/block_header.d.ts +3 -3
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +3 -3
- package/dest/tx/in_tx.d.ts +2 -2
- package/dest/tx/indexed_tx_effect.d.ts +4 -4
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +2 -2
- package/dest/tx/tx_receipt.d.ts +5 -5
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +2 -2
- package/package.json +9 -9
- package/src/block/block_hash.ts +13 -13
- package/src/block/block_parameter.ts +3 -3
- package/src/block/in_block.ts +5 -5
- package/src/contract/contract_address.ts +1 -1
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/private_function.ts +1 -1
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/epoch-helpers/index.ts +9 -0
- package/src/hash/hash.ts +2 -2
- package/src/hash/map_slot.ts +3 -2
- package/src/interfaces/aztec-node.ts +5 -5
- package/src/interfaces/block-builder.ts +2 -0
- package/src/interfaces/validator.ts +1 -2
- package/src/logs/log_id.ts +6 -6
- package/src/logs/siloed_tag.ts +3 -2
- package/src/p2p/block_proposal.ts +9 -2
- package/src/p2p/checkpoint_proposal.ts +9 -2
- package/src/tests/mocks.ts +6 -4
- package/src/tx/block_header.ts +6 -6
- package/src/tx/indexed_tx_effect.ts +2 -2
- package/src/tx/tx_receipt.ts +4 -4
package/dest/tx/tx_receipt.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { RevertCode } from '../avm/revert_code.js';
|
|
3
|
-
import {
|
|
3
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
4
4
|
import { type ZodFor } from '../schemas/schemas.js';
|
|
5
5
|
import { TxHash } from './tx_hash.js';
|
|
6
6
|
/** Block inclusion/finalization status. */
|
|
@@ -39,7 +39,7 @@ export declare class TxReceipt {
|
|
|
39
39
|
/** The transaction fee paid for the transaction. */
|
|
40
40
|
transactionFee?: bigint | undefined;
|
|
41
41
|
/** The hash of the block containing the transaction. */
|
|
42
|
-
blockHash?:
|
|
42
|
+
blockHash?: BlockHash | undefined;
|
|
43
43
|
/** The block number in which the transaction was included. */
|
|
44
44
|
blockNumber?: BlockNumber | undefined;
|
|
45
45
|
constructor(
|
|
@@ -54,7 +54,7 @@ export declare class TxReceipt {
|
|
|
54
54
|
/** The transaction fee paid for the transaction. */
|
|
55
55
|
transactionFee?: bigint | undefined,
|
|
56
56
|
/** The hash of the block containing the transaction. */
|
|
57
|
-
blockHash?:
|
|
57
|
+
blockHash?: BlockHash | undefined,
|
|
58
58
|
/** The block number in which the transaction was included. */
|
|
59
59
|
blockNumber?: BlockNumber | undefined);
|
|
60
60
|
/** Returns true if the transaction was executed successfully. */
|
|
@@ -75,9 +75,9 @@ export declare class TxReceipt {
|
|
|
75
75
|
executionResult?: TxExecutionResult;
|
|
76
76
|
error?: string;
|
|
77
77
|
transactionFee?: bigint;
|
|
78
|
-
blockHash?:
|
|
78
|
+
blockHash?: BlockHash;
|
|
79
79
|
blockNumber?: BlockNumber;
|
|
80
80
|
}): TxReceipt;
|
|
81
81
|
static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult;
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfcmVjZWlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R4L3R4X3JlY2VpcHQudHMiXSwibmFtZXM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sU0FBUyxDQUFDO1FBQ3RCLFdBQVcsQ0FBQyxFQUFFLFdBQVcsQ0FBQztLQUMzQixhQVVBO0lBRUQsT0FBYyw2QkFBNkIsQ0FBQyxVQUFVLEVBQUUsVUFBVSxHQUFHLGlCQUFpQixDQVlyRjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_receipt.d.ts","sourceRoot":"","sources":["../../src/tx/tx_receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,iCAAiC,CAAC;AAIjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tx_receipt.d.ts","sourceRoot":"","sources":["../../src/tx/tx_receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,iCAAiC,CAAC;AAIjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,2CAA2C;AAC3C,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,QAAQ,EAOtC,CAAC;AAEF,yDAAyD;AACzD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;CAChC;AAED;;;;;GAKG;AACH,qBAAa,SAAS;IAElB,6CAA6C;IACtC,MAAM,EAAE,MAAM;IACrB,mDAAmD;IAC5C,MAAM,EAAE,QAAQ;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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { RevertCode } from '../avm/revert_code.js';
|
|
4
|
-
import {
|
|
4
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
5
5
|
import { schemas } from '../schemas/schemas.js';
|
|
6
6
|
import { TxHash } from './tx_hash.js';
|
|
7
7
|
/** Block inclusion/finalization status. */ export var TxStatus = /*#__PURE__*/ function(TxStatus) {
|
|
@@ -74,7 +74,7 @@ import { TxHash } from './tx_hash.js';
|
|
|
74
74
|
status: z.nativeEnum(TxStatus),
|
|
75
75
|
executionResult: z.nativeEnum(TxExecutionResult).optional(),
|
|
76
76
|
error: z.string().optional(),
|
|
77
|
-
blockHash:
|
|
77
|
+
blockHash: BlockHash.schema.optional(),
|
|
78
78
|
blockNumber: BlockNumberSchema.optional(),
|
|
79
79
|
transactionFee: schemas.BigInt.optional()
|
|
80
80
|
}).transform((fields)=>TxReceipt.from(fields));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.18ccd8f0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -78,14 +78,14 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
81
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
82
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
83
|
-
"@aztec/constants": "0.0.1-commit.
|
|
84
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
85
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
86
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
87
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
88
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
81
|
+
"@aztec/bb.js": "0.0.1-commit.18ccd8f0",
|
|
82
|
+
"@aztec/blob-lib": "0.0.1-commit.18ccd8f0",
|
|
83
|
+
"@aztec/constants": "0.0.1-commit.18ccd8f0",
|
|
84
|
+
"@aztec/ethereum": "0.0.1-commit.18ccd8f0",
|
|
85
|
+
"@aztec/foundation": "0.0.1-commit.18ccd8f0",
|
|
86
|
+
"@aztec/l1-artifacts": "0.0.1-commit.18ccd8f0",
|
|
87
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.18ccd8f0",
|
|
88
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.18ccd8f0",
|
|
89
89
|
"@google-cloud/storage": "^7.15.0",
|
|
90
90
|
"axios": "^1.12.0",
|
|
91
91
|
"json-stringify-deterministic": "1.0.12",
|
package/src/block/block_hash.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { BufferReader } from '@aztec/foundation/serialize';
|
|
|
5
5
|
import { schemas } from '../schemas/schemas.js';
|
|
6
6
|
|
|
7
7
|
/** Hash of an L2 block. */
|
|
8
|
-
export class
|
|
8
|
+
export class BlockHash extends Buffer32 {
|
|
9
9
|
constructor(
|
|
10
10
|
/** The buffer containing the hash. */
|
|
11
11
|
hash: Buffer,
|
|
@@ -14,12 +14,12 @@ export class L2BlockHash extends Buffer32 {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Type guard that checks if a value is an
|
|
17
|
+
* Type guard that checks if a value is an BlockHash instance.
|
|
18
18
|
* Uses duck typing to handle cases where instanceof fails due to module duplication.
|
|
19
19
|
* Checks for Buffer32-like structure with a 32-byte buffer.
|
|
20
20
|
*/
|
|
21
|
-
static isL2BlockHash(value: unknown): value is
|
|
22
|
-
if (value instanceof
|
|
21
|
+
static isL2BlockHash(value: unknown): value is BlockHash {
|
|
22
|
+
if (value instanceof BlockHash) {
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
// Duck typing fallback: check if it looks like a Buffer32 with a 32-byte buffer
|
|
@@ -36,32 +36,32 @@ export class L2BlockHash extends Buffer32 {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
static override random() {
|
|
39
|
-
return new
|
|
39
|
+
return new BlockHash(Fr.random().toBuffer());
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
static override fromNumber(num: number):
|
|
43
|
-
return new
|
|
42
|
+
static override fromNumber(num: number): BlockHash {
|
|
43
|
+
return new BlockHash(super.fromNumber(num).toBuffer());
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
static override fromBuffer(buffer: Buffer | BufferReader) {
|
|
47
47
|
const reader = BufferReader.asReader(buffer);
|
|
48
|
-
return new
|
|
48
|
+
return new BlockHash(reader.readBytes(BlockHash.SIZE));
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
static override fromString(str: string):
|
|
52
|
-
return new
|
|
51
|
+
static override fromString(str: string): BlockHash {
|
|
52
|
+
return new BlockHash(super.fromString(str).toBuffer());
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
static get schema() {
|
|
56
|
-
return schemas.BufferHex.transform(value => new
|
|
56
|
+
return schemas.BufferHex.transform(value => new BlockHash(value));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
static zero() {
|
|
60
|
-
return new
|
|
60
|
+
return new BlockHash(Buffer32.ZERO.toBuffer());
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
static override fromField(hash: Fr) {
|
|
64
|
-
return new
|
|
64
|
+
return new BlockHash(hash.toBuffer());
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
toField(): Fr {
|
|
@@ -2,9 +2,9 @@ import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHash } from './block_hash.js';
|
|
6
6
|
|
|
7
|
-
export const BlockParameterSchema = z.union([
|
|
7
|
+
export const BlockParameterSchema = z.union([BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
|
|
8
8
|
|
|
9
|
-
/** Block parameter - either a specific BlockNumber, block hash (
|
|
9
|
+
/** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
|
|
10
10
|
export type BlockParameter = z.infer<typeof BlockParameterSchema>;
|
package/src/block/in_block.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types'
|
|
|
2
2
|
|
|
3
3
|
import { type ZodTypeAny, z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHash } from './block_hash.js';
|
|
6
6
|
import type { L2Block } from './l2_block.js';
|
|
7
7
|
|
|
8
8
|
export type InBlock = {
|
|
9
9
|
l2BlockNumber: BlockNumber;
|
|
10
|
-
l2BlockHash:
|
|
10
|
+
l2BlockHash: BlockHash;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// Note: If you expand this type with indexInBlock, then delete `IndexedTxEffect` and use this type instead.
|
|
@@ -18,7 +18,7 @@ export type DataInBlock<T> = {
|
|
|
18
18
|
export function randomInBlock(): InBlock {
|
|
19
19
|
return {
|
|
20
20
|
l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000)),
|
|
21
|
-
l2BlockHash:
|
|
21
|
+
l2BlockHash: BlockHash.random(),
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -33,14 +33,14 @@ export async function wrapDataInBlock<T>(data: T, block: L2Block): Promise<DataI
|
|
|
33
33
|
return {
|
|
34
34
|
data,
|
|
35
35
|
l2BlockNumber: block.number,
|
|
36
|
-
l2BlockHash:
|
|
36
|
+
l2BlockHash: BlockHash.fromField(await block.hash()),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function inBlockSchema() {
|
|
41
41
|
return z.object({
|
|
42
42
|
l2BlockNumber: BlockNumberSchema,
|
|
43
|
-
l2BlockHash:
|
|
43
|
+
l2BlockHash: BlockHash.schema,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -87,5 +87,5 @@ export async function computeInitializationHashFromEncodedArgs(
|
|
|
87
87
|
encodedArgs: Fr[],
|
|
88
88
|
): Promise<Fr> {
|
|
89
89
|
const argsHash = await computeVarArgsHash(encodedArgs);
|
|
90
|
-
return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.
|
|
90
|
+
return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.INITIALIZER);
|
|
91
91
|
}
|
|
@@ -13,7 +13,7 @@ import { computePrivateFunctionsRoot } from './private_function.js';
|
|
|
13
13
|
*
|
|
14
14
|
* ```
|
|
15
15
|
* version = 1
|
|
16
|
-
* private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash],
|
|
16
|
+
* private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF))
|
|
17
17
|
* private_functions_root = merkleize(private_function_leaves)
|
|
18
18
|
* bytecode_commitment = calculate_commitment(packed_bytecode)
|
|
19
19
|
* contract_class_id = pedersen([version, artifact_hash, private_functions_root, bytecode_commitment], GENERATOR__CLASS_IDENTIFIER)
|
|
@@ -31,7 +31,7 @@ function computePrivateFunctionLeaves(fns: PrivateFunction[]): Promise<Buffer[]>
|
|
|
31
31
|
|
|
32
32
|
/** Returns the leaf for a given private function. */
|
|
33
33
|
export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<Buffer> {
|
|
34
|
-
return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.
|
|
34
|
+
return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.PRIVATE_FUNCTION_LEAF)).toBuffer();
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator> {
|
|
@@ -99,7 +99,7 @@ export async function createPrivateFunctionMembershipProof(
|
|
|
99
99
|
* contract_class = db.get_contract_class(contract_class_id)
|
|
100
100
|
*
|
|
101
101
|
* // Compute function leaf and assert it belongs to the private functions tree
|
|
102
|
-
* function_leaf = pedersen([selector as Field, vk_hash],
|
|
102
|
+
* function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
|
|
103
103
|
* computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
|
|
104
104
|
* assert computed_private_function_tree_root == contract_class.private_functions_root
|
|
105
105
|
*
|
|
@@ -51,6 +51,15 @@ export function getSlotAtTimestamp(
|
|
|
51
51
|
: SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** Returns the L2 slot number at the next L1 block based on the current timestamp. */
|
|
55
|
+
export function getSlotAtNextL1Block(
|
|
56
|
+
currentL1Timestamp: bigint,
|
|
57
|
+
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>,
|
|
58
|
+
): SlotNumber {
|
|
59
|
+
const nextL1BlockTimestamp = currentL1Timestamp + BigInt(constants.ethereumSlotDuration);
|
|
60
|
+
return getSlotAtTimestamp(nextL1BlockTimestamp, constants);
|
|
61
|
+
}
|
|
62
|
+
|
|
54
63
|
/** Returns the epoch number for a given timestamp. */
|
|
55
64
|
export function getEpochNumberAtTimestamp(
|
|
56
65
|
ts: bigint,
|
package/src/hash/hash.ts
CHANGED
|
@@ -55,7 +55,7 @@ export function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promis
|
|
|
55
55
|
* @returns A siloed nullifier.
|
|
56
56
|
*/
|
|
57
57
|
export function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promise<Fr> {
|
|
58
|
-
return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.
|
|
58
|
+
return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.SILOED_NULLIFIER);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -87,7 +87,7 @@ export function computePublicDataTreeValue(value: Fr): Fr {
|
|
|
87
87
|
|
|
88
88
|
*/
|
|
89
89
|
export function computePublicDataTreeLeafSlot(contractAddress: AztecAddress, storageSlot: Fr): Promise<Fr> {
|
|
90
|
-
return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.
|
|
90
|
+
return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_SLOT);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
package/src/hash/map_slot.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
2
3
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -14,5 +15,5 @@ export function deriveStorageSlotInMap(
|
|
|
14
15
|
toField: () => Fr;
|
|
15
16
|
},
|
|
16
17
|
): Promise<Fr> {
|
|
17
|
-
return
|
|
18
|
+
return poseidon2HashWithSeparator([mapSlot, key.toField()], GeneratorIndex.PUBLIC_STORAGE_MAP_SLOT);
|
|
18
19
|
}
|
|
@@ -23,7 +23,7 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
|
|
|
23
23
|
import { z } from 'zod';
|
|
24
24
|
|
|
25
25
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
26
|
-
import {
|
|
26
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
27
27
|
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
28
28
|
import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
|
|
29
29
|
import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
|
|
@@ -355,7 +355,7 @@ export interface AztecNode
|
|
|
355
355
|
* @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
|
|
356
356
|
* for a tag, the caller should fetch the next page to check for more logs.
|
|
357
357
|
*/
|
|
358
|
-
getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?:
|
|
358
|
+
getPrivateLogsByTags(tags: SiloedTag[], page?: number, referenceBlock?: BlockHash): Promise<TxScopedL2Log[][]>;
|
|
359
359
|
|
|
360
360
|
/**
|
|
361
361
|
* Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
|
|
@@ -374,7 +374,7 @@ export interface AztecNode
|
|
|
374
374
|
contractAddress: AztecAddress,
|
|
375
375
|
tags: Tag[],
|
|
376
376
|
page?: number,
|
|
377
|
-
referenceBlock?:
|
|
377
|
+
referenceBlock?: BlockHash,
|
|
378
378
|
): Promise<TxScopedL2Log[][]>;
|
|
379
379
|
|
|
380
380
|
/**
|
|
@@ -633,7 +633,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
633
633
|
|
|
634
634
|
getPrivateLogsByTags: z
|
|
635
635
|
.function()
|
|
636
|
-
.args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(
|
|
636
|
+
.args(z.array(SiloedTag.schema).max(MAX_RPC_LEN), optional(z.number().gte(0)), optional(BlockHash.schema))
|
|
637
637
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
638
638
|
|
|
639
639
|
getPublicLogsByTagsFromContract: z
|
|
@@ -642,7 +642,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
642
642
|
schemas.AztecAddress,
|
|
643
643
|
z.array(Tag.schema).max(MAX_RPC_LEN),
|
|
644
644
|
optional(z.number().gte(0)),
|
|
645
|
-
optional(
|
|
645
|
+
optional(BlockHash.schema),
|
|
646
646
|
)
|
|
647
647
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
648
648
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
3
4
|
|
|
4
5
|
import type { L2Block } from '../block/l2_block.js';
|
|
5
6
|
import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
|
|
@@ -92,5 +93,6 @@ export interface ICheckpointsBuilder {
|
|
|
92
93
|
l1ToL2Messages: Fr[],
|
|
93
94
|
previousCheckpointOutHashes: Fr[],
|
|
94
95
|
fork: MerkleTreeWriteOperations,
|
|
96
|
+
bindings?: LoggerBindings,
|
|
95
97
|
): Promise<ICheckpointBlockBuilder>;
|
|
96
98
|
}
|
|
@@ -51,8 +51,7 @@ export type ValidatorClientConfig = ValidatorHASignerConfig & {
|
|
|
51
51
|
/** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
|
|
52
52
|
fishermanMode?: boolean;
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
/** Skip checkpoint proposal validation and always attest (default: true) */
|
|
54
|
+
/** Skip checkpoint proposal validation and always attest (default: false) */
|
|
56
55
|
skipCheckpointProposalValidation?: boolean;
|
|
57
56
|
|
|
58
57
|
/** Skip pushing re-executed blocks to archiver (default: false) */
|
package/src/logs/log_id.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { BufferReader } from '@aztec/foundation/serialize';
|
|
|
5
5
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
9
9
|
import { schemas } from '../schemas/index.js';
|
|
10
10
|
|
|
11
11
|
/** A globally unique log id. */
|
|
@@ -20,7 +20,7 @@ export class LogId {
|
|
|
20
20
|
/** The block number the log was emitted in. */
|
|
21
21
|
public readonly blockNumber: BlockNumber,
|
|
22
22
|
/** The hash of the block the log was emitted in. */
|
|
23
|
-
public readonly blockHash:
|
|
23
|
+
public readonly blockHash: BlockHash,
|
|
24
24
|
/** The index of a tx in a block the log was emitted in. */
|
|
25
25
|
public readonly txIndex: number,
|
|
26
26
|
/** The index of a log the tx was emitted in. */
|
|
@@ -40,7 +40,7 @@ export class LogId {
|
|
|
40
40
|
static random() {
|
|
41
41
|
return new LogId(
|
|
42
42
|
BlockNumber(Math.floor(Math.random() * 1000) + 1),
|
|
43
|
-
|
|
43
|
+
BlockHash.random(),
|
|
44
44
|
Math.floor(Math.random() * 1000),
|
|
45
45
|
Math.floor(Math.random() * 100),
|
|
46
46
|
);
|
|
@@ -50,7 +50,7 @@ export class LogId {
|
|
|
50
50
|
return z
|
|
51
51
|
.object({
|
|
52
52
|
blockNumber: BlockNumberSchema,
|
|
53
|
-
blockHash:
|
|
53
|
+
blockHash: BlockHash.schema,
|
|
54
54
|
txIndex: schemas.Integer,
|
|
55
55
|
logIndex: schemas.Integer,
|
|
56
56
|
})
|
|
@@ -81,7 +81,7 @@ export class LogId {
|
|
|
81
81
|
const reader = BufferReader.asReader(buffer);
|
|
82
82
|
|
|
83
83
|
const blockNumber = BlockNumber(reader.readNumber());
|
|
84
|
-
const blockHash = reader.readObject(
|
|
84
|
+
const blockHash = reader.readObject(BlockHash);
|
|
85
85
|
const txIndex = reader.readNumber();
|
|
86
86
|
const logIndex = reader.readNumber();
|
|
87
87
|
|
|
@@ -104,7 +104,7 @@ export class LogId {
|
|
|
104
104
|
static fromString(data: string): LogId {
|
|
105
105
|
const [rawBlockNumber, rawTxIndex, rawLogIndex, rawBlockHash] = data.split('-');
|
|
106
106
|
const blockNumber = BlockNumber(Number(rawBlockNumber));
|
|
107
|
-
const blockHash =
|
|
107
|
+
const blockHash = BlockHash.fromString(rawBlockHash);
|
|
108
108
|
const txIndex = Number(rawTxIndex);
|
|
109
109
|
const logIndex = Number(rawLogIndex);
|
|
110
110
|
|
package/src/logs/siloed_tag.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
2
3
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
4
5
|
|
|
@@ -22,7 +23,7 @@ export class SiloedTag {
|
|
|
22
23
|
constructor(public readonly value: Fr) {}
|
|
23
24
|
|
|
24
25
|
static async compute(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
|
|
25
|
-
const siloedTag = await
|
|
26
|
+
const siloedTag = await poseidon2HashWithSeparator([app, tag.value], GeneratorIndex.PRIVATE_LOG_FIRST_FIELD);
|
|
26
27
|
return new SiloedTag(siloedTag);
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -30,8 +30,15 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export type BlockProposalOptions = {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Whether to include the tx objects along with the block proposal.
|
|
35
|
+
* Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
|
|
36
|
+
*/
|
|
37
|
+
publishFullTxs?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to generate an invalid block proposal for broadcasting.
|
|
40
|
+
* Use only for testing.
|
|
41
|
+
*/
|
|
35
42
|
broadcastInvalidBlockProposal?: boolean;
|
|
36
43
|
};
|
|
37
44
|
|
|
@@ -32,8 +32,15 @@ export class CheckpointProposalHash extends Buffer32 {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export type CheckpointProposalOptions = {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Whether to include the tx objects along with the block proposal.
|
|
37
|
+
* Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
|
|
38
|
+
*/
|
|
39
|
+
publishFullTxs?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to generate an invalid checkpoint proposal for broadcasting.
|
|
42
|
+
* Use only for testing.
|
|
43
|
+
*/
|
|
37
44
|
broadcastInvalidCheckpointProposal?: boolean;
|
|
38
45
|
};
|
|
39
46
|
|
package/src/tests/mocks.ts
CHANGED
|
@@ -97,12 +97,14 @@ export const mockTx = async (
|
|
|
97
97
|
publicCalldataSize = 2,
|
|
98
98
|
feePayer,
|
|
99
99
|
chonkProof = ChonkProof.random(),
|
|
100
|
+
maxFeesPerGas = new GasFees(10, 10),
|
|
100
101
|
maxPriorityFeesPerGas,
|
|
101
102
|
gasUsed = Gas.empty(),
|
|
102
103
|
chainId = Fr.ZERO,
|
|
103
104
|
version = Fr.ZERO,
|
|
104
105
|
vkTreeRoot = Fr.ZERO,
|
|
105
106
|
protocolContractsHash = Fr.ZERO,
|
|
107
|
+
anchorBlockHeader = BlockHeader.empty(),
|
|
106
108
|
}: {
|
|
107
109
|
numberOfNonRevertiblePublicCallRequests?: number;
|
|
108
110
|
numberOfRevertiblePublicCallRequests?: number;
|
|
@@ -111,12 +113,14 @@ export const mockTx = async (
|
|
|
111
113
|
publicCalldataSize?: number;
|
|
112
114
|
feePayer?: AztecAddress;
|
|
113
115
|
chonkProof?: ChonkProof;
|
|
116
|
+
maxFeesPerGas?: GasFees;
|
|
114
117
|
maxPriorityFeesPerGas?: GasFees;
|
|
115
118
|
gasUsed?: Gas;
|
|
116
119
|
chainId?: Fr;
|
|
117
120
|
version?: Fr;
|
|
118
121
|
vkTreeRoot?: Fr;
|
|
119
122
|
protocolContractsHash?: Fr;
|
|
123
|
+
anchorBlockHeader?: BlockHeader;
|
|
120
124
|
} = {},
|
|
121
125
|
) => {
|
|
122
126
|
const totalPublicCallRequests =
|
|
@@ -126,10 +130,8 @@ export const mockTx = async (
|
|
|
126
130
|
const isForPublic = totalPublicCallRequests > 0;
|
|
127
131
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
128
132
|
const firstNullifier = new Nullifier(new Fr(seed + 1), Fr.ZERO, 0);
|
|
129
|
-
data.constants.
|
|
130
|
-
|
|
131
|
-
maxPriorityFeesPerGas,
|
|
132
|
-
});
|
|
133
|
+
data.constants.anchorBlockHeader = anchorBlockHeader;
|
|
134
|
+
data.constants.txContext.gasSettings = GasSettings.default({ maxFeesPerGas, maxPriorityFeesPerGas });
|
|
133
135
|
data.feePayer = feePayer ?? (await AztecAddress.random());
|
|
134
136
|
data.gasUsed = gasUsed;
|
|
135
137
|
data.constants.txContext.chainId = chainId;
|
package/src/tx/block_header.ts
CHANGED
|
@@ -11,14 +11,14 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
11
11
|
import { inspect } from 'util';
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
15
15
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
16
16
|
import { GlobalVariables } from './global_variables.js';
|
|
17
17
|
import { StateReference } from './state_reference.js';
|
|
18
18
|
|
|
19
19
|
/** A header of an L2 block. */
|
|
20
20
|
export class BlockHeader {
|
|
21
|
-
private _cachedHash?: Promise<
|
|
21
|
+
private _cachedHash?: Promise<BlockHash>;
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
24
24
|
/** Snapshot of archive before the block is applied. */
|
|
@@ -162,10 +162,10 @@ export class BlockHeader {
|
|
|
162
162
|
return BlockHeader.fromBuffer(hexToBuffer(str));
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
hash(): Promise<
|
|
165
|
+
hash(): Promise<BlockHash> {
|
|
166
166
|
if (!this._cachedHash) {
|
|
167
|
-
this._cachedHash = poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.
|
|
168
|
-
|
|
167
|
+
this._cachedHash = poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.BLOCK_HEADER_HASH).then(fr =>
|
|
168
|
+
BlockHash.fromField(fr),
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
return this._cachedHash;
|
|
@@ -173,7 +173,7 @@ export class BlockHeader {
|
|
|
173
173
|
|
|
174
174
|
/** Manually set the hash for this block header if already computed */
|
|
175
175
|
setHash(hashed: Fr) {
|
|
176
|
-
this._cachedHash = Promise.resolve(
|
|
176
|
+
this._cachedHash = Promise.resolve(BlockHash.fromField(hashed));
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
static random(overrides: Partial<FieldsOf<BlockHeader>> & Partial<FieldsOf<GlobalVariables>> = {}): BlockHeader {
|
|
@@ -2,7 +2,7 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
import { schemas } from '@aztec/foundation/schemas';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
6
6
|
import { type DataInBlock, dataInBlockSchemaFor, randomDataInBlock } from '../block/in_block.js';
|
|
7
7
|
import { TxEffect } from './tx_effect.js';
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ export function serializeIndexedTxEffect(effect: IndexedTxEffect): Buffer {
|
|
|
26
26
|
export function deserializeIndexedTxEffect(buffer: Buffer): IndexedTxEffect {
|
|
27
27
|
const reader = BufferReader.asReader(buffer);
|
|
28
28
|
|
|
29
|
-
const l2BlockHash = reader.readObject(
|
|
29
|
+
const l2BlockHash = reader.readObject(BlockHash);
|
|
30
30
|
const l2BlockNumber = BlockNumber(reader.readNumber());
|
|
31
31
|
const txIndexInBlock = reader.readNumber();
|
|
32
32
|
const data = reader.readObject(TxEffect);
|
package/src/tx/tx_receipt.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types'
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import { RevertCode } from '../avm/revert_code.js';
|
|
6
|
-
import {
|
|
6
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
7
7
|
import { type ZodFor, schemas } from '../schemas/schemas.js';
|
|
8
8
|
import { TxHash } from './tx_hash.js';
|
|
9
9
|
|
|
@@ -54,7 +54,7 @@ export class TxReceipt {
|
|
|
54
54
|
/** The transaction fee paid for the transaction. */
|
|
55
55
|
public transactionFee?: bigint,
|
|
56
56
|
/** The hash of the block containing the transaction. */
|
|
57
|
-
public blockHash?:
|
|
57
|
+
public blockHash?: BlockHash,
|
|
58
58
|
/** The block number in which the transaction was included. */
|
|
59
59
|
public blockNumber?: BlockNumber,
|
|
60
60
|
) {}
|
|
@@ -100,7 +100,7 @@ export class TxReceipt {
|
|
|
100
100
|
status: z.nativeEnum(TxStatus),
|
|
101
101
|
executionResult: z.nativeEnum(TxExecutionResult).optional(),
|
|
102
102
|
error: z.string().optional(),
|
|
103
|
-
blockHash:
|
|
103
|
+
blockHash: BlockHash.schema.optional(),
|
|
104
104
|
blockNumber: BlockNumberSchema.optional(),
|
|
105
105
|
transactionFee: schemas.BigInt.optional(),
|
|
106
106
|
})
|
|
@@ -113,7 +113,7 @@ export class TxReceipt {
|
|
|
113
113
|
executionResult?: TxExecutionResult;
|
|
114
114
|
error?: string;
|
|
115
115
|
transactionFee?: bigint;
|
|
116
|
-
blockHash?:
|
|
116
|
+
blockHash?: BlockHash;
|
|
117
117
|
blockNumber?: BlockNumber;
|
|
118
118
|
}) {
|
|
119
119
|
return new TxReceipt(
|