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

feat: spartan proving #9584

Merged
merged 27 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ad29ca3
fix: stop bot in case of tx errors
alexghr Oct 24, 2024
99dc9ac
fix: build l1-artifacts first
alexghr Oct 25, 2024
ae82246
fix: close container
alexghr Oct 25, 2024
d886a14
refactor: config
alexghr Oct 25, 2024
ab4afb3
fix: handle reorgs in the p2p-client
alexghr Oct 25, 2024
160b7a3
chore: restore commented out code
alexghr Oct 28, 2024
29baee5
feat: add mined txs back to pending set
alexghr Oct 28, 2024
e9e66d9
fix: add missing method
alexghr Oct 28, 2024
5a81e43
fix: expose env var for batch size
alexghr Oct 29, 2024
6a2547c
fix: block build reorg
alexghr Oct 30, 2024
8eb1c99
fix: only move back to pending txs that were actually reorged
alexghr Oct 30, 2024
d583dd6
fix: correctly use historical header
alexghr Oct 30, 2024
63748cb
chore: bump ClientIVC block sizes
alexghr Oct 30, 2024
95e0770
chore: normalize case
alexghr Oct 30, 2024
2ccee2e
feat: pass rollup address or pxe URL when deploying verifier
alexghr Oct 30, 2024
dae0504
feat: add prover-agent pods
alexghr Oct 30, 2024
2e5c703
Merge branch 'master' into ag/spartan-proving
PhilWindle Oct 30, 2024
c0c6b7a
chore: bump slot duration and epoch size
alexghr Oct 30, 2024
a810863
chore: update fixtures
alexghr Oct 30, 2024
d29928c
Update constants.nr
ludamad Oct 30, 2024
70f1523
Update prover-agent.yaml
ludamad Oct 30, 2024
2365781
Update ConstantsGen.sol
ludamad Oct 30, 2024
a0383d7
Update ConstantsGen.sol
ludamad Oct 30, 2024
52f94a4
Update constants.gen.ts
ludamad Oct 30, 2024
bd21a7f
Update constants.gen.ts
ludamad Oct 30, 2024
9be0941
Merge branch 'master' into ag/spartan-proving
ludamad Oct 30, 2024
a2f8f96
undo constants change
ludamad Oct 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ template <typename FF_> class MegaArith {
this->delta_range = 25000;
this->elliptic = 80000;
this->aux = 100000;
this->poseidon2_external = 30000;
this->poseidon2_internal = 150000;
Copy link
Collaborator

@ludamad ludamad Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could probably be bumped to a rounder number unless we have reason to think this will be stably 'enough'

this->poseidon2_external = 30128;
this->poseidon2_internal = 172000;
this->lookup = 200000;
}
};
Expand Down Expand Up @@ -247,4 +247,4 @@ using MegaArithmetization = MegaArith<bb::fr>;

template <typename T>
concept HasAdditionalSelectors = IsAnyOf<T, MegaArith<bb::fr>>;
} // namespace bb
} // namespace bb
8 changes: 4 additions & 4 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ library Constants {
uint256 internal constant INITIAL_L2_BLOCK_NUM = 1;
uint256 internal constant BLOB_SIZE_IN_BYTES = 126976;
uint256 internal constant ETHEREUM_SLOT_DURATION = 12;
uint256 internal constant AZTEC_SLOT_DURATION = 24;
uint256 internal constant AZTEC_EPOCH_DURATION = 16;
uint256 internal constant AZTEC_SLOT_DURATION = 36;
uint256 internal constant AZTEC_EPOCH_DURATION = 32;
uint256 internal constant AZTEC_TARGET_COMMITTEE_SIZE = 48;
uint256 internal constant AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS = 13;
uint256 internal constant GENESIS_ARCHIVE_ROOT =
Expand Down Expand Up @@ -226,8 +226,8 @@ library Constants {
uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 664;
uint256 internal constant CONSTANT_ROLLUP_DATA_LENGTH = 13;
uint256 internal constant BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 30;
uint256 internal constant BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 60;
uint256 internal constant ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 44;
uint256 internal constant BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 92;
uint256 internal constant ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 76;
uint256 internal constant GET_NOTES_ORACLE_RETURN_LENGTH = 674;
uint256 internal constant NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP = 2048;
uint256 internal constant NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ global INITIAL_L2_BLOCK_NUM: Field = 1;
global BLOB_SIZE_IN_BYTES: Field = 31 * 4096;
global ETHEREUM_SLOT_DURATION: u32 = 12;
// AZTEC_SLOT_DURATION should be a multiple of ETHEREUM_SLOT_DURATION
global AZTEC_SLOT_DURATION: u32 = ETHEREUM_SLOT_DURATION * 2;
global AZTEC_EPOCH_DURATION: u32 = 16;
global AZTEC_SLOT_DURATION: u32 = ETHEREUM_SLOT_DURATION * 3;
global AZTEC_EPOCH_DURATION: u32 = 32;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pointing out this change ☝️
Sooner or later we'll need to build docker images from master

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slows down testing, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per discussion rolled this back - this needs at least a comment about these constants changing for prod

global AZTEC_TARGET_COMMITTEE_SIZE: u32 = 48;
// The number of AZTEC_SLOTS that we can wait for a proof of an epoch to be produced.
global AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS: u32 = 13;
Expand Down
58 changes: 58 additions & 0 deletions spartan/aztec-network/templates/deploy-l1-verifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if .Values.network.setupL2Contracts }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "aztec-network.fullname" . }}-deploy-l1-verifier
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: deploy-l1-verifier
spec:
restartPolicy: OnFailure
containers:
- name: deploy-l1-verifier
image: {{ .Values.images.aztec.image }}
command:
- /bin/bash
- -c
- |
set -e

[ $ENABLE = "true" ] || exit 0

until curl -s -X GET "$AZTEC_NODE_URL/status"; do
echo "Waiting for Aztec node $AZTEC_NODE_URL..."
sleep 5
done
echo "Boot node is ready!"

export ROLLUP_CONTRACT_ADDRESS=$(curl -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"node_getL1ContractAddresses","params":[],"id":1}' \
"$AZTEC_NODE_URL" \
| jq -r '.result.rollupAddress.data')

echo "Rollup contract address: $ROLLUP_CONTRACT_ADDRESS"
node /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-verifier --verifier real
echo "L1 verifier deployed"
env:
- name: ENABLE
value: {{ .Values.jobs.deployL1Verifier.enable | quote }}
- name: NODE_NO_WARNINGS
value: "1"
- name: DEBUG
value: "aztec:*"
- name: LOG_LEVEL
value: "debug"
- name: ETHEREUM_HOST
value: {{ include "aztec-network.ethereumHost" . | quote }}
- name: L1_CHAIN_ID
value: {{ .Values.ethereum.chainId | quote }}
- name: PRIVATE_KEY
value: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
- name: AZTEC_NODE_URL
value: {{ include "aztec-network.bootNodeUrl" . | quote }}
{{ end }}
71 changes: 71 additions & 0 deletions spartan/aztec-network/templates/prover-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{{- if .Values.proverAgent.enabled }}
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: {{ include "aztec-network.fullname" . }}-prover-agent
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.proverAgent.replicas }}
selector:
matchLabels:
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: prover-agent
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: prover-agent
spec:
initContainers:
- name: wait-for-prover-node
image: {{ .Values.images.curl.image }}
command:
- /bin/sh
- -c
- |
until curl -s -X POST "$PROVER_JOB_SOURCE_URL/status"; do
echo "Waiting for Prover node $PROVER_JOB_SOURCE_URL ..."
sleep 5
done
echo "Prover node is ready!"
{{- if .Values.telemetry.enabled }}
until curl --head --silent {{ include "aztec-network.otelCollectorMetricsEndpoint" . }} > /dev/null; do
echo "Waiting for OpenTelemetry collector..."
sleep 5
done
echo "OpenTelemetry collector is ready!"
{{- end }}
env:
- name: PROVER_JOB_SOURCE_URL
value: http://{{ include "aztec-network.fullname" . }}-prover-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.proverNode.service.nodePort }}
containers:
- name: prover-agent
image: "{{ .Values.images.aztec.image }}"
imagePullPolicy: {{ .Values.images.aztec.pullPolicy }}
command:
- "/bin/bash"
- "-c"
- "node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover"
env:
- name: LOG_LEVEL
value: "{{ .Values.proverAgent.logLevel }}"
- name: LOG_JSON
value: "1"
- name: DEBUG
value: "{{ .Values.proverAgent.debug }}"
- name: PROVER_REAL_PROOFS
value: "{{ .Values.proverAgent.realProofs }}"
- name: PROVER_JOB_SOURCE_URL
value: http://{{ include "aztec-network.fullname" . }}-prover-node.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.proverNode.service.nodePort }}
- name: PROVER_AGENT_ENABLED
value: "true"
- name: PROVER_AGENT_CONCURRENCY
value: {{ .Values.proverAgent.concurrency | quote }}
- name: HARDWARE_CONCURRENCY
value: {{ .Values.proverAgent.bb.hardwareConcurrency | quote }}
- name: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
value: {{ include "aztec-network.otelCollectorMetricsEndpoint" . | quote }}
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
value: {{ include "aztec-network.otelCollectorTracesEndpoint" . | quote }}
{{- end }}
4 changes: 2 additions & 2 deletions spartan/aztec-network/templates/prover-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
command:
- "/bin/bash"
- "-c"
- "source /shared/contracts.env && env && node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-node --prover --archiver"
- "source /shared/contracts.env && env && node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --prover-node --archiver"
volumeMounts:
- name: shared-volume
mountPath: /shared
Expand Down Expand Up @@ -163,4 +163,4 @@ spec:
- port: {{ .Values.proverNode.service.nodePort }}
name: node
{{ end }}
{{ end }}
{{ end }}
4 changes: 3 additions & 1 deletion spartan/aztec-network/templates/pxe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ spec:
value: "{{ .Values.pxe.logLevel }}"
- name: DEBUG
value: "{{ .Values.pxe.debug }}"
- name: PXE_PROVER_ENABLED
value: "{{ .Values.pxe.proverEnabled }}"
ports:
- name: http
containerPort: {{ .Values.pxe.service.port }}
Expand Down Expand Up @@ -119,4 +121,4 @@ spec:
nodePort: {{ .Values.pxe.service.nodePort }}
{{- end }}
{{ end }}
{{- end }}
{{- end }}
22 changes: 18 additions & 4 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bootNode:
p2pUdpPort: 40400
nodePort: 8080
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
coinbaseAddress: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
sequencer:
maxSecondsBetweenBlocks: 0
Expand Down Expand Up @@ -67,7 +67,7 @@ validator:
p2pUdpPort: 40400
nodePort: 8080
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
sequencer:
maxSecondsBetweenBlocks: 0
minTxsPerBlock: 1
Expand All @@ -88,9 +88,9 @@ proverNode:
service:
nodePort: 8080
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
realProofs: false
proverAgentEnabled: true
proverAgentEnabled: false
resources:
requests:
memory: "2Gi"
Expand All @@ -102,6 +102,7 @@ pxe:
externalHost: ""
logLevel: "debug"
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*"
proverEnable: false
replicas: 1
service:
port: 8080
Expand Down Expand Up @@ -176,3 +177,16 @@ ethereum:
memory: "2Gi"
cpu: "200m"
storage: "8Gi"

proverAgent:
enabled: true
replicas: 1
debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*"
realProofs: false
concurrency: 1
bb:
hardwareConcurrency: ""

jobs:
deployL1Verifier:
enable: false
37 changes: 37 additions & 0 deletions spartan/aztec-network/values/1-validator-with-proving.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
validator:
replicas: 1
validatorKeys:
- 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
validatorAddresses:
- 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
validator:
disabled: false

bootNode:
validator:
disabled: true

proverNode:
realProofs: true

proverAgent:
replicas: 6
realProofs: true
bb:
hardwareConcurrency: 16

pxe:
proverEnabled: true

bot:
enabled: true
pxeProverEnabled: true
txIntervalSeconds: 200

jobs:
deployL1Verifier:
enable: true

telemetry:
enabled: true
otelCollectorEndpoint: http://metrics-opentelemetry-collector.metrics:4318
1 change: 0 additions & 1 deletion spartan/aztec-network/values/1-validators.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
validator:
debug: "aztec:*,-aztec:avm_simulator:*,-aztec:libp2p_service"
replicas: 1
validatorKeys:
- 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/bot/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const botConfigMappings: ConfigMappingsType<BotConfig> = {
description: 'Which chain the bot follows',
defaultValue: 'NONE',
parseEnv(val) {
if (!botFollowChain.includes(val as any)) {
if (!(botFollowChain as readonly string[]).includes(val.toUpperCase())) {
throw new Error(`Invalid value for BOT_FOLLOW_CHAIN: ${val}`);
}
return val as BotFollowChain;
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export const INITIALIZATION_SLOT_SEPARATOR = 1000000000;
export const INITIAL_L2_BLOCK_NUM = 1;
export const BLOB_SIZE_IN_BYTES = 126976;
export const ETHEREUM_SLOT_DURATION = 12;
export const AZTEC_SLOT_DURATION = 24;
export const AZTEC_EPOCH_DURATION = 16;
export const AZTEC_SLOT_DURATION = 36;
export const AZTEC_EPOCH_DURATION = 32;
export const AZTEC_TARGET_COMMITTEE_SIZE = 48;
export const AZTEC_EPOCH_PROOF_CLAIM_WINDOW_IN_L2_SLOTS = 13;
export const GENESIS_ARCHIVE_ROOT = 8142738430000951296386584486068033372964809139261822027365426310856631083550n;
Expand Down Expand Up @@ -204,8 +204,8 @@ export const VM_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2374;
export const KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 664;
export const CONSTANT_ROLLUP_DATA_LENGTH = 13;
export const BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 30;
export const BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 60;
export const ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 44;
export const BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 92;
export const ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH = 76;
export const GET_NOTES_ORACLE_RETURN_LENGTH = 674;
export const NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP = 2048;
export const NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
Expand Down
Loading
Loading