@aztec/p2p 0.0.1-commit.6c91f13 → 0.0.1-commit.96bb3f7
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/client/interface.d.ts +18 -5
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +10 -13
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +448 -117
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +61 -42
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +225 -262
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +21 -18
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +113 -108
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +17 -16
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +89 -128
- package/dest/mem_pools/attestation_pool/mocks.d.ts +7 -6
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +9 -8
- package/dest/mem_pools/instrumentation.d.ts +1 -1
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +4 -13
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +4 -4
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +12 -10
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +5 -5
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +7 -10
- package/dest/msg_validators/index.d.ts +2 -2
- package/dest/msg_validators/index.d.ts.map +1 -1
- package/dest/msg_validators/index.js +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/index.d.ts +4 -0
- package/dest/msg_validators/proposal_validator/index.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/index.js +3 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/{block_proposal_validator/block_proposal_validator.js → proposal_validator/proposal_validator.js} +19 -21
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +23 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +183 -0
- package/dest/msg_validators/tx_validator/data_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/services/dummy_service.d.ts +6 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +3 -0
- package/dest/services/encoding.d.ts +1 -1
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +4 -2
- package/dest/services/libp2p/instrumentation.d.ts +1 -1
- package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
- package/dest/services/libp2p/instrumentation.js +15 -68
- package/dest/services/libp2p/libp2p_service.d.ts +27 -10
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +696 -137
- package/dest/services/peer-manager/metrics.d.ts +1 -1
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +6 -26
- package/dest/services/peer-manager/peer_manager.d.ts +2 -2
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +0 -10
- package/dest/services/peer-manager/peer_scoring.d.ts +1 -1
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +2 -5
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts +1 -1
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.d.ts +1 -1
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.js +5 -21
- package/dest/services/reqresp/protocols/status.d.ts +1 -1
- package/dest/services/reqresp/protocols/status.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/status.js +2 -0
- package/dest/services/reqresp/reqresp.js +402 -24
- package/dest/services/service.d.ts +16 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +4 -14
- package/dest/services/tx_provider_instrumentation.d.ts +1 -1
- package/dest/services/tx_provider_instrumentation.d.ts.map +1 -1
- package/dest/services/tx_provider_instrumentation.js +6 -19
- package/dest/testbench/p2p_client_testbench_worker.js +25 -11
- package/dest/testbench/worker_client_manager.d.ts +1 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +6 -1
- package/package.json +14 -14
- package/src/client/interface.ts +19 -4
- package/src/client/p2p_client.ts +77 -127
- package/src/mem_pools/attestation_pool/attestation_pool.ts +68 -41
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +231 -287
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +162 -140
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +141 -164
- package/src/mem_pools/attestation_pool/mocks.ts +13 -9
- package/src/mem_pools/instrumentation.ts +9 -18
- package/src/msg_validators/attestation_validator/attestation_validator.ts +16 -13
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +9 -12
- package/src/msg_validators/index.ts +1 -1
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +10 -0
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +13 -0
- package/src/msg_validators/proposal_validator/index.ts +3 -0
- package/src/msg_validators/{block_proposal_validator/block_proposal_validator.ts → proposal_validator/proposal_validator.ts} +23 -28
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +206 -0
- package/src/msg_validators/tx_validator/data_validator.ts +12 -4
- package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
- package/src/msg_validators/tx_validator/timestamp_validator.ts +3 -1
- package/src/services/dummy_service.ts +6 -0
- package/src/services/encoding.ts +3 -1
- package/src/services/libp2p/instrumentation.ts +14 -68
- package/src/services/libp2p/libp2p_service.ts +324 -100
- package/src/services/peer-manager/metrics.ts +5 -26
- package/src/services/peer-manager/peer_manager.ts +1 -2
- package/src/services/peer-manager/peer_scoring.ts +1 -5
- package/src/services/reqresp/connection-sampler/connection_sampler.ts +3 -1
- package/src/services/reqresp/metrics.ts +7 -23
- package/src/services/reqresp/protocols/status.ts +2 -1
- package/src/services/service.ts +19 -4
- package/src/services/tx_collection/instrumentation.ts +4 -21
- package/src/services/tx_provider_instrumentation.ts +11 -24
- package/src/testbench/p2p_client_testbench_worker.ts +34 -11
- package/src/testbench/worker_client_manager.ts +6 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +0 -12
- 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/block_proposal_validator/index.js +0 -1
- package/src/msg_validators/block_proposal_validator/index.ts +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
|
+
import type { BlockProposal, P2PValidator } from '@aztec/stdlib/p2p';
|
|
3
|
+
|
|
4
|
+
import { ProposalValidator } from '../proposal_validator/proposal_validator.js';
|
|
5
|
+
|
|
6
|
+
export class BlockProposalValidator extends ProposalValidator<BlockProposal> implements P2PValidator<BlockProposal> {
|
|
7
|
+
constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }) {
|
|
8
|
+
super(epochCache, opts, 'p2p:block_proposal_validator');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
|
+
import type { CheckpointProposal, P2PValidator } from '@aztec/stdlib/p2p';
|
|
3
|
+
|
|
4
|
+
import { ProposalValidator } from '../proposal_validator/proposal_validator.js';
|
|
5
|
+
|
|
6
|
+
export class CheckpointProposalValidator
|
|
7
|
+
extends ProposalValidator<CheckpointProposal>
|
|
8
|
+
implements P2PValidator<CheckpointProposal>
|
|
9
|
+
{
|
|
10
|
+
constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }) {
|
|
11
|
+
super(epochCache, opts, 'p2p:checkpoint_proposal_validator');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,63 +1,60 @@
|
|
|
1
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
2
|
import { NoCommitteeError } from '@aztec/ethereum/contracts';
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import {
|
|
4
|
+
import { BlockProposal, CheckpointProposal, PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
5
5
|
|
|
6
|
-
export class
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export abstract class ProposalValidator<TProposal extends BlockProposal | CheckpointProposal> {
|
|
7
|
+
protected epochCache: EpochCacheInterface;
|
|
8
|
+
protected logger: Logger;
|
|
9
|
+
protected txsPermitted: boolean;
|
|
10
10
|
|
|
11
|
-
constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }) {
|
|
11
|
+
constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }, loggerName: string) {
|
|
12
12
|
this.epochCache = epochCache;
|
|
13
13
|
this.txsPermitted = opts.txsPermitted;
|
|
14
|
-
this.logger = createLogger(
|
|
14
|
+
this.logger = createLogger(loggerName);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async validate(
|
|
17
|
+
public async validate(proposal: TProposal): Promise<PeerErrorSeverity | undefined> {
|
|
18
18
|
try {
|
|
19
|
-
//
|
|
20
|
-
const proposer =
|
|
19
|
+
// Signature validity
|
|
20
|
+
const proposer = proposal.getSender();
|
|
21
21
|
if (!proposer) {
|
|
22
|
-
this.logger.debug(`Penalizing peer for
|
|
22
|
+
this.logger.debug(`Penalizing peer for proposal with invalid signature`);
|
|
23
23
|
return PeerErrorSeverity.MidToleranceError;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
const embeddedTxCount =
|
|
28
|
-
if (!this.txsPermitted && (
|
|
26
|
+
// Transactions permitted check
|
|
27
|
+
const embeddedTxCount = proposal.txs?.length ?? 0;
|
|
28
|
+
if (!this.txsPermitted && (proposal.txHashes.length > 0 || embeddedTxCount > 0)) {
|
|
29
29
|
this.logger.debug(
|
|
30
|
-
`Penalizing peer for
|
|
30
|
+
`Penalizing peer for proposal with ${proposal.txHashes.length} transaction(s) when transactions are not permitted`,
|
|
31
31
|
);
|
|
32
32
|
return PeerErrorSeverity.MidToleranceError;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
//
|
|
36
|
-
const hashSet = new Set(
|
|
35
|
+
// Embedded txs must be listed in txHashes
|
|
36
|
+
const hashSet = new Set(proposal.txHashes.map(h => h.toString()));
|
|
37
37
|
const missingTxHashes =
|
|
38
38
|
embeddedTxCount > 0
|
|
39
|
-
?
|
|
39
|
+
? proposal.txs!.filter(tx => !hashSet.has(tx.getTxHash().toString())).map(tx => tx.getTxHash().toString())
|
|
40
40
|
: [];
|
|
41
41
|
if (embeddedTxCount > 0 && missingTxHashes.length > 0) {
|
|
42
42
|
this.logger.warn('Penalizing peer for embedded transaction(s) not included in txHashes', {
|
|
43
43
|
embeddedTxCount,
|
|
44
|
-
txHashesLength:
|
|
44
|
+
txHashesLength: proposal.txHashes.length,
|
|
45
45
|
missingTxHashes,
|
|
46
46
|
});
|
|
47
47
|
return PeerErrorSeverity.MidToleranceError;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// Slot and proposer checks
|
|
50
51
|
const { currentProposer, nextProposer, currentSlot, nextSlot } =
|
|
51
52
|
await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
|
|
52
|
-
|
|
53
|
-
// Check that the attestation is for the current or next slot
|
|
54
|
-
const slotNumber = block.payload.header.slotNumber;
|
|
53
|
+
const slotNumber = proposal.slotNumber;
|
|
55
54
|
if (slotNumber !== currentSlot && slotNumber !== nextSlot) {
|
|
56
55
|
this.logger.debug(`Penalizing peer for invalid slot number ${slotNumber}`, { currentSlot, nextSlot });
|
|
57
56
|
return PeerErrorSeverity.HighToleranceError;
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
// Check that the block proposal is from the current or next proposer
|
|
61
58
|
if (slotNumber === currentSlot && currentProposer !== undefined && !proposer.equals(currentProposer)) {
|
|
62
59
|
this.logger.debug(`Penalizing peer for invalid proposer for current slot ${slotNumber}`, {
|
|
63
60
|
currentProposer,
|
|
@@ -66,7 +63,6 @@ export class BlockProposalValidator implements P2PValidator<BlockProposal> {
|
|
|
66
63
|
});
|
|
67
64
|
return PeerErrorSeverity.MidToleranceError;
|
|
68
65
|
}
|
|
69
|
-
|
|
70
66
|
if (slotNumber === nextSlot && nextProposer !== undefined && !proposer.equals(nextProposer)) {
|
|
71
67
|
this.logger.debug(`Penalizing peer for invalid proposer for next slot ${slotNumber}`, {
|
|
72
68
|
currentProposer,
|
|
@@ -77,8 +73,8 @@ export class BlockProposalValidator implements P2PValidator<BlockProposal> {
|
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
// Validate tx hashes for all txs embedded in the proposal
|
|
80
|
-
if (!(await Promise.all(
|
|
81
|
-
this.logger.warn(`Penalizing peer for invalid tx hashes in
|
|
76
|
+
if (!(await Promise.all(proposal.txs?.map(tx => tx.validateTxHash()) ?? [])).every(v => v)) {
|
|
77
|
+
this.logger.warn(`Penalizing peer for invalid tx hashes in proposal`, {
|
|
82
78
|
proposer,
|
|
83
79
|
slotNumber,
|
|
84
80
|
});
|
|
@@ -87,7 +83,6 @@ export class BlockProposalValidator implements P2PValidator<BlockProposal> {
|
|
|
87
83
|
|
|
88
84
|
return undefined;
|
|
89
85
|
} catch (e) {
|
|
90
|
-
// People shouldn't be sending us block proposals if the committee doesn't exist
|
|
91
86
|
if (e instanceof NoCommitteeError) {
|
|
92
87
|
return PeerErrorSeverity.LowToleranceError;
|
|
93
88
|
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
|
+
import type { Secp256k1Signer } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import { type BlockProposal, type CheckpointProposal, PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
5
|
+
import type { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
+
|
|
7
|
+
import type { MockProxy } from 'jest-mock-extended';
|
|
8
|
+
|
|
9
|
+
export interface ProposalValidatorTestParams<TProposal extends BlockProposal | CheckpointProposal> {
|
|
10
|
+
validatorFactory: (
|
|
11
|
+
epochCache: EpochCacheInterface,
|
|
12
|
+
opts: { txsPermitted: boolean },
|
|
13
|
+
) => { validate: (proposal: TProposal) => Promise<PeerErrorSeverity | undefined> };
|
|
14
|
+
makeProposal: (options?: any) => Promise<TProposal>;
|
|
15
|
+
makeHeader: (epochNumber: number | bigint, slotNumber: number | bigint, blockNumber: number | bigint) => any;
|
|
16
|
+
getSigner: () => Secp256k1Signer;
|
|
17
|
+
getAddress: (signer?: Secp256k1Signer) => EthAddress;
|
|
18
|
+
getSlot: (slot: number | bigint) => any;
|
|
19
|
+
getTxHashes: (n: number) => TxHash[];
|
|
20
|
+
getTxs: () => any[];
|
|
21
|
+
epochCacheMock: () => MockProxy<EpochCacheInterface>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function sharedProposalValidatorTests<TProposal extends BlockProposal | CheckpointProposal>(
|
|
25
|
+
params: ProposalValidatorTestParams<TProposal>,
|
|
26
|
+
) {
|
|
27
|
+
const { validatorFactory, makeProposal, makeHeader, getSigner, getAddress, getSlot, getTxHashes, epochCacheMock } =
|
|
28
|
+
params;
|
|
29
|
+
|
|
30
|
+
describe('shared proposal validation logic', () => {
|
|
31
|
+
let epochCache: MockProxy<EpochCacheInterface>;
|
|
32
|
+
let validator: { validate: (proposal: TProposal) => Promise<PeerErrorSeverity | undefined> };
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
epochCache = epochCacheMock();
|
|
36
|
+
validator = validatorFactory(epochCache, { txsPermitted: true });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('returns high tolerance error if slot number is not current or next slot', async () => {
|
|
40
|
+
const header = makeHeader(1, 97, 97);
|
|
41
|
+
const mockProposal = await makeProposal({ blockHeader: header, lastBlockHeader: header });
|
|
42
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
43
|
+
currentSlot: getSlot(98),
|
|
44
|
+
nextSlot: getSlot(99),
|
|
45
|
+
currentProposer: getAddress(),
|
|
46
|
+
nextProposer: getAddress(),
|
|
47
|
+
});
|
|
48
|
+
const result = await validator.validate(mockProposal);
|
|
49
|
+
expect(result).toBe(PeerErrorSeverity.HighToleranceError);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('returns mid tolerance error if proposer is not current proposer for current slot', async () => {
|
|
53
|
+
const currentProposer = getSigner();
|
|
54
|
+
const nextProposer = getSigner();
|
|
55
|
+
const invalidProposer = getSigner();
|
|
56
|
+
const header = makeHeader(1, 100, 100);
|
|
57
|
+
const mockProposal = await makeProposal({
|
|
58
|
+
blockHeader: header,
|
|
59
|
+
lastBlockHeader: header,
|
|
60
|
+
signer: invalidProposer,
|
|
61
|
+
});
|
|
62
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
63
|
+
currentSlot: getSlot(100),
|
|
64
|
+
nextSlot: getSlot(101),
|
|
65
|
+
currentProposer: getAddress(currentProposer),
|
|
66
|
+
nextProposer: getAddress(nextProposer),
|
|
67
|
+
});
|
|
68
|
+
const result = await validator.validate(mockProposal);
|
|
69
|
+
expect(result).toBe(PeerErrorSeverity.MidToleranceError);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('returns mid tolerance error if proposer is not next proposer for next slot', async () => {
|
|
73
|
+
const currentProposer = getSigner();
|
|
74
|
+
const nextProposer = getSigner();
|
|
75
|
+
const invalidProposer = getSigner();
|
|
76
|
+
const header = makeHeader(1, 101, 101);
|
|
77
|
+
const mockProposal = await makeProposal({
|
|
78
|
+
blockHeader: header,
|
|
79
|
+
lastBlockHeader: header,
|
|
80
|
+
signer: invalidProposer,
|
|
81
|
+
});
|
|
82
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
83
|
+
currentSlot: getSlot(100),
|
|
84
|
+
nextSlot: getSlot(101),
|
|
85
|
+
currentProposer: getAddress(currentProposer),
|
|
86
|
+
nextProposer: getAddress(nextProposer),
|
|
87
|
+
});
|
|
88
|
+
const result = await validator.validate(mockProposal);
|
|
89
|
+
expect(result).toBe(PeerErrorSeverity.MidToleranceError);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('returns mid tolerance error if proposer is current proposer but proposal is for next slot', async () => {
|
|
93
|
+
const currentProposer = getSigner();
|
|
94
|
+
const nextProposer = getSigner();
|
|
95
|
+
const header = makeHeader(1, 101, 101);
|
|
96
|
+
const mockProposal = await makeProposal({
|
|
97
|
+
blockHeader: header,
|
|
98
|
+
lastBlockHeader: header,
|
|
99
|
+
signer: currentProposer,
|
|
100
|
+
});
|
|
101
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
102
|
+
currentSlot: getSlot(100),
|
|
103
|
+
nextSlot: getSlot(101),
|
|
104
|
+
currentProposer: getAddress(currentProposer),
|
|
105
|
+
nextProposer: getAddress(nextProposer),
|
|
106
|
+
});
|
|
107
|
+
const result = await validator.validate(mockProposal);
|
|
108
|
+
expect(result).toBe(PeerErrorSeverity.MidToleranceError);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('returns undefined if proposal is valid for current slot and proposer', async () => {
|
|
112
|
+
const currentProposer = getSigner();
|
|
113
|
+
const nextProposer = getSigner();
|
|
114
|
+
const header = makeHeader(1, 100, 100);
|
|
115
|
+
const mockProposal = await makeProposal({
|
|
116
|
+
blockHeader: header,
|
|
117
|
+
lastBlockHeader: header,
|
|
118
|
+
signer: currentProposer,
|
|
119
|
+
});
|
|
120
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
121
|
+
currentSlot: getSlot(100),
|
|
122
|
+
nextSlot: getSlot(101),
|
|
123
|
+
currentProposer: getAddress(currentProposer),
|
|
124
|
+
nextProposer: getAddress(nextProposer),
|
|
125
|
+
});
|
|
126
|
+
const result = await validator.validate(mockProposal);
|
|
127
|
+
expect(result).toBeUndefined();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('returns undefined if proposal is valid for next slot and proposer', async () => {
|
|
131
|
+
const currentProposer = getSigner();
|
|
132
|
+
const nextProposer = getSigner();
|
|
133
|
+
const header = makeHeader(1, 101, 101);
|
|
134
|
+
const mockProposal = await makeProposal({ blockHeader: header, lastBlockHeader: header, signer: nextProposer });
|
|
135
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
136
|
+
currentSlot: getSlot(100),
|
|
137
|
+
nextSlot: getSlot(101),
|
|
138
|
+
currentProposer: getAddress(currentProposer),
|
|
139
|
+
nextProposer: getAddress(nextProposer),
|
|
140
|
+
});
|
|
141
|
+
const result = await validator.validate(mockProposal);
|
|
142
|
+
expect(result).toBeUndefined();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('transaction permission validation', () => {
|
|
146
|
+
it('returns mid tolerance error if txs not permitted and proposal contains txHashes', async () => {
|
|
147
|
+
const currentProposer = getSigner();
|
|
148
|
+
const validatorWithTxsDisabled = validatorFactory(epochCache, { txsPermitted: false });
|
|
149
|
+
const header = makeHeader(1, 100, 100);
|
|
150
|
+
const mockProposal = await makeProposal({
|
|
151
|
+
blockHeader: header,
|
|
152
|
+
lastBlockHeader: header,
|
|
153
|
+
signer: currentProposer,
|
|
154
|
+
txHashes: getTxHashes(2),
|
|
155
|
+
});
|
|
156
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
157
|
+
currentSlot: getSlot(100),
|
|
158
|
+
nextSlot: getSlot(101),
|
|
159
|
+
currentProposer: getAddress(currentProposer),
|
|
160
|
+
nextProposer: getAddress(),
|
|
161
|
+
});
|
|
162
|
+
const result = await validatorWithTxsDisabled.validate(mockProposal);
|
|
163
|
+
expect(result).toBe(PeerErrorSeverity.MidToleranceError);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('returns undefined if txs not permitted but proposal has no txHashes', async () => {
|
|
167
|
+
const currentProposer = getSigner();
|
|
168
|
+
const validatorWithTxsDisabled = validatorFactory(epochCache, { txsPermitted: false });
|
|
169
|
+
const header = makeHeader(1, 100, 100);
|
|
170
|
+
const mockProposal = await makeProposal({
|
|
171
|
+
blockHeader: header,
|
|
172
|
+
lastBlockHeader: header,
|
|
173
|
+
signer: currentProposer,
|
|
174
|
+
txHashes: getTxHashes(0),
|
|
175
|
+
});
|
|
176
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
177
|
+
currentSlot: getSlot(100),
|
|
178
|
+
nextSlot: getSlot(101),
|
|
179
|
+
currentProposer: getAddress(currentProposer),
|
|
180
|
+
nextProposer: getAddress(),
|
|
181
|
+
});
|
|
182
|
+
const result = await validatorWithTxsDisabled.validate(mockProposal);
|
|
183
|
+
expect(result).toBeUndefined();
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('returns undefined if txs permitted and proposal contains txHashes', async () => {
|
|
187
|
+
const currentProposer = getSigner();
|
|
188
|
+
const header = makeHeader(1, 100, 100);
|
|
189
|
+
const mockProposal = await makeProposal({
|
|
190
|
+
blockHeader: header,
|
|
191
|
+
lastBlockHeader: header,
|
|
192
|
+
signer: currentProposer,
|
|
193
|
+
txHashes: getTxHashes(2),
|
|
194
|
+
});
|
|
195
|
+
epochCache.getProposerAttesterAddressInCurrentOrNextSlot.mockResolvedValue({
|
|
196
|
+
currentSlot: getSlot(100),
|
|
197
|
+
nextSlot: getSlot(101),
|
|
198
|
+
currentProposer: getAddress(currentProposer),
|
|
199
|
+
nextProposer: getAddress(),
|
|
200
|
+
});
|
|
201
|
+
const result = await validator.validate(mockProposal);
|
|
202
|
+
expect(result).toBeUndefined();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
@@ -31,7 +31,9 @@ export class DataTxValidator implements TxValidator<Tx> {
|
|
|
31
31
|
if (!tx.getTxHash().equals(expected)) {
|
|
32
32
|
const reason = TX_ERROR_INCORRECT_HASH;
|
|
33
33
|
this.#log.verbose(
|
|
34
|
-
`Rejecting tx ${tx.getTxHash().toString()}. Reason: ${reason}. Expected hash ${expected.toString()}. Got ${tx
|
|
34
|
+
`Rejecting tx ${tx.getTxHash().toString()}. Reason: ${reason}. Expected hash ${expected.toString()}. Got ${tx
|
|
35
|
+
.getTxHash()
|
|
36
|
+
.toString()}.`,
|
|
35
37
|
);
|
|
36
38
|
return reason;
|
|
37
39
|
}
|
|
@@ -52,7 +54,9 @@ export class DataTxValidator implements TxValidator<Tx> {
|
|
|
52
54
|
if (tx.getTotalPublicCalldataCount() > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
|
|
53
55
|
const reason = TX_ERROR_CALLDATA_COUNT_TOO_LARGE;
|
|
54
56
|
this.#log.verbose(
|
|
55
|
-
`Rejecting tx ${tx
|
|
57
|
+
`Rejecting tx ${tx
|
|
58
|
+
.getTxHash()
|
|
59
|
+
.toString()}. Reason: ${reason}. Expected no greater than ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS} fields. Got ${tx.getTotalPublicCalldataCount()}.`,
|
|
56
60
|
);
|
|
57
61
|
return reason;
|
|
58
62
|
}
|
|
@@ -89,7 +93,9 @@ export class DataTxValidator implements TxValidator<Tx> {
|
|
|
89
93
|
if (expectedHashes.some(h => logHash.value.equals(h))) {
|
|
90
94
|
const matchingLogIndex = expectedHashes.findIndex(l => logHash.value.equals(l));
|
|
91
95
|
this.#log.verbose(
|
|
92
|
-
`Rejecting tx ${tx
|
|
96
|
+
`Rejecting tx ${tx
|
|
97
|
+
.getTxHash()
|
|
98
|
+
.toString()} because of mismatched contract class logs indices. Expected ${i} from the kernel's log hashes. Got ${matchingLogIndex} in the tx.`,
|
|
93
99
|
);
|
|
94
100
|
return TX_ERROR_CONTRACT_CLASS_LOG_SORTING;
|
|
95
101
|
} else {
|
|
@@ -105,7 +111,9 @@ export class DataTxValidator implements TxValidator<Tx> {
|
|
|
105
111
|
const expectedMinLength = 1 + tx.contractClassLogFields[i].fields.findLastIndex(f => !f.isZero());
|
|
106
112
|
if (logHash.logHash.length < expectedMinLength) {
|
|
107
113
|
this.#log.verbose(
|
|
108
|
-
`Rejecting tx ${tx
|
|
114
|
+
`Rejecting tx ${tx
|
|
115
|
+
.getTxHash()
|
|
116
|
+
.toString()} because of incorrect contract class log length. Expected the length to be at least ${expectedMinLength}. Got ${
|
|
109
117
|
logHash.logHash.length
|
|
110
118
|
}.`,
|
|
111
119
|
);
|
|
@@ -43,7 +43,9 @@ export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
43
43
|
// This gets implicitly tested in the proof validator, but we can get a much cheaper check here by looking early at the vk.
|
|
44
44
|
if (!tx.data.constants.vkTreeRoot.equals(this.values.vkTreeRoot)) {
|
|
45
45
|
this.#log.verbose(
|
|
46
|
-
`Rejecting tx ${
|
|
46
|
+
`Rejecting tx ${
|
|
47
|
+
'txHash' in tx ? tx.txHash : tx.hash
|
|
48
|
+
} because of incorrect vk tree root ${tx.data.constants.vkTreeRoot.toString()} != ${this.values.vkTreeRoot.toString()}`,
|
|
47
49
|
);
|
|
48
50
|
return false;
|
|
49
51
|
} else {
|
|
@@ -54,7 +56,9 @@ export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
54
56
|
#hasCorrectprotocolContractsHash(tx: T): boolean {
|
|
55
57
|
if (!tx.data.constants.protocolContractsHash.equals(this.values.protocolContractsHash)) {
|
|
56
58
|
this.#log.verbose(
|
|
57
|
-
`Rejecting tx ${
|
|
59
|
+
`Rejecting tx ${
|
|
60
|
+
'txHash' in tx ? tx.txHash : tx.hash
|
|
61
|
+
} because of incorrect protocol contracts hash ${tx.data.constants.protocolContractsHash.toString()} != ${this.values.protocolContractsHash.toString()}`,
|
|
58
62
|
);
|
|
59
63
|
return false;
|
|
60
64
|
}
|
|
@@ -64,7 +68,9 @@ export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
64
68
|
#hasCorrectL1ChainId(tx: T): boolean {
|
|
65
69
|
if (!tx.data.constants.txContext.chainId.equals(this.values.l1ChainId)) {
|
|
66
70
|
this.#log.verbose(
|
|
67
|
-
`Rejecting tx ${
|
|
71
|
+
`Rejecting tx ${
|
|
72
|
+
'txHash' in tx ? tx.txHash : tx.hash
|
|
73
|
+
} because of incorrect L1 chain ${tx.data.constants.txContext.chainId.toNumber()} != ${this.values.l1ChainId.toNumber()}`,
|
|
68
74
|
);
|
|
69
75
|
return false;
|
|
70
76
|
} else {
|
|
@@ -75,7 +81,9 @@ export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
75
81
|
#hasCorrectRollupVersion(tx: T): boolean {
|
|
76
82
|
if (!tx.data.constants.txContext.version.equals(this.values.rollupVersion)) {
|
|
77
83
|
this.#log.verbose(
|
|
78
|
-
`Rejecting tx ${
|
|
84
|
+
`Rejecting tx ${
|
|
85
|
+
'txHash' in tx ? tx.txHash : tx.hash
|
|
86
|
+
} because of incorrect rollup version ${tx.data.constants.txContext.version.toNumber()} != ${this.values.rollupVersion.toNumber()}`,
|
|
79
87
|
);
|
|
80
88
|
return false;
|
|
81
89
|
} else {
|
|
@@ -35,7 +35,9 @@ export class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
this.#log.verbose(
|
|
38
|
-
`Rejecting tx ${getTxHash(
|
|
38
|
+
`Rejecting tx ${getTxHash(
|
|
39
|
+
tx,
|
|
40
|
+
)} for low expiration timestamp. Tx expiration timestamp: ${includeByTimestamp}, timestamp: ${
|
|
39
41
|
this.values.timestamp
|
|
40
42
|
}.`,
|
|
41
43
|
);
|
|
@@ -23,6 +23,7 @@ import type { GoodByeReason } from './reqresp/protocols/goodbye.js';
|
|
|
23
23
|
import { ReqRespStatus } from './reqresp/status.js';
|
|
24
24
|
import {
|
|
25
25
|
type P2PBlockReceivedCallback,
|
|
26
|
+
type P2PCheckpointReceivedCallback,
|
|
26
27
|
type P2PService,
|
|
27
28
|
type PeerDiscoveryService,
|
|
28
29
|
PeerDiscoveryState,
|
|
@@ -74,6 +75,11 @@ export class DummyP2PService implements P2PService {
|
|
|
74
75
|
*/
|
|
75
76
|
public registerBlockReceivedCallback(_callback: P2PBlockReceivedCallback) {}
|
|
76
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Register a callback into the validator client for when a checkpoint proposal is received
|
|
80
|
+
*/
|
|
81
|
+
public registerCheckpointReceivedCallback(_callback: P2PCheckpointReceivedCallback) {}
|
|
82
|
+
|
|
77
83
|
/**
|
|
78
84
|
* Sends a request to a peer.
|
|
79
85
|
* @param _protocol - The protocol to send the request on.
|
package/src/services/encoding.ts
CHANGED
|
@@ -55,10 +55,12 @@ const DefaultMaxSizesKb: Record<TopicType, number> = {
|
|
|
55
55
|
// Tx effects should not exceed 128kb, so 512kb for the full tx obj should be sufficient
|
|
56
56
|
[TopicType.tx]: 512,
|
|
57
57
|
// An attestation has roughly 30 fields, which is 1kb, so 5x is plenty
|
|
58
|
-
[TopicType.
|
|
58
|
+
[TopicType.checkpoint_attestation]: 5,
|
|
59
59
|
// Proposals may carry some tx objects, so we allow a larger size capped at 10mb
|
|
60
60
|
// Note this may not be enough for carrying all tx objects in a block
|
|
61
61
|
[TopicType.block_proposal]: 1024 * 10,
|
|
62
|
+
// TODO(palla/mbps): Check size for checkpoint proposal
|
|
63
|
+
[TopicType.checkpoint_proposal]: 1024 * 10,
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
/**
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
type ObservableGauge,
|
|
9
9
|
type TelemetryClient,
|
|
10
10
|
type UpDownCounter,
|
|
11
|
-
ValueType,
|
|
12
11
|
} from '@aztec/telemetry-client';
|
|
13
12
|
|
|
14
13
|
import { type RecordableHistogram, createHistogram } from 'node:perf_hooks';
|
|
@@ -28,81 +27,28 @@ export class P2PInstrumentation {
|
|
|
28
27
|
constructor(client: TelemetryClient, name: string) {
|
|
29
28
|
const meter = client.getMeter(name);
|
|
30
29
|
|
|
31
|
-
this.messageValidationDuration = meter.createHistogram(Metrics.P2P_GOSSIP_MESSAGE_VALIDATION_DURATION
|
|
32
|
-
unit: 'ms',
|
|
33
|
-
description: 'How long validating a gossiped message takes',
|
|
34
|
-
valueType: ValueType.INT,
|
|
35
|
-
});
|
|
30
|
+
this.messageValidationDuration = meter.createHistogram(Metrics.P2P_GOSSIP_MESSAGE_VALIDATION_DURATION);
|
|
36
31
|
|
|
37
|
-
this.messagePrevalidationCount = meter.createUpDownCounter(Metrics.P2P_GOSSIP_MESSAGE_PREVALIDATION_COUNT
|
|
38
|
-
description: 'How many message pass/fail prevalidation',
|
|
39
|
-
valueType: ValueType.INT,
|
|
40
|
-
});
|
|
32
|
+
this.messagePrevalidationCount = meter.createUpDownCounter(Metrics.P2P_GOSSIP_MESSAGE_PREVALIDATION_COUNT);
|
|
41
33
|
|
|
42
|
-
this.messageLatency = meter.createHistogram(Metrics.P2P_GOSSIP_MESSAGE_LATENCY
|
|
43
|
-
unit: 'ms',
|
|
44
|
-
description: 'P2P message latency',
|
|
45
|
-
valueType: ValueType.INT,
|
|
46
|
-
});
|
|
34
|
+
this.messageLatency = meter.createHistogram(Metrics.P2P_GOSSIP_MESSAGE_LATENCY);
|
|
47
35
|
|
|
48
|
-
this.txReceivedCount = meter.createUpDownCounter(Metrics.P2P_GOSSIP_TX_RECEIVED_COUNT
|
|
49
|
-
description: 'The number of txs received from the p2p network',
|
|
50
|
-
});
|
|
36
|
+
this.txReceivedCount = meter.createUpDownCounter(Metrics.P2P_GOSSIP_TX_RECEIVED_COUNT);
|
|
51
37
|
|
|
52
38
|
this.aggLatencyMetrics = {
|
|
53
|
-
avg: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_AVG,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
max: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_MAX, {
|
|
59
|
-
valueType: ValueType.DOUBLE,
|
|
60
|
-
description: 'MAX msg latency',
|
|
61
|
-
unit: 'ms',
|
|
62
|
-
}),
|
|
63
|
-
min: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_MIN, {
|
|
64
|
-
valueType: ValueType.DOUBLE,
|
|
65
|
-
description: 'MIN msg latency',
|
|
66
|
-
unit: 'ms',
|
|
67
|
-
}),
|
|
68
|
-
p50: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_P50, {
|
|
69
|
-
valueType: ValueType.DOUBLE,
|
|
70
|
-
description: 'P50 msg latency',
|
|
71
|
-
unit: 'ms',
|
|
72
|
-
}),
|
|
73
|
-
p90: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_P90, {
|
|
74
|
-
valueType: ValueType.DOUBLE,
|
|
75
|
-
description: 'P90 msg latency',
|
|
76
|
-
unit: 'ms',
|
|
77
|
-
}),
|
|
39
|
+
avg: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_AVG),
|
|
40
|
+
max: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_MAX),
|
|
41
|
+
min: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_MIN),
|
|
42
|
+
p50: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_P50),
|
|
43
|
+
p90: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_LATENCY_P90),
|
|
78
44
|
};
|
|
79
45
|
|
|
80
46
|
this.aggValidationMetrics = {
|
|
81
|
-
avg: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_AVG,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
max: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_MAX, {
|
|
87
|
-
valueType: ValueType.DOUBLE,
|
|
88
|
-
description: 'MAX msg validation',
|
|
89
|
-
unit: 'ms',
|
|
90
|
-
}),
|
|
91
|
-
min: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_MIN, {
|
|
92
|
-
valueType: ValueType.DOUBLE,
|
|
93
|
-
description: 'MIN msg validation',
|
|
94
|
-
unit: 'ms',
|
|
95
|
-
}),
|
|
96
|
-
p50: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_P50, {
|
|
97
|
-
valueType: ValueType.DOUBLE,
|
|
98
|
-
description: 'P50 msg validation',
|
|
99
|
-
unit: 'ms',
|
|
100
|
-
}),
|
|
101
|
-
p90: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_P90, {
|
|
102
|
-
valueType: ValueType.DOUBLE,
|
|
103
|
-
description: 'P90 msg validation',
|
|
104
|
-
unit: 'ms',
|
|
105
|
-
}),
|
|
47
|
+
avg: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_AVG),
|
|
48
|
+
max: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_MAX),
|
|
49
|
+
min: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_MIN),
|
|
50
|
+
p50: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_P50),
|
|
51
|
+
p90: meter.createObservableGauge(Metrics.P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_P90),
|
|
106
52
|
};
|
|
107
53
|
|
|
108
54
|
meter.addBatchObservableCallback(this.aggregate, [
|