Skip to content

Commit

Permalink
feat: add epoch config (#9884)
Browse files Browse the repository at this point in the history
This PR adds configuration for the length of an epoch to the Helm chart.
  • Loading branch information
alexghr authored Nov 11, 2024
1 parent b621603 commit 7971974
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 18 deletions.
16 changes: 16 additions & 0 deletions spartan/aztec-network/templates/boot-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ spec:
value: {{ include "aztec-network.ethereumHost" . | quote }}
- name: INIT_VALIDATORS
value: {{ not .Values.validator.external | quote }}
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS
value: "{{ .Values.aztec.epochProofClaimWindow }}"
{{- end }}
containers:
- name: boot-node
Expand Down Expand Up @@ -144,6 +152,14 @@ spec:
value: {{ include "aztec-network.otelCollectorTracesEndpoint" . | quote }}
- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
value: {{ include "aztec-network.otelCollectorLogsEndpoint" . | quote }}
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS
value: "{{ .Values.aztec.epochProofClaimWindow }}"
ports:
- containerPort: {{ .Values.bootNode.service.nodePort }}
- containerPort: {{ .Values.bootNode.service.p2pTcpPort }}
Expand Down
8 changes: 8 additions & 0 deletions spartan/aztec-network/templates/prover-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ spec:
value: "0.0.0.0:{{ .Values.proverNode.service.p2pTcpPort }}"
- name: P2P_UDP_LISTEN_ADDR
value: "0.0.0.0:{{ .Values.proverNode.service.p2pUdpPort }}"
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS
value: "{{ .Values.aztec.epochProofClaimWindow }}"
ports:
- containerPort: {{ .Values.proverNode.service.nodePort }}
- containerPort: {{ .Values.proverNode.service.p2pTcpPort }}
Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-network/templates/transaction-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ spec:
{{- if and (eq .Values.bot.service.type "NodePort") .Values.bot.service.nodePort }}
nodePort: {{ .Values.bot.service.nodePort }}
{{- end }}
{{- end }}
{{- end }}
10 changes: 9 additions & 1 deletion spartan/aztec-network/templates/validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ spec:
value: {{ include "aztec-network.otelCollectorTracesEndpoint" . | quote }}
- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
value: {{ include "aztec-network.otelCollectorLogsEndpoint" . | quote }}
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS
value: "{{ .Values.aztec.epochProofClaimWindow }}"
ports:
- containerPort: {{ .Values.validator.service.nodePort }}
- containerPort: {{ .Values.validator.service.p2pTcpPort }}
Expand Down Expand Up @@ -255,4 +263,4 @@ spec:
protocol: UDP
---
{{- end }}
{{ end }}
{{ end }}
5 changes: 5 additions & 0 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ images:
image: ghcr.io/paradigmxyz/reth:v1.0.8
pullPolicy: IfNotPresent

aztec:
slotDuration: 24 # in seconds, aka L2 slot duration. Must be a multiple of {{ ethereum.blockTime }}
epochDuration: 16 # how many L2 slots in an epoch
epochProofClaimWindow: 13 # in L2 slots

bootNode:
externalTcpHost: ""
externalUdpHost: ""
Expand Down
4 changes: 4 additions & 0 deletions spartan/aztec-network/values/1-validator-with-proving.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
deployL1Verifier:
enable: true

aztec:
slotDuration: 36
epochDuration: 32

telemetry:
enabled: true
otelCollectorEndpoint: http://metrics-opentelemetry-collector.metrics:4318
12 changes: 6 additions & 6 deletions yarn-project/ethereum/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ConfigMappingsType, getConfigFromMappings } from '@aztec/foundation/config';
import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';

export type L1ContractsConfig = {
/** How many seconds an L1 slot lasts. */
Expand All @@ -25,27 +25,27 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
ethereumSlotDuration: {
env: 'ETHEREUM_SLOT_DURATION',
description: 'How many seconds an L1 slot lasts.',
defaultValue: DefaultL1ContractsConfig.ethereumSlotDuration,
...numberConfigHelper(DefaultL1ContractsConfig.ethereumSlotDuration),
},
aztecSlotDuration: {
env: 'AZTEC_SLOT_DURATION',
description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
defaultValue: DefaultL1ContractsConfig.aztecSlotDuration,
...numberConfigHelper(DefaultL1ContractsConfig.aztecSlotDuration),
},
aztecEpochDuration: {
env: 'AZTEC_EPOCH_DURATION',
description: `How many L2 slots an epoch lasts (maximum AZTEC_MAX_EPOCH_DURATION).`,
defaultValue: DefaultL1ContractsConfig.aztecEpochDuration,
...numberConfigHelper(DefaultL1ContractsConfig.aztecEpochDuration),
},
aztecTargetCommitteeSize: {
env: 'AZTEC_TARGET_COMMITTEE_SIZE',
description: 'The target validator committee size.',
defaultValue: DefaultL1ContractsConfig.aztecTargetCommitteeSize,
...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize),
},
aztecEpochProofClaimWindowInL2Slots: {
env: 'AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS',
description: 'The number of L2 slots that we can wait for a proof of an epoch to be produced.',
defaultValue: DefaultL1ContractsConfig.aztecEpochProofClaimWindowInL2Slots,
...numberConfigHelper(DefaultL1ContractsConfig.aztecEpochProofClaimWindowInL2Slots),
},
};

Expand Down
20 changes: 10 additions & 10 deletions yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,11 @@ export const deployL1Contracts = async (
return await (await fetch(rpcUrl, content)).json();
};
if (isAnvilTestChain(chain.id)) {
const interval = 12; // @todo #8084
const res = await rpcCall('anvil_setBlockTimestampInterval', [interval]);
const res = await rpcCall('anvil_setBlockTimestampInterval', [args.ethereumSlotDuration]);
if (res.error) {
throw new Error(`Error setting block interval: ${res.error.message}`);
}
logger.info(`Set block interval to ${interval}`);
logger.info(`Set block interval to ${args.ethereumSlotDuration}`);
}

logger.info(`Deploying contracts from ${account.address.toString()}...`);
Expand Down Expand Up @@ -347,21 +346,22 @@ export const deployL1Contracts = async (
]);
logger.info(`Deployed Fee Juice Portal at ${feeJuicePortalAddress}`);

const rollupArgs = {
aztecSlotDuration: args.aztecSlotDuration,
aztecEpochDuration: args.aztecEpochDuration,
targetCommitteeSize: args.aztecTargetCommitteeSize,
aztecEpochProofClaimWindowInL2Slots: args.aztecEpochProofClaimWindowInL2Slots,
};
const rollupAddress = await deployer.deploy(l1Artifacts.rollup, [
feeJuicePortalAddress.toString(),
rewardDistributorAddress.toString(),
args.vkTreeRoot.toString(),
args.protocolContractTreeRoot.toString(),
account.address.toString(),
args.initialValidators?.map(v => v.toString()) ?? [],
{
aztecSlotDuration: args.aztecSlotDuration,
aztecEpochDuration: args.aztecEpochDuration,
targetCommitteeSize: args.aztecTargetCommitteeSize,
aztecEpochProofClaimWindowInL2Slots: args.aztecEpochProofClaimWindowInL2Slots,
},
rollupArgs,
]);
logger.info(`Deployed Rollup at ${rollupAddress}`);
logger.info(`Deployed Rollup at ${rollupAddress}`, rollupArgs);

await deployer.waitForDeployments();
logger.info(`All core contracts deployed`);
Expand Down

0 comments on commit 7971974

Please sign in to comment.