Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: L1 request intervals #8997

Merged
merged 9 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 44 additions & 45 deletions docker-compose.provernet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Logs latest block numbers every 10 seconds.
name: aztec-provernet
services:

# Anvil instance that serves as L1
ethereum:
image: ghcr.io/foundry-rs/foundry@sha256:29ba6e34379e79c342ec02d437beb7929c9e254261e8032b17e187be71a2609f
Expand All @@ -23,18 +22,18 @@ services:
L1_CHAIN_ID: 31337
AZTEC_PORT: 80
DEPLOY_AZTEC_CONTRACTS: 1
ARCHIVER_POLLING_INTERVAL: 1000
ARCHIVER_POLLING_INTERVAL_MS: 1000
ARCHIVER_VIEM_POLLING_INTERVAL_MS: 1000
SEQ_VIEM_POLLING_INTERVAL_MS: 1000
SEQ_MAX_TX_PER_BLOCK: 4
SEQ_MIN_TX_PER_BLOCK: 1
SEQ_MAX_SECONDS_BETWEEN_BLOCKS: 3600
SEQ_MIN_SECONDS_BETWEEN_BLOCKS: 0
SEQ_RETRY_INTERVAL: 10000
SEQ_PUBLISHER_PRIVATE_KEY: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"
VALIDATOR_PRIVATE_KEY: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"
PROVER_REAL_PROOFS: "${PROVER_REAL_PROOFS:-false}"
ASSUME_PROVEN_THROUGH_BLOCK_NUMBER: "${ASSUME_PROVEN_THROUGH_BLOCK_NUMBER:-4}"
P2P_ENABLED: false
IS_DEV_NET: true
volumes:
- ./log/aztec-node/:/usr/src/yarn-project/aztec/log:rw
healthcheck:
Expand All @@ -50,43 +49,6 @@ services:
- "--archiver"
- "--sequencer"

# Bot for keeping a steady flow of txs into the network
# Requires bootstrapping to be completed successfully
aztec-bot:
image: "aztecprotocol/${IMAGE:-aztec:master}"
ports:
- "8082:80"
environment:
LOG_LEVEL: info
ETHEREUM_HOST: http://ethereum:8545
AZTEC_NODE_URL: http://aztec-node
L1_CHAIN_ID: 31337
AZTEC_PORT: 80
BOT_PRIVATE_KEY: 0xcafe
BOT_TX_INTERVAL_SECONDS: 5
BOT_PRIVATE_TRANSFERS_PER_TX: 1
BOT_PUBLIC_TRANSFERS_PER_TX: 0
BOT_NO_WAIT_FOR_TRANSFERS: true
BOT_NO_START: false
PXE_PROVER_ENABLED: "${PROVER_REAL_PROOFS:-false}"
PROVER_REAL_PROOFS: "${PROVER_REAL_PROOFS:-false}"
BB_SKIP_CLEANUP: "${BB_SKIP_CLEANUP:-0}" # Persist tmp dirs for debugging
IS_DEV_NET: true
volumes:
- ./log/aztec-bot/:/usr/src/yarn-project/aztec/log:rw
- ./cache/bb-crs/:/root/.bb-crs:rw
- ./workdir/bb-bot/:/usr/src/yarn-project/bb:rw
depends_on:
aztec-node:
condition: service_healthy
healthcheck:
test: [ "CMD", "curl", "-fSs", "http://127.0.0.1:$AZTEC_PORT/status" ]
interval: 3s
timeout: 30s
start_period: 10s
restart: on-failure:5
command: [ "start", "--bot", "--pxe" ]

# Prover node that listens for unproven blocks on L1, and generates and submits block proofs
# Requires one or more agents to be connected for actually generating proofs
# Fetches individual tx proofs from the aztec-node directly
Expand All @@ -97,15 +59,17 @@ services:
environment:
LOG_LEVEL: verbose
ETHEREUM_HOST: http://ethereum:8545
TX_PROVIDER_NODE_URL: http://aztec-node
PROVER_COORDINATION_NODE_URL: http://aztec-node
L1_CHAIN_ID: 31337
AZTEC_PORT: 80
ARCHIVER_POLLING_INTERVAL: 1000
ARCHIVER_POLLING_INTERVAL_MS: 1000
ARCHIVER_VIEM_POLLING_INTERVAL_MS: 1000
PROVER_VIEM_POLLING_INTERVAL_MS: 1000
PROVER_AGENT_ENABLED: false
PROVER_PUBLISHER_PRIVATE_KEY: "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97"
PROVER_REAL_PROOFS: "${PROVER_REAL_PROOFS:-false}"
ASSUME_PROVEN_THROUGH_BLOCK_NUMBER: "${ASSUME_PROVEN_THROUGH_BLOCK_NUMBER:-4}"
IS_DEV_NET: true

volumes:
- ./log/aztec-prover/:/usr/src/yarn-project/aztec/log:rw
depends_on:
Expand Down Expand Up @@ -135,7 +99,6 @@ services:
PROVER_TEST_DELAY_MS: "${PROVER_TEST_DELAY_MS:-0}"
PROVER_AGENT_CONCURRENCY: 2
BB_SKIP_CLEANUP: "${BB_SKIP_CLEANUP:-0}" # Persist tmp dirs for debugging
IS_DEV_NET: true
volumes:
- ./log/aztec-prover-agent/:/usr/src/yarn-project/aztec/log:rw
- ./cache/bb-crs/:/root/.bb-crs:rw
Expand All @@ -151,6 +114,42 @@ services:
timeout: 30s
start_period: 20s

# Bot for keeping a steady flow of txs into the network
# Requires bootstrapping to be completed successfully
aztec-bot:
image: "aztecprotocol/${IMAGE:-aztec:master}"
ports:
- "8082:80"
environment:
LOG_LEVEL: info
ETHEREUM_HOST: http://ethereum:8545
AZTEC_NODE_URL: http://aztec-node
L1_CHAIN_ID: 31337
AZTEC_PORT: 80
BOT_PRIVATE_KEY: 0xcafe
BOT_TX_INTERVAL_SECONDS: 5
BOT_PRIVATE_TRANSFERS_PER_TX: 1
BOT_PUBLIC_TRANSFERS_PER_TX: 0
BOT_NO_WAIT_FOR_TRANSFERS: true
BOT_NO_START: false
PXE_PROVER_ENABLED: "${PROVER_REAL_PROOFS:-false}"
PROVER_REAL_PROOFS: "${PROVER_REAL_PROOFS:-false}"
BB_SKIP_CLEANUP: "${BB_SKIP_CLEANUP:-0}" # Persist tmp dirs for debugging
volumes:
- ./log/aztec-bot/:/usr/src/yarn-project/aztec/log:rw
- ./cache/bb-crs/:/root/.bb-crs:rw
- ./workdir/bb-bot/:/usr/src/yarn-project/bb:rw
depends_on:
aztec-node:
condition: service_healthy
healthcheck:
test: [ "CMD", "curl", "-fSs", "http://127.0.0.1:$AZTEC_PORT/status" ]
interval: 3s
timeout: 30s
start_period: 10s
restart: on-failure:5
command: [ "start", "--bot", "--pxe" ]

# Simple watcher that logs the latest block numbers every few seconds using the CLI and the bot's PXE
aztec-block-watcher:
image: "aztecprotocol/${IMAGE:-aztec:master}"
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/archiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ The interfaces defining how the data can be consumed from the archiver are `L2Bl
To install dependencies and build the package run `yarn install` followed by `yarn build`.
To run test execute `yarn test`.

To start the service export `ETHEREUM_HOST` (defaults to `http://127.0.0.1:8545/`), `ARCHIVER_POLLING_INTERVAL` (defaults to `1000 ms`), `ROLLUP_CONTRACT_ADDRESS`, `INBOX_CONTRACT_ADDRESS` environmental variables and start the service with `yarn start`.
To start the service export `ETHEREUM_HOST` (defaults to `http://127.0.0.1:8545/`), `ARCHIVER_POLLING_INTERVAL_MS` (defaults to `1000 ms`), `ROLLUP_CONTRACT_ADDRESS`, `INBOX_CONTRACT_ADDRESS` environmental variables and start the service with `yarn start`.
10 changes: 5 additions & 5 deletions yarn-project/archiver/src/archiver/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
...numberConfigHelper(1000),
},
viemPollingIntervalMS: {
env: 'ARCHIVER_VIEM_POLLING_INTERVAL_MS',
description: 'The polling interval viem uses in ms',
...numberConfigHelper(1000),
},
dataDirectory: {
env: 'DATA_DIRECTORY',
description: 'Optional dir to store data. If omitted will store in memory.',
Expand All @@ -67,6 +62,11 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
...numberConfigHelper(1_000),
},
...l1ReaderConfigMappings,
viemPollingIntervalMS: {
env: 'ARCHIVER_VIEM_POLLING_INTERVAL_MS',
description: 'The polling interval viem uses in ms',
...numberConfigHelper(1000),
},
};

/**
Expand Down
1 change: 1 addition & 0 deletions yarn-project/archiver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async function main() {
const config = getArchiverConfigFromEnv();
const { l1RpcUrl: rpcUrl, l1Contracts } = config;

log.info(`Starting archiver in main(): ${JSON.stringify(config)}`);
const publicClient = createPublicClient({
chain: localhost,
transport: http(rpcUrl),
Expand Down
10 changes: 9 additions & 1 deletion yarn-project/aztec/terraform/node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,15 @@ resource "aws_ecs_task_definition" "aztec-node" {
value = "${local.data_dir}/node_${count.index + 1}/data"
},
{
name = "ARCHIVER_POLLING_INTERVAL"
name = "ARCHIVER_POLLING_INTERVAL_MS"
value = "10000"
},
{
name = "ARCHIVER_VIEM_POLLING_INTERVAL_MS"
value = "10000"
},
{
name = "SEQ_VIEM_POLLING_INTERVAL_MS"
value = "10000"
},
{
Expand Down
4 changes: 3 additions & 1 deletion yarn-project/aztec/terraform/prover-node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ resource "aws_ecs_task_definition" "aztec-prover-node" {
{ name = "API_PREFIX", value = "/${var.DEPLOY_TAG}/aztec-prover-node-${count.index + 1}/${var.API_KEY}" },

// Archiver
{ name = "ARCHIVER_POLLING_INTERVAL", value = "10000" },
{ name = "ARCHIVER_POLLING_INTERVAL_MS", value = "10000" },
{ name = "ARCHIVER_VIEM_POLLING_INTERVAL_MS", value = "10000" },
{ name = "PROVER_VIEM_POLLING_INTERVAL_MS", value = "10000" },

// 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
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/scripts/docker-compose-p2p.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
DEBUG_COLORS: 1
ETHEREUM_HOST: http://fork:8545
L1_CHAIN_ID: 31337
ARCHIVER_POLLING_INTERVAL: 500
ARCHIVER_POLLING_INTERVAL_MS: 500
P2P_CHECK_INTERVAL: 50
SEQ_TX_POLLING_INTERVAL: 50
WS_CHECK_INTERVAL: 50
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/scripts/start_p2p_e2e.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash
set -eu
export DEBUG='aztec:*'
export ARCHIVER_POLLING_INTERVAL=500
export ARCHIVER_POLLING_INTERVAL_MS=500
export P2P_CHECK_INTERVAL=50
export WS_CHECK_INTERVAL=50
export SEQ_TX_POLLING_INTERVAL=50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ describe('L1Publisher integration', () => {
publisherPrivateKey: sequencerPK,
l1PublishRetryIntervalMS: 100,
l1ChainId: 31337,
viemPollingIntervalMS: 100,
},
new NoopTelemetryClient(),
);
Expand Down
1 change: 1 addition & 0 deletions yarn-project/end-to-end/src/e2e_synching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ describe('e2e_synching', () => {
publisherPrivateKey: sequencerPK,
l1PublishRetryIntervalMS: 100,
l1ChainId: 31337,
viemPollingIntervalMS: 100,
},
new NoopTelemetryClient(),
);
Expand Down
11 changes: 10 additions & 1 deletion yarn-project/ethereum/src/l1_reader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ConfigMappingsType } from '@aztec/foundation/config';
import { type ConfigMappingsType, numberConfigHelper } from '@aztec/foundation/config';

import { type L1ContractAddresses, l1ContractAddressesMapping } from './l1_contract_addresses.js';

Expand All @@ -19,6 +19,10 @@ export interface L1ReaderConfig {
* The deployed l1 contract addresses
*/
l1Contracts: L1ContractAddresses;
/**
* The polling interval viem uses in ms
*/
viemPollingIntervalMS: number;
}

export const l1ReaderConfigMappings: ConfigMappingsType<L1ReaderConfig> = {
Expand All @@ -37,4 +41,9 @@ export const l1ReaderConfigMappings: ConfigMappingsType<L1ReaderConfig> = {
description: 'The deployed L1 contract addresses',
defaultValue: l1ContractAddressesMapping,
},
viemPollingIntervalMS: {
env: 'L1_READER_VIEM_POLLING_INTERVAL_MS',
description: 'The polling interval viem uses in ms',
...numberConfigHelper(1_000),
},
};
6 changes: 5 additions & 1 deletion yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,8 @@ export type EnvVar =
| 'VERSION'
| 'WS_BLOCK_CHECK_INTERVAL_MS'
| 'WS_L2_BLOCK_QUEUE_SIZE'
| 'WS_PROVEN_BLOCKS_ONLY';
| 'WS_PROVEN_BLOCKS_ONLY'
| 'VERIFIER_VIEM_POLLING_INTERVAL_MS'
| 'L1_READER_VIEM_POLLING_INTERVAL_MS'
| 'PROVER_VIEM_POLLING_INTERVAL_MS'
| 'SEQ_VIEM_POLLING_INTERVAL_MS';
7 changes: 7 additions & 0 deletions yarn-project/proof-verifier/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type ProofVerifierConfig = {
bbWorkingDirectory: string;
/** Whether to skip cleanup of bb temporary files */
bbSkipCleanup: boolean;
/** The polling interval viem uses in ms */
viemPollingIntervalMS: number;
} & TelemetryClientConfig;

export const proofVerifierConfigMappings: ConfigMappingsType<ProofVerifierConfig> = {
Expand Down Expand Up @@ -66,6 +68,11 @@ export const proofVerifierConfigMappings: ConfigMappingsType<ProofVerifierConfig
description: 'Whether to skip cleanup of bb temporary files',
...booleanConfigHelper(false),
},
viemPollingIntervalMS: {
env: 'VERIFIER_VIEM_POLLING_INTERVAL_MS',
description: 'The polling interval viem uses in ms',
...numberConfigHelper(1_000),
},
};

export function getProofVerifierConfigFromEnv(): ProofVerifierConfig {
Expand Down
1 change: 1 addition & 0 deletions yarn-project/proof-verifier/src/proof_verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class ProofVerifier {
const client = createPublicClient({
chain: createEthereumChain(config.l1Url, config.l1ChainId).chainInfo,
transport: http(config.l1Url),
pollingInterval: config.viemPollingIntervalMS,
});

return new ProofVerifier(config, client, verifier, telemetryClient, logger);
Expand Down
4 changes: 0 additions & 4 deletions yarn-project/publish_npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ set -eu

echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >.npmrc

echo "Current directory: $(pwd)"
echo "Contents of .npmrc:"
cat .npmrc

# This is to be used with the 'canary' tag for testing, and then 'latest' for making it public
DIST_TAG=${1:-"latest"}
VERSION=$2
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/sequencer-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ export const chainConfigMappings: ConfigMappingsType<ChainConfig> = {

export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
...sequencerConfigMappings,
...l1ReaderConfigMappings,
...getTxSenderConfigMappings('SEQ'),
...getPublisherConfigMappings('SEQ'),
...l1ReaderConfigMappings,
...chainConfigMappings,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
this.publicClient = createPublicClient({
chain: chain.chainInfo,
transport: http(chain.rpcUrl),
pollingInterval: config.viemPollingIntervalMS,
});

this.rollupContract = getContract({
Expand Down
7 changes: 6 additions & 1 deletion yarn-project/sequencer-client/src/publisher/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type L1ReaderConfig, NULL_KEY } from '@aztec/ethereum';
import { type ConfigMappingsType, getConfigFromMappings } from '@aztec/foundation/config';
import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';

/**
* The configuration of the rollup transaction publisher.
Expand Down Expand Up @@ -51,6 +51,11 @@ export const getTxSenderConfigMappings: (
defaultValue: 1,
description: 'The number of confirmations required.',
},
viemPollingIntervalMS: {
env: `${scope}_VIEM_POLLING_INTERVAL_MS`,
description: 'The polling interval viem uses in ms',
...numberConfigHelper(1_000),
},
});

export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export class L1Publisher {
this.publicClient = createPublicClient({
chain: chain.chainInfo,
transport: http(chain.rpcUrl),
pollingInterval: config.viemPollingIntervalMS,
});

this.rollupContract = getContract({
Expand Down
Loading