@aztec/p2p 0.74.0 → 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2
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/bootstrap/bootstrap.js +41 -29
- package/dest/client/factory.js +8 -10
- package/dest/client/index.js +0 -1
- package/dest/client/p2p_client.js +513 -507
- package/dest/config.js +44 -39
- package/dest/errors/reqresp.error.js +6 -10
- package/dest/index.js +0 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +6 -2
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +64 -32
- package/dest/mem_pools/attestation_pool/index.js +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +22 -19
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +22 -26
- package/dest/mem_pools/attestation_pool/mocks.js +10 -6
- package/dest/mem_pools/epoch_proof_quote_pool/epoch_proof_quote_pool.js +1 -2
- package/dest/mem_pools/epoch_proof_quote_pool/index.js +0 -1
- package/dest/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.js +5 -4
- package/dest/mem_pools/epoch_proof_quote_pool/test_utils.js +2 -3
- package/dest/mem_pools/index.js +1 -2
- package/dest/mem_pools/instrumentation.js +37 -42
- package/dest/mem_pools/interface.js +3 -2
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +127 -134
- package/dest/mem_pools/tx_pool/index.js +0 -1
- package/dest/mem_pools/tx_pool/memory_tx_pool.js +45 -43
- package/dest/mem_pools/tx_pool/priority.js +1 -3
- package/dest/mem_pools/tx_pool/tx_pool.js +3 -2
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +107 -37
- package/dest/mocks/index.js +47 -38
- package/dest/msg_validators/attestation_validator/attestation_validator.js +3 -3
- package/dest/msg_validators/attestation_validator/index.js +0 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +2 -2
- package/dest/msg_validators/block_proposal_validator/index.js +0 -1
- package/dest/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.js +2 -2
- package/dest/msg_validators/epoch_proof_quote_validator/index.js +0 -1
- package/dest/msg_validators/index.js +0 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +9 -11
- package/dest/msg_validators/tx_validator/block_header_validator.js +17 -12
- package/dest/msg_validators/tx_validator/data_validator.js +41 -32
- package/dest/msg_validators/tx_validator/double_spend_validator.js +22 -14
- package/dest/msg_validators/tx_validator/index.js +0 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +29 -26
- package/dest/msg_validators/tx_validator/tx_proof_validator.js +17 -12
- package/dest/services/data_store.js +57 -57
- package/dest/services/discv5/discV5_service.js +31 -23
- package/dest/services/dummy_service.js +40 -58
- package/dest/services/encoding.js +10 -9
- package/dest/services/index.js +0 -1
- package/dest/services/libp2p/libp2p_service.js +709 -695
- package/dest/services/peer-manager/metrics.js +14 -7
- package/dest/services/peer-manager/peer_manager.js +340 -342
- package/dest/services/peer-manager/peer_scoring.js +20 -18
- package/dest/services/reqresp/config.js +4 -5
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.js +35 -28
- package/dest/services/reqresp/connection-sampler/connection_sampler.js +60 -59
- package/dest/services/reqresp/index.js +1 -3
- package/dest/services/reqresp/interface.js +25 -30
- package/dest/services/reqresp/metrics.js +23 -10
- package/dest/services/reqresp/protocols/block.js +1 -2
- package/dest/services/reqresp/protocols/goodbye.js +35 -40
- package/dest/services/reqresp/protocols/index.js +1 -3
- package/dest/services/reqresp/protocols/ping.js +1 -3
- package/dest/services/reqresp/protocols/status.js +1 -3
- package/dest/services/reqresp/protocols/tx.js +5 -8
- package/dest/services/reqresp/rate-limiter/index.js +0 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.js +42 -36
- package/dest/services/reqresp/rate-limiter/rate_limits.js +16 -17
- package/dest/services/reqresp/reqresp.js +461 -395
- package/dest/services/reqresp/status.js +51 -0
- package/dest/services/service.js +3 -4
- package/dest/services/types.js +16 -23
- package/dest/util.js +23 -34
- package/package.json +8 -8
- package/src/client/p2p_client.ts +159 -125
- package/src/mem_pools/index.ts +3 -3
- package/src/mem_pools/instrumentation.ts +3 -2
- package/src/services/reqresp/interface.ts +11 -0
- package/src/services/reqresp/rate-limiter/rate_limiter.ts +3 -1
- package/src/services/reqresp/rate-limiter/rate_limits.ts +2 -2
- package/src/services/reqresp/reqresp.ts +111 -24
- package/src/services/reqresp/status.ts +59 -0
- package/dest/bootstrap/bootstrap.d.ts +0 -38
- package/dest/bootstrap/bootstrap.d.ts.map +0 -1
- package/dest/client/factory.d.ts +0 -19
- package/dest/client/factory.d.ts.map +0 -1
- package/dest/client/index.d.ts +0 -3
- package/dest/client/index.d.ts.map +0 -1
- package/dest/client/p2p_client.d.ts +0 -321
- package/dest/client/p2p_client.d.ts.map +0 -1
- package/dest/config.d.ts +0 -171
- package/dest/config.d.ts.map +0 -1
- package/dest/errors/reqresp.error.d.ts +0 -28
- package/dest/errors/reqresp.error.d.ts.map +0 -1
- package/dest/index.d.ts +0 -9
- package/dest/index.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +0 -57
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +0 -3
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/index.d.ts +0 -3
- package/dest/mem_pools/attestation_pool/index.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +0 -22
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +0 -17
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/mocks.d.ts +0 -18
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +0 -1
- package/dest/mem_pools/epoch_proof_quote_pool/epoch_proof_quote_pool.d.ts +0 -7
- package/dest/mem_pools/epoch_proof_quote_pool/epoch_proof_quote_pool.d.ts.map +0 -1
- package/dest/mem_pools/epoch_proof_quote_pool/index.d.ts +0 -4
- package/dest/mem_pools/epoch_proof_quote_pool/index.d.ts.map +0 -1
- package/dest/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.d.ts +0 -12
- package/dest/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.d.ts.map +0 -1
- package/dest/mem_pools/epoch_proof_quote_pool/test_utils.d.ts +0 -8
- package/dest/mem_pools/epoch_proof_quote_pool/test_utils.d.ts.map +0 -1
- package/dest/mem_pools/index.d.ts +0 -5
- package/dest/mem_pools/index.d.ts.map +0 -1
- package/dest/mem_pools/instrumentation.d.ts +0 -31
- package/dest/mem_pools/instrumentation.d.ts.map +0 -1
- package/dest/mem_pools/interface.d.ts +0 -13
- package/dest/mem_pools/interface.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +0 -66
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/index.d.ts +0 -4
- package/dest/mem_pools/tx_pool/index.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts +0 -56
- package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/priority.d.ts +0 -8
- package/dest/mem_pools/tx_pool/priority.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/tx_pool.d.ts +0 -66
- package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +0 -7
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +0 -1
- package/dest/mocks/index.d.ts +0 -54
- package/dest/mocks/index.d.ts.map +0 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +0 -8
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +0 -1
- package/dest/msg_validators/attestation_validator/index.d.ts +0 -2
- package/dest/msg_validators/attestation_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +0 -8
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/index.d.ts +0 -2
- package/dest/msg_validators/block_proposal_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.d.ts +0 -8
- package/dest/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.d.ts.map +0 -1
- package/dest/msg_validators/epoch_proof_quote_validator/index.d.ts +0 -2
- package/dest/msg_validators/epoch_proof_quote_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/index.d.ts +0 -4
- package/dest/msg_validators/index.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +0 -7
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +0 -11
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts +0 -6
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +0 -12
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/index.d.ts +0 -7
- package/dest/msg_validators/tx_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +0 -10
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +0 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +0 -8
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +0 -1
- package/dest/services/data_store.d.ts +0 -27
- package/dest/services/data_store.d.ts.map +0 -1
- package/dest/services/discv5/discV5_service.d.ts +0 -36
- package/dest/services/discv5/discV5_service.d.ts.map +0 -1
- package/dest/services/dummy_service.d.ts +0 -82
- package/dest/services/dummy_service.d.ts.map +0 -1
- package/dest/services/encoding.d.ts +0 -31
- package/dest/services/encoding.d.ts.map +0 -1
- package/dest/services/index.d.ts +0 -3
- package/dest/services/index.d.ts.map +0 -1
- package/dest/services/libp2p/libp2p_service.d.ts +0 -225
- package/dest/services/libp2p/libp2p_service.d.ts.map +0 -1
- package/dest/services/peer-manager/metrics.d.ts +0 -12
- package/dest/services/peer-manager/metrics.d.ts.map +0 -1
- package/dest/services/peer-manager/peer_manager.d.ts +0 -76
- package/dest/services/peer-manager/peer_manager.d.ts.map +0 -1
- package/dest/services/peer-manager/peer_scoring.d.ts +0 -28
- package/dest/services/peer-manager/peer_scoring.d.ts.map +0 -1
- package/dest/services/reqresp/config.d.ts +0 -16
- package/dest/services/reqresp/config.d.ts.map +0 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +0 -45
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +0 -1
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts +0 -61
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts.map +0 -1
- package/dest/services/reqresp/index.d.ts +0 -6
- package/dest/services/reqresp/index.d.ts.map +0 -1
- package/dest/services/reqresp/interface.d.ts +0 -107
- package/dest/services/reqresp/interface.d.ts.map +0 -1
- package/dest/services/reqresp/metrics.d.ts +0 -15
- package/dest/services/reqresp/metrics.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/block.d.ts +0 -4
- package/dest/services/reqresp/protocols/block.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/goodbye.d.ts +0 -51
- package/dest/services/reqresp/protocols/goodbye.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/index.d.ts +0 -9
- package/dest/services/reqresp/protocols/index.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/ping.d.ts +0 -9
- package/dest/services/reqresp/protocols/ping.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/status.d.ts +0 -9
- package/dest/services/reqresp/protocols/status.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/tx.d.ts +0 -13
- package/dest/services/reqresp/protocols/tx.d.ts.map +0 -1
- package/dest/services/reqresp/rate-limiter/index.d.ts +0 -2
- package/dest/services/reqresp/rate-limiter/index.d.ts.map +0 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +0 -102
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +0 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +0 -3
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts.map +0 -1
- package/dest/services/reqresp/reqresp.d.ts +0 -161
- package/dest/services/reqresp/reqresp.d.ts.map +0 -1
- package/dest/services/service.d.ts +0 -85
- package/dest/services/service.d.ts.map +0 -1
- package/dest/services/types.d.ts +0 -38
- package/dest/services/types.d.ts.map +0 -1
- package/dest/util.d.ts +0 -53
- package/dest/util.d.ts.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './aggregate_tx_validator.js';
|
|
2
|
-
export * from './data_validator.js';
|
|
3
|
-
export * from './double_spend_validator.js';
|
|
4
|
-
export * from './metadata_validator.js';
|
|
5
|
-
export * from './tx_proof_validator.js';
|
|
6
|
-
export * from './block_header_validator.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type AnyTx, type TxValidationResult, type TxValidator } from '@aztec/circuit-types';
|
|
2
|
-
import { type Fr } from '@aztec/circuits.js';
|
|
3
|
-
export declare class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
4
|
-
#private;
|
|
5
|
-
private chainId;
|
|
6
|
-
private blockNumber;
|
|
7
|
-
constructor(chainId: Fr, blockNumber: Fr);
|
|
8
|
-
validateTx(tx: T): Promise<TxValidationResult>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=metadata_validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/metadata_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAM,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAG7C,qBAAa,mBAAmB,CAAC,CAAC,SAAS,KAAK,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;;IAG7D,OAAO,CAAC,OAAO;IAAM,OAAO,CAAC,WAAW;gBAAhC,OAAO,EAAE,EAAE,EAAU,WAAW,EAAE,EAAE;IAElD,UAAU,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAsCrD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type ClientProtocolCircuitVerifier, Tx, type TxValidationResult, type TxValidator } from '@aztec/circuit-types';
|
|
2
|
-
export declare class TxProofValidator implements TxValidator<Tx> {
|
|
3
|
-
#private;
|
|
4
|
-
private verifier;
|
|
5
|
-
constructor(verifier: ClientProtocolCircuitVerifier);
|
|
6
|
-
validateTx(tx: Tx): Promise<TxValidationResult>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=tx_proof_validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tx_proof_validator.d.ts","sourceRoot":"","sources":["../../../src/msg_validators/tx_validator/tx_proof_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,EAAE,EACF,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAG9B,qBAAa,gBAAiB,YAAW,WAAW,CAAC,EAAE,CAAC;;IAG1C,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,6BAA6B;IAErD,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAQtD"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import { type Batch, type Datastore, Key, type KeyQuery, type Pair, type Query } from 'interface-datastore';
|
|
3
|
-
import type { AwaitIterable } from 'interface-store';
|
|
4
|
-
export declare class AztecDatastore implements Datastore {
|
|
5
|
-
#private;
|
|
6
|
-
private maxMemoryItems;
|
|
7
|
-
constructor(db: AztecAsyncKVStore, { maxMemoryItems }?: {
|
|
8
|
-
maxMemoryItems: number;
|
|
9
|
-
});
|
|
10
|
-
has(key: Key): Promise<boolean>;
|
|
11
|
-
get(key: Key): Promise<Uint8Array>;
|
|
12
|
-
put(key: Key, val: Uint8Array): Promise<Key>;
|
|
13
|
-
putMany(source: AwaitIterable<Pair>): AwaitIterable<Key>;
|
|
14
|
-
getMany(source: AwaitIterable<Key>): AwaitIterable<Pair>;
|
|
15
|
-
deleteMany(source: AwaitIterable<Key>): AwaitIterable<Key>;
|
|
16
|
-
delete(key: Key): Promise<void>;
|
|
17
|
-
batch(): Batch;
|
|
18
|
-
query(q: Query): AwaitIterable<Pair>;
|
|
19
|
-
queryKeys(q: KeyQuery): AsyncIterable<Key>;
|
|
20
|
-
private _put;
|
|
21
|
-
private all;
|
|
22
|
-
/**
|
|
23
|
-
* Prune memory store
|
|
24
|
-
*/
|
|
25
|
-
private pruneMemoryDatastore;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=data_store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data_store.d.ts","sourceRoot":"","sources":["../../src/services/data_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAqBrD,qBAAa,cAAe,YAAW,SAAS;;IAM9C,OAAO,CAAC,cAAc,CAAS;gBAEnB,EAAE,EAAE,iBAAiB,EAAE,EAAE,cAAc,EAAE;;KAAyB;IAOxE,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBxC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;IAOxD,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC;IASxD,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;IAO3D,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrC,KAAK,IAAI,KAAK;IA4Bd,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC;IA4BpC,SAAS,CAAC,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC;YA2B5B,IAAI;YAqBH,GAAG;IAkBlB;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAiB7B"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
-
import { ENR } from '@chainsafe/enr';
|
|
4
|
-
import type { PeerId } from '@libp2p/interface';
|
|
5
|
-
import EventEmitter from 'events';
|
|
6
|
-
import type { P2PConfig } from '../../config.js';
|
|
7
|
-
import { type PeerDiscoveryService, PeerDiscoveryState } from '../service.js';
|
|
8
|
-
/**
|
|
9
|
-
* Peer discovery service using Discv5.
|
|
10
|
-
*/
|
|
11
|
-
export declare class DiscV5Service extends EventEmitter implements PeerDiscoveryService {
|
|
12
|
-
private peerId;
|
|
13
|
-
private logger;
|
|
14
|
-
/** The Discv5 instance */
|
|
15
|
-
private discv5;
|
|
16
|
-
/** This instance's ENR */
|
|
17
|
-
private enr;
|
|
18
|
-
/** UDP listen addr */
|
|
19
|
-
private listenMultiAddrUdp;
|
|
20
|
-
private currentState;
|
|
21
|
-
private bootstrapNodes;
|
|
22
|
-
private bootstrapNodePeerIds;
|
|
23
|
-
private startTime;
|
|
24
|
-
constructor(peerId: PeerId, config: P2PConfig, telemetry?: TelemetryClient, logger?: import("@aztec/foundation/log").Logger);
|
|
25
|
-
start(): Promise<void>;
|
|
26
|
-
runRandomNodesQuery(): Promise<void>;
|
|
27
|
-
getAllPeers(): ENR[];
|
|
28
|
-
getEnr(): ENR;
|
|
29
|
-
getPeerId(): PeerId;
|
|
30
|
-
getStatus(): PeerDiscoveryState;
|
|
31
|
-
isBootstrapPeer(peerId: PeerId): boolean;
|
|
32
|
-
stop(): Promise<void>;
|
|
33
|
-
private onEnrAdded;
|
|
34
|
-
private onDiscovered;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=discV5_service.d.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UAAU;IAOxB,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { BlockAttestation, BlockProposal, Gossipable, PeerInfo, TxHash } from '@aztec/circuit-types';
|
|
3
|
-
import type { PeerId } from '@libp2p/interface';
|
|
4
|
-
import EventEmitter from 'events';
|
|
5
|
-
import { type ReqRespSubProtocol, type SubProtocolMap } from './reqresp/interface.js';
|
|
6
|
-
import { type P2PService, type PeerDiscoveryService, PeerDiscoveryState } from './service.js';
|
|
7
|
-
/**
|
|
8
|
-
* A dummy implementation of the P2P Service.
|
|
9
|
-
*/
|
|
10
|
-
export declare class DummyP2PService implements P2PService {
|
|
11
|
-
/** Returns an empty array for peers. */
|
|
12
|
-
getPeers(): PeerInfo[];
|
|
13
|
-
/**
|
|
14
|
-
* Starts the dummy implementation.
|
|
15
|
-
* @returns A resolved promise.
|
|
16
|
-
*/
|
|
17
|
-
start(): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Stops the dummy implementation.
|
|
20
|
-
* @returns A resolved promise.
|
|
21
|
-
*/
|
|
22
|
-
stop(): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Called to have the given message propagated through the P2P network.
|
|
25
|
-
* @param _ - The message to be propagated.
|
|
26
|
-
*/
|
|
27
|
-
propagate<T extends Gossipable>(_: T): void;
|
|
28
|
-
/**
|
|
29
|
-
* Called upon receipt of settled transactions.
|
|
30
|
-
* @param _ - The hashes of the settled transactions.
|
|
31
|
-
*/
|
|
32
|
-
settledTxs(_: TxHash[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Register a callback into the validator client for when a block proposal is received
|
|
35
|
-
*/
|
|
36
|
-
registerBlockReceivedCallback(_: (block: BlockProposal) => Promise<BlockAttestation>): void;
|
|
37
|
-
/**
|
|
38
|
-
* Sends a request to a peer.
|
|
39
|
-
* @param _protocol - The protocol to send the request on.
|
|
40
|
-
* @param _request - The request to send.
|
|
41
|
-
* @returns The response from the peer, otherwise undefined.
|
|
42
|
-
*/
|
|
43
|
-
sendRequest<Protocol extends ReqRespSubProtocol>(_protocol: Protocol, _request: InstanceType<SubProtocolMap[Protocol]['request']>): Promise<InstanceType<SubProtocolMap[Protocol]['response']> | undefined>;
|
|
44
|
-
/**
|
|
45
|
-
* Sends a batch request to a peer.
|
|
46
|
-
* @param _protocol - The protocol to send the request on.
|
|
47
|
-
* @param _requests - The requests to send.
|
|
48
|
-
* @returns The responses from the peer, otherwise undefined.
|
|
49
|
-
*/
|
|
50
|
-
sendBatchRequest<Protocol extends ReqRespSubProtocol>(_protocol: Protocol, _requests: InstanceType<SubProtocolMap[Protocol]['request']>[]): Promise<InstanceType<SubProtocolMap[Protocol]['response']>[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Returns the ENR of the peer.
|
|
53
|
-
* @returns The ENR of the peer, otherwise undefined.
|
|
54
|
-
*/
|
|
55
|
-
getEnr(): undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* A dummy implementation of the Peer Discovery Service.
|
|
59
|
-
*/
|
|
60
|
-
export declare class DummyPeerDiscoveryService extends EventEmitter implements PeerDiscoveryService {
|
|
61
|
-
private currentState;
|
|
62
|
-
/**
|
|
63
|
-
* Starts the dummy implementation.
|
|
64
|
-
* @returns A resolved promise.
|
|
65
|
-
*/
|
|
66
|
-
start(): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Stops the dummy implementation.
|
|
69
|
-
* @returns A resolved promise.
|
|
70
|
-
*/
|
|
71
|
-
stop(): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Called to discover peers in the network.
|
|
74
|
-
* @returns An array of discovered peer addresses.
|
|
75
|
-
*/
|
|
76
|
-
getAllPeers(): never[];
|
|
77
|
-
runRandomNodesQuery(): Promise<void>;
|
|
78
|
-
isBootstrapPeer(_: PeerId): boolean;
|
|
79
|
-
getStatus(): PeerDiscoveryState;
|
|
80
|
-
getEnr(): undefined;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=dummy_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dummy_service.d.ts","sourceRoot":"","sources":["../../src/services/dummy_service.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE1G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9F;;GAEG;AACH,qBAAa,eAAgB,YAAW,UAAU;IAChD,wCAAwC;IACxC,QAAQ,IAAI,QAAQ,EAAE;IAItB;;;OAGG;IACI,KAAK;IAIZ;;;OAGG;IACI,IAAI;IAIX;;;OAGG;IACI,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,EAAE,CAAC;IAE3C;;;OAGG;IACI,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE;IAE7B;;OAEG;IACI,6BAA6B,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,gBAAgB,CAAC;IAE3F;;;;;OAKG;IACI,WAAW,CAAC,QAAQ,SAAS,kBAAkB,EACpD,SAAS,EAAE,QAAQ,EACnB,QAAQ,EAAE,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,GAC1D,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;IAI1E;;;;;OAKG;IACI,gBAAgB,CAAC,QAAQ,SAAS,kBAAkB,EACzD,SAAS,EAAE,QAAQ,EACnB,SAAS,EAAE,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,GAC7D,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;IAIhE;;;OAGG;IACI,MAAM,IAAI,SAAS;CAG3B;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,YAAa,YAAW,oBAAoB;IACzF,OAAO,CAAC,YAAY,CAA8B;IAClD;;;OAGG;IACI,KAAK;IAIZ;;;OAGG;IACI,IAAI;IAIX;;;OAGG;IACI,WAAW;IAIX,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAInC,SAAS,IAAI,kBAAkB;IAI/B,MAAM,IAAI,SAAS;CAG3B"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { type RPC } from '@chainsafe/libp2p-gossipsub/message';
|
|
4
|
-
import { type DataTransform } from '@chainsafe/libp2p-gossipsub/types';
|
|
5
|
-
import { type Message } from '@libp2p/interface';
|
|
6
|
-
/**
|
|
7
|
-
* The function used to generate a gossipsub message id
|
|
8
|
-
* We use the first 8 bytes of SHA256(data) for content addressing
|
|
9
|
-
*/
|
|
10
|
-
export declare function fastMsgIdFn(rpcMsg: RPC.Message): string;
|
|
11
|
-
export declare function msgIdToStrFn(msgId: Uint8Array): string;
|
|
12
|
-
/**
|
|
13
|
-
* Get the message identifier from a libp2p message
|
|
14
|
-
*
|
|
15
|
-
* Follows similarly to:
|
|
16
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.1.0-alpha.7/specs/altair/p2p-interface.md#topics-and-messages
|
|
17
|
-
*
|
|
18
|
-
* @param message - The libp2p message
|
|
19
|
-
* @returns The message identifier
|
|
20
|
-
*/
|
|
21
|
-
export declare function getMsgIdFn(message: Message): Buffer;
|
|
22
|
-
/**
|
|
23
|
-
* Snappy transform for libp2p gossipsub
|
|
24
|
-
*/
|
|
25
|
-
export declare class SnappyTransform implements DataTransform {
|
|
26
|
-
inboundTransform(_topicStr: string, data: Uint8Array): Uint8Array;
|
|
27
|
-
inboundTransformNoTopic(data: Buffer): Buffer;
|
|
28
|
-
outboundTransform(_topicStr: string, data: Uint8Array): Uint8Array;
|
|
29
|
-
outboundTransformNoTopic(data: Buffer): Buffer;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=encoding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../src/services/encoding.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAajD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAKvD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAItD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,UAK1C;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,aAAa;IAEnD,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU;IAI1D,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAQpD,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU;IAI3D,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAMtD"}
|
package/dest/services/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { BlockAttestation, BlockProposal, type ClientProtocolCircuitVerifier, EpochProofQuote, type Gossipable, type L2BlockSource, P2PClientType, type PeerInfo, type WorldStateSynchronizer } from '@aztec/circuit-types';
|
|
2
|
-
import { type EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
|
-
import { type TelemetryClient, WithTracer } from '@aztec/telemetry-client';
|
|
5
|
-
import { type ENR } from '@chainsafe/enr';
|
|
6
|
-
import { type PeerId } from '@libp2p/interface';
|
|
7
|
-
import '@libp2p/kad-dht';
|
|
8
|
-
import { type P2PConfig } from '../../config.js';
|
|
9
|
-
import { type MemPools } from '../../mem_pools/interface.js';
|
|
10
|
-
import { type PubSubLibp2p } from '../../util.js';
|
|
11
|
-
import { ReqRespSubProtocol, type SubProtocolMap } from '../reqresp/interface.js';
|
|
12
|
-
import { ReqResp } from '../reqresp/reqresp.js';
|
|
13
|
-
import type { P2PService, PeerDiscoveryService } from '../service.js';
|
|
14
|
-
/**
|
|
15
|
-
* Lib P2P implementation of the P2PService interface.
|
|
16
|
-
*/
|
|
17
|
-
export declare class LibP2PService<T extends P2PClientType> extends WithTracer implements P2PService {
|
|
18
|
-
private clientType;
|
|
19
|
-
private config;
|
|
20
|
-
private node;
|
|
21
|
-
private peerDiscoveryService;
|
|
22
|
-
private mempools;
|
|
23
|
-
private l2BlockSource;
|
|
24
|
-
private proofVerifier;
|
|
25
|
-
private worldStateSynchronizer;
|
|
26
|
-
private logger;
|
|
27
|
-
private jobQueue;
|
|
28
|
-
private peerManager;
|
|
29
|
-
private discoveryRunningPromise?;
|
|
30
|
-
private attestationValidator;
|
|
31
|
-
private blockProposalValidator;
|
|
32
|
-
private epochProofQuoteValidator;
|
|
33
|
-
reqresp: ReqResp;
|
|
34
|
-
/**
|
|
35
|
-
* Callback for when a block is received from a peer.
|
|
36
|
-
* @param block - The block received from the peer.
|
|
37
|
-
* @returns The attestation for the block, if any.
|
|
38
|
-
*/
|
|
39
|
-
private blockReceivedCallback;
|
|
40
|
-
constructor(clientType: T, config: P2PConfig, node: PubSubLibp2p, peerDiscoveryService: PeerDiscoveryService, mempools: MemPools<T>, l2BlockSource: L2BlockSource, epochCache: EpochCache, proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, telemetry: TelemetryClient, logger?: import("@aztec/foundation/log").Logger);
|
|
41
|
-
/**
|
|
42
|
-
* Creates an instance of the LibP2P service.
|
|
43
|
-
* @param config - The configuration to use when creating the service.
|
|
44
|
-
* @param txPool - The transaction pool to be accessed by the service.
|
|
45
|
-
* @returns The new service.
|
|
46
|
-
*/
|
|
47
|
-
static new<T extends P2PClientType>(clientType: T, config: P2PConfig, peerDiscoveryService: PeerDiscoveryService, peerId: PeerId, mempools: MemPools<T>, l2BlockSource: L2BlockSource, epochCache: EpochCache, proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, store: AztecAsyncKVStore, telemetry: TelemetryClient): Promise<LibP2PService<T>>;
|
|
48
|
-
/**
|
|
49
|
-
* Starts the LibP2P service.
|
|
50
|
-
* @returns An empty promise.
|
|
51
|
-
*/
|
|
52
|
-
start(): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Stops the LibP2P service.
|
|
55
|
-
* @returns An empty promise.
|
|
56
|
-
*/
|
|
57
|
-
stop(): Promise<void>;
|
|
58
|
-
getPeers(includePending?: boolean): PeerInfo[];
|
|
59
|
-
private handleGossipSubEvent;
|
|
60
|
-
/**
|
|
61
|
-
* Send Request via the ReqResp service
|
|
62
|
-
* The subprotocol defined will determine the request and response types
|
|
63
|
-
*
|
|
64
|
-
* See the subProtocolMap for the mapping of subprotocols to request/response types in `interface.ts`
|
|
65
|
-
*
|
|
66
|
-
* @param protocol The request response protocol to use
|
|
67
|
-
* @param request The request type to send
|
|
68
|
-
* @returns
|
|
69
|
-
*/
|
|
70
|
-
sendRequest<SubProtocol extends ReqRespSubProtocol>(protocol: SubProtocol, request: InstanceType<SubProtocolMap[SubProtocol]['request']>): Promise<InstanceType<SubProtocolMap[SubProtocol]['response']> | undefined>;
|
|
71
|
-
/**
|
|
72
|
-
* Send a batch of requests to peers, and return the responses
|
|
73
|
-
* @param protocol - The request response protocol to use
|
|
74
|
-
* @param requests - The requests to send to the peers
|
|
75
|
-
* @returns The responses to the requests
|
|
76
|
-
*/
|
|
77
|
-
sendBatchRequest<SubProtocol extends ReqRespSubProtocol>(protocol: SubProtocol, requests: InstanceType<SubProtocolMap[SubProtocol]['request']>[]): Promise<InstanceType<SubProtocolMap[SubProtocol]['response']>[] | undefined>;
|
|
78
|
-
/**
|
|
79
|
-
* Get the ENR of the node
|
|
80
|
-
* @returns The ENR of the node
|
|
81
|
-
*/
|
|
82
|
-
getEnr(): ENR | undefined;
|
|
83
|
-
registerBlockReceivedCallback(callback: (block: BlockProposal) => Promise<BlockAttestation | undefined>): void;
|
|
84
|
-
/**
|
|
85
|
-
* Subscribes to a topic.
|
|
86
|
-
* @param topic - The topic to subscribe to.
|
|
87
|
-
*/
|
|
88
|
-
private subscribeToTopic;
|
|
89
|
-
/**
|
|
90
|
-
* Publishes data to a topic.
|
|
91
|
-
* @param topic - The topic to publish to.
|
|
92
|
-
* @param data - The data to publish.
|
|
93
|
-
* @returns The number of recipients the data was sent to.
|
|
94
|
-
*/
|
|
95
|
-
private publishToTopic;
|
|
96
|
-
/**
|
|
97
|
-
* Handles a new gossip message that was received by the client.
|
|
98
|
-
* @param topic - The message's topic.
|
|
99
|
-
* @param data - The message data
|
|
100
|
-
*/
|
|
101
|
-
private handleNewGossipMessage;
|
|
102
|
-
/**Process Attestation From Peer
|
|
103
|
-
* When a proposal is received from a peer, we add it to the attestation pool, so it can be accessed by other services.
|
|
104
|
-
*
|
|
105
|
-
* @param attestation - The attestation to process.
|
|
106
|
-
*/
|
|
107
|
-
private processAttestationFromPeer;
|
|
108
|
-
/**Process block from peer
|
|
109
|
-
*
|
|
110
|
-
* Pass the received block to the validator client
|
|
111
|
-
*
|
|
112
|
-
* @param block - The block to process.
|
|
113
|
-
*/
|
|
114
|
-
private processBlockFromPeer;
|
|
115
|
-
/**
|
|
116
|
-
* Broadcast an attestation to all peers.
|
|
117
|
-
* @param attestation - The attestation to broadcast.
|
|
118
|
-
*/
|
|
119
|
-
private broadcastAttestation;
|
|
120
|
-
private processEpochProofQuoteFromPeer;
|
|
121
|
-
/**
|
|
122
|
-
* Propagates provided message to peers.
|
|
123
|
-
* @param message - The message to propagate.
|
|
124
|
-
*/
|
|
125
|
-
propagate<T extends Gossipable>(message: T): Promise<void>;
|
|
126
|
-
private processTxFromPeer;
|
|
127
|
-
/**
|
|
128
|
-
* Validate a tx that has been requested from a peer.
|
|
129
|
-
*
|
|
130
|
-
* The core component of this validator is that the tx hash MUST match the requested tx hash,
|
|
131
|
-
* In order to perform this check, the tx proof must be verified.
|
|
132
|
-
*
|
|
133
|
-
* Note: This function is called from within `ReqResp.sendRequest` as part of the
|
|
134
|
-
* ReqRespSubProtocol.TX subprotocol validation.
|
|
135
|
-
*
|
|
136
|
-
* @param requestedTxHash - The hash of the tx that was requested.
|
|
137
|
-
* @param responseTx - The tx that was received as a response to the request.
|
|
138
|
-
* @param peerId - The peer ID of the peer that sent the tx.
|
|
139
|
-
* @returns True if the tx is valid, false otherwise.
|
|
140
|
-
*/
|
|
141
|
-
private validateRequestedTx;
|
|
142
|
-
/**
|
|
143
|
-
* Validate a tx from a peer.
|
|
144
|
-
* @param propagationSource - The peer ID of the peer that sent the tx.
|
|
145
|
-
* @param msg - The tx message.
|
|
146
|
-
* @returns True if the tx is valid, false otherwise.
|
|
147
|
-
*/
|
|
148
|
-
private validatePropagatedTxFromMessage;
|
|
149
|
-
/**
|
|
150
|
-
* Validate an attestation from a peer.
|
|
151
|
-
* @param propagationSource - The peer ID of the peer that sent the attestation.
|
|
152
|
-
* @param msg - The attestation message.
|
|
153
|
-
* @returns True if the attestation is valid, false otherwise.
|
|
154
|
-
*/
|
|
155
|
-
private validatePropagatedAttestationFromMessage;
|
|
156
|
-
/**
|
|
157
|
-
* Validate a block proposal from a peer.
|
|
158
|
-
* @param propagationSource - The peer ID of the peer that sent the block.
|
|
159
|
-
* @param msg - The block proposal message.
|
|
160
|
-
* @returns True if the block proposal is valid, false otherwise.
|
|
161
|
-
*/
|
|
162
|
-
private validatePropagatedBlockFromMessage;
|
|
163
|
-
/**
|
|
164
|
-
* Validate an epoch proof quote from a peer.
|
|
165
|
-
* @param propagationSource - The peer ID of the peer that sent the epoch proof quote.
|
|
166
|
-
* @param msg - The epoch proof quote message.
|
|
167
|
-
* @returns True if the epoch proof quote is valid, false otherwise.
|
|
168
|
-
*/
|
|
169
|
-
private validatePropagatedEpochProofQuoteFromMessage;
|
|
170
|
-
private validatePropagatedTx;
|
|
171
|
-
/**
|
|
172
|
-
* Create message validators for the given block number.
|
|
173
|
-
*
|
|
174
|
-
* Each validator is a pair of a validator and a severity.
|
|
175
|
-
* If a validator fails, the peer is penalized with the severity of the validator.
|
|
176
|
-
*
|
|
177
|
-
* @param blockNumber - The block number to create validators for.
|
|
178
|
-
* @returns The message validators.
|
|
179
|
-
*/
|
|
180
|
-
private createMessageValidators;
|
|
181
|
-
/**
|
|
182
|
-
* Run validations on a tx.
|
|
183
|
-
* @param tx - The tx to validate.
|
|
184
|
-
* @param messageValidators - The message validators to run.
|
|
185
|
-
* @returns The validation outcome.
|
|
186
|
-
*/
|
|
187
|
-
private runValidations;
|
|
188
|
-
/**
|
|
189
|
-
* Handle a double spend failure.
|
|
190
|
-
*
|
|
191
|
-
* Double spend failures are managed on their own because they are a special case.
|
|
192
|
-
* We must check if the double spend is recent or old, if it is past a threshold, then we heavily penalize the peer.
|
|
193
|
-
*
|
|
194
|
-
* @param tx - The tx that failed the double spend validator.
|
|
195
|
-
* @param blockNumber - The block number of the tx.
|
|
196
|
-
* @param peerId - The peer ID of the peer that sent the tx.
|
|
197
|
-
* @returns True if the tx is valid, false otherwise.
|
|
198
|
-
*/
|
|
199
|
-
private handleDoubleSpendFailure;
|
|
200
|
-
/**
|
|
201
|
-
* Validate an attestation.
|
|
202
|
-
*
|
|
203
|
-
* @param attestation - The attestation to validate.
|
|
204
|
-
* @returns True if the attestation is valid, false otherwise.
|
|
205
|
-
*/
|
|
206
|
-
validateAttestation(peerId: PeerId, attestation: BlockAttestation): Promise<boolean>;
|
|
207
|
-
/**
|
|
208
|
-
* Validate a block proposal.
|
|
209
|
-
*
|
|
210
|
-
* @param block - The block proposal to validate.
|
|
211
|
-
* @returns True if the block proposal is valid, false otherwise.
|
|
212
|
-
*/
|
|
213
|
-
validateBlockProposal(peerId: PeerId, block: BlockProposal): Promise<boolean>;
|
|
214
|
-
/**
|
|
215
|
-
* Validate an epoch proof quote.
|
|
216
|
-
*
|
|
217
|
-
* @param epochProofQuote - The epoch proof quote to validate.
|
|
218
|
-
* @returns True if the epoch proof quote is valid, false otherwise.
|
|
219
|
-
*/
|
|
220
|
-
validateEpochProofQuote(peerId: PeerId, epochProofQuote: EpochProofQuote): Promise<boolean>;
|
|
221
|
-
getPeerScore(peerId: PeerId): number;
|
|
222
|
-
private sendToPeers;
|
|
223
|
-
private stopLibP2P;
|
|
224
|
-
}
|
|
225
|
-
//# sourceMappingURL=libp2p_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"libp2p_service.d.ts","sourceRoot":"","sources":["../../../src/services/libp2p/libp2p_service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,6BAA6B,EAClC,eAAe,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,aAAa,EAEb,KAAK,QAAQ,EAMb,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AAM,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;YAI7B,WAAW;YAWX,UAAU;CAYzB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
2
|
-
import { type GoodByeReason } from '../reqresp/protocols/index.js';
|
|
3
|
-
export declare class PeerManagerMetrics {
|
|
4
|
-
readonly telemetryClient: TelemetryClient;
|
|
5
|
-
private sentGoodbyes;
|
|
6
|
-
private receivedGoodbyes;
|
|
7
|
-
readonly tracer: Tracer;
|
|
8
|
-
constructor(telemetryClient: TelemetryClient, name?: string);
|
|
9
|
-
recordGoodbyeSent(reason: GoodByeReason): void;
|
|
10
|
-
recordGoodbyeReceived(reason: GoodByeReason): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/services/peer-manager/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,+BAA+B,CAAC;AAExF,qBAAa,kBAAkB;aAMD,eAAe,EAAE,eAAe;IAL5D,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,gBAAgB,CAAgB;IAExC,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEH,eAAe,EAAE,eAAe,EAAE,IAAI,SAAgB;IAgB3E,iBAAiB,CAAC,MAAM,EAAE,aAAa;IAIvC,qBAAqB,CAAC,MAAM,EAAE,aAAa;CAGnD"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { type PeerErrorSeverity, type PeerInfo } from '@aztec/circuit-types';
|
|
2
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
-
import { type PeerId } from '@libp2p/interface';
|
|
4
|
-
import { type P2PConfig } from '../../config.js';
|
|
5
|
-
import { type PubSubLibp2p } from '../../util.js';
|
|
6
|
-
import { GoodByeReason } from '../reqresp/protocols/goodbye.js';
|
|
7
|
-
import { type ReqResp } from '../reqresp/reqresp.js';
|
|
8
|
-
import { type PeerDiscoveryService } from '../service.js';
|
|
9
|
-
import { type PeerScoring } from './peer_scoring.js';
|
|
10
|
-
export declare class PeerManager {
|
|
11
|
-
private libP2PNode;
|
|
12
|
-
private peerDiscoveryService;
|
|
13
|
-
private config;
|
|
14
|
-
private logger;
|
|
15
|
-
private peerScoring;
|
|
16
|
-
private reqresp;
|
|
17
|
-
private cachedPeers;
|
|
18
|
-
private heartbeatCounter;
|
|
19
|
-
private displayPeerCountsPeerHeartbeat;
|
|
20
|
-
private timedOutPeers;
|
|
21
|
-
private metrics;
|
|
22
|
-
private discoveredPeerHandler;
|
|
23
|
-
constructor(libP2PNode: PubSubLibp2p, peerDiscoveryService: PeerDiscoveryService, config: P2PConfig, telemetryClient: TelemetryClient, logger: import("@aztec/foundation/log").Logger, peerScoring: PeerScoring, reqresp: ReqResp);
|
|
24
|
-
get tracer(): import("@aztec/telemetry-client").Tracer;
|
|
25
|
-
heartbeat(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Cleans up expired timeouts.
|
|
28
|
-
*
|
|
29
|
-
* When peers fail to dial after a number of retries, they are temporarily timed out.
|
|
30
|
-
* This function removes any peers that have been in the timed out state for too long.
|
|
31
|
-
* To give them a chance to reconnect.
|
|
32
|
-
*/
|
|
33
|
-
private cleanupExpiredTimeouts;
|
|
34
|
-
/**
|
|
35
|
-
* Simply logs the type of connected peer.
|
|
36
|
-
* @param e - The connected peer event.
|
|
37
|
-
*/
|
|
38
|
-
private handleConnectedPeerEvent;
|
|
39
|
-
/**
|
|
40
|
-
* Simply logs the type of disconnected peer.
|
|
41
|
-
* @param e - The disconnected peer event.
|
|
42
|
-
*/
|
|
43
|
-
private handleDisconnectedPeerEvent;
|
|
44
|
-
/**
|
|
45
|
-
* Handles a goodbye received from a peer.
|
|
46
|
-
*
|
|
47
|
-
* Used as the reqresp handler when a peer sends us goodbye message.
|
|
48
|
-
* @param peerId - The peer ID.
|
|
49
|
-
* @param reason - The reason for the goodbye.
|
|
50
|
-
*/
|
|
51
|
-
goodbyeReceived(peerId: PeerId, reason: GoodByeReason): void;
|
|
52
|
-
penalizePeer(peerId: PeerId, penalty: PeerErrorSeverity): void;
|
|
53
|
-
getPeerScore(peerId: string): number;
|
|
54
|
-
getPeers(includePending?: boolean): PeerInfo[];
|
|
55
|
-
/**
|
|
56
|
-
* Discovers peers.
|
|
57
|
-
*/
|
|
58
|
-
private discover;
|
|
59
|
-
private pruneUnhealthyPeers;
|
|
60
|
-
private goodbyeAndDisconnectPeer;
|
|
61
|
-
private disconnectPeer;
|
|
62
|
-
/**
|
|
63
|
-
* Handles a discovered peer.
|
|
64
|
-
* @param enr - The discovered peer's ENR.
|
|
65
|
-
*/
|
|
66
|
-
private handleDiscoveredPeer;
|
|
67
|
-
private dialPeer;
|
|
68
|
-
private shouldDialPeer;
|
|
69
|
-
private pruneCachedPeers;
|
|
70
|
-
/**
|
|
71
|
-
* Stops the peer manager.
|
|
72
|
-
* Removing all event listeners.
|
|
73
|
-
*/
|
|
74
|
-
stop(): Promise<void>;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=peer_manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peer_manager.d.ts","sourceRoot":"","sources":["../../../src/services/peer-manager/peer_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,KAAK,eAAe,EAAa,MAAM,yBAAyB,CAAC;AAG1E,OAAO,EAAmB,KAAK,MAAM,EAAE,MAAM,mBAA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M;IAIpC,QAAQ,CAAC,cAAc,UAAQ,GAAG,QAAQ,EAAE;IAiCnD;;OAEG;IACH,OAAO,CAAC,QAAQ;IA6DhB,OAAO,CAAC,mBAAmB;YAoBb,wBAAwB;YAcxB,cAAc;IAQ5B;;;OAGG;YACW,oBAAoB;YA8DpB,QAAQ;IA2BtB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,gBAAgB;IAiBxB;;;OAGG;IACU,IAAI;CAYlB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { PeerErrorSeverity } from '@aztec/circuit-types';
|
|
2
|
-
import { type PeerId } from '@libp2p/interface';
|
|
3
|
-
import { type P2PConfig } from '../../config.js';
|
|
4
|
-
export declare enum PeerScoreState {
|
|
5
|
-
Banned = 0,
|
|
6
|
-
Disconnect = 1,
|
|
7
|
-
Healthy = 2
|
|
8
|
-
}
|
|
9
|
-
export declare class PeerScoring {
|
|
10
|
-
private logger;
|
|
11
|
-
private scores;
|
|
12
|
-
private lastUpdateTime;
|
|
13
|
-
private decayInterval;
|
|
14
|
-
private decayFactor;
|
|
15
|
-
peerPenalties: {
|
|
16
|
-
[key in PeerErrorSeverity]: number;
|
|
17
|
-
};
|
|
18
|
-
constructor(config: P2PConfig);
|
|
19
|
-
penalizePeer(peerId: PeerId, penalty: PeerErrorSeverity): number;
|
|
20
|
-
updateScore(peerId: string, scoreDelta: number): number;
|
|
21
|
-
decayAllScores(): void;
|
|
22
|
-
getScore(peerId: string): number;
|
|
23
|
-
getScoreState(peerId: string): PeerScoreState;
|
|
24
|
-
getStats(): {
|
|
25
|
-
medianScore: number;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=peer_scoring.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peer_scoring.d.ts","sourceRoot":"","sources":["../../../src/services/peer-manager/peer_scoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQjD,oBAAY,cAAc;IACxB,MAAM,IAAA;IACN,UAAU,IAAA;IACV,OAAO,IAAA;CACR;AAMD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAoC;IAClD,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,cAAc,CAAkC;IACxD,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,WAAW,CAAO;IAC1B,aAAa,EAAE;SAAG,GAAG,IAAI,iBAAiB,GAAG,MAAM;KAAE,CAAC;gBAE1C,MAAM,EAAE,SAAS;IAYtB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;IAQ9D,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAmBvD,cAAc,IAAI,IAAI;IActB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIzB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IAYpD,QAAQ,IAAI;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE;CAGpC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type ConfigMapping } from '@aztec/foundation/config';
|
|
2
|
-
export declare const DEFAULT_INDIVIDUAL_REQUEST_TIMEOUT_MS = 2000;
|
|
3
|
-
export declare const DEFAULT_OVERALL_REQUEST_TIMEOUT_MS = 4000;
|
|
4
|
-
export declare const DEFAULT_P2P_REQRESP_CONFIG: P2PReqRespConfig;
|
|
5
|
-
export interface P2PReqRespConfig {
|
|
6
|
-
/**
|
|
7
|
-
* The overall timeout for a request response operation.
|
|
8
|
-
*/
|
|
9
|
-
overallRequestTimeoutMs: number;
|
|
10
|
-
/**
|
|
11
|
-
* The timeout for an individual request response peer interaction.
|
|
12
|
-
*/
|
|
13
|
-
individualRequestTimeoutMs: number;
|
|
14
|
-
}
|
|
15
|
-
export declare const p2pReqRespConfigMappings: Record<keyof P2PReqRespConfig, ConfigMapping>;
|
|
16
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/services/reqresp/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,0BAA0B,CAAC;AAElF,eAAO,MAAM,qCAAqC,OAAO,CAAC;AAC1D,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAGvD,eAAO,MAAM,0BAA0B,EAAE,gBAGxC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,0BAA0B,EAAE,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,gBAAgB,EAAE,aAAa,CAWlF,CAAC"}
|