@aztec/stdlib 3.0.0-nightly.20251023 → 3.0.0-nightly.20251025
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/avm/index.d.ts +1 -0
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +1 -0
- package/dest/avm/message_pack.d.ts +1 -0
- package/dest/avm/message_pack.d.ts.map +1 -1
- package/dest/avm/message_pack.js +28 -5
- package/dest/block/l2_block_source.d.ts +29 -0
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/contract/contract_address.d.ts +1 -1
- package/dest/contract/contract_address.js +1 -1
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +7 -0
- package/dest/interfaces/aztec-node-admin.d.ts +36 -35
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +24 -0
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +4 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +5 -0
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/tx_provider.d.ts +1 -1
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +96 -1
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +7 -0
- package/dest/note/index.d.ts +1 -1
- package/dest/note/index.d.ts.map +1 -1
- package/dest/note/index.js +1 -1
- package/dest/note/unique_note.d.ts +43 -0
- package/dest/note/unique_note.d.ts.map +1 -0
- package/dest/note/{extended_note.js → unique_note.js} +9 -48
- package/dest/p2p/block_attestation.d.ts +2 -8
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_attestation.js +7 -12
- package/dest/p2p/block_proposal.d.ts +2 -7
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +7 -11
- package/dest/parity/parity_base_private_inputs.d.ts +2 -2
- package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
- package/dest/parity/parity_base_private_inputs.js +5 -1
- package/dest/rollup/block_root_rollup_private_inputs.d.ts +3 -3
- package/dest/tests/mocks.d.ts +1 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +5 -8
- package/dest/world-state/index.d.ts +2 -0
- package/dest/world-state/index.d.ts.map +1 -0
- package/dest/world-state/index.js +1 -0
- package/dest/world-state/world_state_revision.d.ts +22 -0
- package/dest/world-state/world_state_revision.d.ts.map +1 -0
- package/dest/world-state/world_state_revision.js +21 -0
- package/package.json +10 -9
- package/src/avm/index.ts +1 -0
- package/src/avm/message_pack.ts +25 -1
- package/src/block/l2_block_source.ts +32 -0
- package/src/contract/contract_address.ts +1 -1
- package/src/interfaces/archiver.ts +9 -1
- package/src/interfaces/aztec-node-admin.ts +2 -2
- package/src/interfaces/aztec-node.ts +36 -0
- package/src/interfaces/merkle_tree_operations.ts +6 -0
- package/src/interfaces/tx_provider.ts +1 -0
- package/src/interfaces/validator.ts +15 -1
- package/src/note/index.ts +1 -1
- package/src/note/{extended_note.ts → unique_note.ts} +14 -75
- package/src/p2p/block_attestation.ts +8 -20
- package/src/p2p/block_proposal.ts +5 -13
- package/src/parity/parity_base_private_inputs.ts +8 -6
- package/src/tests/mocks.ts +5 -24
- package/src/world-state/index.ts +1 -0
- package/src/world-state/world_state_revision.ts +21 -0
- package/dest/note/extended_note.d.ts +0 -111
- package/dest/note/extended_note.d.ts.map +0 -1
|
@@ -2,6 +2,7 @@ import type { SecretValue } from '@aztec/foundation/config';
|
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { type ZodFor } from '@aztec/foundation/schemas';
|
|
5
6
|
import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
7
|
import type { BlockAttestation, BlockProposal, BlockProposalOptions } from '@aztec/stdlib/p2p';
|
|
7
8
|
import type { StateReference, Tx } from '@aztec/stdlib/tx';
|
|
@@ -30,7 +31,13 @@ export interface ValidatorClientConfig {
|
|
|
30
31
|
/** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
|
|
31
32
|
alwaysReexecuteBlockProposals?: boolean;
|
|
32
33
|
}
|
|
33
|
-
export type ValidatorClientFullConfig = ValidatorClientConfig & Pick<SequencerConfig, 'txPublicSetupAllowList' | 'broadcastInvalidBlockProposal'> & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'
|
|
34
|
+
export type ValidatorClientFullConfig = ValidatorClientConfig & Pick<SequencerConfig, 'txPublicSetupAllowList' | 'broadcastInvalidBlockProposal'> & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'> & {
|
|
35
|
+
/**
|
|
36
|
+
* Whether transactions are disabled for this node
|
|
37
|
+
* @remarks This should match the property in P2PConfig. It's not picked from there to avoid circular dependencies.
|
|
38
|
+
*/
|
|
39
|
+
disableTransactions?: boolean;
|
|
40
|
+
};
|
|
34
41
|
export declare const ValidatorClientConfigSchema: z.ZodObject<{
|
|
35
42
|
validatorAddresses: z.ZodOptional<z.ZodArray<z.ZodType<EthAddress, any, string>, "many">>;
|
|
36
43
|
disableValidator: z.ZodBoolean;
|
|
@@ -56,6 +63,94 @@ export declare const ValidatorClientConfigSchema: z.ZodObject<{
|
|
|
56
63
|
validatorAddresses?: string[] | undefined;
|
|
57
64
|
alwaysReexecuteBlockProposals?: boolean | undefined;
|
|
58
65
|
}>;
|
|
66
|
+
export declare const ValidatorClientFullConfigSchema: z.ZodObject<{
|
|
67
|
+
validatorAddresses: z.ZodOptional<z.ZodArray<z.ZodType<EthAddress, any, string>, "many">>;
|
|
68
|
+
disableValidator: z.ZodBoolean;
|
|
69
|
+
disabledValidators: z.ZodArray<z.ZodType<EthAddress, any, string>, "many">;
|
|
70
|
+
attestationPollingIntervalMs: z.ZodNumber;
|
|
71
|
+
validatorReexecute: z.ZodBoolean;
|
|
72
|
+
validatorReexecuteDeadlineMs: z.ZodNumber;
|
|
73
|
+
alwaysReexecuteBlockProposals: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
} & {
|
|
75
|
+
txPublicSetupAllowList: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
76
|
+
address: ZodFor<import("../aztec-address/index.js").AztecAddress>;
|
|
77
|
+
selector: ZodFor<import("../abi/function_selector.js").FunctionSelector>;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
selector: import("../abi/function_selector.js").FunctionSelector;
|
|
80
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
81
|
+
}, {
|
|
82
|
+
selector?: any;
|
|
83
|
+
address?: any;
|
|
84
|
+
}>, z.ZodObject<{
|
|
85
|
+
address: ZodFor<import("../aztec-address/index.js").AztecAddress>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
88
|
+
}, {
|
|
89
|
+
address?: any;
|
|
90
|
+
}>, z.ZodObject<{
|
|
91
|
+
classId: ZodFor<Fr>;
|
|
92
|
+
selector: ZodFor<import("../abi/function_selector.js").FunctionSelector>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
selector: import("../abi/function_selector.js").FunctionSelector;
|
|
95
|
+
classId: Fr;
|
|
96
|
+
}, {
|
|
97
|
+
selector?: any;
|
|
98
|
+
classId?: any;
|
|
99
|
+
}>, z.ZodObject<{
|
|
100
|
+
classId: ZodFor<Fr>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
classId: Fr;
|
|
103
|
+
}, {
|
|
104
|
+
classId?: any;
|
|
105
|
+
}>]>, "many">>;
|
|
106
|
+
broadcastInvalidBlockProposal: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
slashBroadcastedInvalidBlockPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
108
|
+
disableTransactions: z.ZodOptional<z.ZodBoolean>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
slashBroadcastedInvalidBlockPenalty: bigint;
|
|
111
|
+
disableValidator: boolean;
|
|
112
|
+
disabledValidators: EthAddress[];
|
|
113
|
+
attestationPollingIntervalMs: number;
|
|
114
|
+
validatorReexecute: boolean;
|
|
115
|
+
validatorReexecuteDeadlineMs: number;
|
|
116
|
+
txPublicSetupAllowList?: ({
|
|
117
|
+
selector: import("../abi/function_selector.js").FunctionSelector;
|
|
118
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
119
|
+
} | {
|
|
120
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
121
|
+
} | {
|
|
122
|
+
selector: import("../abi/function_selector.js").FunctionSelector;
|
|
123
|
+
classId: Fr;
|
|
124
|
+
} | {
|
|
125
|
+
classId: Fr;
|
|
126
|
+
})[] | undefined;
|
|
127
|
+
broadcastInvalidBlockProposal?: boolean | undefined;
|
|
128
|
+
validatorAddresses?: EthAddress[] | undefined;
|
|
129
|
+
alwaysReexecuteBlockProposals?: boolean | undefined;
|
|
130
|
+
disableTransactions?: boolean | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
slashBroadcastedInvalidBlockPenalty: string | number | bigint;
|
|
133
|
+
disableValidator: boolean;
|
|
134
|
+
disabledValidators: string[];
|
|
135
|
+
attestationPollingIntervalMs: number;
|
|
136
|
+
validatorReexecute: boolean;
|
|
137
|
+
validatorReexecuteDeadlineMs: number;
|
|
138
|
+
txPublicSetupAllowList?: ({
|
|
139
|
+
selector?: any;
|
|
140
|
+
address?: any;
|
|
141
|
+
} | {
|
|
142
|
+
address?: any;
|
|
143
|
+
} | {
|
|
144
|
+
selector?: any;
|
|
145
|
+
classId?: any;
|
|
146
|
+
} | {
|
|
147
|
+
classId?: any;
|
|
148
|
+
})[] | undefined;
|
|
149
|
+
broadcastInvalidBlockProposal?: boolean | undefined;
|
|
150
|
+
validatorAddresses?: string[] | undefined;
|
|
151
|
+
alwaysReexecuteBlockProposals?: boolean | undefined;
|
|
152
|
+
disableTransactions?: boolean | undefined;
|
|
153
|
+
}>;
|
|
59
154
|
export interface Validator {
|
|
60
155
|
start(): Promise<void>;
|
|
61
156
|
updateConfig(config: Partial<ValidatorClientFullConfig>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/interfaces/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/interfaces/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,EAA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AC,IAAI,CAAC,CAAC;IACvB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC;IAG/D,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,EAAE,EACX,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,EAAE,EAAE,EACT,eAAe,EAAE,UAAU,GAAG,SAAS,EACvC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IACtC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAC;IAEnG,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5G,0BAA0B,CACxB,sBAAsB,EAAE,+BAA+B,EACvD,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,SAAS,CAAC,CAAC;CACvB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { schemas } from '@aztec/foundation/schemas';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { AllowedElementSchema } from './allowed_element.js';
|
|
3
4
|
export const ValidatorClientConfigSchema = z.object({
|
|
4
5
|
validatorAddresses: z.array(schemas.EthAddress).optional(),
|
|
5
6
|
disableValidator: z.boolean(),
|
|
@@ -9,3 +10,9 @@ export const ValidatorClientConfigSchema = z.object({
|
|
|
9
10
|
validatorReexecuteDeadlineMs: z.number().min(0),
|
|
10
11
|
alwaysReexecuteBlockProposals: z.boolean().optional()
|
|
11
12
|
});
|
|
13
|
+
export const ValidatorClientFullConfigSchema = ValidatorClientConfigSchema.extend({
|
|
14
|
+
txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
|
|
15
|
+
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
16
|
+
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
|
|
17
|
+
disableTransactions: z.boolean().optional()
|
|
18
|
+
});
|
package/dest/note/index.d.ts
CHANGED
package/dest/note/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/note/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/note/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
package/dest/note/index.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
|
+
import { type ZodFor } from '../schemas/index.js';
|
|
5
|
+
import { TxHash } from '../tx/tx_hash.js';
|
|
6
|
+
import { Note } from './note.js';
|
|
7
|
+
/**
|
|
8
|
+
* A note with contextual data and a nonce that makes it unique.
|
|
9
|
+
*/
|
|
10
|
+
export declare class UniqueNote {
|
|
11
|
+
/** The note as emitted from the Noir contract. */
|
|
12
|
+
note: Note;
|
|
13
|
+
/** The recipient whose public key was used to encrypt the note. */
|
|
14
|
+
recipient: AztecAddress;
|
|
15
|
+
/** The contract address this note is created in. */
|
|
16
|
+
contractAddress: AztecAddress;
|
|
17
|
+
/** The specific storage location of the note on the contract. */
|
|
18
|
+
storageSlot: Fr;
|
|
19
|
+
/** The hash of the tx the note was created in. */
|
|
20
|
+
txHash: TxHash;
|
|
21
|
+
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
22
|
+
noteNonce: Fr;
|
|
23
|
+
constructor(
|
|
24
|
+
/** The note as emitted from the Noir contract. */
|
|
25
|
+
note: Note,
|
|
26
|
+
/** The recipient whose public key was used to encrypt the note. */
|
|
27
|
+
recipient: AztecAddress,
|
|
28
|
+
/** The contract address this note is created in. */
|
|
29
|
+
contractAddress: AztecAddress,
|
|
30
|
+
/** The specific storage location of the note on the contract. */
|
|
31
|
+
storageSlot: Fr,
|
|
32
|
+
/** The hash of the tx the note was created in. */
|
|
33
|
+
txHash: TxHash,
|
|
34
|
+
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
35
|
+
noteNonce: Fr);
|
|
36
|
+
static get schema(): ZodFor<UniqueNote>;
|
|
37
|
+
toBuffer(): Buffer;
|
|
38
|
+
static random(): Promise<UniqueNote>;
|
|
39
|
+
static fromBuffer(buffer: Buffer | BufferReader): UniqueNote;
|
|
40
|
+
static fromString(str: string): UniqueNote;
|
|
41
|
+
toString(): `0x${string}`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=unique_note.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique_note.d.ts","sourceRoot":"","sources":["../../src/note/unique_note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAK9E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,UAAU;IAEnB,kDAAkD;IAC3C,IAAI,EAAE,IAAI;IACjB,mEAAmE;IAC5D,SAAS,EAAE,YAAY;IAC9B,oDAAoD;IAC7C,eAAe,EAAE,YAAY;IACpC,iEAAiE;IAC1D,WAAW,EAAE,EAAE;IACtB,kDAAkD;IAC3C,MAAM,EAAE,MAAM;IACrB,gGAAgG;IACzF,SAAS,EAAE,EAAE;;IAXpB,kDAAkD;IAC3C,IAAI,EAAE,IAAI;IACjB,mEAAmE;IAC5D,SAAS,EAAE,YAAY;IAC9B,oDAAoD;IAC7C,eAAe,EAAE,YAAY;IACpC,iEAAiE;IAC1D,WAAW,EAAE,EAAE;IACtB,kDAAkD;IAC3C,MAAM,EAAE,MAAM;IACrB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGtB,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,CAatC;IAED,QAAQ,IAAI,MAAM;WAWL,MAAM;IAWnB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAa/C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,QAAQ;CAGT"}
|
|
@@ -7,63 +7,21 @@ import { schemas } from '../schemas/index.js';
|
|
|
7
7
|
import { TxHash } from '../tx/tx_hash.js';
|
|
8
8
|
import { Note } from './note.js';
|
|
9
9
|
/**
|
|
10
|
-
* A note with contextual data.
|
|
11
|
-
*/ export class
|
|
10
|
+
* A note with contextual data and a nonce that makes it unique.
|
|
11
|
+
*/ export class UniqueNote {
|
|
12
12
|
note;
|
|
13
13
|
recipient;
|
|
14
14
|
contractAddress;
|
|
15
15
|
storageSlot;
|
|
16
16
|
txHash;
|
|
17
|
-
|
|
17
|
+
noteNonce;
|
|
18
|
+
constructor(/** The note as emitted from the Noir contract. */ note, /** The recipient whose public key was used to encrypt the note. */ recipient, /** The contract address this note is created in. */ contractAddress, /** The specific storage location of the note on the contract. */ storageSlot, /** The hash of the tx the note was created in. */ txHash, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce){
|
|
18
19
|
this.note = note;
|
|
19
20
|
this.recipient = recipient;
|
|
20
21
|
this.contractAddress = contractAddress;
|
|
21
22
|
this.storageSlot = storageSlot;
|
|
22
23
|
this.txHash = txHash;
|
|
23
|
-
|
|
24
|
-
toBuffer() {
|
|
25
|
-
return serializeToBuffer([
|
|
26
|
-
this.note,
|
|
27
|
-
this.recipient,
|
|
28
|
-
this.contractAddress,
|
|
29
|
-
this.storageSlot,
|
|
30
|
-
this.txHash
|
|
31
|
-
]);
|
|
32
|
-
}
|
|
33
|
-
static fromBuffer(buffer) {
|
|
34
|
-
const reader = BufferReader.asReader(buffer);
|
|
35
|
-
const note = reader.readObject(Note);
|
|
36
|
-
const recipient = reader.readObject(AztecAddress);
|
|
37
|
-
const contractAddress = reader.readObject(AztecAddress);
|
|
38
|
-
const storageSlot = reader.readObject(Fr);
|
|
39
|
-
const txHash = reader.readObject(TxHash);
|
|
40
|
-
return new this(note, recipient, contractAddress, storageSlot, txHash);
|
|
41
|
-
}
|
|
42
|
-
static get schema() {
|
|
43
|
-
return z.object({
|
|
44
|
-
note: Note.schema,
|
|
45
|
-
recipient: schemas.AztecAddress,
|
|
46
|
-
contractAddress: schemas.AztecAddress,
|
|
47
|
-
storageSlot: schemas.Fr,
|
|
48
|
-
txHash: TxHash.schema
|
|
49
|
-
}).transform(({ note, recipient, contractAddress, storageSlot, txHash })=>{
|
|
50
|
-
return new ExtendedNote(note, recipient, contractAddress, storageSlot, txHash);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
toString() {
|
|
54
|
-
return bufferToHex(this.toBuffer());
|
|
55
|
-
}
|
|
56
|
-
static fromString(str) {
|
|
57
|
-
return ExtendedNote.fromBuffer(hexToBuffer(str));
|
|
58
|
-
}
|
|
59
|
-
static async random() {
|
|
60
|
-
return new ExtendedNote(Note.random(), await AztecAddress.random(), await AztecAddress.random(), Fr.random(), TxHash.random());
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export class UniqueNote extends ExtendedNote {
|
|
64
|
-
noteNonce;
|
|
65
|
-
constructor(/** The note as emitted from the Noir contract. */ note, /** The recipient whose public key was used to encrypt the note. */ recipient, /** The contract address this note is created in. */ contractAddress, /** The specific storage location of the note on the contract. */ storageSlot, /** The hash of the tx the note was created in. */ txHash, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce){
|
|
66
|
-
super(note, recipient, contractAddress, storageSlot, txHash), this.noteNonce = noteNonce;
|
|
24
|
+
this.noteNonce = noteNonce;
|
|
67
25
|
}
|
|
68
26
|
static get schema() {
|
|
69
27
|
return z.object({
|
|
@@ -98,9 +56,12 @@ export class UniqueNote extends ExtendedNote {
|
|
|
98
56
|
const storageSlot = reader.readObject(Fr);
|
|
99
57
|
const txHash = reader.readObject(TxHash);
|
|
100
58
|
const noteNonce = reader.readObject(Fr);
|
|
101
|
-
return new
|
|
59
|
+
return new UniqueNote(note, recipient, contractAddress, storageSlot, txHash, noteNonce);
|
|
102
60
|
}
|
|
103
61
|
static fromString(str) {
|
|
104
62
|
return UniqueNote.fromBuffer(hexToBuffer(str));
|
|
105
63
|
}
|
|
64
|
+
toString() {
|
|
65
|
+
return bufferToHex(this.toBuffer());
|
|
66
|
+
}
|
|
106
67
|
}
|
|
@@ -3,8 +3,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
6
|
-
import {
|
|
7
|
-
import type { UInt32 } from '../types/index.js';
|
|
6
|
+
import type { ZodFor } from '../schemas/index.js';
|
|
8
7
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
9
8
|
import { Gossipable } from './gossipable.js';
|
|
10
9
|
import { TopicType } from './topic_type.js';
|
|
@@ -18,8 +17,6 @@ export declare class BlockAttestationHash extends Buffer32 {
|
|
|
18
17
|
* will produce a block attestation over the header of the block
|
|
19
18
|
*/
|
|
20
19
|
export declare class BlockAttestation extends Gossipable {
|
|
21
|
-
/** The block number of the attestation. */
|
|
22
|
-
readonly blockNumber: UInt32;
|
|
23
20
|
/** The payload of the message, and what the signature is over */
|
|
24
21
|
readonly payload: ConsensusPayload;
|
|
25
22
|
/** The signature of the block attester */
|
|
@@ -30,8 +27,6 @@ export declare class BlockAttestation extends Gossipable {
|
|
|
30
27
|
private sender;
|
|
31
28
|
private proposer;
|
|
32
29
|
constructor(
|
|
33
|
-
/** The block number of the attestation. */
|
|
34
|
-
blockNumber: UInt32,
|
|
35
30
|
/** The payload of the message, and what the signature is over */
|
|
36
31
|
payload: ConsensusPayload,
|
|
37
32
|
/** The signature of the block attester */
|
|
@@ -51,7 +46,7 @@ export declare class BlockAttestation extends Gossipable {
|
|
|
51
46
|
* Lazily evaluate and cache the proposer of the block
|
|
52
47
|
* @returns The proposer of the block
|
|
53
48
|
*/
|
|
54
|
-
getProposer(): EthAddress;
|
|
49
|
+
getProposer(): EthAddress | undefined;
|
|
55
50
|
getPayload(): Buffer;
|
|
56
51
|
toBuffer(): Buffer;
|
|
57
52
|
static fromBuffer(buf: Buffer | BufferReader): BlockAttestation;
|
|
@@ -59,7 +54,6 @@ export declare class BlockAttestation extends Gossipable {
|
|
|
59
54
|
static random(): BlockAttestation;
|
|
60
55
|
getSize(): number;
|
|
61
56
|
toInspect(): {
|
|
62
|
-
blockNumber: number;
|
|
63
57
|
payload: {
|
|
64
58
|
header: {
|
|
65
59
|
lastArchive: `0x${string}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_attestation.d.ts","sourceRoot":"","sources":["../../src/p2p/block_attestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,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,CAAC,QAAQ,CAAC;IAI1D,IAAI,OAAO,IAAI,EAAE,CAEhB;IAED,IAAI,UAAU,IAAI,EAAE,CAEnB;IAED;;;OAGG;IACH,SAAS,IAAI,UAAU,GAAG,SAAS;IAWnC;;;OAGG;IACH,WAAW,IAAI,UAAU,GAAG,SAAS;IAWrC,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB;IAS/D,MAAM,CAAC,KAAK,IAAI,gBAAgB;IAIhC,MAAM,CAAC,MAAM,IAAI,gBAAgB;IAIjC,OAAO,IAAI,MAAM;IAIjB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOV"}
|
|
@@ -3,7 +3,6 @@ import { keccak256, tryRecoverAddress } from '@aztec/foundation/crypto';
|
|
|
3
3
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { schemas } from '../schemas/index.js';
|
|
7
6
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
8
7
|
import { Gossipable } from './gossipable.js';
|
|
9
8
|
import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
|
|
@@ -19,23 +18,21 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
19
18
|
* A validator that has attested to seeing the contents of a block
|
|
20
19
|
* will produce a block attestation over the header of the block
|
|
21
20
|
*/ export class BlockAttestation extends Gossipable {
|
|
22
|
-
blockNumber;
|
|
23
21
|
payload;
|
|
24
22
|
signature;
|
|
25
23
|
proposerSignature;
|
|
26
24
|
static p2pTopic = TopicType.block_attestation;
|
|
27
25
|
sender;
|
|
28
26
|
proposer;
|
|
29
|
-
constructor(/** The
|
|
30
|
-
super(), this.
|
|
27
|
+
constructor(/** The payload of the message, and what the signature is over */ payload, /** The signature of the block attester */ signature, /** The signature from the block proposer */ proposerSignature){
|
|
28
|
+
super(), this.payload = payload, this.signature = signature, this.proposerSignature = proposerSignature;
|
|
31
29
|
}
|
|
32
30
|
static get schema() {
|
|
33
31
|
return z.object({
|
|
34
|
-
blockNumber: schemas.UInt32,
|
|
35
32
|
payload: ConsensusPayload.schema,
|
|
36
33
|
signature: Signature.schema,
|
|
37
34
|
proposerSignature: Signature.schema
|
|
38
|
-
}).transform((obj)=>new BlockAttestation(obj.
|
|
35
|
+
}).transform((obj)=>new BlockAttestation(obj.payload, obj.signature, obj.proposerSignature));
|
|
39
36
|
}
|
|
40
37
|
generateP2PMessageIdentifier() {
|
|
41
38
|
return Promise.resolve(new BlockAttestationHash(keccak256(this.signature.toBuffer())));
|
|
@@ -75,7 +72,6 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
75
72
|
}
|
|
76
73
|
toBuffer() {
|
|
77
74
|
return serializeToBuffer([
|
|
78
|
-
this.blockNumber,
|
|
79
75
|
this.payload,
|
|
80
76
|
this.signature,
|
|
81
77
|
this.proposerSignature
|
|
@@ -83,20 +79,19 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
83
79
|
}
|
|
84
80
|
static fromBuffer(buf) {
|
|
85
81
|
const reader = BufferReader.asReader(buf);
|
|
86
|
-
return new BlockAttestation(reader.
|
|
82
|
+
return new BlockAttestation(reader.readObject(ConsensusPayload), reader.readObject(Signature), reader.readObject(Signature));
|
|
87
83
|
}
|
|
88
84
|
static empty() {
|
|
89
|
-
return new BlockAttestation(
|
|
85
|
+
return new BlockAttestation(ConsensusPayload.empty(), Signature.empty(), Signature.empty());
|
|
90
86
|
}
|
|
91
87
|
static random() {
|
|
92
|
-
return new BlockAttestation(
|
|
88
|
+
return new BlockAttestation(ConsensusPayload.random(), Signature.random(), Signature.random());
|
|
93
89
|
}
|
|
94
90
|
getSize() {
|
|
95
|
-
return
|
|
91
|
+
return this.payload.getSize() + this.signature.getSize() + this.proposerSignature.getSize();
|
|
96
92
|
}
|
|
97
93
|
toInspect() {
|
|
98
94
|
return {
|
|
99
|
-
blockNumber: this.blockNumber,
|
|
100
95
|
payload: this.payload.toInspect(),
|
|
101
96
|
signature: this.signature.toString(),
|
|
102
97
|
proposerSignature: this.proposerSignature.toString()
|
|
@@ -6,7 +6,6 @@ import { BufferReader } from '@aztec/foundation/serialize';
|
|
|
6
6
|
import type { L2BlockInfo } from '../block/l2_block_info.js';
|
|
7
7
|
import { TxHash } from '../tx/index.js';
|
|
8
8
|
import { Tx } from '../tx/tx.js';
|
|
9
|
-
import type { UInt32 } from '../types/index.js';
|
|
10
9
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
11
10
|
import { Gossipable } from './gossipable.js';
|
|
12
11
|
import { TopicType } from './topic_type.js';
|
|
@@ -25,8 +24,6 @@ export type BlockProposalOptions = {
|
|
|
25
24
|
* be included in the head of the chain
|
|
26
25
|
*/
|
|
27
26
|
export declare class BlockProposal extends Gossipable {
|
|
28
|
-
/** The number of the block */
|
|
29
|
-
readonly blockNumber: UInt32;
|
|
30
27
|
/** The payload of the message, and what the signature is over */
|
|
31
28
|
readonly payload: ConsensusPayload;
|
|
32
29
|
/** The signer of the BlockProposal over the header of the new block*/
|
|
@@ -38,8 +35,6 @@ export declare class BlockProposal extends Gossipable {
|
|
|
38
35
|
static p2pTopic: TopicType;
|
|
39
36
|
private sender;
|
|
40
37
|
constructor(
|
|
41
|
-
/** The number of the block */
|
|
42
|
-
blockNumber: UInt32,
|
|
43
38
|
/** The payload of the message, and what the signature is over */
|
|
44
39
|
payload: ConsensusPayload,
|
|
45
40
|
/** The signer of the BlockProposal over the header of the new block*/
|
|
@@ -51,8 +46,8 @@ export declare class BlockProposal extends Gossipable {
|
|
|
51
46
|
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
52
47
|
get archive(): Fr;
|
|
53
48
|
get slotNumber(): Fr;
|
|
54
|
-
toBlockInfo(): L2BlockInfo
|
|
55
|
-
static createProposalFromSigner(
|
|
49
|
+
toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'>;
|
|
50
|
+
static createProposalFromSigner(payload: ConsensusPayload, txHashes: TxHash[], txs: Tx[] | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
|
|
56
51
|
/**Get Sender
|
|
57
52
|
* Lazily evaluate the sender of the proposal; result is cached
|
|
58
53
|
* @returns The sender address, or undefined if signature recovery fails
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_proposal.d.ts","sourceRoot":"","sources":["../../src/p2p/block_proposal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"block_proposal.d.ts","sourceRoot":"","sources":["../../src/p2p/block_proposal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EA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AAO,EAAE,QAAQ,KAAK,OAAO,CAAC,SAAS,CAAC;IAQ1D;;;OAGG;IACH,SAAS,IAAI,UAAU,GAAG,SAAS;IAUnC,UAAU;IAIV,QAAQ,IAAI,MAAM;IASlB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa;IAe5D,OAAO,IAAI,MAAM;CASlB"}
|
|
@@ -19,16 +19,15 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
19
19
|
* A block proposal is created by the leader of the chain proposing a sequence of transactions to
|
|
20
20
|
* be included in the head of the chain
|
|
21
21
|
*/ export class BlockProposal extends Gossipable {
|
|
22
|
-
blockNumber;
|
|
23
22
|
payload;
|
|
24
23
|
signature;
|
|
25
24
|
txHashes;
|
|
26
25
|
txs;
|
|
27
26
|
static p2pTopic = TopicType.block_proposal;
|
|
28
27
|
sender;
|
|
29
|
-
constructor(/** The
|
|
28
|
+
constructor(/** The payload of the message, and what the signature is over */ payload, /** The signer of the BlockProposal over the header of the new block*/ signature, /** The sequence of transactions in the block */ txHashes, // Note(md): this is placed after the txs payload in order to be backwards compatible with previous versions
|
|
30
29
|
/** The transactions in the block */ txs){
|
|
31
|
-
super(), this.
|
|
30
|
+
super(), this.payload = payload, this.signature = signature, this.txHashes = txHashes, this.txs = txs;
|
|
32
31
|
}
|
|
33
32
|
generateP2PMessageIdentifier() {
|
|
34
33
|
return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
|
|
@@ -41,7 +40,6 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
41
40
|
}
|
|
42
41
|
toBlockInfo() {
|
|
43
42
|
return {
|
|
44
|
-
blockNumber: this.blockNumber,
|
|
45
43
|
slotNumber: this.slotNumber.toNumber(),
|
|
46
44
|
lastArchive: this.payload.header.lastArchiveRoot,
|
|
47
45
|
timestamp: this.payload.header.timestamp,
|
|
@@ -49,11 +47,11 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
49
47
|
txCount: this.txHashes.length
|
|
50
48
|
};
|
|
51
49
|
}
|
|
52
|
-
static async createProposalFromSigner(
|
|
50
|
+
static async createProposalFromSigner(payload, txHashes, // Note(md): Provided separately to tx hashes such that this function can be optional
|
|
53
51
|
txs, payloadSigner) {
|
|
54
52
|
const hashed = getHashedSignaturePayload(payload, SignatureDomainSeparator.blockProposal);
|
|
55
53
|
const sig = await payloadSigner(hashed);
|
|
56
|
-
return new BlockProposal(
|
|
54
|
+
return new BlockProposal(payload, sig, txHashes, txs);
|
|
57
55
|
}
|
|
58
56
|
/**Get Sender
|
|
59
57
|
* Lazily evaluate the sender of the proposal; result is cached
|
|
@@ -71,7 +69,6 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
71
69
|
}
|
|
72
70
|
toBuffer() {
|
|
73
71
|
const buffer = [
|
|
74
|
-
this.blockNumber,
|
|
75
72
|
this.payload,
|
|
76
73
|
this.signature,
|
|
77
74
|
this.txHashes.length,
|
|
@@ -85,17 +82,16 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
85
82
|
}
|
|
86
83
|
static fromBuffer(buf) {
|
|
87
84
|
const reader = BufferReader.asReader(buf);
|
|
88
|
-
const blockNumber = reader.readNumber();
|
|
89
85
|
const payload = reader.readObject(ConsensusPayload);
|
|
90
86
|
const sig = reader.readObject(Signature);
|
|
91
87
|
const txHashes = reader.readArray(reader.readNumber(), TxHash);
|
|
92
88
|
if (!reader.isEmpty()) {
|
|
93
89
|
const txs = reader.readArray(reader.readNumber(), Tx);
|
|
94
|
-
return new BlockProposal(
|
|
90
|
+
return new BlockProposal(payload, sig, txHashes, txs);
|
|
95
91
|
}
|
|
96
|
-
return new BlockProposal(
|
|
92
|
+
return new BlockProposal(payload, sig, txHashes);
|
|
97
93
|
}
|
|
98
94
|
getSize() {
|
|
99
|
-
return
|
|
95
|
+
return this.payload.getSize() + this.signature.getSize() + 4 /* txHashes.length */ + this.txHashes.length * TxHash.SIZE + (this.txs ? 4 /* txs.length */ + this.txs.reduce((acc, tx)=>acc + tx.getSize(), 0) : 0);
|
|
100
96
|
}
|
|
101
97
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NUM_MSGS_PER_BASE_PARITY } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader, type Tuple } from '@aztec/foundation/serialize';
|
|
4
4
|
export declare class ParityBasePrivateInputs {
|
|
@@ -11,7 +11,7 @@ export declare class ParityBasePrivateInputs {
|
|
|
11
11
|
msgs: Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>,
|
|
12
12
|
/** Root of the VK tree */
|
|
13
13
|
vkTreeRoot: Fr);
|
|
14
|
-
static fromSlice(array:
|
|
14
|
+
static fromSlice(array: Fr[], index: number, vkTreeRoot: Fr): ParityBasePrivateInputs;
|
|
15
15
|
/** Serializes the inputs to a buffer. */
|
|
16
16
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
17
17
|
/** Serializes the inputs to a hex string. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parity_base_private_inputs.d.ts","sourceRoot":"","sources":["../../src/parity/parity_base_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"parity_base_private_inputs.d.ts","sourceRoot":"","sources":["../../src/parity/parity_base_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAqB,MAAM,6BAA6B,CAAC;AAG1F,qBAAa,uBAAuB;IAEhC,6DAA6D;aAC7C,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IAChE,0BAA0B;aACV,UAAU,EAAE,EAAE;;IAH9B,6DAA6D;IAC7C,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IAChE,0BAA0B;IACV,UAAU,EAAE,EAAE;WAGlB,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,GAAG,uBAAuB;IAa5F,yCAAyC;IACzC,QAAQ;IAIR,6CAA6C;IAC7C,QAAQ;IAIR;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAK/C;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,8DAA8D;IAC9D,MAAM;IAIN,6CAA6C;IAC7C,MAAM,KAAK,MAAM,gEAEhB;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NUM_MSGS_PER_BASE_PARITY } from '@aztec/constants';
|
|
1
|
+
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUM_MSGS_PER_BASE_PARITY } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -11,6 +11,10 @@ export class ParityBasePrivateInputs {
|
|
|
11
11
|
this.vkTreeRoot = vkTreeRoot;
|
|
12
12
|
}
|
|
13
13
|
static fromSlice(array, index, vkTreeRoot) {
|
|
14
|
+
// Can't use Tuple<Fr, typeof NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP> due to length
|
|
15
|
+
if (array.length !== NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP) {
|
|
16
|
+
throw new Error(`Msgs array length must be NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP=${NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP}`);
|
|
17
|
+
}
|
|
14
18
|
const start = index * NUM_MSGS_PER_BASE_PARITY;
|
|
15
19
|
const end = start + NUM_MSGS_PER_BASE_PARITY;
|
|
16
20
|
const msgs = array.slice(start, end);
|
|
@@ -53,7 +53,7 @@ export declare class BlockRootFirstRollupPrivateInputs {
|
|
|
53
53
|
*/
|
|
54
54
|
newArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>);
|
|
55
55
|
static from(fields: FieldsOf<BlockRootFirstRollupPrivateInputs>): BlockRootFirstRollupPrivateInputs;
|
|
56
|
-
static getFields(fields: FieldsOf<BlockRootFirstRollupPrivateInputs>): readonly [UltraHonkProofData<ParityPublicInputs>, [RollupHonkProofData<TxRollupPublicInputs>, RollupHonkProofData<TxRollupPublicInputs>], AppendOnlyTreeSnapshot, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr
|
|
56
|
+
static getFields(fields: FieldsOf<BlockRootFirstRollupPrivateInputs>): readonly [UltraHonkProofData<ParityPublicInputs>, [RollupHonkProofData<TxRollupPublicInputs>, RollupHonkProofData<TxRollupPublicInputs>], AppendOnlyTreeSnapshot, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr], [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr]];
|
|
57
57
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
58
58
|
static fromBuffer(buffer: Buffer | BufferReader): BlockRootFirstRollupPrivateInputs;
|
|
59
59
|
toJSON(): Buffer<ArrayBufferLike>;
|
|
@@ -102,7 +102,7 @@ export declare class BlockRootSingleTxFirstRollupPrivateInputs {
|
|
|
102
102
|
*/
|
|
103
103
|
newArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>);
|
|
104
104
|
static from(fields: FieldsOf<BlockRootSingleTxFirstRollupPrivateInputs>): BlockRootSingleTxFirstRollupPrivateInputs;
|
|
105
|
-
static getFields(fields: FieldsOf<BlockRootSingleTxFirstRollupPrivateInputs>): readonly [UltraHonkProofData<ParityPublicInputs>, RollupHonkProofData<TxRollupPublicInputs>, AppendOnlyTreeSnapshot, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr
|
|
105
|
+
static getFields(fields: FieldsOf<BlockRootSingleTxFirstRollupPrivateInputs>): readonly [UltraHonkProofData<ParityPublicInputs>, RollupHonkProofData<TxRollupPublicInputs>, AppendOnlyTreeSnapshot, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr], [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr]];
|
|
106
106
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
107
107
|
static fromBuffer(buffer: Buffer | BufferReader): BlockRootSingleTxFirstRollupPrivateInputs;
|
|
108
108
|
toJSON(): Buffer<ArrayBufferLike>;
|
|
@@ -177,7 +177,7 @@ export declare class BlockRootEmptyTxFirstRollupPrivateInputs {
|
|
|
177
177
|
*/
|
|
178
178
|
newArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>);
|
|
179
179
|
static from(fields: FieldsOf<BlockRootEmptyTxFirstRollupPrivateInputs>): BlockRootEmptyTxFirstRollupPrivateInputs;
|
|
180
|
-
static getFields(fields: FieldsOf<BlockRootEmptyTxFirstRollupPrivateInputs>): readonly [UltraHonkProofData<ParityPublicInputs>, AppendOnlyTreeSnapshot, StateReference, CheckpointConstantData, SpongeBlob, bigint, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr
|
|
180
|
+
static getFields(fields: FieldsOf<BlockRootEmptyTxFirstRollupPrivateInputs>): readonly [UltraHonkProofData<ParityPublicInputs>, AppendOnlyTreeSnapshot, StateReference, CheckpointConstantData, SpongeBlob, bigint, [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr], [Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr, Fr]];
|
|
181
181
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
182
182
|
static fromBuffer(buffer: Buffer | BufferReader): BlockRootEmptyTxFirstRollupPrivateInputs;
|
|
183
183
|
toJSON(): Buffer<ArrayBufferLike>;
|
package/dest/tests/mocks.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
|
9
9
|
import type { ContractInstanceWithAddress } from '../contract/index.js';
|
|
10
10
|
import { Gas } from '../gas/gas.js';
|
|
11
11
|
import { GasFees } from '../gas/gas_fees.js';
|
|
12
|
-
import {
|
|
12
|
+
import { UniqueNote } from '../note/unique_note.js';
|
|
13
13
|
import { BlockAttestation } from '../p2p/block_attestation.js';
|
|
14
14
|
import { BlockProposal } from '../p2p/block_proposal.js';
|
|
15
15
|
import { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
@@ -17,7 +17,6 @@ import { StateReference, Tx } from '../tx/index.js';
|
|
|
17
17
|
import { TxSimulationResult } from '../tx/simulated_tx.js';
|
|
18
18
|
import { TxHash } from '../tx/tx_hash.js';
|
|
19
19
|
export declare const randomTxHash: () => TxHash;
|
|
20
|
-
export declare const randomExtendedNote: ({ note, recipient, contractAddress, txHash, storageSlot, }?: Partial<ExtendedNote>) => Promise<ExtendedNote>;
|
|
21
20
|
export declare const randomUniqueNote: ({ note, recipient, contractAddress, txHash, storageSlot, noteNonce, }?: Partial<UniqueNote>) => Promise<UniqueNote>;
|
|
22
21
|
export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, maxPriorityFeesPerGas, gasUsed, chainId, version, vkTreeRoot, protocolContractsHash, }?: {
|
|
23
22
|
numberOfNonRevertiblePublicCallRequests?: number;
|