@aztec/stdlib 5.0.0-rc.1 → 5.0.0-rc.2
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/abi/buffer.d.ts +6 -2
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +13 -1
- package/dest/avm/avm.js +1 -1
- package/dest/aztec-address/index.d.ts +35 -5
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +32 -8
- package/dest/block/l2_block_source.d.ts +11 -25
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +0 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +25 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +29 -7
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +165 -152
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +10 -2
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +33 -15
- 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 +94 -3
- 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/checkpoint/simulation_overrides.d.ts +61 -0
- package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
- package/dest/checkpoint/simulation_overrides.js +98 -0
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/file-store/factory.d.ts +1 -1
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +7 -0
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/file-store/index.js +1 -0
- package/dest/file-store/memory.d.ts +24 -0
- package/dest/file-store/memory.d.ts.map +1 -0
- package/dest/file-store/memory.js +80 -0
- package/dest/interfaces/archiver.js +1 -1
- package/dest/interfaces/aztec-node-debug.d.ts +26 -1
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-debug.js +20 -0
- package/dest/interfaces/aztec-node.d.ts +20 -20
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +8 -15
- package/dest/interfaces/chain_tips.d.ts +8 -47
- package/dest/interfaces/chain_tips.d.ts.map +1 -1
- package/dest/interfaces/chain_tips.js +1 -6
- package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
- package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
- package/dest/interfaces/checkpoint_parameter.js +3 -3
- package/dest/interfaces/prover-node.d.ts +6 -7
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +15 -10
- package/dest/kernel/hints/read_request.js +1 -1
- package/dest/kernel/log_hash.d.ts +1 -1
- package/dest/kernel/log_hash.d.ts.map +1 -1
- package/dest/kernel/log_hash.js +2 -2
- package/dest/kernel/note_hash.js +1 -1
- package/dest/kernel/nullifier.js +1 -1
- package/dest/kernel/private_log_data.d.ts +1 -1
- package/dest/kernel/private_log_data.d.ts.map +1 -1
- package/dest/kernel/private_log_data.js +1 -1
- package/dest/logs/app_tagging_secret.d.ts +21 -6
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +32 -22
- package/dest/logs/contract_class_log.d.ts +1 -2
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +0 -4
- package/dest/logs/message_context.d.ts +5 -15
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +1 -66
- package/dest/logs/pending_tagged_log.d.ts +6 -8
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +1 -31
- package/dest/p2p/checkpoint_attestation.d.ts +2 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +2 -1
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.d.ts +2 -1
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.d.ts +8 -3
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +20 -10
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +3 -12
- package/dest/trees/nullifier_membership_witness.d.ts +5 -8
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.js +0 -9
- package/dest/trees/public_data_witness.d.ts +7 -17
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +0 -27
- package/dest/tx/execution_payload.d.ts +1 -1
- package/dest/tx/execution_payload.d.ts.map +1 -1
- package/dest/tx/execution_payload.js +1 -1
- package/dest/tx/global_variable_builder.d.ts +2 -12
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.js +2 -2
- package/package.json +8 -8
- package/src/abi/buffer.ts +13 -1
- package/src/avm/avm.ts +1 -1
- package/src/aztec-address/index.ts +36 -6
- package/src/block/l2_block_source.ts +10 -15
- package/src/block/l2_block_stream/interfaces.ts +25 -5
- package/src/block/l2_block_stream/l2_block_stream.ts +222 -172
- package/src/block/l2_block_stream/l2_tips_store_base.ts +36 -15
- package/src/block/test/l2_tips_store_test_suite.ts +73 -4
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/simulation_overrides.ts +171 -0
- package/src/contract/interfaces/contract_data_source.ts +2 -4
- package/src/file-store/factory.ts +7 -0
- package/src/file-store/index.ts +1 -0
- package/src/file-store/memory.ts +94 -0
- package/src/interfaces/archiver.ts +1 -1
- package/src/interfaces/aztec-node-debug.ts +37 -0
- package/src/interfaces/aztec-node.ts +30 -33
- package/src/interfaces/chain_tips.ts +8 -16
- package/src/interfaces/checkpoint_parameter.ts +3 -3
- package/src/interfaces/prover-node.ts +19 -11
- package/src/kernel/hints/read_request.ts +1 -1
- package/src/kernel/log_hash.ts +5 -2
- package/src/kernel/note_hash.ts +1 -1
- package/src/kernel/nullifier.ts +1 -1
- package/src/kernel/private_log_data.ts +4 -1
- package/src/logs/app_tagging_secret.ts +39 -23
- package/src/logs/contract_class_log.ts +0 -9
- package/src/logs/message_context.ts +7 -65
- package/src/logs/pending_tagged_log.ts +6 -33
- package/src/rollup/checkpoint_header.ts +16 -2
- package/src/tests/factories.ts +3 -6
- package/src/trees/nullifier_membership_witness.ts +0 -11
- package/src/trees/public_data_witness.ts +0 -31
- package/src/tx/execution_payload.ts +2 -1
- package/src/tx/global_variable_builder.ts +1 -17
- package/src/tx/global_variables.ts +2 -2
|
@@ -94,14 +94,18 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
94
94
|
return new PublishedCheckpoint(checkpoint, L1PublishedData.random(), []);
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
/** Creates a chain-checkpointed event
|
|
98
|
-
const makeCheckpointedEvent = async (
|
|
99
|
-
const lastBlock =
|
|
97
|
+
/** Creates a thin chain-checkpointed event carrying the block + checkpoint ids of the checkpoint's last block. */
|
|
98
|
+
const makeCheckpointedEvent = async (published: PublishedCheckpoint) => {
|
|
99
|
+
const lastBlock = published.checkpoint.blocks.at(-1)!;
|
|
100
100
|
const blockId: L2BlockId = {
|
|
101
101
|
number: lastBlock.number,
|
|
102
102
|
hash: (await lastBlock.hash()).toString(),
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
const checkpointId = {
|
|
105
|
+
number: published.checkpoint.number,
|
|
106
|
+
hash: published.checkpoint.hash().toString(),
|
|
107
|
+
};
|
|
108
|
+
return { type: 'chain-checkpointed' as const, checkpoint: checkpointId, block: blockId };
|
|
105
109
|
};
|
|
106
110
|
|
|
107
111
|
it('returns zero if no tips are stored', async () => {
|
|
@@ -123,6 +127,71 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
123
127
|
expect(await tipsStore.getL2BlockHash(3)).toEqual(blockHashes.get(3));
|
|
124
128
|
});
|
|
125
129
|
|
|
130
|
+
it('records the proposed tip number and hash from a chain-proposed event', async () => {
|
|
131
|
+
// chain-proposed is the sole writer of proposed-tip history in tips-only mode: no preceding blocks-added.
|
|
132
|
+
await tipsStore.handleBlockStreamEvent({
|
|
133
|
+
type: 'chain-proposed',
|
|
134
|
+
block: { number: BlockNumber(5), hash: new Fr(500).toString() },
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const tips = await tipsStore.getL2Tips();
|
|
138
|
+
expect(tips.proposed).toEqual({ number: BlockNumber(5), hash: new Fr(500).toString() });
|
|
139
|
+
// The hash is recorded in the same index the walk-back reads, so it resolves as a sparse anchor.
|
|
140
|
+
expect(await tipsStore.getL2BlockHash(5)).toEqual(new Fr(500).toString());
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('serves sparse proposed anchors from chain-proposed events for the walk-back', async () => {
|
|
144
|
+
// Two tip-moving polls in tips-only mode, with no blocks in between (sparse history).
|
|
145
|
+
await tipsStore.handleBlockStreamEvent({
|
|
146
|
+
type: 'chain-proposed',
|
|
147
|
+
block: { number: BlockNumber(4), hash: new Fr(400).toString() },
|
|
148
|
+
});
|
|
149
|
+
await tipsStore.handleBlockStreamEvent({
|
|
150
|
+
type: 'chain-proposed',
|
|
151
|
+
block: { number: BlockNumber(9), hash: new Fr(900).toString() },
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Both recorded heights resolve; the heights between them were never seen and stay undefined.
|
|
155
|
+
expect(await tipsStore.getL2BlockHash(4)).toEqual(new Fr(400).toString());
|
|
156
|
+
expect(await tipsStore.getL2BlockHash(9)).toEqual(new Fr(900).toString());
|
|
157
|
+
expect(await tipsStore.getL2BlockHash(6)).toBeUndefined();
|
|
158
|
+
|
|
159
|
+
const tips = await tipsStore.getL2Tips();
|
|
160
|
+
expect(tips.proposed).toEqual({ number: BlockNumber(9), hash: new Fr(900).toString() });
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('records block-hash witnesses without moving any tip cursor', async () => {
|
|
164
|
+
// Establish a proposed tip at 9 in tips-only fashion (sole writer of proposed history).
|
|
165
|
+
await tipsStore.handleBlockStreamEvent({
|
|
166
|
+
type: 'chain-proposed',
|
|
167
|
+
block: { number: BlockNumber(9), hash: new Fr(900).toString() },
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Record sparse witnesses at heights below the tip (e.g. a consumer materializing per-height state).
|
|
171
|
+
await tipsStore.recordBlockHashes([
|
|
172
|
+
{ number: BlockNumber(4), hash: new Fr(404).toString() },
|
|
173
|
+
{ number: BlockNumber(6), hash: new Fr(606).toString() },
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
// Each recorded height resolves; an unrecorded gap stays undefined.
|
|
177
|
+
expect(await tipsStore.getL2BlockHash(4)).toEqual(new Fr(404).toString());
|
|
178
|
+
expect(await tipsStore.getL2BlockHash(6)).toEqual(new Fr(606).toString());
|
|
179
|
+
expect(await tipsStore.getL2BlockHash(5)).toBeUndefined();
|
|
180
|
+
|
|
181
|
+
// No tip cursor moved: the proposed tip is still 9, and every other tier is at genesis.
|
|
182
|
+
const tips = await tipsStore.getL2Tips();
|
|
183
|
+
expect(tips.proposed).toEqual({ number: BlockNumber(9), hash: new Fr(900).toString() });
|
|
184
|
+
expect(tips.checkpointed.block).toEqual(makeTip(0));
|
|
185
|
+
expect(tips.proven.block).toEqual(makeTip(0));
|
|
186
|
+
expect(tips.finalized.block).toEqual(makeTip(0));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('skips witnesses with no hash and tolerates an empty list', async () => {
|
|
190
|
+
await tipsStore.recordBlockHashes([]);
|
|
191
|
+
await tipsStore.recordBlockHashes([{ number: BlockNumber(3), hash: '' }]);
|
|
192
|
+
expect(await tipsStore.getL2BlockHash(3)).toBeUndefined();
|
|
193
|
+
});
|
|
194
|
+
|
|
126
195
|
it('checkpoints all proposed blocks', async () => {
|
|
127
196
|
// Propose blocks 1-5
|
|
128
197
|
const blocks = await Promise.all(times(5, i => makeBlock(i + 1)));
|
package/src/checkpoint/index.ts
CHANGED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type FeeHeader,
|
|
3
|
+
RollupContract,
|
|
4
|
+
SimulationOverridesBuilder,
|
|
5
|
+
type SimulationOverridesPlan,
|
|
6
|
+
} from '@aztec/ethereum/contracts';
|
|
7
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
8
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
9
|
+
|
|
10
|
+
import type { CoordinationSignatureContext } from '../p2p/signature_utils.js';
|
|
11
|
+
import type { ProposedCheckpointData } from './checkpoint_data.js';
|
|
12
|
+
import { computeCheckpointPayloadDigest } from './digest.js';
|
|
13
|
+
|
|
14
|
+
type CheckpointSimulationOverridesPlanInput = {
|
|
15
|
+
/** Target rollup contract. */
|
|
16
|
+
rollup: RollupContract;
|
|
17
|
+
/** Checkpoint number to be proposed. */
|
|
18
|
+
checkpointNumber: CheckpointNumber;
|
|
19
|
+
/** Logger instance. */
|
|
20
|
+
log: Logger;
|
|
21
|
+
/**
|
|
22
|
+
* The proposed parent checkpoint when pipelining. Its `checkpointNumber` must equal
|
|
23
|
+
* `checkpointNumber - 1`; the helper enforces this. Mutually exclusive with
|
|
24
|
+
* `invalidateToPendingCheckpointNumber`.
|
|
25
|
+
*/
|
|
26
|
+
proposedCheckpointData?: ProposedCheckpointData;
|
|
27
|
+
/**
|
|
28
|
+
* The pending checkpoint number we'll end up at after invalidation lands. Mutually exclusive
|
|
29
|
+
* with `proposedCheckpointData`.
|
|
30
|
+
*/
|
|
31
|
+
invalidateToPendingCheckpointNumber?: CheckpointNumber;
|
|
32
|
+
/**
|
|
33
|
+
* The real on-chain pending checkpoint number (typically `syncedTo.checkpointedCheckpointNumber`).
|
|
34
|
+
* Used as the snapshot we pin both `pending` and `proven` to avoid prunes in simulation.
|
|
35
|
+
*/
|
|
36
|
+
checkpointedCheckpointNumber: CheckpointNumber;
|
|
37
|
+
/**
|
|
38
|
+
* Chain-level consensus signature context. Used to recompute the parent's `payloadDigest` for the
|
|
39
|
+
* pipelined simulation override so it matches what `propose` will write into `tempCheckpointLogs[parent]`
|
|
40
|
+
* once the parent lands.
|
|
41
|
+
*/
|
|
42
|
+
signatureContext: CoordinationSignatureContext;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Builds the SimulationOverridesPlan describing the simulated L1 rollup state for a checkpoint's
|
|
47
|
+
* enqueue-time simulations: `canProposeAt` (in Sequencer.doWork) and the propose-related sims
|
|
48
|
+
* (validateBlockHeader, simulateProposeTx). The plan reflects "as if our pipelined parent
|
|
49
|
+
* checkpoint has landed and any required invalidation has executed" — the gap that needs to be
|
|
50
|
+
* bridged at enqueue time.
|
|
51
|
+
*
|
|
52
|
+
* Pipelining (`proposedCheckpointData`) and invalidation (`invalidateToPendingCheckpointNumber`)
|
|
53
|
+
* are mutually exclusive; passing both throws.
|
|
54
|
+
*/
|
|
55
|
+
export async function buildCheckpointSimulationOverridesPlan(
|
|
56
|
+
input: CheckpointSimulationOverridesPlanInput,
|
|
57
|
+
): Promise<SimulationOverridesPlan | undefined> {
|
|
58
|
+
if (input.proposedCheckpointData && input.invalidateToPendingCheckpointNumber !== undefined) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
'Error in buildCheckpointSimulationOverridesPlan: proposedCheckpointData and invalidateToPendingCheckpointNumber are mutually exclusive',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const builder = new SimulationOverridesBuilder();
|
|
65
|
+
const pendingCheckpointNumber = derivePendingCheckpointNumber(input);
|
|
66
|
+
|
|
67
|
+
// Override the latest checkpoint number when invalidating or pipelining, so our checkpoint
|
|
68
|
+
// follows from it. We also override the proven chain tip so we dont need to worry about
|
|
69
|
+
// prunes kicking in that would break out simulation if there's a prune pending. We always
|
|
70
|
+
// assume that a proof will land in time. If we don't have a pending checkpoint number to force,
|
|
71
|
+
// we still set both tips to the current checkpoint number to avoid the prune trigger.
|
|
72
|
+
const overridenChainTip = pendingCheckpointNumber ?? input.checkpointedCheckpointNumber;
|
|
73
|
+
builder.withChainTips({ pending: overridenChainTip, proven: overridenChainTip });
|
|
74
|
+
|
|
75
|
+
if (input.proposedCheckpointData) {
|
|
76
|
+
const { header, archive, checkpointOutHash, feeAssetPriceModifier } = input.proposedCheckpointData;
|
|
77
|
+
builder.withPendingArchive(archive.root);
|
|
78
|
+
// Override every locally-derivable `tempCheckpointLogs[parent]` field that L1 will eventually
|
|
79
|
+
// write. `slotNumber` is load-bearing for `STFLib.canPruneAtTime`: without it the cell reads
|
|
80
|
+
// slotNumber 0, the contract treats the pending tip as belonging to an expired epoch, and
|
|
81
|
+
// `getEffectivePendingCheckpointNumber` silently collapses pending back to proven — producing
|
|
82
|
+
// a spurious `Rollup__InvalidArchive` against the on-chain genesis archive. The other fields
|
|
83
|
+
// (headerHash, outHash, payloadDigest) are not strictly load-bearing for `canProposeAt` /
|
|
84
|
+
// `validateBlockHeader`, but mirroring the full cell keeps the simulation byte-faithful with
|
|
85
|
+
// what the actual `propose()` send will observe, which is a defense against future reads
|
|
86
|
+
// taking dependencies on them.
|
|
87
|
+
builder.withPendingTempCheckpointLogFields({
|
|
88
|
+
headerHash: header.hash(),
|
|
89
|
+
outHash: checkpointOutHash,
|
|
90
|
+
slotNumber: header.slotNumber,
|
|
91
|
+
payloadDigest: computeCheckpointPayloadDigest({
|
|
92
|
+
header,
|
|
93
|
+
archiveRoot: archive.root,
|
|
94
|
+
feeAssetPriceModifier,
|
|
95
|
+
signatureContext: input.signatureContext,
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const feeHeader = await computePipelinedParentFeeHeader({
|
|
100
|
+
checkpointNumber: input.checkpointNumber,
|
|
101
|
+
proposedCheckpointData: input.proposedCheckpointData,
|
|
102
|
+
rollup: input.rollup,
|
|
103
|
+
log: input.log,
|
|
104
|
+
});
|
|
105
|
+
if (feeHeader) {
|
|
106
|
+
builder.withPendingFeeHeader(feeHeader);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return builder.build();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function derivePendingCheckpointNumber(input: CheckpointSimulationOverridesPlanInput): CheckpointNumber | undefined {
|
|
114
|
+
if (input.invalidateToPendingCheckpointNumber !== undefined) {
|
|
115
|
+
return input.invalidateToPendingCheckpointNumber;
|
|
116
|
+
}
|
|
117
|
+
if (!input.proposedCheckpointData) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
if (input.checkpointNumber < 1) {
|
|
121
|
+
throw new Error(`Cannot build simulation override for checkpoint ${input.checkpointNumber}: no parent exists`);
|
|
122
|
+
}
|
|
123
|
+
const expectedParent = CheckpointNumber(input.checkpointNumber - 1);
|
|
124
|
+
if (input.proposedCheckpointData.checkpointNumber !== expectedParent) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
`Cannot build simulation override for checkpoint ${input.checkpointNumber}: proposedCheckpointData.checkpointNumber (${input.proposedCheckpointData.checkpointNumber}) does not match expected parent ${expectedParent}`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return expectedParent;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
type PipelinedParentFeeHeaderInput = {
|
|
133
|
+
checkpointNumber: CheckpointNumber;
|
|
134
|
+
proposedCheckpointData: ProposedCheckpointData;
|
|
135
|
+
rollup: RollupContract;
|
|
136
|
+
log: Logger;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Derives the pending parent fee header used during pipelined proposal simulation. Returns
|
|
141
|
+
* `undefined` only when no grandparent exists (i.e. the proposed parent is the genesis
|
|
142
|
+
* checkpoint); all other failure modes (missing grandparent state, missing fee header, RPC
|
|
143
|
+
* errors) throw so callers don't silently desync the fee-header override.
|
|
144
|
+
*/
|
|
145
|
+
export async function computePipelinedParentFeeHeader(
|
|
146
|
+
input: PipelinedParentFeeHeaderInput,
|
|
147
|
+
): Promise<FeeHeader | undefined> {
|
|
148
|
+
if (input.checkpointNumber < 2) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const grandparentCheckpointNumber = CheckpointNumber(input.checkpointNumber - 2);
|
|
153
|
+
|
|
154
|
+
const [grandparentCheckpoint, manaTarget] = await Promise.all([
|
|
155
|
+
input.rollup.getCheckpoint(grandparentCheckpointNumber),
|
|
156
|
+
input.rollup.getManaTarget(),
|
|
157
|
+
]);
|
|
158
|
+
|
|
159
|
+
if (!grandparentCheckpoint?.feeHeader) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Grandparent checkpoint or feeHeader missing for checkpoint ${grandparentCheckpointNumber.toString()}`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return RollupContract.computeChildFeeHeader(
|
|
166
|
+
grandparentCheckpoint.feeHeader,
|
|
167
|
+
input.proposedCheckpointData.totalManaUsed,
|
|
168
|
+
input.proposedCheckpointData.feeAssetPriceModifier,
|
|
169
|
+
manaTarget,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
@@ -25,11 +25,9 @@ export interface ContractDataSource {
|
|
|
25
25
|
/**
|
|
26
26
|
* Returns a publicly deployed contract instance given its address.
|
|
27
27
|
* @param address - Address of the deployed contract.
|
|
28
|
-
* @param timestamp - Timestamp at which to
|
|
29
|
-
* be used.
|
|
30
|
-
* TODO(#15170): Fix the implementations ignoring the timestamp param and make timestamp required.
|
|
28
|
+
* @param timestamp - Timestamp at which to resolve the contract instance's current class id.
|
|
31
29
|
*/
|
|
32
|
-
getContract(address: AztecAddress, timestamp
|
|
30
|
+
getContract(address: AztecAddress, timestamp: UInt64): Promise<ContractInstanceWithAddress | undefined>;
|
|
33
31
|
|
|
34
32
|
/**
|
|
35
33
|
* Returns the list of all class ids known.
|
|
@@ -4,6 +4,7 @@ import { GoogleCloudFileStore } from './gcs.js';
|
|
|
4
4
|
import { HttpFileStore, type HttpFileStoreOptions } from './http.js';
|
|
5
5
|
import type { FileStore, ReadOnlyFileStore } from './interface.js';
|
|
6
6
|
import { LocalFileStore } from './local.js';
|
|
7
|
+
import { InMemoryFileStore } from './memory.js';
|
|
7
8
|
import { S3FileStore } from './s3.js';
|
|
8
9
|
|
|
9
10
|
const supportedExamples = [
|
|
@@ -21,6 +22,12 @@ export async function createFileStore(
|
|
|
21
22
|
): Promise<FileStore | undefined> {
|
|
22
23
|
if (config === undefined) {
|
|
23
24
|
return undefined;
|
|
25
|
+
} else if (config.startsWith('mem://')) {
|
|
26
|
+
// In-memory store for tests (see InMemoryFileStore). The namespace is everything after the
|
|
27
|
+
// scheme, so `mem://X` and a later `mem://X` share data, like two file:// stores over one dir.
|
|
28
|
+
const namespace = config.slice('mem://'.length).replace(/\/+$/, '');
|
|
29
|
+
logger.info(`Creating in-memory file store at ${namespace}`);
|
|
30
|
+
return new InMemoryFileStore(namespace);
|
|
24
31
|
} else if (config.startsWith('file://')) {
|
|
25
32
|
const url = new URL(config);
|
|
26
33
|
if (url.host) {
|
package/src/file-store/index.ts
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { writeFile } from 'fs/promises';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { gunzip as gunzipCb, gzip as gzipCb } from 'zlib';
|
|
4
|
+
|
|
5
|
+
import type { FileStore, FileStoreSaveOptions } from './interface.js';
|
|
6
|
+
|
|
7
|
+
const gzip = promisify(gzipCb);
|
|
8
|
+
const gunzip = promisify(gunzipCb);
|
|
9
|
+
|
|
10
|
+
// Backing data is shared per namespace so that a store created for writing and a (read-only) store
|
|
11
|
+
// created later from the same `mem://` URL observe the same files — mirroring how two `file://`
|
|
12
|
+
// stores over the same directory share state on disk. Without this, `FileStoreTxSource`, which
|
|
13
|
+
// builds its own store from the URL, would never see what a test wrote through a different instance.
|
|
14
|
+
const namespaces = new Map<string, Map<string, Buffer>>();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* In-memory {@link FileStore}, addressed via `mem://<namespace>/...`. Reads and writes are synchronous
|
|
18
|
+
* map operations with no disk I/O, so it is deterministic — useful for tests that exercise consumers
|
|
19
|
+
* of a file store (e.g. the tx file store) rather than the on-disk store itself, where a real
|
|
20
|
+
* filesystem can introduce timing flakes.
|
|
21
|
+
*/
|
|
22
|
+
export class InMemoryFileStore implements FileStore {
|
|
23
|
+
private readonly files: Map<string, Buffer>;
|
|
24
|
+
|
|
25
|
+
constructor(private readonly namespace: string) {
|
|
26
|
+
let files = namespaces.get(namespace);
|
|
27
|
+
if (!files) {
|
|
28
|
+
files = new Map();
|
|
29
|
+
namespaces.set(namespace, files);
|
|
30
|
+
}
|
|
31
|
+
this.files = files;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Clears all in-memory file store data, or a single namespace. Intended for test isolation. */
|
|
35
|
+
static clear(namespace?: string): void {
|
|
36
|
+
if (namespace === undefined) {
|
|
37
|
+
namespaces.clear();
|
|
38
|
+
} else {
|
|
39
|
+
namespaces.delete(namespace);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public async save(path: string, data: Buffer, opts?: FileStoreSaveOptions): Promise<string> {
|
|
44
|
+
const toStore = opts?.compress ? await gzip(data) : data;
|
|
45
|
+
const key = this.key(path);
|
|
46
|
+
this.files.set(key, Buffer.from(toStore));
|
|
47
|
+
return `mem://${this.namespace}/${key}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async upload(destPath: string, srcPath: string, opts?: FileStoreSaveOptions): Promise<string> {
|
|
51
|
+
const { readFile } = await import('fs/promises');
|
|
52
|
+
return this.save(destPath, await readFile(srcPath), opts);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public async read(pathOrUrl: string): Promise<Buffer> {
|
|
56
|
+
const data = this.files.get(this.key(pathOrUrl));
|
|
57
|
+
if (data === undefined) {
|
|
58
|
+
throw new Error(`File not found in memory store: ${pathOrUrl}`);
|
|
59
|
+
}
|
|
60
|
+
// Match LocalFileStore: transparently gunzip content that was stored compressed.
|
|
61
|
+
if (data.length >= 2 && data[0] === 0x1f && data[1] === 0x8b) {
|
|
62
|
+
return await gunzip(data);
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public async download(pathOrUrl: string, destPath: string): Promise<void> {
|
|
68
|
+
await writeFile(destPath, await this.read(pathOrUrl));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public exists(pathOrUrl: string): Promise<boolean> {
|
|
72
|
+
return Promise.resolve(this.files.has(this.key(pathOrUrl)));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Lists stored file keys, optionally restricted to those under `prefix`. Not part of {@link FileStore}. */
|
|
76
|
+
public listFiles(prefix = ''): string[] {
|
|
77
|
+
const keys = [...this.files.keys()];
|
|
78
|
+
const normalizedPrefix = prefix.replace(/^\/+/, '');
|
|
79
|
+
return normalizedPrefix ? keys.filter(k => k.startsWith(normalizedPrefix)) : keys;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Resolves a relative path or a `mem://` URI (as returned by `save`) to the registry key. */
|
|
83
|
+
private key(pathOrUrl: string): string {
|
|
84
|
+
const ownPrefix = `mem://${this.namespace}/`;
|
|
85
|
+
if (pathOrUrl.startsWith(ownPrefix)) {
|
|
86
|
+
return pathOrUrl.slice(ownPrefix.length);
|
|
87
|
+
}
|
|
88
|
+
if (pathOrUrl.startsWith('mem://')) {
|
|
89
|
+
// A mem:// URI for some namespace: drop the scheme and the leading namespace segment.
|
|
90
|
+
return pathOrUrl.slice('mem://'.length).replace(/^[^/]*\//, '');
|
|
91
|
+
}
|
|
92
|
+
return pathOrUrl.replace(/^\/+/, '');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -122,7 +122,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
122
122
|
getContractClass: z.function({ input: z.tuple([schemas.Fr]), output: ContractClassPublicSchema.optional() }),
|
|
123
123
|
getBytecodeCommitment: z.function({ input: z.tuple([schemas.Fr]), output: schemas.Fr }),
|
|
124
124
|
getContract: z.function({
|
|
125
|
-
input: z.tuple([schemas.AztecAddress,
|
|
125
|
+
input: z.tuple([schemas.AztecAddress, schemas.BigInt]),
|
|
126
126
|
output: ContractInstanceWithAddressSchema.optional(),
|
|
127
127
|
}),
|
|
128
128
|
getContractClassIds: z.function({ input: z.tuple([]), output: z.array(schemas.Fr) }),
|
|
@@ -6,6 +6,9 @@ import { z } from 'zod';
|
|
|
6
6
|
import { type ApiSchemaFor, optional } from '../schemas/schemas.js';
|
|
7
7
|
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
8
8
|
|
|
9
|
+
const MAX_SIGNATURES_PER_REGISTER_CALL = 100;
|
|
10
|
+
const MAX_SIGNATURE_LEN = 10000;
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
13
|
* Debug interface for Aztec node available in sandbox/local-network mode.
|
|
11
14
|
*/
|
|
@@ -33,11 +36,45 @@ export interface AztecNodeDebug {
|
|
|
33
36
|
* @throws If no automine sequencer is running (only the automine sequencer supports synthetic proving).
|
|
34
37
|
*/
|
|
35
38
|
prove(upToCheckpoint?: CheckpointNumber): Promise<CheckpointNumber>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Warps L1 time forward to at least `targetTimestamp` and builds an empty L2 checkpoint at the next slot boundary,
|
|
42
|
+
* advancing the L2 timestamp to at least the target. The warp is serialized with block building, so it never
|
|
43
|
+
* interleaves with an in-flight build. A no-op when `targetTimestamp` is already at or behind the current L1 time.
|
|
44
|
+
*
|
|
45
|
+
* @param targetTimestamp - Target L1 timestamp, in seconds.
|
|
46
|
+
* @throws If no automine sequencer is running (only the automine sequencer supports time warps).
|
|
47
|
+
*/
|
|
48
|
+
warpL2TimeAtLeastTo(targetTimestamp: number): Promise<void>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Warps L1 time forward by at least `duration` seconds from the current L1 time and builds an empty L2 checkpoint
|
|
52
|
+
* at the next slot boundary. The warp is serialized with block building, so it never interleaves with an in-flight
|
|
53
|
+
* build.
|
|
54
|
+
*
|
|
55
|
+
* @param duration - Number of seconds to advance; must be positive.
|
|
56
|
+
* @throws If no automine sequencer is running, or if `duration` is not positive.
|
|
57
|
+
*/
|
|
58
|
+
warpL2TimeAtLeastBy(duration: number): Promise<void>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Registers public function signatures so the node can resolve selectors to names in public-execution stack
|
|
62
|
+
* traces. The mapping lives only in unpersisted node memory, is not gossiped, and is exposed here (rather than on
|
|
63
|
+
* the main node API) because it is a debug-only, unauthenticated write that should not be reachable on prod nodes.
|
|
64
|
+
* @param functionSignatures - Decoded `name(paramTypes)` signatures to register by selector.
|
|
65
|
+
*/
|
|
66
|
+
registerContractFunctionSignatures(functionSignatures: string[]): Promise<void>;
|
|
36
67
|
}
|
|
37
68
|
|
|
38
69
|
export const AztecNodeDebugApiSchema: ApiSchemaFor<AztecNodeDebug> = {
|
|
39
70
|
mineBlock: z.function({ input: z.tuple([]), output: z.void() }),
|
|
40
71
|
prove: z.function({ input: z.tuple([optional(CheckpointNumberSchema)]), output: CheckpointNumberSchema }),
|
|
72
|
+
warpL2TimeAtLeastTo: z.function({ input: z.tuple([z.number()]), output: z.void() }),
|
|
73
|
+
warpL2TimeAtLeastBy: z.function({ input: z.tuple([z.number()]), output: z.void() }),
|
|
74
|
+
registerContractFunctionSignatures: z.function({
|
|
75
|
+
input: z.tuple([z.array(z.string().max(MAX_SIGNATURE_LEN)).max(MAX_SIGNATURES_PER_REGISTER_CALL)]),
|
|
76
|
+
output: z.void(),
|
|
77
|
+
}),
|
|
41
78
|
};
|
|
42
79
|
|
|
43
80
|
export function createAztecNodeDebugClient(
|
|
@@ -23,9 +23,15 @@ import { z } from 'zod';
|
|
|
23
23
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
24
24
|
import { type BlockData, BlockDataSchema } from '../block/block_data.js';
|
|
25
25
|
import { BlockHash } from '../block/block_hash.js';
|
|
26
|
-
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
26
|
+
import { type BlockParameter, BlockParameterSchema, BlockTagWithoutLatestSchema } from '../block/block_parameter.js';
|
|
27
27
|
import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
type CheckpointsQuery,
|
|
30
|
+
CheckpointsQuerySchema,
|
|
31
|
+
type L2BlockTag,
|
|
32
|
+
type L2Tips,
|
|
33
|
+
L2TipsSchema,
|
|
34
|
+
} from '../block/l2_block_source.js';
|
|
29
35
|
import { type CheckpointData, CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
|
|
30
36
|
import {
|
|
31
37
|
type ContractClassPublic,
|
|
@@ -80,7 +86,7 @@ import {
|
|
|
80
86
|
type BlocksIncludeOptions,
|
|
81
87
|
BlocksIncludeOptionsSchema,
|
|
82
88
|
} from './block_response.js';
|
|
83
|
-
import { type
|
|
89
|
+
import { type CheckpointTag, CheckpointTagSchema } from './chain_tips.js';
|
|
84
90
|
import { type CheckpointParameter, CheckpointParameterSchema } from './checkpoint_parameter.js';
|
|
85
91
|
import {
|
|
86
92
|
type CheckpointIncludeOptions,
|
|
@@ -232,23 +238,20 @@ export interface AztecNode {
|
|
|
232
238
|
): Promise<L2ToL1MembershipWitness | undefined>;
|
|
233
239
|
|
|
234
240
|
/**
|
|
235
|
-
* Returns the block number at a given
|
|
241
|
+
* Returns the block number at a given block tag, or the latest proposed block number when
|
|
236
242
|
* `tip` is omitted.
|
|
237
243
|
*/
|
|
238
|
-
getBlockNumber(tip?:
|
|
244
|
+
getBlockNumber(tip?: L2BlockTag): Promise<BlockNumber>;
|
|
239
245
|
|
|
240
246
|
/**
|
|
241
|
-
* Returns the checkpoint number at a given
|
|
242
|
-
* `tip` is omitted.
|
|
243
|
-
*
|
|
244
|
-
* @remarks **Semantic foot-gun**: block-side `'proposed'` means "latest proposed block" (chain
|
|
245
|
-
* head), but checkpoint-side `'proposed'` means "latest confirmed checkpoint" — pre-L1-confirm
|
|
246
|
-
* checkpoints are not exposed over RPC. `'checkpointed'` on the checkpoint side is equivalent.
|
|
247
|
+
* Returns the checkpoint number at a given checkpoint tag, or the latest checkpointed number when
|
|
248
|
+
* `tip` is omitted. The proposed-but-unconfirmed checkpoint frontier is archiver-internal and not
|
|
249
|
+
* exposed over RPC, so `'proposed'` is not a valid checkpoint tag (see {@link CheckpointTag}).
|
|
247
250
|
*/
|
|
248
|
-
getCheckpointNumber(tip?:
|
|
251
|
+
getCheckpointNumber(tip?: CheckpointTag): Promise<CheckpointNumber>;
|
|
249
252
|
|
|
250
253
|
/** Returns the tips of the L2 chain. */
|
|
251
|
-
getChainTips(): Promise<
|
|
254
|
+
getChainTips(): Promise<L2Tips>;
|
|
252
255
|
|
|
253
256
|
/** Returns the rollup constants for the current chain. */
|
|
254
257
|
getL1Constants(): Promise<L1RollupConstants>;
|
|
@@ -382,12 +385,6 @@ export interface AztecNode {
|
|
|
382
385
|
*/
|
|
383
386
|
getProtocolContractAddresses(): Promise<ProtocolContractAddresses>;
|
|
384
387
|
|
|
385
|
-
/**
|
|
386
|
-
* Registers contract function signatures for debugging purposes.
|
|
387
|
-
* @param functionSignatures - An array of function signatures to register by selector.
|
|
388
|
-
*/
|
|
389
|
-
registerContractFunctionSignatures(functionSignatures: string[]): Promise<void>;
|
|
390
|
-
|
|
391
388
|
/**
|
|
392
389
|
* Gets private logs matching the given tags. Returns one inner array per element of `query.tags`, in
|
|
393
390
|
* input order. An empty inner array means no logs matched that tag. Set `query.includeEffects` to also
|
|
@@ -525,10 +522,18 @@ export interface AztecNode {
|
|
|
525
522
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
526
523
|
|
|
527
524
|
/**
|
|
528
|
-
* Returns a publicly deployed contract instance given its address.
|
|
525
|
+
* Returns a publicly deployed contract instance given its address. Its current class id is resolved as of the given
|
|
526
|
+
* reference block.
|
|
527
|
+
*
|
|
528
|
+
* Returns `undefined` if the instance has not been published (i.e. `publish_for_public_execution` was never called
|
|
529
|
+
* on the `ContractInstanceRegistry`). A contract whose class has been updated will never return `undefined`:
|
|
530
|
+
* scheduling an update requires the contract's deployment nullifier, which is only emitted by publishing, so any
|
|
531
|
+
* updatable contract has necessarily been published.
|
|
529
532
|
* @param address - Address of the deployed contract.
|
|
533
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
534
|
+
* Defaults to 'latest'.
|
|
530
535
|
*/
|
|
531
|
-
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
536
|
+
getContract(address: AztecAddress, referenceBlock?: BlockParameter): Promise<ContractInstanceWithAddress | undefined>;
|
|
532
537
|
|
|
533
538
|
/**
|
|
534
539
|
* Returns the ENR of this node for peer discovery, if available.
|
|
@@ -566,9 +571,6 @@ export interface AztecNode {
|
|
|
566
571
|
getProposalsForSlot(slot: SlotNumber): Promise<ProposalsForSlot>;
|
|
567
572
|
}
|
|
568
573
|
|
|
569
|
-
const MAX_SIGNATURES_PER_REGISTER_CALL = 100;
|
|
570
|
-
const MAX_SIGNATURE_LEN = 10000;
|
|
571
|
-
|
|
572
574
|
export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
573
575
|
getWorldStateSyncStatus: z.function({ input: z.tuple([]), output: WorldStateSyncStatusSchema }),
|
|
574
576
|
|
|
@@ -622,11 +624,11 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
622
624
|
output: L2ToL1MembershipWitnessSchema.optional(),
|
|
623
625
|
}),
|
|
624
626
|
|
|
625
|
-
getBlockNumber: z.function({ input: z.tuple([optional(
|
|
627
|
+
getBlockNumber: z.function({ input: z.tuple([optional(BlockTagWithoutLatestSchema)]), output: BlockNumberSchema }),
|
|
626
628
|
|
|
627
|
-
getCheckpointNumber: z.function({ input: z.tuple([optional(
|
|
629
|
+
getCheckpointNumber: z.function({ input: z.tuple([optional(CheckpointTagSchema)]), output: CheckpointNumberSchema }),
|
|
628
630
|
|
|
629
|
-
getChainTips: z.function({ input: z.tuple([]), output:
|
|
631
|
+
getChainTips: z.function({ input: z.tuple([]), output: L2TipsSchema }),
|
|
630
632
|
|
|
631
633
|
getL1Constants: z.function({ input: z.tuple([]), output: L1RollupConstantsSchema }),
|
|
632
634
|
|
|
@@ -691,11 +693,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
691
693
|
|
|
692
694
|
getProtocolContractAddresses: z.function({ input: z.tuple([]), output: ProtocolContractAddressesSchema }),
|
|
693
695
|
|
|
694
|
-
registerContractFunctionSignatures: z.function({
|
|
695
|
-
input: z.tuple([z.array(z.string().max(MAX_SIGNATURE_LEN)).max(MAX_SIGNATURES_PER_REGISTER_CALL)]),
|
|
696
|
-
output: z.void(),
|
|
697
|
-
}),
|
|
698
|
-
|
|
699
696
|
getPrivateLogsByTags: z.function({
|
|
700
697
|
input: z.tuple([PrivateLogsQuerySchema]),
|
|
701
698
|
output: z.array(z.array(LogResultSchema)),
|
|
@@ -769,7 +766,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
769
766
|
getContractClass: z.function({ input: z.tuple([schemas.Fr]), output: ContractClassPublicSchema.optional() }),
|
|
770
767
|
|
|
771
768
|
getContract: z.function({
|
|
772
|
-
input: z.tuple([schemas.AztecAddress]),
|
|
769
|
+
input: z.tuple([schemas.AztecAddress, optional(BlockParameterSchema)]),
|
|
773
770
|
output: ContractInstanceWithAddressSchema.optional(),
|
|
774
771
|
}),
|
|
775
772
|
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
import { type L2BlockTag, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
|
-
* Public
|
|
7
|
-
*
|
|
4
|
+
* Public checkpoint-tip selectors usable in RPC requests.
|
|
5
|
+
*
|
|
6
|
+
* `'proposed'` is intentionally excluded: the proposed-but-unconfirmed checkpoint frontier is an
|
|
7
|
+
* archiver-internal pipelining concept, not part of the public chain-tip surface. Select the
|
|
8
|
+
* proposed *block* tip with a block tag (`L2BlockTag`) instead.
|
|
8
9
|
*/
|
|
9
|
-
export type
|
|
10
|
+
export type CheckpointTag = 'checkpointed' | 'proven' | 'finalized';
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
-
z.literal('proposed'),
|
|
12
|
+
export const CheckpointTagSchema = z.union([
|
|
13
13
|
z.literal('checkpointed'),
|
|
14
14
|
z.literal('proven'),
|
|
15
15
|
z.literal('finalized'),
|
|
16
|
-
]) satisfies z.ZodType<
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Tips of the L2 chain.
|
|
20
|
-
* Omits the sequencer-internal `proposedCheckpoint` from the public RPC surface.
|
|
21
|
-
*/
|
|
22
|
-
export type ChainTips = Omit<L2Tips, 'proposedCheckpoint'>;
|
|
23
|
-
|
|
24
|
-
export const ChainTipsSchema = L2TipsSchema.omit({ proposedCheckpoint: true });
|
|
16
|
+
]) satisfies z.ZodType<CheckpointTag>;
|