@aztec/stdlib 0.85.0-alpha-testnet.5 → 0.85.0-alpha-testnet.8
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/errors/simulation_error.d.ts.map +1 -1
- package/dest/errors/simulation_error.js +2 -2
- package/dest/p2p/block_proposal.d.ts +8 -3
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +23 -8
- package/dest/p2p/interface.d.ts +1 -1
- package/dest/tests/mocks.d.ts +1 -0
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +1 -1
- package/package.json +7 -7
- package/src/errors/simulation_error.ts +2 -2
- package/src/p2p/block_proposal.ts +29 -5
- package/src/tests/mocks.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation_error.d.ts","sourceRoot":"","sources":["../../src/errors/simulation_error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAInD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"simulation_error.d.ts","sourceRoot":"","sources":["../../src/errors/simulation_error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAInD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,qBAAqB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,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Q;IAqBR;;OAEG;IACH,YAAY,IAAI,eAAe,EAAE;IAIjC;;;OAGG;IACH,gBAAgB,IAAI,aAAa;IAIjC;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,aAAa;IAIzC,eAAe,CAAC,OAAO,EAAE,MAAM;IAI/B,MAAM;;;;;;IASN,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,CAmB3C;WAEY,MAAM;CAKpB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
3
3
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
|
-
import { schemas } from '../schemas/index.js';
|
|
4
|
+
import { optional, schemas } from '../schemas/index.js';
|
|
5
5
|
const SourceCodeLocationSchema = z.object({
|
|
6
6
|
filePath: z.string(),
|
|
7
7
|
line: z.number().int().nonnegative(),
|
|
@@ -144,7 +144,7 @@ const NoirCallStackSchema = z.union([
|
|
|
144
144
|
functionErrorStack: z.array(z.object({
|
|
145
145
|
contractAddress: schemas.AztecAddress,
|
|
146
146
|
contractName: z.string().optional(),
|
|
147
|
-
functionSelector: schemas.FunctionSelector,
|
|
147
|
+
functionSelector: optional(schemas.FunctionSelector),
|
|
148
148
|
functionName: z.string().optional()
|
|
149
149
|
})),
|
|
150
150
|
noirErrorStack: NoirCallStackSchema.optional(),
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
4
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
6
|
-
import
|
|
6
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
7
7
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
8
|
+
import { Tx } from '../tx/tx.js';
|
|
8
9
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
9
10
|
import { Gossipable } from './gossipable.js';
|
|
10
11
|
export declare class BlockProposalHash extends Buffer32 {
|
|
@@ -21,18 +22,22 @@ export declare class BlockProposal extends Gossipable {
|
|
|
21
22
|
readonly payload: ConsensusPayload;
|
|
22
23
|
/** The signer of the BlockProposal over the header of the new block*/
|
|
23
24
|
readonly signature: Signature;
|
|
25
|
+
/** The transactions in the block */
|
|
26
|
+
readonly txs?: Tx[] | undefined;
|
|
24
27
|
static p2pTopic: string;
|
|
25
28
|
private sender;
|
|
26
29
|
constructor(
|
|
27
30
|
/** The payload of the message, and what the signature is over */
|
|
28
31
|
payload: ConsensusPayload,
|
|
29
32
|
/** The signer of the BlockProposal over the header of the new block*/
|
|
30
|
-
signature: Signature
|
|
33
|
+
signature: Signature,
|
|
34
|
+
/** The transactions in the block */
|
|
35
|
+
txs?: Tx[] | undefined);
|
|
31
36
|
p2pMessageIdentifier(): Promise<Buffer32>;
|
|
32
37
|
get archive(): Fr;
|
|
33
38
|
get slotNumber(): Fr;
|
|
34
39
|
get blockNumber(): Fr;
|
|
35
|
-
static createProposalFromSigner(payload: ConsensusPayload, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
|
|
40
|
+
static createProposalFromSigner(payload: ConsensusPayload, txs: Tx[], payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
|
|
36
41
|
/**Get Sender
|
|
37
42
|
* Lazily evaluate the sender of the proposal; result is cached
|
|
38
43
|
*/
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"block_proposal.d.ts","sourceRoot":"","sources":["../../src/p2p/block_proposal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AM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa;IAa5D,OAAO,IAAI,MAAM;CAOlB"}
|
|
@@ -2,6 +2,7 @@ import { Buffer32 } from '@aztec/foundation/buffer';
|
|
|
2
2
|
import { keccak256, recoverAddress } from '@aztec/foundation/crypto';
|
|
3
3
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
|
+
import { Tx } from '../tx/tx.js';
|
|
5
6
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
6
7
|
import { Gossipable } from './gossipable.js';
|
|
7
8
|
import { SignatureDomainSeparator, getHashedSignaturePayload, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
|
|
@@ -19,10 +20,12 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
19
20
|
*/ export class BlockProposal extends Gossipable {
|
|
20
21
|
payload;
|
|
21
22
|
signature;
|
|
23
|
+
txs;
|
|
22
24
|
static p2pTopic = createTopicString(TopicType.block_proposal);
|
|
23
25
|
sender;
|
|
24
|
-
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)
|
|
25
|
-
|
|
26
|
+
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, // Note(md): this is placed after the txs payload in order to be backwards compatible with previous versions
|
|
27
|
+
/** The transactions in the block */ txs){
|
|
28
|
+
super(), this.payload = payload, this.signature = signature, this.txs = txs;
|
|
26
29
|
}
|
|
27
30
|
p2pMessageIdentifier() {
|
|
28
31
|
return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
|
|
@@ -36,10 +39,11 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
36
39
|
get blockNumber() {
|
|
37
40
|
return this.payload.header.globalVariables.blockNumber;
|
|
38
41
|
}
|
|
39
|
-
static async createProposalFromSigner(payload,
|
|
42
|
+
static async createProposalFromSigner(payload, // Note(md): Provided seperately to tx hashes such that this function can be optional
|
|
43
|
+
txs, payloadSigner) {
|
|
40
44
|
const hashed = await getHashedSignaturePayload(payload, SignatureDomainSeparator.blockProposal);
|
|
41
45
|
const sig = await payloadSigner(hashed);
|
|
42
|
-
return new BlockProposal(payload, sig);
|
|
46
|
+
return new BlockProposal(payload, sig, txs);
|
|
43
47
|
}
|
|
44
48
|
/**Get Sender
|
|
45
49
|
* Lazily evaluate the sender of the proposal; result is cached
|
|
@@ -55,16 +59,27 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
55
59
|
return this.payload.getPayloadToSign(SignatureDomainSeparator.blockProposal);
|
|
56
60
|
}
|
|
57
61
|
toBuffer() {
|
|
58
|
-
|
|
62
|
+
const buffer = [
|
|
59
63
|
this.payload,
|
|
60
64
|
this.signature
|
|
61
|
-
]
|
|
65
|
+
];
|
|
66
|
+
if (this.txs) {
|
|
67
|
+
buffer.push(this.txs.length);
|
|
68
|
+
buffer.push(this.txs);
|
|
69
|
+
}
|
|
70
|
+
return serializeToBuffer(buffer);
|
|
62
71
|
}
|
|
63
72
|
static fromBuffer(buf) {
|
|
64
73
|
const reader = BufferReader.asReader(buf);
|
|
65
|
-
|
|
74
|
+
const payload = reader.readObject(ConsensusPayload);
|
|
75
|
+
const sig = reader.readObject(Signature);
|
|
76
|
+
if (!reader.isEmpty()) {
|
|
77
|
+
const txs = reader.readArray(reader.readNumber(), Tx);
|
|
78
|
+
return new BlockProposal(payload, sig, txs);
|
|
79
|
+
}
|
|
80
|
+
return new BlockProposal(payload, sig);
|
|
66
81
|
}
|
|
67
82
|
getSize() {
|
|
68
|
-
return this.payload.getSize() + this.signature.getSize();
|
|
83
|
+
return this.payload.getSize() + this.signature.getSize() + (this.txs ? this.txs.reduce((acc, tx)=>acc + tx.getSize(), 0) : 0);
|
|
69
84
|
}
|
|
70
85
|
}
|
package/dest/p2p/interface.d.ts
CHANGED
|
@@ -13,6 +13,6 @@ export declare const TopicTypeMap: Record<string, typeof Gossipable>;
|
|
|
13
13
|
* Used in msgIdFn libp2p to get the p2pMessageIdentifier from a message
|
|
14
14
|
*/
|
|
15
15
|
export declare const TopicToDeserializer: {
|
|
16
|
-
[x: string]: typeof
|
|
16
|
+
[x: string]: typeof Tx.fromBuffer | typeof BlockAttestation.fromBuffer | typeof BlockProposal.fromBuffer;
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=interface.d.ts.map
|
package/dest/tests/mocks.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface MakeConsensusPayloadOptions {
|
|
|
44
44
|
header?: BlockHeader;
|
|
45
45
|
archive?: Fr;
|
|
46
46
|
txHashes?: TxHash[];
|
|
47
|
+
txs?: Tx[];
|
|
47
48
|
}
|
|
48
49
|
export declare const makeBlockProposal: (options?: MakeConsensusPayloadOptions) => Promise<BlockProposal>;
|
|
49
50
|
export declare const makeBlockAttestation: (options?: MakeConsensusPayloadOptions) => Promise<BlockAttestation>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAA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AAEF,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAqB3B"}
|
package/dest/tests/mocks.js
CHANGED
|
@@ -147,7 +147,7 @@ const makeAndSignConsensusPayload = async (domainSeparator, options)=>{
|
|
|
147
147
|
};
|
|
148
148
|
export const makeBlockProposal = async (options)=>{
|
|
149
149
|
const { payload, signature } = await makeAndSignConsensusPayload(SignatureDomainSeparator.blockProposal, options);
|
|
150
|
-
return new BlockProposal(payload, signature);
|
|
150
|
+
return new BlockProposal(payload, signature, options?.txs ?? []);
|
|
151
151
|
};
|
|
152
152
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
|
|
153
153
|
export const makeBlockAttestation = async (options)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.85.0-alpha-testnet.
|
|
3
|
+
"version": "0.85.0-alpha-testnet.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aztec/bb.js": "0.85.0-alpha-testnet.
|
|
72
|
-
"@aztec/blob-lib": "0.85.0-alpha-testnet.
|
|
73
|
-
"@aztec/constants": "0.85.0-alpha-testnet.
|
|
74
|
-
"@aztec/ethereum": "0.85.0-alpha-testnet.
|
|
75
|
-
"@aztec/foundation": "0.85.0-alpha-testnet.
|
|
76
|
-
"@aztec/noir-noirc_abi": "0.85.0-alpha-testnet.
|
|
71
|
+
"@aztec/bb.js": "0.85.0-alpha-testnet.8",
|
|
72
|
+
"@aztec/blob-lib": "0.85.0-alpha-testnet.8",
|
|
73
|
+
"@aztec/constants": "0.85.0-alpha-testnet.8",
|
|
74
|
+
"@aztec/ethereum": "0.85.0-alpha-testnet.8",
|
|
75
|
+
"@aztec/foundation": "0.85.0-alpha-testnet.8",
|
|
76
|
+
"@aztec/noir-noirc_abi": "0.85.0-alpha-testnet.8",
|
|
77
77
|
"@google-cloud/storage": "^7.15.0",
|
|
78
78
|
"lodash.chunk": "^4.2.0",
|
|
79
79
|
"lodash.isequal": "^4.5.0",
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
import type { OpcodeLocation } from '../abi/abi.js';
|
|
6
6
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
7
7
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
8
|
-
import { type ZodFor, schemas } from '../schemas/index.js';
|
|
8
|
+
import { type ZodFor, optional, schemas } from '../schemas/index.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Address and selector of a function that failed during simulation.
|
|
@@ -240,7 +240,7 @@ export class SimulationError extends Error {
|
|
|
240
240
|
z.object({
|
|
241
241
|
contractAddress: schemas.AztecAddress,
|
|
242
242
|
contractName: z.string().optional(),
|
|
243
|
-
functionSelector: schemas.FunctionSelector,
|
|
243
|
+
functionSelector: optional(schemas.FunctionSelector),
|
|
244
244
|
functionName: z.string().optional(),
|
|
245
245
|
}),
|
|
246
246
|
),
|
|
@@ -2,9 +2,10 @@ import { Buffer32 } from '@aztec/foundation/buffer';
|
|
|
2
2
|
import { keccak256, recoverAddress } from '@aztec/foundation/crypto';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
|
-
import
|
|
5
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
6
6
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
7
7
|
|
|
8
|
+
import { Tx } from '../tx/tx.js';
|
|
8
9
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
9
10
|
import { Gossipable } from './gossipable.js';
|
|
10
11
|
import {
|
|
@@ -37,6 +38,10 @@ export class BlockProposal extends Gossipable {
|
|
|
37
38
|
|
|
38
39
|
/** The signer of the BlockProposal over the header of the new block*/
|
|
39
40
|
public readonly signature: Signature,
|
|
41
|
+
|
|
42
|
+
// Note(md): this is placed after the txs payload in order to be backwards compatible with previous versions
|
|
43
|
+
/** The transactions in the block */
|
|
44
|
+
public readonly txs?: Tx[],
|
|
40
45
|
) {
|
|
41
46
|
super();
|
|
42
47
|
}
|
|
@@ -59,12 +64,14 @@ export class BlockProposal extends Gossipable {
|
|
|
59
64
|
|
|
60
65
|
static async createProposalFromSigner(
|
|
61
66
|
payload: ConsensusPayload,
|
|
67
|
+
// Note(md): Provided seperately to tx hashes such that this function can be optional
|
|
68
|
+
txs: Tx[],
|
|
62
69
|
payloadSigner: (payload: Buffer32) => Promise<Signature>,
|
|
63
70
|
) {
|
|
64
71
|
const hashed = await getHashedSignaturePayload(payload, SignatureDomainSeparator.blockProposal);
|
|
65
72
|
const sig = await payloadSigner(hashed);
|
|
66
73
|
|
|
67
|
-
return new BlockProposal(payload, sig);
|
|
74
|
+
return new BlockProposal(payload, sig, txs);
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
/**Get Sender
|
|
@@ -88,15 +95,32 @@ export class BlockProposal extends Gossipable {
|
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
toBuffer(): Buffer {
|
|
91
|
-
|
|
98
|
+
const buffer: any[] = [this.payload, this.signature];
|
|
99
|
+
if (this.txs) {
|
|
100
|
+
buffer.push(this.txs.length);
|
|
101
|
+
buffer.push(this.txs);
|
|
102
|
+
}
|
|
103
|
+
return serializeToBuffer(buffer);
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
static fromBuffer(buf: Buffer | BufferReader): BlockProposal {
|
|
95
107
|
const reader = BufferReader.asReader(buf);
|
|
96
|
-
|
|
108
|
+
const payload = reader.readObject(ConsensusPayload);
|
|
109
|
+
const sig = reader.readObject(Signature);
|
|
110
|
+
|
|
111
|
+
if (!reader.isEmpty()) {
|
|
112
|
+
const txs = reader.readArray(reader.readNumber(), Tx);
|
|
113
|
+
return new BlockProposal(payload, sig, txs);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return new BlockProposal(payload, sig);
|
|
97
117
|
}
|
|
98
118
|
|
|
99
119
|
getSize(): number {
|
|
100
|
-
return
|
|
120
|
+
return (
|
|
121
|
+
this.payload.getSize() +
|
|
122
|
+
this.signature.getSize() +
|
|
123
|
+
(this.txs ? this.txs.reduce((acc, tx) => acc + tx.getSize(), 0) : 0)
|
|
124
|
+
);
|
|
101
125
|
}
|
|
102
126
|
}
|
package/src/tests/mocks.ts
CHANGED
|
@@ -234,6 +234,7 @@ export interface MakeConsensusPayloadOptions {
|
|
|
234
234
|
header?: BlockHeader;
|
|
235
235
|
archive?: Fr;
|
|
236
236
|
txHashes?: TxHash[];
|
|
237
|
+
txs?: Tx[];
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
const makeAndSignConsensusPayload = async (
|
|
@@ -261,7 +262,7 @@ const makeAndSignConsensusPayload = async (
|
|
|
261
262
|
|
|
262
263
|
export const makeBlockProposal = async (options?: MakeConsensusPayloadOptions): Promise<BlockProposal> => {
|
|
263
264
|
const { payload, signature } = await makeAndSignConsensusPayload(SignatureDomainSeparator.blockProposal, options);
|
|
264
|
-
return new BlockProposal(payload, signature);
|
|
265
|
+
return new BlockProposal(payload, signature, options?.txs ?? []);
|
|
265
266
|
};
|
|
266
267
|
|
|
267
268
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
|