@aztec/validator-client 0.0.0-test.1 → 0.0.1-commit.b655e406
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_proposal_handler.d.ts +52 -0
- package/dest/block_proposal_handler.d.ts.map +1 -0
- package/dest/block_proposal_handler.js +286 -0
- package/dest/config.d.ts +2 -13
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +31 -7
- package/dest/duties/validation_service.d.ts +16 -8
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +35 -11
- package/dest/factory.d.ts +21 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +13 -6
- package/dest/index.d.ts +3 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -1
- package/dest/key_store/index.d.ts +2 -0
- package/dest/key_store/index.d.ts.map +1 -1
- package/dest/key_store/index.js +2 -0
- package/dest/key_store/interface.d.ts +54 -5
- package/dest/key_store/interface.d.ts.map +1 -1
- package/dest/key_store/interface.js +3 -3
- package/dest/key_store/local_key_store.d.ts +40 -10
- package/dest/key_store/local_key_store.d.ts.map +1 -1
- package/dest/key_store/local_key_store.js +63 -16
- package/dest/key_store/node_keystore_adapter.d.ts +138 -0
- package/dest/key_store/node_keystore_adapter.d.ts.map +1 -0
- package/dest/key_store/node_keystore_adapter.js +316 -0
- package/dest/key_store/web3signer_key_store.d.ts +67 -0
- package/dest/key_store/web3signer_key_store.d.ts.map +1 -0
- package/dest/key_store/web3signer_key_store.js +152 -0
- package/dest/metrics.d.ts +11 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +52 -15
- package/dest/validator.d.ts +48 -61
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +262 -165
- package/package.json +25 -19
- package/src/block_proposal_handler.ts +343 -0
- package/src/config.ts +42 -22
- package/src/duties/validation_service.ts +69 -14
- package/src/factory.ts +56 -11
- package/src/index.ts +3 -1
- package/src/key_store/index.ts +2 -0
- package/src/key_store/interface.ts +61 -5
- package/src/key_store/local_key_store.ts +67 -17
- package/src/key_store/node_keystore_adapter.ts +375 -0
- package/src/key_store/web3signer_key_store.ts +192 -0
- package/src/metrics.ts +68 -17
- package/src/validator.ts +381 -233
- package/dest/errors/index.d.ts +0 -2
- package/dest/errors/index.d.ts.map +0 -1
- package/dest/errors/index.js +0 -1
- package/dest/errors/validator.error.d.ts +0 -29
- package/dest/errors/validator.error.d.ts.map +0 -1
- package/dest/errors/validator.error.js +0 -45
- package/src/errors/index.ts +0 -1
- package/src/errors/validator.error.ts +0 -55
package/dest/validator.d.ts
CHANGED
|
@@ -1,81 +1,68 @@
|
|
|
1
1
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import type
|
|
6
|
-
import
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
9
|
-
import type
|
|
10
|
-
import type {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
numFailedTxs: number;
|
|
23
|
-
blockBuildingTimer: Timer;
|
|
24
|
-
}>;
|
|
25
|
-
export interface Validator {
|
|
26
|
-
start(): Promise<void>;
|
|
27
|
-
registerBlockProposalHandler(): void;
|
|
28
|
-
registerBlockBuilder(blockBuilder: BlockBuilderCallback): void;
|
|
29
|
-
createBlockProposal(header: BlockHeader, archive: Fr, txs: TxHash[]): Promise<BlockProposal | undefined>;
|
|
30
|
-
attestToProposal(proposal: BlockProposal): void;
|
|
31
|
-
broadcastBlockProposal(proposal: BlockProposal): void;
|
|
32
|
-
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
33
|
-
}
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
6
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
7
|
+
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
8
|
+
import type { P2P, PeerId, TxProvider } from '@aztec/p2p';
|
|
9
|
+
import { type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
10
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
+
import type { CommitteeAttestationsAndSigners, L2BlockSource } from '@aztec/stdlib/block';
|
|
12
|
+
import type { IFullNodeBlockBuilder, Validator, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
|
|
13
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
14
|
+
import type { BlockAttestation, BlockProposal, BlockProposalOptions } from '@aztec/stdlib/p2p';
|
|
15
|
+
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
16
|
+
import type { StateReference, Tx } from '@aztec/stdlib/tx';
|
|
17
|
+
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
18
|
+
import type { TypedDataDefinition } from 'viem';
|
|
19
|
+
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
20
|
+
import { NodeKeystoreAdapter } from './key_store/node_keystore_adapter.js';
|
|
21
|
+
declare const ValidatorClient_base: new () => WatcherEmitter;
|
|
34
22
|
/**
|
|
35
23
|
* Validator Client
|
|
36
24
|
*/
|
|
37
|
-
export declare class ValidatorClient extends
|
|
25
|
+
export declare class ValidatorClient extends ValidatorClient_base implements Validator, Watcher {
|
|
38
26
|
private keyStore;
|
|
39
27
|
private epochCache;
|
|
40
28
|
private p2pClient;
|
|
29
|
+
private blockProposalHandler;
|
|
41
30
|
private config;
|
|
42
31
|
private dateProvider;
|
|
43
32
|
private log;
|
|
33
|
+
readonly tracer: Tracer;
|
|
44
34
|
private validationService;
|
|
45
35
|
private metrics;
|
|
36
|
+
private hasRegisteredHandlers;
|
|
46
37
|
private previousProposal?;
|
|
47
|
-
private
|
|
38
|
+
private lastEpochForCommitteeUpdateLoop;
|
|
48
39
|
private epochCacheUpdateLoop;
|
|
49
|
-
private
|
|
50
|
-
constructor(keyStore:
|
|
51
|
-
static
|
|
40
|
+
private proposersOfInvalidBlocks;
|
|
41
|
+
protected constructor(keyStore: NodeKeystoreAdapter, epochCache: EpochCache, p2pClient: P2P, blockProposalHandler: BlockProposalHandler, config: ValidatorClientFullConfig, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: Logger);
|
|
42
|
+
static validateKeyStoreConfiguration(keyStoreManager: KeystoreManager, logger?: Logger): void;
|
|
43
|
+
private handleEpochCommitteeUpdate;
|
|
44
|
+
static new(config: ValidatorClientFullConfig, blockBuilder: IFullNodeBlockBuilder, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, keyStoreManager: KeystoreManager, dateProvider?: DateProvider, telemetry?: TelemetryClient): ValidatorClient;
|
|
45
|
+
getValidatorAddresses(): EthAddress[];
|
|
46
|
+
getBlockProposalHandler(): BlockProposalHandler;
|
|
47
|
+
reExecuteTransactions(proposal: BlockProposal, blockNumber: number, txs: any[], l1ToL2Messages: Fr[]): Promise<any>;
|
|
48
|
+
signWithAddress(addr: EthAddress, msg: TypedDataDefinition): Promise<Signature>;
|
|
49
|
+
getCoinbaseForAttestor(attestor: EthAddress): EthAddress;
|
|
50
|
+
getFeeRecipientForAttestor(attestor: EthAddress): AztecAddress;
|
|
51
|
+
getConfig(): ValidatorClientFullConfig;
|
|
52
|
+
updateConfig(config: Partial<ValidatorClientFullConfig>): void;
|
|
52
53
|
start(): Promise<void>;
|
|
53
54
|
stop(): Promise<void>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Re-execute the transactions in the proposal and check that the state updates match the header state
|
|
64
|
-
* @param proposal - The proposal to re-execute
|
|
65
|
-
*/
|
|
66
|
-
reExecuteTransactions(proposal: BlockProposal): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Ensure that all of the transactions in the proposal are available in the tx pool before attesting
|
|
69
|
-
*
|
|
70
|
-
* 1. Check if the local tx pool contains all of the transactions in the proposal
|
|
71
|
-
* 2. If any transactions are not in the local tx pool, request them from the network
|
|
72
|
-
* 3. If we cannot retrieve them from the network, throw an error
|
|
73
|
-
* @param proposal - The proposal to attest to
|
|
74
|
-
*/
|
|
75
|
-
ensureTransactionsAreAvailable(proposal: BlockProposal): Promise<void>;
|
|
76
|
-
createBlockProposal(header: BlockHeader, archive: Fr, txs: TxHash[]): Promise<BlockProposal | undefined>;
|
|
77
|
-
broadcastBlockProposal(proposal: BlockProposal): void;
|
|
55
|
+
/** Register handlers on the p2p client */
|
|
56
|
+
registerHandlers(): Promise<void>;
|
|
57
|
+
attestToProposal(proposal: BlockProposal, proposalSender: PeerId): Promise<BlockAttestation[] | undefined>;
|
|
58
|
+
private slashInvalidBlock;
|
|
59
|
+
createBlockProposal(blockNumber: number, header: CheckpointHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal | undefined>;
|
|
60
|
+
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
61
|
+
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress): Promise<Signature>;
|
|
62
|
+
collectOwnAttestations(proposal: BlockProposal): Promise<BlockAttestation[]>;
|
|
78
63
|
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
64
|
+
private createBlockAttestationsFromProposal;
|
|
65
|
+
private handleAuthRequest;
|
|
79
66
|
}
|
|
80
67
|
export {};
|
|
81
68
|
//# sourceMappingURL=validator.d.ts.map
|
package/dest/validator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,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,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACnH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,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