@aztec/validator-client 1.0.0-nightly.20250607 → 1.0.0-nightly.20250610
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/duties/validation_service.d.ts +1 -1
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +8 -1
- package/dest/validator.d.ts +2 -2
- package/dest/validator.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/duties/validation_service.ts +10 -2
- package/src/validator.ts +2 -2
|
@@ -16,7 +16,7 @@ export declare class ValidationService {
|
|
|
16
16
|
*
|
|
17
17
|
* @returns A block proposal signing the above information (not the current implementation!!!)
|
|
18
18
|
*/
|
|
19
|
-
createBlockProposal(blockNumber: Fr, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAttesterAddress: EthAddress, options: BlockProposalOptions): Promise<BlockProposal>;
|
|
19
|
+
createBlockProposal(blockNumber: Fr, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
|
|
20
20
|
/**
|
|
21
21
|
* Attest with selection of validators to the given block proposal, constructed by the current sequencer
|
|
22
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,oBAAoB,EAG1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,iBAAiB;IAE/C;;;;;;;;;OASG;IACG,mBAAmB,CACvB,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,EAAE,EACX,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,EAAE,EAAE,EACT,uBAAuB,EAAE,UAAU,GAAG,SAAS,EAC/C,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAoBzB;;;;;;;;;OASG;IACG,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAUtG"}
|
|
@@ -16,7 +16,14 @@ export class ValidationService {
|
|
|
16
16
|
*
|
|
17
17
|
* @returns A block proposal signing the above information (not the current implementation!!!)
|
|
18
18
|
*/ async createBlockProposal(blockNumber, header, archive, stateReference, txs, proposerAttesterAddress, options) {
|
|
19
|
-
|
|
19
|
+
let payloadSigner;
|
|
20
|
+
if (proposerAttesterAddress !== undefined) {
|
|
21
|
+
payloadSigner = (payload)=>this.keyStore.signMessageWithAddress(proposerAttesterAddress, payload);
|
|
22
|
+
} else {
|
|
23
|
+
// if there is no proposer attester address, just use the first signer
|
|
24
|
+
const signer = this.keyStore.getAddress(0);
|
|
25
|
+
payloadSigner = (payload)=>this.keyStore.signMessageWithAddress(signer, payload);
|
|
26
|
+
}
|
|
20
27
|
// TODO: check if this is calculated earlier / can not be recomputed
|
|
21
28
|
const txHashes = await Promise.all(txs.map((tx)=>tx.getTxHash()));
|
|
22
29
|
return BlockProposal.createProposalFromSigner(blockNumber, new ConsensusPayload(header, archive, stateReference, txHashes), options.publishFullTxs ? txs : undefined, payloadSigner);
|
package/dest/validator.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { ValidatorKeyStore } from './key_store/interface.js';
|
|
|
13
13
|
export interface Validator {
|
|
14
14
|
start(): Promise<void>;
|
|
15
15
|
registerBlockProposalHandler(): void;
|
|
16
|
-
createBlockProposal(blockNumber: Fr, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAddress: EthAddress, options: BlockProposalOptions): Promise<BlockProposal | undefined>;
|
|
16
|
+
createBlockProposal(blockNumber: Fr, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal | undefined>;
|
|
17
17
|
attestToProposal(proposal: BlockProposal, sender: PeerId): Promise<BlockAttestation[] | undefined>;
|
|
18
18
|
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
19
19
|
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
@@ -52,7 +52,7 @@ export declare class ValidatorClient extends WithTracer implements Validator {
|
|
|
52
52
|
* @param proposal - The proposal to re-execute
|
|
53
53
|
*/
|
|
54
54
|
reExecuteTransactions(proposal: BlockProposal, txs: Tx[]): Promise<void>;
|
|
55
|
-
createBlockProposal(blockNumber: Fr, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAddress: EthAddress, options: BlockProposalOptions): Promise<BlockProposal | undefined>;
|
|
55
|
+
createBlockProposal(blockNumber: Fr, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal | undefined>;
|
|
56
56
|
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
57
57
|
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
58
58
|
private doAttestToProposal;
|
package/dest/validator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAmB,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,KAAK,eAAe,EAAE,UAAU,EAAsB,MAAM,yBAAyB,CAAC;AAE/F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAWzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAIlE,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,4BAA4B,IAAI,IAAI,CAAC;IAGrC,mBAAmB,CACjB,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,EAAE,EACX,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,EAAE,EAAE,EACT,eAAe,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,E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;IAIV,4BAA4B;IAO7B,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC;IAsFhH,OAAO,CAAC,sBAAsB;IAS9B;;;OAGG;IACG,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,EAAE;IAmDxD,mBAAmB,CACvB,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,mBAAmB,EAC3B,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;IAmB/B,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAiDnG,kBAAkB;CAKjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/validator-client",
|
|
3
|
-
"version": "1.0.0-nightly.
|
|
3
|
+
"version": "1.0.0-nightly.20250610",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@aztec/constants": "1.0.0-nightly.
|
|
64
|
-
"@aztec/epoch-cache": "1.0.0-nightly.
|
|
65
|
-
"@aztec/ethereum": "1.0.0-nightly.
|
|
66
|
-
"@aztec/foundation": "1.0.0-nightly.
|
|
67
|
-
"@aztec/p2p": "1.0.0-nightly.
|
|
68
|
-
"@aztec/stdlib": "1.0.0-nightly.
|
|
69
|
-
"@aztec/telemetry-client": "1.0.0-nightly.
|
|
63
|
+
"@aztec/constants": "1.0.0-nightly.20250610",
|
|
64
|
+
"@aztec/epoch-cache": "1.0.0-nightly.20250610",
|
|
65
|
+
"@aztec/ethereum": "1.0.0-nightly.20250610",
|
|
66
|
+
"@aztec/foundation": "1.0.0-nightly.20250610",
|
|
67
|
+
"@aztec/p2p": "1.0.0-nightly.20250610",
|
|
68
|
+
"@aztec/stdlib": "1.0.0-nightly.20250610",
|
|
69
|
+
"@aztec/telemetry-client": "1.0.0-nightly.20250610",
|
|
70
70
|
"koa": "^2.16.1",
|
|
71
71
|
"koa-router": "^12.0.0",
|
|
72
72
|
"tslib": "^2.4.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
2
|
import { keccak256 } from '@aztec/foundation/crypto';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
5
|
import type { Fr } from '@aztec/foundation/fields';
|
|
5
6
|
import {
|
|
6
7
|
BlockAttestation,
|
|
@@ -32,10 +33,17 @@ export class ValidationService {
|
|
|
32
33
|
archive: Fr,
|
|
33
34
|
stateReference: StateReference,
|
|
34
35
|
txs: Tx[],
|
|
35
|
-
proposerAttesterAddress: EthAddress,
|
|
36
|
+
proposerAttesterAddress: EthAddress | undefined,
|
|
36
37
|
options: BlockProposalOptions,
|
|
37
38
|
): Promise<BlockProposal> {
|
|
38
|
-
|
|
39
|
+
let payloadSigner: (payload: Buffer32) => Promise<Signature>;
|
|
40
|
+
if (proposerAttesterAddress !== undefined) {
|
|
41
|
+
payloadSigner = (payload: Buffer32) => this.keyStore.signMessageWithAddress(proposerAttesterAddress, payload);
|
|
42
|
+
} else {
|
|
43
|
+
// if there is no proposer attester address, just use the first signer
|
|
44
|
+
const signer = this.keyStore.getAddress(0);
|
|
45
|
+
payloadSigner = (payload: Buffer32) => this.keyStore.signMessageWithAddress(signer, payload);
|
|
46
|
+
}
|
|
39
47
|
// TODO: check if this is calculated earlier / can not be recomputed
|
|
40
48
|
const txHashes = await Promise.all(txs.map(tx => tx.getTxHash()));
|
|
41
49
|
|
package/src/validator.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface Validator {
|
|
|
43
43
|
archive: Fr,
|
|
44
44
|
stateReference: StateReference,
|
|
45
45
|
txs: Tx[],
|
|
46
|
-
proposerAddress: EthAddress,
|
|
46
|
+
proposerAddress: EthAddress | undefined,
|
|
47
47
|
options: BlockProposalOptions,
|
|
48
48
|
): Promise<BlockProposal | undefined>;
|
|
49
49
|
attestToProposal(proposal: BlockProposal, sender: PeerId): Promise<BlockAttestation[] | undefined>;
|
|
@@ -339,7 +339,7 @@ export class ValidatorClient extends WithTracer implements Validator {
|
|
|
339
339
|
archive: Fr,
|
|
340
340
|
stateReference: StateReference,
|
|
341
341
|
txs: Tx[],
|
|
342
|
-
proposerAddress: EthAddress,
|
|
342
|
+
proposerAddress: EthAddress | undefined,
|
|
343
343
|
options: BlockProposalOptions,
|
|
344
344
|
): Promise<BlockProposal | undefined> {
|
|
345
345
|
if (this.previousProposal?.slotNumber.equals(header.slotNumber)) {
|