Skip to content

Commit

Permalink
refactor: remove ARCHIVER_L1_START_BLOCK
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Sep 16, 2024
1 parent d91e330 commit 4429abb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
2 changes: 2 additions & 0 deletions l1-contracts/src/core/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
// @todo #8018
uint256 public constant TIMELINESS_PROVING_IN_SLOTS = 100;

uint256 public immutable L1_BLOCK_AT_GENESIS;
IRegistry public immutable REGISTRY;
IInbox public immutable INBOX;
IOutbox public immutable OUTBOX;
Expand Down Expand Up @@ -84,6 +85,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
OUTBOX = new Outbox(address(this));
vkTreeRoot = _vkTreeRoot;
VERSION = 1;
L1_BLOCK_AT_GENESIS = block.number;

// Genesis block
blocks[0] = BlockLog({
Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/src/core/interfaces/IRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ interface IRollup {

function OUTBOX() external view returns (IOutbox);

function L1_BLOCK_AT_GENESIS() external view returns (uint256);

function propose(
bytes calldata _header,
bytes32 _archive,
Expand Down
13 changes: 11 additions & 2 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Fr } from '@aztec/foundation/fields';
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
import { RunningPromise } from '@aztec/foundation/running-promise';
import { Timer } from '@aztec/foundation/timer';
import { RollupAbi } from '@aztec/l1-artifacts';
import { ClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer';
import { type TelemetryClient } from '@aztec/telemetry-client';
import {
Expand All @@ -42,7 +43,7 @@ import {
} from '@aztec/types/contracts';

import groupBy from 'lodash.groupby';
import { type Chain, type HttpTransport, type PublicClient, createPublicClient, http } from 'viem';
import { type Chain, type HttpTransport, type PublicClient, createPublicClient, getContract, http } from 'viem';

import { type ArchiverDataStore } from './archiver_store.js';
import { type ArchiverConfig } from './config.js';
Expand Down Expand Up @@ -109,6 +110,14 @@ export class Archiver implements ArchiveSource {
pollingInterval: config.viemPollingIntervalMS,
});

const rollup = getContract({
address: config.l1Contracts.rollupAddress.toString(),
abi: RollupAbi,
client: publicClient,
});

const l1StartBlock = await rollup.read.L1_BLOCK_AT_GENESIS();

const archiver = new Archiver(
publicClient,
config.l1Contracts.rollupAddress,
Expand All @@ -117,7 +126,7 @@ export class Archiver implements ArchiveSource {
archiverStore,
config.archiverPollingIntervalMS,
new ArchiverInstrumentation(telemetry),
BigInt(config.archiverL1StartBlock),
BigInt(l1StartBlock),
);
await archiver.start(blockUntilSynced);
return archiver;
Expand Down
10 changes: 0 additions & 10 deletions yarn-project/archiver/src/archiver/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export type ArchiverConfig = {
*/
archiverPollingIntervalMS?: number;

/**
* The L1 block to start reading from
*/
archiverL1StartBlock: number;

/**
* The polling interval viem uses in ms
*/
Expand Down Expand Up @@ -57,11 +52,6 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
...numberConfigHelper(1000),
},
archiverL1StartBlock: {
env: 'ARCHIVER_L1_START_BLOCK',
description: 'The L1 block the archiver should start reading logs from',
...numberConfigHelper(0),
},
viemPollingIntervalMS: {
env: 'ARCHIVER_VIEM_POLLING_INTERVAL_MS',
description: 'The polling interval viem uses in ms',
Expand Down
4 changes: 0 additions & 4 deletions yarn-project/aztec/terraform/node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,6 @@ resource "aws_ecs_task_definition" "aztec-node" {
name = "ARCHIVER_POLLING_INTERVAL"
value = "10000"
},
{
name = "ARCHIVER_L1_START_BLOCK",
value = "15918000"
},
{
name = "SEQ_RETRY_INTERVAL"
value = "10000"
Expand Down
1 change: 0 additions & 1 deletion yarn-project/aztec/terraform/prover-node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ resource "aws_ecs_task_definition" "aztec-prover-node" {

// Archiver
{ name = "ARCHIVER_POLLING_INTERVAL", value = "10000" },
{ name = "ARCHIVER_L1_START_BLOCK", value = "15918000" },

// Aztec node to pull clientivc proofs from (to be replaced with a p2p connection)
{ name = "TX_PROVIDER_NODE_URL", value = "http://${var.DEPLOY_TAG}-aztec-node-${count.index + 1}.local/${var.DEPLOY_TAG}/aztec-node-${count.index + 1}/${var.API_KEY}" },
Expand Down
1 change: 0 additions & 1 deletion yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export type EnvVar =
| 'ARCHIVER_POLLING_INTERVAL_MS'
| 'ARCHIVER_VIEM_POLLING_INTERVAL_MS'
| 'ARCHIVER_MAX_LOGS'
| 'ARCHIVER_L1_START_BLOCK'
| 'SEQ_TX_POLLING_INTERVAL_MS'
| 'SEQ_MAX_TX_PER_BLOCK'
| 'SEQ_MIN_TX_PER_BLOCK'
Expand Down

0 comments on commit 4429abb

Please sign in to comment.