Skip to content

Commit 49b37dd

Browse files
committed
feat: blob sink in sandbox
1 parent 7e9e268 commit 49b37dd

42 files changed

Lines changed: 390 additions & 71 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

yarn-project/archiver/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
]
6565
},
6666
"dependencies": {
67+
"@aztec/blob-sink": "workspace:^",
6768
"@aztec/circuit-types": "workspace:^",
6869
"@aztec/circuits.js": "workspace:^",
6970
"@aztec/ethereum": "workspace:^",

yarn-project/archiver/src/archiver/archiver.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
12
import { InboxLeaf, type L1RollupConstants, L2Block } from '@aztec/circuit-types';
23
import { GENESIS_ARCHIVE_ROOT, PrivateLog } from '@aztec/circuits.js';
34
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
@@ -53,6 +54,7 @@ describe('Archiver', () => {
5354

5455
let publicClient: MockProxy<PublicClient<HttpTransport, Chain>>;
5556
let instrumentation: MockProxy<ArchiverInstrumentation>;
57+
let blobSinkClient: MockProxy<BlobSinkClientInterface>;
5658
let archiverStore: ArchiverDataStore;
5759
let now: number;
5860
let l1Constants: L1RollupConstants;
@@ -92,6 +94,7 @@ describe('Archiver', () => {
9294
);
9395
}) as any,
9496
});
97+
blobSinkClient = mock<BlobSinkClientInterface>();
9598

9699
const tracer = new NoopTelemetryClient().getTracer();
97100
instrumentation = mock<ArchiverInstrumentation>({ isEnabled: () => true, tracer });
@@ -109,6 +112,7 @@ describe('Archiver', () => {
109112
{ rollupAddress, inboxAddress, registryAddress },
110113
archiverStore,
111114
{ pollingIntervalMs: 1000, batchSize: 1000 },
115+
blobSinkClient,
112116
instrumentation,
113117
l1Constants,
114118
);

yarn-project/archiver/src/archiver/archiver.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
12
import {
23
type GetUnencryptedLogsResponse,
34
type InBlock,
@@ -115,6 +116,7 @@ export class Archiver implements ArchiveSource, Traceable {
115116
private readonly l1Addresses: { rollupAddress: EthAddress; inboxAddress: EthAddress; registryAddress: EthAddress },
116117
readonly dataStore: ArchiverDataStore,
117118
private readonly config: { pollingIntervalMs: number; batchSize: number },
119+
private readonly _blobSinkClient: BlobSinkClientInterface,
118120
private readonly instrumentation: ArchiverInstrumentation,
119121
private readonly l1constants: L1RollupConstants,
120122
private readonly log: Logger = createLogger('archiver'),
@@ -145,7 +147,7 @@ export class Archiver implements ArchiveSource, Traceable {
145147
public static async createAndSync(
146148
config: ArchiverConfig,
147149
archiverStore: ArchiverDataStore,
148-
telemetry: TelemetryClient,
150+
deps: { telemetry: TelemetryClient; blobSinkClient: BlobSinkClientInterface },
149151
blockUntilSynced = true,
150152
): Promise<Archiver> {
151153
const chain = createEthereumChain(config.l1RpcUrl, config.l1ChainId);
@@ -176,7 +178,8 @@ export class Archiver implements ArchiveSource, Traceable {
176178
pollingIntervalMs: config.archiverPollingIntervalMS ?? 10_000,
177179
batchSize: config.archiverBatchSize ?? 100,
178180
},
179-
await ArchiverInstrumentation.new(telemetry, () => archiverStore.estimateSize()),
181+
deps.blobSinkClient,
182+
await ArchiverInstrumentation.new(deps.telemetry, () => archiverStore.estimateSize()),
180183
{ l1StartBlock, l1GenesisTime, epochDuration, slotDuration, ethereumSlotDuration },
181184
);
182185
await archiver.start(blockUntilSynced);

yarn-project/archiver/src/factory.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
12
import { type ArchiverApi, type Service } from '@aztec/circuit-types';
23
import {
34
type ContractClassPublic,
@@ -23,6 +24,7 @@ import { createArchiverClient } from './rpc/index.js';
2324

2425
export async function createArchiver(
2526
config: ArchiverConfig & DataStoreConfig,
27+
blobSinkClient: BlobSinkClientInterface,
2628
telemetry: TelemetryClient = new NoopTelemetryClient(),
2729
opts: { blockUntilSync: boolean } = { blockUntilSync: true },
2830
): Promise<ArchiverApi & Maybe<Service>> {
@@ -31,7 +33,7 @@ export async function createArchiver(
3133
const archiverStore = new KVArchiverDataStore(store, config.maxLogs);
3234
await registerProtocolContracts(archiverStore);
3335
await registerCommonContracts(archiverStore);
34-
return Archiver.createAndSync(config, archiverStore, telemetry, opts.blockUntilSync);
36+
return Archiver.createAndSync(config, archiverStore, { telemetry, blobSinkClient }, opts.blockUntilSync);
3537
} else {
3638
return createArchiverClient(config.archiverUrl);
3739
}

yarn-project/archiver/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"tsBuildInfoFile": ".tsbuildinfo"
77
},
88
"references": [
9+
{
10+
"path": "../blob-sink"
11+
},
912
{
1013
"path": "../circuit-types"
1114
},

yarn-project/aztec-node/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"dependencies": {
6565
"@aztec/archiver": "workspace:^",
6666
"@aztec/bb-prover": "workspace:^",
67+
"@aztec/blob-sink": "workspace:^",
6768
"@aztec/circuit-types": "workspace:^",
6869
"@aztec/circuits.js": "workspace:^",
6970
"@aztec/epoch-cache": "workspace:^",

yarn-project/aztec-node/src/aztec-node/server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createArchiver } from '@aztec/archiver';
22
import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
3+
import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
34
import {
45
type AztecNode,
56
type ClientProtocolCircuitVerifier,
@@ -139,11 +140,13 @@ export class AztecNodeService implements AztecNode, Traceable {
139140
logger?: Logger;
140141
publisher?: L1Publisher;
141142
dateProvider?: DateProvider;
143+
blobSinkClient?: BlobSinkClientInterface;
142144
} = {},
143145
): Promise<AztecNodeService> {
144146
const telemetry = deps.telemetry ?? new NoopTelemetryClient();
145147
const log = deps.logger ?? createLogger('node');
146148
const dateProvider = deps.dateProvider ?? new DateProvider();
149+
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config.blobSinkUrl);
147150
const ethereumChain = createEthereumChain(config.l1RpcUrl, config.l1ChainId);
148151
//validate that the actual chain id matches that specified in configuration
149152
if (config.l1ChainId !== ethereumChain.chainInfo.id) {
@@ -152,7 +155,7 @@ export class AztecNodeService implements AztecNode, Traceable {
152155
);
153156
}
154157

155-
const archiver = await createArchiver(config, telemetry, { blockUntilSync: true });
158+
const archiver = await createArchiver(config, blobSinkClient, telemetry, { blockUntilSync: true });
156159

157160
// we identify the P2P transaction protocol by using the rollup contract address.
158161
// this may well change in future
@@ -190,6 +193,7 @@ export class AztecNodeService implements AztecNode, Traceable {
190193
const sequencer = config.disableValidator
191194
? undefined
192195
: await SequencerClient.new(config, {
196+
...deps,
193197
validatorClient,
194198
p2pClient,
195199
worldStateSynchronizer,
@@ -199,7 +203,7 @@ export class AztecNodeService implements AztecNode, Traceable {
199203
l1ToL2MessageSource: archiver,
200204
telemetry,
201205
dateProvider,
202-
...deps,
206+
blobSinkClient,
203207
});
204208

205209
return new AztecNodeService(

yarn-project/aztec-node/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
{
1313
"path": "../bb-prover"
1414
},
15+
{
16+
"path": "../blob-sink"
17+
},
1518
{
1619
"path": "../circuit-types"
1720
},

yarn-project/aztec/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@aztec/aztec-node": "workspace:^",
3636
"@aztec/aztec.js": "workspace:^",
3737
"@aztec/bb-prover": "workspace:^",
38+
"@aztec/blob-sink": "workspace:^",
3839
"@aztec/bot": "workspace:^",
3940
"@aztec/builder": "workspace:^",
4041
"@aztec/circuit-types": "workspace:^",

yarn-project/aztec/src/cli/cmds/start_archiver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Archiver, type ArchiverConfig, KVArchiverDataStore, archiverConfigMappings } from '@aztec/archiver';
22
import { createLogger } from '@aztec/aztec.js';
3+
import { createBlobSinkClient } from '@aztec/blob-sink/client';
34
import { ArchiverApiSchema } from '@aztec/circuit-types';
45
import { type NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
56
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
@@ -31,7 +32,9 @@ export async function startArchiver(
3132
const archiverStore = new KVArchiverDataStore(store, archiverConfig.maxLogs);
3233

3334
const telemetry = await createAndStartTelemetryClient(getTelemetryClientConfig());
34-
const archiver = await Archiver.createAndSync(archiverConfig, archiverStore, telemetry, true);
35+
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/10056): place CL url in config here
36+
const blobSinkClient = createBlobSinkClient();
37+
const archiver = await Archiver.createAndSync(archiverConfig, archiverStore, { telemetry, blobSinkClient }, true);
3538
services.archiver = [archiver, ArchiverApiSchema];
3639
signalHandlers.push(archiver.stop);
3740
return services;

0 commit comments

Comments
 (0)