@aztec/stdlib 4.0.0-nightly.20260111 → 4.0.0-nightly.20260113
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/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/l2_block.d.ts +6 -3
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -2
- package/dest/block/l2_block_new.d.ts +1 -2
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +4 -1
- package/dest/block/l2_block_source.d.ts +245 -41
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +23 -5
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +16 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +102 -30
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +483 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +13 -13
- package/dest/checkpoint/checkpoint.d.ts +1 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +1 -0
- package/dest/checkpoint/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -4
- package/dest/interfaces/aztec-node-admin.d.ts +12 -6
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +2 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +8 -3
- package/dest/interfaces/configs.d.ts +6 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/p2p.d.ts +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- package/dest/interfaces/proving-job.d.ts +166 -166
- package/dest/interfaces/validator.d.ts +41 -7
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +5 -6
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +85 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +120 -37
- package/dest/p2p/checkpoint_attestation.d.ts +77 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +154 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +217 -0
- package/dest/p2p/consensus_payload.d.ts +4 -2
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -2
- package/dest/p2p/index.d.ts +4 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +3 -1
- package/dest/p2p/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +40 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +70 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +8 -2
- package/dest/rollup/checkpoint_header.d.ts +5 -1
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +4 -0
- package/dest/tests/factories.d.ts +13 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +50 -1
- package/dest/tests/mocks.d.ts +55 -9
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +84 -35
- package/dest/tx/private_execution_result.d.ts +1 -5
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -20
- package/package.json +8 -8
- package/src/block/attestation_info.ts +9 -6
- package/src/block/l2_block.ts +3 -3
- package/src/block/l2_block_new.ts +5 -1
- package/src/block/l2_block_source.ts +66 -16
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +16 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +121 -38
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +485 -36
- package/src/block/validate_block_result.ts +35 -31
- package/src/checkpoint/checkpoint.ts +1 -0
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +14 -6
- package/src/interfaces/aztec-node-admin.ts +5 -2
- package/src/interfaces/aztec-node.ts +30 -3
- package/src/interfaces/configs.ts +5 -0
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/validator.ts +57 -7
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +5 -8
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +185 -41
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +337 -0
- package/src/p2p/consensus_payload.ts +5 -2
- package/src/p2p/index.ts +3 -1
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +83 -0
- package/src/p2p/topic_type.ts +3 -2
- package/src/rollup/checkpoint_header.ts +13 -0
- package/src/tests/factories.ts +42 -1
- package/src/tests/mocks.ts +146 -50
- package/src/tx/private_execution_result.ts +0 -15
- package/dest/p2p/block_attestation.d.ts +0 -77
- package/dest/p2p/block_attestation.d.ts.map +0 -1
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { times } from '@aztec/foundation/collection';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
type CheckpointId,
|
|
7
|
+
GENESIS_CHECKPOINT_HEADER_HASH,
|
|
8
|
+
type L2BlockId,
|
|
9
|
+
L2BlockNew,
|
|
10
|
+
type L2TipId,
|
|
11
|
+
} from '@aztec/stdlib/block';
|
|
12
|
+
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
7
13
|
|
|
8
14
|
import { jestExpect as expect } from '@jest/expect';
|
|
9
15
|
|
|
@@ -11,83 +17,526 @@ import type { L2TipsStore } from '../l2_block_stream/index.js';
|
|
|
11
17
|
|
|
12
18
|
export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
13
19
|
let tipsStore: L2TipsStore;
|
|
20
|
+
// Track blocks and their hashes for test assertions
|
|
21
|
+
const blockHashes: Map<number, string> = new Map();
|
|
22
|
+
// Track checkpoints and their hashes
|
|
23
|
+
const checkpointHashes: Map<number, string> = new Map();
|
|
24
|
+
// Track which blocks belong to which checkpoint
|
|
25
|
+
const blockToCheckpoint: Map<number, number> = new Map();
|
|
14
26
|
|
|
15
27
|
beforeEach(async () => {
|
|
16
28
|
tipsStore = await makeTipsStore();
|
|
29
|
+
blockHashes.clear();
|
|
30
|
+
checkpointHashes.clear();
|
|
31
|
+
blockToCheckpoint.clear();
|
|
17
32
|
});
|
|
18
33
|
|
|
19
|
-
const makeBlock = (number: number):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
34
|
+
const makeBlock = async (number: number): Promise<L2BlockNew> => {
|
|
35
|
+
const block = await L2BlockNew.random(BlockNumber(number));
|
|
36
|
+
blockHashes.set(number, (await block.hash()).toString());
|
|
37
|
+
return block;
|
|
38
|
+
};
|
|
25
39
|
|
|
26
40
|
const makeBlockId = (number: number): L2BlockId => ({
|
|
27
41
|
number: BlockNumber(number),
|
|
28
|
-
hash: new Fr(number).toString(),
|
|
42
|
+
hash: blockHashes.get(number) ?? new Fr(number).toString(),
|
|
29
43
|
});
|
|
30
44
|
|
|
31
45
|
const makeTip = (number: number): L2BlockId => ({
|
|
32
46
|
number: BlockNumber(number),
|
|
33
|
-
hash: number === 0 ? GENESIS_BLOCK_HEADER_HASH.toString() : new Fr(number).toString(),
|
|
47
|
+
hash: number === 0 ? GENESIS_BLOCK_HEADER_HASH.toString() : (blockHashes.get(number) ?? new Fr(number).toString()),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const makeCheckpointIdForBlock = (blockNumber: number): CheckpointId => {
|
|
51
|
+
if (blockNumber === 0) {
|
|
52
|
+
return { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() };
|
|
53
|
+
}
|
|
54
|
+
const checkpointNum = blockToCheckpoint.get(blockNumber);
|
|
55
|
+
if (checkpointNum === undefined) {
|
|
56
|
+
return { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() };
|
|
57
|
+
}
|
|
58
|
+
const hash = checkpointHashes.get(checkpointNum);
|
|
59
|
+
if (!hash) {
|
|
60
|
+
return { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() };
|
|
61
|
+
}
|
|
62
|
+
return { number: CheckpointNumber(checkpointNum), hash };
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const makeTipId = (blockNumber: number): L2TipId => ({
|
|
66
|
+
block: makeTip(blockNumber),
|
|
67
|
+
checkpoint: makeCheckpointIdForBlock(blockNumber),
|
|
34
68
|
});
|
|
35
69
|
|
|
36
|
-
const makeTips = (
|
|
37
|
-
|
|
38
|
-
proven:
|
|
39
|
-
finalized:
|
|
70
|
+
const makeTips = (proposed: number, proven: number, finalized: number, checkpointed: number = 0) => ({
|
|
71
|
+
proposed: makeTip(proposed),
|
|
72
|
+
proven: makeTipId(proven),
|
|
73
|
+
finalized: makeTipId(finalized),
|
|
74
|
+
checkpointed: makeTipId(checkpointed),
|
|
40
75
|
});
|
|
41
76
|
|
|
77
|
+
const makeCheckpoint = async (checkpointNumber: number, blocks: L2BlockNew[]): Promise<PublishedCheckpoint> => {
|
|
78
|
+
const checkpoint = await Checkpoint.random(CheckpointNumber(checkpointNumber), {
|
|
79
|
+
numBlocks: blocks.length,
|
|
80
|
+
startBlockNumber: blocks[0].number,
|
|
81
|
+
});
|
|
82
|
+
// Override the blocks with our actual blocks (to keep hashes consistent)
|
|
83
|
+
(checkpoint as any).blocks = blocks;
|
|
84
|
+
|
|
85
|
+
const checkpointHash = checkpoint.hash().toString();
|
|
86
|
+
checkpointHashes.set(checkpointNumber, checkpointHash);
|
|
87
|
+
|
|
88
|
+
// Track which blocks belong to this checkpoint
|
|
89
|
+
for (const block of blocks) {
|
|
90
|
+
blockToCheckpoint.set(block.number, checkpointNumber);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return new PublishedCheckpoint(checkpoint, L1PublishedData.random(), []);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** Creates a chain-checkpointed event with the required block field */
|
|
97
|
+
const makeCheckpointedEvent = async (checkpoint: PublishedCheckpoint) => {
|
|
98
|
+
const lastBlock = checkpoint.checkpoint.blocks.at(-1)!;
|
|
99
|
+
const blockId: L2BlockId = {
|
|
100
|
+
number: lastBlock.number,
|
|
101
|
+
hash: (await lastBlock.hash()).toString(),
|
|
102
|
+
};
|
|
103
|
+
return { type: 'chain-checkpointed' as const, checkpoint, block: blockId };
|
|
104
|
+
};
|
|
105
|
+
|
|
42
106
|
it('returns zero if no tips are stored', async () => {
|
|
43
107
|
const tips = await tipsStore.getL2Tips();
|
|
44
108
|
expect(tips).toEqual(makeTips(0, 0, 0));
|
|
45
109
|
});
|
|
46
110
|
|
|
47
|
-
it('
|
|
48
|
-
await tipsStore.handleBlockStreamEvent({
|
|
111
|
+
it('sets proposed tip from blocks added', async () => {
|
|
112
|
+
await tipsStore.handleBlockStreamEvent({
|
|
113
|
+
type: 'blocks-added',
|
|
114
|
+
blocks: await Promise.all(times(3, i => makeBlock(i + 1))),
|
|
115
|
+
});
|
|
49
116
|
|
|
50
|
-
await tipsStore.
|
|
51
|
-
|
|
52
|
-
|
|
117
|
+
const tips = await tipsStore.getL2Tips();
|
|
118
|
+
expect(tips).toEqual(makeTips(3, 0, 0));
|
|
119
|
+
|
|
120
|
+
expect(await tipsStore.getL2BlockHash(1)).toEqual(blockHashes.get(1));
|
|
121
|
+
expect(await tipsStore.getL2BlockHash(2)).toEqual(blockHashes.get(2));
|
|
122
|
+
expect(await tipsStore.getL2BlockHash(3)).toEqual(blockHashes.get(3));
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('checkpoints all proposed blocks', async () => {
|
|
126
|
+
// Propose blocks 1-5
|
|
127
|
+
const blocks = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
128
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks });
|
|
129
|
+
|
|
130
|
+
// Checkpoint all proposed blocks (1-5)
|
|
131
|
+
const checkpoint1 = await makeCheckpoint(1, blocks);
|
|
132
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
53
133
|
|
|
54
134
|
const tips = await tipsStore.getL2Tips();
|
|
55
|
-
|
|
135
|
+
// Proposed and checkpointed should be the same
|
|
136
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
137
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5));
|
|
138
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(1));
|
|
56
139
|
});
|
|
57
140
|
|
|
58
|
-
it('
|
|
59
|
-
|
|
141
|
+
it('advances proven chain with checkpoint info', async () => {
|
|
142
|
+
// Propose and checkpoint blocks 1-5
|
|
143
|
+
const blocks = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
144
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks });
|
|
145
|
+
const checkpoint1 = await makeCheckpoint(1, blocks);
|
|
146
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
147
|
+
|
|
148
|
+
// Prove up to block 5
|
|
149
|
+
await tipsStore.handleBlockStreamEvent({ type: 'chain-proven', block: makeBlockId(5) });
|
|
60
150
|
|
|
61
151
|
const tips = await tipsStore.getL2Tips();
|
|
62
|
-
expect(tips).toEqual(
|
|
152
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
153
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5));
|
|
154
|
+
expect(tips.proven.block).toEqual(makeTip(5));
|
|
155
|
+
|
|
156
|
+
// Proven tip should have the checkpoint info
|
|
157
|
+
expect(tips.proven.checkpoint.number).toEqual(CheckpointNumber(1));
|
|
158
|
+
expect(tips.proven.checkpoint.hash).toEqual(checkpointHashes.get(1));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('advances finalized chain with checkpoint info', async () => {
|
|
162
|
+
// Propose and checkpoint blocks 1-5
|
|
163
|
+
const blocks = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
164
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks });
|
|
165
|
+
const checkpoint1 = await makeCheckpoint(1, blocks);
|
|
166
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
167
|
+
|
|
168
|
+
// Prove and finalize
|
|
169
|
+
await tipsStore.handleBlockStreamEvent({ type: 'chain-proven', block: makeBlockId(5) });
|
|
170
|
+
await tipsStore.handleBlockStreamEvent({ type: 'chain-finalized', block: makeBlockId(5) });
|
|
63
171
|
|
|
64
|
-
|
|
65
|
-
expect(
|
|
66
|
-
expect(
|
|
172
|
+
const tips = await tipsStore.getL2Tips();
|
|
173
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
174
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5));
|
|
175
|
+
expect(tips.proven.block).toEqual(makeTip(5));
|
|
176
|
+
expect(tips.finalized.block).toEqual(makeTip(5));
|
|
177
|
+
|
|
178
|
+
// Finalized tip should have checkpoint info
|
|
179
|
+
expect(tips.finalized.checkpoint.number).toEqual(CheckpointNumber(1));
|
|
180
|
+
expect(tips.finalized.checkpoint.hash).toEqual(checkpointHashes.get(1));
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('handles multiple checkpoints advancing the chain', async () => {
|
|
184
|
+
// Propose blocks 1-5
|
|
185
|
+
const blocks1 = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
186
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks1 });
|
|
187
|
+
|
|
188
|
+
// Checkpoint 1: all proposed blocks 1-5
|
|
189
|
+
const checkpoint1 = await makeCheckpoint(1, blocks1);
|
|
190
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
191
|
+
|
|
192
|
+
// Propose more blocks 6-10
|
|
193
|
+
const blocks2 = await Promise.all(times(5, i => makeBlock(i + 6)));
|
|
194
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks2 });
|
|
195
|
+
|
|
196
|
+
// Checkpoint 2: all remaining proposed blocks 6-10
|
|
197
|
+
const checkpoint2 = await makeCheckpoint(2, blocks2);
|
|
198
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint2));
|
|
199
|
+
|
|
200
|
+
const tips = await tipsStore.getL2Tips();
|
|
201
|
+
expect(tips.proposed).toEqual(makeTip(10));
|
|
202
|
+
expect(tips.checkpointed.block).toEqual(makeTip(10));
|
|
203
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(2));
|
|
204
|
+
expect(tips.checkpointed.checkpoint.hash).toEqual(checkpointHashes.get(2));
|
|
67
205
|
});
|
|
68
206
|
|
|
69
207
|
it('clears block hashes when setting finalized chain', async () => {
|
|
70
|
-
|
|
208
|
+
// Propose blocks 1-3
|
|
209
|
+
const blocks1to3 = await Promise.all(times(3, i => makeBlock(i + 1)));
|
|
210
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks1to3 });
|
|
211
|
+
|
|
212
|
+
// Checkpoint all proposed blocks (1-3)
|
|
213
|
+
const checkpoint1 = await makeCheckpoint(1, blocks1to3);
|
|
214
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
215
|
+
|
|
216
|
+
// Propose more blocks 4-5
|
|
217
|
+
const blocks4to5 = await Promise.all(times(2, i => makeBlock(i + 4)));
|
|
218
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks4to5 });
|
|
219
|
+
|
|
220
|
+
// Checkpoint all remaining proposed blocks (4-5)
|
|
221
|
+
const checkpoint2 = await makeCheckpoint(2, blocks4to5);
|
|
222
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint2));
|
|
223
|
+
|
|
224
|
+
// Prove and finalize up to block 3 (checkpoint 1)
|
|
71
225
|
await tipsStore.handleBlockStreamEvent({ type: 'chain-proven', block: makeBlockId(3) });
|
|
72
226
|
await tipsStore.handleBlockStreamEvent({ type: 'chain-finalized', block: makeBlockId(3) });
|
|
73
227
|
|
|
74
|
-
|
|
75
|
-
expect(tips).toEqual(makeTips(5, 3, 3));
|
|
76
|
-
|
|
228
|
+
// Blocks before finalized should be cleared
|
|
77
229
|
expect(await tipsStore.getL2BlockHash(1)).toBeUndefined();
|
|
78
230
|
expect(await tipsStore.getL2BlockHash(2)).toBeUndefined();
|
|
79
231
|
|
|
80
|
-
|
|
81
|
-
expect(await tipsStore.getL2BlockHash(
|
|
82
|
-
expect(await tipsStore.getL2BlockHash(
|
|
232
|
+
// Finalized and later blocks should remain
|
|
233
|
+
expect(await tipsStore.getL2BlockHash(3)).toEqual(blockHashes.get(3));
|
|
234
|
+
expect(await tipsStore.getL2BlockHash(4)).toEqual(blockHashes.get(4));
|
|
235
|
+
expect(await tipsStore.getL2BlockHash(5)).toEqual(blockHashes.get(5));
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('handles chain pruning by updating proposed tip', async () => {
|
|
239
|
+
const blocks = await Promise.all(times(10, i => makeBlock(i + 1)));
|
|
240
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks });
|
|
241
|
+
|
|
242
|
+
// Prune to block 5
|
|
243
|
+
await tipsStore.handleBlockStreamEvent({
|
|
244
|
+
type: 'chain-pruned',
|
|
245
|
+
block: makeBlockId(5),
|
|
246
|
+
reason: 'unproven',
|
|
247
|
+
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const tips = await tipsStore.getL2Tips();
|
|
251
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('handles pruning proposed chain to genesis, re-proposing, and checkpointing', async () => {
|
|
255
|
+
// Propose blocks 1-3
|
|
256
|
+
const firstBlocks = await Promise.all(times(3, i => makeBlock(i + 1)));
|
|
257
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: firstBlocks });
|
|
258
|
+
|
|
259
|
+
let tips = await tipsStore.getL2Tips();
|
|
260
|
+
expect(tips.proposed).toEqual(makeTip(3));
|
|
261
|
+
|
|
262
|
+
// Store original hashes
|
|
263
|
+
const originalHash1 = blockHashes.get(1);
|
|
264
|
+
const originalHash2 = blockHashes.get(2);
|
|
265
|
+
const originalHash3 = blockHashes.get(3);
|
|
266
|
+
|
|
267
|
+
// Prune back to genesis (block 0)
|
|
268
|
+
await tipsStore.handleBlockStreamEvent({
|
|
269
|
+
type: 'chain-pruned',
|
|
270
|
+
block: makeTip(0),
|
|
271
|
+
reason: 'unproven',
|
|
272
|
+
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
tips = await tipsStore.getL2Tips();
|
|
276
|
+
expect(tips.proposed).toEqual(makeTip(0));
|
|
277
|
+
expect(tips.checkpointed.block).toEqual(makeTip(0));
|
|
278
|
+
|
|
279
|
+
// Clear hashes and propose new blocks 1-3 (different from original)
|
|
280
|
+
blockHashes.delete(1);
|
|
281
|
+
blockHashes.delete(2);
|
|
282
|
+
blockHashes.delete(3);
|
|
283
|
+
const newBlocks = await Promise.all(times(3, i => makeBlock(i + 1)));
|
|
284
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: newBlocks });
|
|
285
|
+
|
|
286
|
+
// Verify new blocks have different hashes
|
|
287
|
+
expect(blockHashes.get(1)).not.toEqual(originalHash1);
|
|
288
|
+
expect(blockHashes.get(2)).not.toEqual(originalHash2);
|
|
289
|
+
expect(blockHashes.get(3)).not.toEqual(originalHash3);
|
|
290
|
+
|
|
291
|
+
tips = await tipsStore.getL2Tips();
|
|
292
|
+
expect(tips.proposed).toEqual(makeTip(3));
|
|
293
|
+
expect(tips.checkpointed.block).toEqual(makeTip(0)); // Not yet checkpointed
|
|
294
|
+
|
|
295
|
+
// Checkpoint all the new proposed blocks (1-3)
|
|
296
|
+
const checkpoint1 = await makeCheckpoint(1, newBlocks);
|
|
297
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
298
|
+
|
|
299
|
+
tips = await tipsStore.getL2Tips();
|
|
300
|
+
expect(tips.proposed).toEqual(makeTip(3));
|
|
301
|
+
expect(tips.checkpointed.block).toEqual(makeTip(3));
|
|
302
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(1));
|
|
303
|
+
|
|
304
|
+
// Verify block hashes in store are the new ones
|
|
305
|
+
expect(await tipsStore.getL2BlockHash(1)).toEqual(blockHashes.get(1));
|
|
306
|
+
expect(await tipsStore.getL2BlockHash(2)).toEqual(blockHashes.get(2));
|
|
307
|
+
expect(await tipsStore.getL2BlockHash(3)).toEqual(blockHashes.get(3));
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('handles reorg: prune proposed blocks back to checkpoint, then re-propose with different blocks', async () => {
|
|
311
|
+
// Propose blocks 1-5
|
|
312
|
+
const firstBlocks = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
313
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: firstBlocks });
|
|
314
|
+
|
|
315
|
+
// Checkpoint all proposed blocks (1-5) - these are now committed
|
|
316
|
+
const checkpoint1 = await makeCheckpoint(1, firstBlocks);
|
|
317
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
318
|
+
|
|
319
|
+
// Propose more blocks 6-10 (not yet checkpointed, can be pruned)
|
|
320
|
+
const originalBlocks6to10 = await Promise.all(times(5, i => makeBlock(i + 6)));
|
|
321
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: originalBlocks6to10 });
|
|
322
|
+
|
|
323
|
+
let tips = await tipsStore.getL2Tips();
|
|
324
|
+
expect(tips.proposed).toEqual(makeTip(10));
|
|
325
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5)); // Only blocks 1-5 are checkpointed
|
|
326
|
+
|
|
327
|
+
// Store original hashes for proposed (non-checkpointed) blocks 6-8
|
|
328
|
+
const originalHash6 = blockHashes.get(6);
|
|
329
|
+
const originalHash7 = blockHashes.get(7);
|
|
330
|
+
const originalHash8 = blockHashes.get(8);
|
|
331
|
+
|
|
332
|
+
// Prune proposed blocks back to checkpoint (block 5)
|
|
333
|
+
// This removes proposed blocks 6-10, but checkpoint remains at 5
|
|
334
|
+
await tipsStore.handleBlockStreamEvent({
|
|
335
|
+
type: 'chain-pruned',
|
|
336
|
+
block: makeBlockId(5),
|
|
337
|
+
reason: 'unproven',
|
|
338
|
+
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
tips = await tipsStore.getL2Tips();
|
|
342
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
343
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5)); // Checkpoint unchanged
|
|
344
|
+
|
|
345
|
+
// Propose new blocks 6-8 (different from original 6-10)
|
|
346
|
+
blockHashes.delete(6);
|
|
347
|
+
blockHashes.delete(7);
|
|
348
|
+
blockHashes.delete(8);
|
|
349
|
+
const newBlocks = await Promise.all(times(3, i => makeBlock(i + 6)));
|
|
350
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: newBlocks });
|
|
351
|
+
|
|
352
|
+
// Verify the new blocks have different hashes than the original ones
|
|
353
|
+
expect(blockHashes.get(6)).not.toEqual(originalHash6);
|
|
354
|
+
expect(blockHashes.get(7)).not.toEqual(originalHash7);
|
|
355
|
+
expect(blockHashes.get(8)).not.toEqual(originalHash8);
|
|
356
|
+
|
|
357
|
+
tips = await tipsStore.getL2Tips();
|
|
358
|
+
expect(tips.proposed).toEqual(makeTip(8));
|
|
359
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5)); // Still at checkpoint 1
|
|
360
|
+
|
|
361
|
+
// Checkpoint all the new proposed blocks (6-8)
|
|
362
|
+
const checkpoint2 = await makeCheckpoint(2, newBlocks);
|
|
363
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint2));
|
|
364
|
+
|
|
365
|
+
tips = await tipsStore.getL2Tips();
|
|
366
|
+
expect(tips.proposed).toEqual(makeTip(8));
|
|
367
|
+
expect(tips.checkpointed.block).toEqual(makeTip(8));
|
|
368
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(2));
|
|
369
|
+
|
|
370
|
+
// Block hashes in the store should reflect the new blocks
|
|
371
|
+
expect(await tipsStore.getL2BlockHash(6)).toEqual(blockHashes.get(6));
|
|
372
|
+
expect(await tipsStore.getL2BlockHash(7)).toEqual(blockHashes.get(7));
|
|
373
|
+
expect(await tipsStore.getL2BlockHash(8)).toEqual(blockHashes.get(8));
|
|
374
|
+
|
|
375
|
+
// And should NOT equal the original hashes
|
|
376
|
+
expect(await tipsStore.getL2BlockHash(6)).not.toEqual(originalHash6);
|
|
377
|
+
expect(await tipsStore.getL2BlockHash(7)).not.toEqual(originalHash7);
|
|
378
|
+
expect(await tipsStore.getL2BlockHash(8)).not.toEqual(originalHash8);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('handles reorg with different chain length after prune', async () => {
|
|
382
|
+
// Propose blocks 1-3
|
|
383
|
+
const firstBlocks = await Promise.all(times(3, i => makeBlock(i + 1)));
|
|
384
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: firstBlocks });
|
|
385
|
+
|
|
386
|
+
// Checkpoint all proposed blocks (1-3) - these are now committed
|
|
387
|
+
const checkpoint1 = await makeCheckpoint(1, firstBlocks);
|
|
388
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
389
|
+
|
|
390
|
+
// Propose more blocks 4-10 (not yet checkpointed, can be pruned)
|
|
391
|
+
const originalBlocks4to10 = await Promise.all(times(7, i => makeBlock(i + 4)));
|
|
392
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: originalBlocks4to10 });
|
|
393
|
+
|
|
394
|
+
let tips = await tipsStore.getL2Tips();
|
|
395
|
+
expect(tips.proposed).toEqual(makeTip(10));
|
|
396
|
+
expect(tips.checkpointed.block).toEqual(makeTip(3)); // Only blocks 1-3 are checkpointed
|
|
397
|
+
|
|
398
|
+
// Prune proposed blocks back to checkpoint (block 3)
|
|
399
|
+
await tipsStore.handleBlockStreamEvent({
|
|
400
|
+
type: 'chain-pruned',
|
|
401
|
+
block: makeBlockId(3),
|
|
402
|
+
reason: 'unproven',
|
|
403
|
+
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
tips = await tipsStore.getL2Tips();
|
|
407
|
+
expect(tips.proposed).toEqual(makeTip(3));
|
|
408
|
+
expect(tips.checkpointed.block).toEqual(makeTip(3)); // Checkpoint unchanged
|
|
409
|
+
|
|
410
|
+
// Now propose only 2 new blocks (4-5) instead of the original 7 blocks (4-10)
|
|
411
|
+
blockHashes.delete(4);
|
|
412
|
+
blockHashes.delete(5);
|
|
413
|
+
const newBlocks = await Promise.all(times(2, i => makeBlock(i + 4)));
|
|
414
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: newBlocks });
|
|
415
|
+
|
|
416
|
+
tips = await tipsStore.getL2Tips();
|
|
417
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
418
|
+
expect(tips.checkpointed.block).toEqual(makeTip(3)); // Still at checkpoint 1
|
|
419
|
+
|
|
420
|
+
// Checkpoint all the new proposed blocks (4-5)
|
|
421
|
+
const checkpoint2 = await makeCheckpoint(2, newBlocks);
|
|
422
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint2));
|
|
423
|
+
|
|
424
|
+
tips = await tipsStore.getL2Tips();
|
|
425
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
426
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5));
|
|
427
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(2));
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
it('handles reorg: prune back to proven tip (including checkpointed blocks), then re-propose and checkpoint', async () => {
|
|
431
|
+
// Propose blocks 1-3
|
|
432
|
+
const firstBlocks = await Promise.all(times(3, i => makeBlock(i + 1)));
|
|
433
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: firstBlocks });
|
|
434
|
+
|
|
435
|
+
// Checkpoint all proposed blocks (1-3)
|
|
436
|
+
const checkpoint1 = await makeCheckpoint(1, firstBlocks);
|
|
437
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
438
|
+
|
|
439
|
+
// Prove up to block 3
|
|
440
|
+
await tipsStore.handleBlockStreamEvent({ type: 'chain-proven', block: makeBlockId(3) });
|
|
441
|
+
|
|
442
|
+
let tips = await tipsStore.getL2Tips();
|
|
443
|
+
expect(tips.proposed).toEqual(makeTip(3));
|
|
444
|
+
expect(tips.checkpointed.block).toEqual(makeTip(3));
|
|
445
|
+
expect(tips.proven.block).toEqual(makeTip(3));
|
|
446
|
+
|
|
447
|
+
// Propose more blocks 4-6
|
|
448
|
+
const blocks4to6 = await Promise.all(times(3, i => makeBlock(i + 4)));
|
|
449
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks4to6 });
|
|
450
|
+
|
|
451
|
+
// Checkpoint blocks 4-6 (now checkpointed is ahead of proven)
|
|
452
|
+
const checkpoint2 = await makeCheckpoint(2, blocks4to6);
|
|
453
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint2));
|
|
454
|
+
|
|
455
|
+
tips = await tipsStore.getL2Tips();
|
|
456
|
+
expect(tips.proposed).toEqual(makeTip(6));
|
|
457
|
+
expect(tips.checkpointed.block).toEqual(makeTip(6));
|
|
458
|
+
expect(tips.proven.block).toEqual(makeTip(3)); // Proven is behind checkpointed
|
|
459
|
+
|
|
460
|
+
// Propose even more blocks 7-10 (proposed is now ahead of checkpointed)
|
|
461
|
+
const originalBlocks7to10 = await Promise.all(times(4, i => makeBlock(i + 7)));
|
|
462
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: originalBlocks7to10 });
|
|
463
|
+
|
|
464
|
+
tips = await tipsStore.getL2Tips();
|
|
465
|
+
// Now all three tips are different: proposed=10, checkpointed=6, proven=3
|
|
466
|
+
expect(tips.proposed).toEqual(makeTip(10));
|
|
467
|
+
expect(tips.checkpointed.block).toEqual(makeTip(6));
|
|
468
|
+
expect(tips.proven.block).toEqual(makeTip(3));
|
|
469
|
+
|
|
470
|
+
// Store original hashes for blocks 4-7
|
|
471
|
+
const originalHash4 = blockHashes.get(4);
|
|
472
|
+
const originalHash5 = blockHashes.get(5);
|
|
473
|
+
const originalHash6 = blockHashes.get(6);
|
|
474
|
+
const originalHash7 = blockHashes.get(7);
|
|
475
|
+
|
|
476
|
+
// Prune all the way back to proven tip (block 3)
|
|
477
|
+
// This prunes both proposed blocks (7-10) AND checkpointed blocks (4-6)
|
|
478
|
+
await tipsStore.handleBlockStreamEvent({
|
|
479
|
+
type: 'chain-pruned',
|
|
480
|
+
block: makeBlockId(3),
|
|
481
|
+
reason: 'unproven',
|
|
482
|
+
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
tips = await tipsStore.getL2Tips();
|
|
486
|
+
expect(tips.proposed).toEqual(makeTip(3));
|
|
487
|
+
expect(tips.checkpointed.block).toEqual(makeTip(3)); // Checkpointed also pruned back
|
|
488
|
+
expect(tips.proven.block).toEqual(makeTip(3));
|
|
489
|
+
|
|
490
|
+
// Propose new blocks 4-7 (different from original)
|
|
491
|
+
blockHashes.delete(4);
|
|
492
|
+
blockHashes.delete(5);
|
|
493
|
+
blockHashes.delete(6);
|
|
494
|
+
blockHashes.delete(7);
|
|
495
|
+
const newBlocks = await Promise.all(times(4, i => makeBlock(i + 4)));
|
|
496
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: newBlocks });
|
|
497
|
+
|
|
498
|
+
// Verify the new blocks have different hashes than the original ones
|
|
499
|
+
expect(blockHashes.get(4)).not.toEqual(originalHash4);
|
|
500
|
+
expect(blockHashes.get(5)).not.toEqual(originalHash5);
|
|
501
|
+
expect(blockHashes.get(6)).not.toEqual(originalHash6);
|
|
502
|
+
expect(blockHashes.get(7)).not.toEqual(originalHash7);
|
|
503
|
+
|
|
504
|
+
tips = await tipsStore.getL2Tips();
|
|
505
|
+
expect(tips.proposed).toEqual(makeTip(7));
|
|
506
|
+
expect(tips.proven.block).toEqual(makeTip(3));
|
|
507
|
+
|
|
508
|
+
// Checkpoint all the new proposed blocks (4-7)
|
|
509
|
+
const checkpoint3 = await makeCheckpoint(3, newBlocks);
|
|
510
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint3));
|
|
511
|
+
|
|
512
|
+
tips = await tipsStore.getL2Tips();
|
|
513
|
+
expect(tips.proposed).toEqual(makeTip(7));
|
|
514
|
+
expect(tips.checkpointed.block).toEqual(makeTip(7));
|
|
515
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(3));
|
|
516
|
+
expect(tips.proven.block).toEqual(makeTip(3)); // Proven hasn't moved yet
|
|
517
|
+
|
|
518
|
+
// Block hashes in the store should reflect the new blocks
|
|
519
|
+
expect(await tipsStore.getL2BlockHash(4)).toEqual(blockHashes.get(4));
|
|
520
|
+
expect(await tipsStore.getL2BlockHash(5)).toEqual(blockHashes.get(5));
|
|
521
|
+
expect(await tipsStore.getL2BlockHash(6)).toEqual(blockHashes.get(6));
|
|
522
|
+
expect(await tipsStore.getL2BlockHash(7)).toEqual(blockHashes.get(7));
|
|
523
|
+
|
|
524
|
+
// And should NOT equal the original hashes
|
|
525
|
+
expect(await tipsStore.getL2BlockHash(4)).not.toEqual(originalHash4);
|
|
526
|
+
expect(await tipsStore.getL2BlockHash(5)).not.toEqual(originalHash5);
|
|
527
|
+
expect(await tipsStore.getL2BlockHash(6)).not.toEqual(originalHash6);
|
|
528
|
+
expect(await tipsStore.getL2BlockHash(7)).not.toEqual(originalHash7);
|
|
83
529
|
});
|
|
84
530
|
|
|
85
531
|
// Regression test for #13142
|
|
86
532
|
it('does not blow up when setting proven chain on an unseen block number', async () => {
|
|
87
|
-
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: [makeBlock(5)] });
|
|
533
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: [await makeBlock(5)] });
|
|
88
534
|
await tipsStore.handleBlockStreamEvent({ type: 'chain-proven', block: makeBlockId(3) });
|
|
89
535
|
|
|
90
536
|
const tips = await tipsStore.getL2Tips();
|
|
91
|
-
expect(tips).toEqual(
|
|
537
|
+
expect(tips.proposed).toEqual(makeTip(5));
|
|
538
|
+
expect(tips.proven.block).toEqual(makeTip(3));
|
|
539
|
+
// No checkpoint for block 3 since it wasn't checkpointed
|
|
540
|
+
expect(tips.proven.checkpoint.number).toEqual(CheckpointNumber.ZERO);
|
|
92
541
|
});
|
|
93
542
|
}
|