@aztec/stdlib 5.0.0-nightly.20260324 → 5.0.0-nightly.20260328
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/abi/decoder.d.ts +5 -44
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +12 -67
- package/dest/abi/function_selector.js +1 -1
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- 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 +3 -0
- package/dest/file-store/factory.d.ts +4 -3
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +2 -2
- package/dest/file-store/http.d.ts +9 -2
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +20 -9
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/hash/hash.d.ts +4 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +5 -0
- package/dest/interfaces/aztec-node-admin.d.ts +1 -4
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +2 -10
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +0 -1
- package/dest/logs/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +4 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +7 -3
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/package.json +8 -8
- package/src/abi/decoder.ts +23 -78
- package/src/abi/function_selector.ts +1 -1
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/epoch-helpers/index.ts +8 -0
- package/src/file-store/factory.ts +13 -4
- package/src/file-store/http.ts +29 -10
- package/src/file-store/index.ts +1 -0
- package/src/hash/hash.ts +5 -0
- package/src/interfaces/validator.ts +1 -5
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +7 -2
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/note/note_dao.ts +1 -4
- package/src/proofs/chonk_proof.ts +91 -5
- package/src/tx/capsule.ts +10 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
|
|
4
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
5
4
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
6
5
|
import { MessageContext } from './message_context.js';
|
|
7
6
|
|
|
@@ -17,9 +16,8 @@ export class PendingTaggedLog {
|
|
|
17
16
|
txHash: TxHash,
|
|
18
17
|
uniqueNoteHashesInTx: Fr[],
|
|
19
18
|
firstNullifierInTx: Fr,
|
|
20
|
-
recipient: AztecAddress,
|
|
21
19
|
) {
|
|
22
|
-
this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx
|
|
20
|
+
this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
toFields(): Fr[] {
|
|
@@ -1,26 +1,37 @@
|
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
1
2
|
import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
2
|
-
import
|
|
3
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
+
import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
3
6
|
|
|
7
|
+
import type { AztecAddress } from '../aztec-address/index.js';
|
|
4
8
|
import type { PublicKey } from '../keys/public_key.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the shared secret
|
|
11
|
+
* Derives an app-siloed ECDH shared secret.
|
|
12
|
+
*
|
|
13
|
+
* Computes the raw ECDH shared secret `S = secretKey * publicKey`, then app-silos it:
|
|
14
|
+
* `s_app = h(DOM_SEP__APP_SILOED_ECDH_SHARED_SECRET, S.x, S.y, contractAddress)`
|
|
10
15
|
*
|
|
11
16
|
* @param secretKey - The secret key used to derive shared secret.
|
|
12
17
|
* @param publicKey - The public key used to derive shared secret.
|
|
13
|
-
* @
|
|
18
|
+
* @param contractAddress - The address of the calling contract, used for app-siloing.
|
|
19
|
+
* @returns The app-siloed shared secret as a Field.
|
|
14
20
|
* @throws If the publicKey is zero.
|
|
15
|
-
*
|
|
16
|
-
* TODO(#12656): This function is kept around because of the utilityGetSharedSecret oracle. Nuke this once returning
|
|
17
|
-
* the app-siloed secret.
|
|
18
21
|
*/
|
|
19
|
-
export function
|
|
22
|
+
export async function deriveAppSiloedSharedSecret(
|
|
23
|
+
secretKey: GrumpkinScalar,
|
|
24
|
+
publicKey: PublicKey,
|
|
25
|
+
contractAddress: AztecAddress,
|
|
26
|
+
): Promise<Fr> {
|
|
20
27
|
if (publicKey.isZero()) {
|
|
21
28
|
throw new Error(
|
|
22
29
|
`Attempting to derive a shared secret with a zero public key. You have probably passed a zero public key in your Noir code somewhere thinking that the note won't be broadcast... but it was.`,
|
|
23
30
|
);
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
const rawSharedSecret = await Grumpkin.mul(publicKey, secretKey);
|
|
33
|
+
return poseidon2HashWithSeparator(
|
|
34
|
+
[rawSharedSecret.x, rawSharedSecret.y, contractAddress],
|
|
35
|
+
DomainSeparator.APP_SILOED_ECDH_SHARED_SECRET,
|
|
36
|
+
);
|
|
26
37
|
}
|
package/src/logs/siloed_tag.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
3
4
|
|
|
4
5
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
-
import { computeSiloedPrivateLogFirstField } from '../hash/hash.js';
|
|
6
|
+
import { computeLogTag, computeSiloedPrivateLogFirstField } from '../hash/hash.js';
|
|
6
7
|
import { schemas } from '../schemas/schemas.js';
|
|
7
8
|
import type { PreTag } from './pre_tag.js';
|
|
8
9
|
import { Tag } from './tag.js';
|
|
@@ -24,9 +25,13 @@ export class SiloedTag {
|
|
|
24
25
|
|
|
25
26
|
static async compute(preTag: PreTag): Promise<SiloedTag> {
|
|
26
27
|
const tag = await Tag.compute(preTag);
|
|
27
|
-
|
|
28
|
+
const logTag = await computeLogTag(tag.value, DomainSeparator.UNCONSTRAINED_MSG_LOG_TAG);
|
|
29
|
+
return SiloedTag.computeFromTagAndApp(new Tag(logTag), preTag.extendedSecret.app);
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Unlike `compute`, this expects a tag whose value is already domain-separated.
|
|
34
|
+
*/
|
|
30
35
|
static async computeFromTagAndApp(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
|
|
31
36
|
const siloedTag = await computeSiloedPrivateLogFirstField(app, tag.value);
|
|
32
37
|
return new SiloedTag(siloedTag);
|
|
@@ -6,6 +6,7 @@ import { bufferToHex } from '@aztec/foundation/string';
|
|
|
6
6
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
7
7
|
|
|
8
8
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
9
|
+
import type { BlockParameter } from '../block/block_parameter.js';
|
|
9
10
|
import { computeL1ToL2MessageNullifier } from '../hash/hash.js';
|
|
10
11
|
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
11
12
|
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
@@ -79,20 +80,22 @@ export async function getNonNullifiedL1ToL2MessageWitness(
|
|
|
79
80
|
contractAddress: AztecAddress,
|
|
80
81
|
messageHash: Fr,
|
|
81
82
|
secret: Fr,
|
|
83
|
+
referenceBlock: BlockParameter = 'latest',
|
|
82
84
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]> {
|
|
83
|
-
const
|
|
84
|
-
if (!response) {
|
|
85
|
-
throw new Error(`No L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
86
|
-
}
|
|
85
|
+
const messageNullifier = await computeL1ToL2MessageNullifier(contractAddress, messageHash, secret);
|
|
87
86
|
|
|
88
|
-
const [
|
|
87
|
+
const [l1ToL2Response, nullifierResponse] = await Promise.all([
|
|
88
|
+
node.getL1ToL2MessageMembershipWitness(referenceBlock, messageHash),
|
|
89
|
+
node.findLeavesIndexes(referenceBlock, MerkleTreeId.NULLIFIER_TREE, [messageNullifier]),
|
|
90
|
+
]);
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
if (!l1ToL2Response) {
|
|
93
|
+
throw new Error(`No L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
94
|
+
}
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
if (nullifierIndex !== undefined) {
|
|
96
|
+
if (nullifierResponse[0] !== undefined) {
|
|
94
97
|
throw new Error(`No non-nullified L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
return
|
|
100
|
+
return l1ToL2Response;
|
|
98
101
|
}
|
package/src/note/note_dao.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
5
|
import { Note } from '@aztec/stdlib/note';
|
|
@@ -148,9 +147,7 @@ export class NoteDao {
|
|
|
148
147
|
* @returns - Its size in bytes.
|
|
149
148
|
*/
|
|
150
149
|
public getSize() {
|
|
151
|
-
|
|
152
|
-
// 2 numbers for txIndexInBlock and noteIndexInTx (4 bytes each)
|
|
153
|
-
return noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + 8;
|
|
150
|
+
return this.toBuffer().length;
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
static async random({
|
|
@@ -1,21 +1,41 @@
|
|
|
1
|
+
import { BarretenbergSync, flattenChonkProofFields } from '@aztec/bb.js';
|
|
1
2
|
import { CHONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
3
|
import { times } from '@aztec/foundation/collection';
|
|
3
4
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
4
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
6
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
6
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
7
|
+
import { BufferReader, numToUInt32BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serialization format detection for ChonkProof is size-based:
|
|
11
|
+
* - UNCOMPRESSED (legacy): [field_count=1632: uint32] [fields...] → total ≈ 52KB (>= 40KB)
|
|
12
|
+
* - COMPRESSED: [byte_count: uint32] [compressed_bytes] → total ≈ 35KB (< 40KB)
|
|
13
|
+
*
|
|
14
|
+
* Detection: if the first uint32 equals CHONK_PROOF_LENGTH (1632), it's legacy format
|
|
15
|
+
* (field count). Otherwise, it's compressed format (byte count). The old uncompressed
|
|
16
|
+
* format is never smaller than 40KB; compressed proofs are always smaller than 40KB.
|
|
17
|
+
*/
|
|
7
18
|
|
|
8
19
|
// CHONK: "Client Honk" - An UltraHonk variant with incremental folding and delayed non-native arithmetic.
|
|
9
20
|
export class ChonkProof {
|
|
21
|
+
/**
|
|
22
|
+
* Optional compressed proof bytes from chonk compression (point compression + u256 encoding).
|
|
23
|
+
* When set, toBuffer() will serialize in compressed format (~1.7x smaller).
|
|
24
|
+
* When reading from compressed format, this is populated and fields are decompressed on demand.
|
|
25
|
+
*/
|
|
26
|
+
public compressedProof?: Buffer;
|
|
27
|
+
|
|
10
28
|
constructor(
|
|
11
29
|
// The proof fields.
|
|
12
30
|
// For native verification, attach public inputs via `attachPublicInputs(publicInputs)`.
|
|
13
31
|
// Not using Tuple here due to the length being too high.
|
|
14
32
|
public fields: Fr[],
|
|
33
|
+
compressedProof?: Buffer,
|
|
15
34
|
) {
|
|
16
35
|
if (fields.length !== CHONK_PROOF_LENGTH) {
|
|
17
36
|
throw new Error(`Invalid ChonkProof length: ${fields.length}`);
|
|
18
37
|
}
|
|
38
|
+
this.compressedProof = compressedProof;
|
|
19
39
|
}
|
|
20
40
|
|
|
21
41
|
public attachPublicInputs(publicInputs: Fr[]) {
|
|
@@ -53,19 +73,84 @@ export class ChonkProof {
|
|
|
53
73
|
return this.toBuffer();
|
|
54
74
|
}
|
|
55
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Deserialize a ChonkProof from a buffer.
|
|
78
|
+
* Supports both legacy (field elements) and compressed (chonk compression) formats.
|
|
79
|
+
*
|
|
80
|
+
* Size-based format detection:
|
|
81
|
+
* - First uint32 == CHONK_PROOF_LENGTH (1632): legacy format, read field elements
|
|
82
|
+
* Total proof data ≈ 52KB (always >= 40KB)
|
|
83
|
+
* - Otherwise: compressed format, first uint32 is byte count of compressed data
|
|
84
|
+
* Total proof data ≈ 35KB (always < 40KB)
|
|
85
|
+
*/
|
|
56
86
|
static fromBuffer(buffer: Buffer | BufferReader): ChonkProof {
|
|
57
87
|
const reader = BufferReader.asReader(buffer);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
const firstUint32 = reader.readNumber();
|
|
89
|
+
|
|
90
|
+
if (firstUint32 === CHONK_PROOF_LENGTH) {
|
|
91
|
+
// Legacy format: firstUint32 is the field count (1632)
|
|
92
|
+
// Widen to `number` to prevent TS from narrowing to literal 1632,
|
|
93
|
+
// which would cause Tuple<Fr, 1632> to exceed the recursion limit.
|
|
94
|
+
const fieldCount: number = firstUint32;
|
|
95
|
+
const proof = reader.readArray(fieldCount, Fr);
|
|
96
|
+
return new ChonkProof(proof);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Compressed format: firstUint32 is the compressed byte count
|
|
100
|
+
const compressedBytes = reader.readBytes(firstUint32);
|
|
101
|
+
return ChonkProof.fromCompressedBytes(Buffer.from(compressedBytes));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Create a ChonkProof from compressed bytes by decompressing via the BarretenbergSync API.
|
|
106
|
+
* The compressed format uses point compression and u256 encoding (from PR #20645).
|
|
107
|
+
*
|
|
108
|
+
* @param compressed - Compressed proof bytes from chonk compression
|
|
109
|
+
* @returns ChonkProof with both fields and compressed bytes populated
|
|
110
|
+
*/
|
|
111
|
+
static fromCompressedBytes(compressed: Buffer): ChonkProof {
|
|
112
|
+
const api = BarretenbergSync.getSingleton();
|
|
113
|
+
const result = api.chonkDecompressProof({ compressedProof: new Uint8Array(compressed) });
|
|
114
|
+
|
|
115
|
+
// Flatten the structured bb.js ChonkProof into flat Fr[] field elements
|
|
116
|
+
const flatFields = flattenChonkProofFields(result.proof);
|
|
117
|
+
const fields = flatFields.map(f => Fr.fromBuffer(Buffer.from(f)));
|
|
118
|
+
|
|
119
|
+
// The decompressed proof includes public inputs in hidingOinkProof.
|
|
120
|
+
// Since ChonkProof stores fields WITHOUT public inputs, strip them.
|
|
121
|
+
// The number of public inputs = total fields - CHONK_PROOF_LENGTH
|
|
122
|
+
if (fields.length > CHONK_PROOF_LENGTH) {
|
|
123
|
+
const numPubInputs = fields.length - CHONK_PROOF_LENGTH;
|
|
124
|
+
const proofFields = fields.slice(numPubInputs);
|
|
125
|
+
return new ChonkProof(proofFields, compressed);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return new ChonkProof(fields, compressed);
|
|
61
129
|
}
|
|
62
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Serialize the proof to a buffer.
|
|
133
|
+
* If compressed bytes are available, uses the compressed format (~1.7x smaller).
|
|
134
|
+
* Otherwise falls back to legacy field element format.
|
|
135
|
+
*/
|
|
63
136
|
public toBuffer() {
|
|
137
|
+
if (this.compressedProof) {
|
|
138
|
+
// Compressed format: [compressed_byte_count: uint32] [compressed_bytes]
|
|
139
|
+
return Buffer.concat([numToUInt32BE(this.compressedProof.length), this.compressedProof]);
|
|
140
|
+
}
|
|
141
|
+
// Legacy format: [field_count=1632: uint32] [fields...]
|
|
64
142
|
return serializeToBuffer(this.fields.length, this.fields);
|
|
65
143
|
}
|
|
66
144
|
}
|
|
67
145
|
|
|
68
146
|
export class ChonkProofWithPublicInputs {
|
|
147
|
+
/**
|
|
148
|
+
* Optional compressed proof bytes (covers the full proof WITH public inputs).
|
|
149
|
+
* Set by the prover when using chonk compression. Flows through to ChonkProof
|
|
150
|
+
* via removePublicInputs() so the Tx can serialize in compressed format.
|
|
151
|
+
*/
|
|
152
|
+
public compressedProof?: Buffer;
|
|
153
|
+
|
|
69
154
|
constructor(
|
|
70
155
|
// The proof fields with public inputs.
|
|
71
156
|
// For recursive verification, use without public inputs via `removePublicInputs()`.
|
|
@@ -83,7 +168,8 @@ export class ChonkProofWithPublicInputs {
|
|
|
83
168
|
|
|
84
169
|
public removePublicInputs() {
|
|
85
170
|
const numPublicInputs = this.fieldsWithPublicInputs.length - CHONK_PROOF_LENGTH;
|
|
86
|
-
|
|
171
|
+
// Flow compressed proof bytes through so the ChonkProof can serialize efficiently
|
|
172
|
+
return new ChonkProof(this.fieldsWithPublicInputs.slice(numPublicInputs), this.compressedProof);
|
|
87
173
|
}
|
|
88
174
|
|
|
89
175
|
public isEmpty() {
|
package/src/tx/capsule.ts
CHANGED
|
@@ -19,6 +19,8 @@ export class Capsule {
|
|
|
19
19
|
public readonly storageSlot: Fr,
|
|
20
20
|
/** Data passed to the contract */
|
|
21
21
|
public readonly data: Fr[],
|
|
22
|
+
/** Optional namespace for the capsule contents */
|
|
23
|
+
public readonly scope?: AztecAddress,
|
|
22
24
|
) {}
|
|
23
25
|
|
|
24
26
|
static get schema() {
|
|
@@ -30,12 +32,18 @@ export class Capsule {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
toBuffer() {
|
|
33
|
-
return
|
|
35
|
+
return this.scope
|
|
36
|
+
? serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data), true, this.scope)
|
|
37
|
+
: serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data), false);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
static fromBuffer(buffer: Buffer | BufferReader): Capsule {
|
|
37
41
|
const reader = BufferReader.asReader(buffer);
|
|
38
|
-
|
|
42
|
+
const contractAddress = AztecAddress.fromBuffer(reader);
|
|
43
|
+
const storageSlot = Fr.fromBuffer(reader);
|
|
44
|
+
const data = reader.readVector(Fr);
|
|
45
|
+
const hasScope = reader.readBoolean();
|
|
46
|
+
return new Capsule(contractAddress, storageSlot, data, hasScope ? AztecAddress.fromBuffer(reader) : undefined);
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
toString() {
|