Skip to content
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
10 changes: 5 additions & 5 deletions l1-contracts/src/governance/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ contract Governance is IGovernance {

configuration = DataStructures.Configuration({
proposeConfig: DataStructures.ProposeConfiguration({
lockDelay: Timestamp.wrap(3600),
lockDelay: Timestamp.wrap(60),
lockAmount: 1000e18
}),
votingDelay: Timestamp.wrap(3600),
votingDuration: Timestamp.wrap(3600),
executionDelay: Timestamp.wrap(3600),
gracePeriod: Timestamp.wrap(3600),
votingDelay: Timestamp.wrap(60),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there an issue for picking real values for these?

Copy link
Member

Choose a reason for hiding this comment

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

Was 60 picked to make the test work? I would prefer they default high but we adjust the slot in a test to a lower value

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As discussed offline, the 60 was picked just to make the test fast, and acknowledging that for the first few upgrades on testnet, aztec labs likely be using proposeWithLock and voting, so shorter times are preferable.

Ideally these are configurable in a constructor, similar to the governanceproposer.

votingDuration: Timestamp.wrap(60),
executionDelay: Timestamp.wrap(60),
gracePeriod: Timestamp.wrap(60),
quorum: 0.1e18,
voteDifferential: 0.04e18,
minimumVotes: 1000e18
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/src/governance/libraries/ConfigurationLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ library ConfigurationLib {

uint256 internal constant VOTES_LOWER = 1;

Timestamp internal constant TIME_LOWER = Timestamp.wrap(3600);
Timestamp internal constant TIME_LOWER = Timestamp.wrap(60);
Timestamp internal constant TIME_UPPER = Timestamp.wrap(30 * 24 * 3600);

function withdrawalDelay(DataStructures.Configuration storage _self)
Expand Down
1 change: 1 addition & 0 deletions l1-contracts/src/governance/libraries/DataStructures.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ library DataStructures {
uint256 nea;
}

// @notice if this changes, please update the enum in governance.ts
enum ProposalState {
Pending,
Active,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ contract FinaliseWithdrawTest is GovernanceBase {
uint256 withdrawalCount = governance.withdrawalCount();
for (uint256 i = 0; i < withdrawalCount; i++) {
DataStructures.Withdrawal memory withdrawal = governance.getWithdrawal(i);
if (Timestamp.unwrap(withdrawal.unlocksAt) <= block.timestamp) {
continue;
}
assertGt(withdrawal.unlocksAt, block.timestamp);

uint256 time =
Expand Down
6 changes: 5 additions & 1 deletion spartan/aztec-network/files/config/config-prover-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-no

echo "$output"

boot_node_enr=$(echo "$output" | grep -oP 'Node ENR: \Kenr:[a-zA-Z0-9\-\_\.]+')
boot_node_enr=""
if [ "$P2P_ENABLED" = "true" ]; then
# Only look for boot node ENR if P2P is enabled
boot_node_enr=$(echo "$output" | grep -oP 'Node ENR: \Kenr:[a-zA-Z0-9\-\_\.]+')
fi
rollup_address=$(echo "$output" | grep -oP 'Rollup Address: \K0x[a-fA-F0-9]{40}')
registry_address=$(echo "$output" | grep -oP 'Registry Address: \K0x[a-fA-F0-9]{40}')
inbox_address=$(echo "$output" | grep -oP 'L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}')
Expand Down
6 changes: 5 additions & 1 deletion spartan/aztec-network/files/config/config-validator-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ output=$(node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js get-no

echo "$output"

boot_node_enr=$(echo "$output" | grep -oP 'Node ENR: \Kenr:[a-zA-Z0-9\-\_\.]+')
boot_node_enr=""
if [ "$P2P_ENABLED" = "true" ]; then
# Only look for boot node ENR if P2P is enabled
boot_node_enr=$(echo "$output" | grep -oP 'Node ENR: \Kenr:[a-zA-Z0-9\-\_\.]+')
fi
rollup_address=$(echo "$output" | grep -oP 'Rollup Address: \K0x[a-fA-F0-9]{40}')
registry_address=$(echo "$output" | grep -oP 'Registry Address: \K0x[a-fA-F0-9]{40}')
inbox_address=$(echo "$output" | grep -oP 'L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}')
Expand Down
38 changes: 17 additions & 21 deletions spartan/aztec-network/files/config/deploy-l1-contracts.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/bash
set -exu

# If REGISTRY_CONTRACT_ADDRESS is already set, skip deployment and just write the file
if [ -n "${REGISTRY_CONTRACT_ADDRESS:-}" ]; then
echo "Registry address already set. Skipping deployment."
# Write the addresses to a file in the shared volume
cat <<EOF >/shared/contracts/contracts.env
export REGISTRY_CONTRACT_ADDRESS=$REGISTRY_CONTRACT_ADDRESS
EOF
cat /shared/contracts/contracts.env
exit 0
fi

SALT=${1:-$RANDOM}
CHAIN_ID=$2
VALIDATOR_ADDRESSES=$3
Expand All @@ -9,10 +20,15 @@ VALIDATOR_ADDRESSES=$3
output=""
MAX_RETRIES=5
RETRY_DELAY=15
TEST_ACCOUNTS=${TEST_ACCOUNTS:-false}
TEST_ACCOUNTS_ARG=""
if [ "$TEST_ACCOUNTS" = "true" ]; then
TEST_ACCOUNTS_ARG="--test-accounts"
fi

for attempt in $(seq 1 $MAX_RETRIES); do
# Construct base command
base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --test-accounts"
base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts $TEST_ACCOUNTS_ARG"

# Add account - use private key if set, otherwise use mnemonic
if [ -n "${L1_DEPLOYMENT_PRIVATE_KEY:-}" ]; then
Expand All @@ -38,32 +54,12 @@ done || {
echo "$output"

# Extract contract addresses using grep and regex
rollup_address=$(echo "$output" | grep -oP 'Rollup Address: \K0x[a-fA-F0-9]{40}')
registry_address=$(echo "$output" | grep -oP 'Registry Address: \K0x[a-fA-F0-9]{40}')
Copy link
Member

Choose a reason for hiding this comment

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

nice!

inbox_address=$(echo "$output" | grep -oP 'L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}')
outbox_address=$(echo "$output" | grep -oP 'L2 -> L1 Outbox Address: \K0x[a-fA-F0-9]{40}')
fee_juice_address=$(echo "$output" | grep -oP 'Fee Juice Address: \K0x[a-fA-F0-9]{40}')
staking_asset_address=$(echo "$output" | grep -oP 'Staking Asset Address: \K0x[a-fA-F0-9]{40}')
fee_juice_portal_address=$(echo "$output" | grep -oP 'Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}')
coin_issuer_address=$(echo "$output" | grep -oP 'CoinIssuer Address: \K0x[a-fA-F0-9]{40}')
reward_distributor_address=$(echo "$output" | grep -oP 'RewardDistributor Address: \K0x[a-fA-F0-9]{40}')
governance_proposer_address=$(echo "$output" | grep -oP 'GovernanceProposer Address: \K0x[a-fA-F0-9]{40}')
governance_address=$(echo "$output" | grep -oP 'Governance Address: \K0x[a-fA-F0-9]{40}')
slash_factory_address=$(echo "$output" | grep -oP 'SlashFactory Address: \K0x[a-fA-F0-9]{40}')

# Write the addresses to a file in the shared volume
cat <<EOF >/shared/contracts/contracts.env
export ROLLUP_CONTRACT_ADDRESS=$rollup_address
export REGISTRY_CONTRACT_ADDRESS=$registry_address
export INBOX_CONTRACT_ADDRESS=$inbox_address
export OUTBOX_CONTRACT_ADDRESS=$outbox_address
export FEE_JUICE_CONTRACT_ADDRESS=$fee_juice_address
export STAKING_ASSET_CONTRACT_ADDRESS=$staking_asset_address
export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$fee_juice_portal_address
export COIN_ISSUER_CONTRACT_ADDRESS=$coin_issuer_address
export REWARD_DISTRIBUTOR_CONTRACT_ADDRESS=$reward_distributor_address
export GOVERNANCE_PROPOSER_CONTRACT_ADDRESS=$governance_proposer_address
export GOVERNANCE_CONTRACT_ADDRESS=$governance_address
export SLASH_FACTORY_CONTRACT_ADDRESS=$slash_factory_address
EOF

Expand Down
38 changes: 6 additions & 32 deletions spartan/aztec-network/templates/boot-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ spec:
volumeMounts:
- name: config
mountPath: /shared/config
{{- if .Values.bootNode.deployContracts }}
- name: deploy-l1-contracts
{{- include "aztec-network.image" . | nindent 10 }}
command:
Expand All @@ -99,6 +98,10 @@ spec:
- name: scripts
mountPath: /scripts
env:
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: REGISTRY_CONTRACT_ADDRESS
value: "{{ .Values.bootNode.contracts.registryAddress }}"
- name: TELEMETRY
value: "{{ .Values.telemetry.enabled }}"
- name: INIT_VALIDATORS
Expand Down Expand Up @@ -133,7 +136,6 @@ spec:
fieldPath: metadata.namespace
- name: USE_GCLOUD_LOGGING
value: "{{ .Values.telemetry.useGcloudLogging }}"
{{- end }}
containers:
- name: boot-node
{{- include "aztec-network.image" . | nindent 10 }}
Expand Down Expand Up @@ -168,14 +170,8 @@ spec:
mountPath: /shared/config
- name: boot-node-data
mountPath: {{ .Values.bootNode.dataDir }}
{{- if .Values.bootNode.deployContracts }}
- name: scripts-output
mountPath: /shared/contracts
{{- else }}
- name: contracts-env
mountPath: /shared/contracts/contracts.env
subPath: contracts.env
{{- end }}
env:
- name: POD_IP
valueFrom:
Expand Down Expand Up @@ -253,6 +249,8 @@ spec:
value: "{{ .Values.telemetry.useGcloudLogging }}"
- name: OTEL_EXCLUDE_METRICS
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand All @@ -277,35 +275,11 @@ spec:
persistentVolumeClaim:
claimName: boot-node-data
{{- end }}
{{- if .Values.bootNode.deployContracts }}
- name: scripts
configMap:
name: {{ include "aztec-network.fullname" . }}-scripts
- name: scripts-output
emptyDir: {}
{{- else }}
- name: contracts-env
configMap:
name: {{ include "aztec-network.fullname" . }}-contracts-env
{{- end }}
{{- if not .Values.bootNode.deployContracts }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "aztec-network.fullname" . }}-contracts-env
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
data:
contracts.env: |
export ROLLUP_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.rollupAddress }}
export REGISTRY_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.registryAddress }}
export INBOX_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.inboxAddress }}
export OUTBOX_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.outboxAddress }}
export FEE_JUICE_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.feeJuiceAddress }}
export STAKING_ASSET_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.stakingAssetAddress }}
export FEE_JUICE_PORTAL_CONTRACT_ADDRESS={{ .Values.bootNode.contracts.feeJuicePortalAddress }}
{{- end }}
---
# Headless service for StatefulSet DNS entries
apiVersion: v1
Expand Down
5 changes: 5 additions & 0 deletions spartan/aztec-network/templates/prover-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ spec:
mountPath: /scripts
- name: config
mountPath: /shared/config
env:
- name: P2P_ENABLED
value: "{{ .Values.proverNode.p2p.enabled }}"

containers:
- name: prover-node
Expand Down Expand Up @@ -225,6 +228,8 @@ spec:
value: "{{ .Values.telemetry.useGcloudLogging }}"
- name: OTEL_EXCLUDE_METRICS
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/pxe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ spec:
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: L1_CHAIN_ID
value: "{{ .Values.ethereum.chainId }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
ports:
- name: http
containerPort: {{ .Values.pxe.service.nodePort }}
Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-network/templates/setup-l2-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
done
echo "PXE service is ready!"
set -e
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait
LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait
echo "L2 contracts initialized"
env:
- name: K8S_POD_UID
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/transaction-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ spec:
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: L1_CHAIN_ID
value: "{{ .Values.ethereum.chainId }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
ports:
- name: http
containerPort: {{ .Values.bot.service.nodePort }}
Expand Down
5 changes: 5 additions & 0 deletions spartan/aztec-network/templates/validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ spec:
mountPath: /scripts
- name: config
mountPath: /shared/config
env:
- name: P2P_ENABLED
value: "{{ .Values.validator.p2p.enabled }}"
containers:
- name: validator
{{- include "aztec-network.image" . | nindent 10 }}
Expand Down Expand Up @@ -237,6 +240,8 @@ spec:
value: "{{ .Values.telemetry.useGcloudLogging }}"
- name: OTEL_EXCLUDE_METRICS
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
Expand Down
3 changes: 2 additions & 1 deletion spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ aztec:
extraAccounts: 10

botKeyIndexStart: 3000
l1Salt: "" # leave empty for random salt
l1Salt: "42" # leave empty for random salt
testAccounts: true

bootNode:
peerIdPrivateKey: ""
Expand Down
2 changes: 2 additions & 0 deletions spartan/aztec-network/values/1-validators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ telemetry:

validator:
replicas: 1
sequencer:
minTxsPerBlock: 0
validator:
disabled: false

Expand Down
5 changes: 5 additions & 0 deletions spartan/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function test_cmds {
echo "$hash timeout -v 20m ./spartan/bootstrap.sh test-kind-transfer"
echo "$hash timeout -v 30m ./spartan/bootstrap.sh test-kind-4epochs"
echo "$hash timeout -v 30m ./spartan/bootstrap.sh test-kind-transfer-blob-with-sink"
echo "$hash timeout -v 30m ./spartan/bootstrap.sh test-kind-upgrade-rollup-version"
fi
}

Expand Down Expand Up @@ -129,6 +130,10 @@ case "$cmd" in
# export OVERRIDES="blobSink.enabled=true"
./bootstrap.sh test-kind-transfer
;;
"test-kind-upgrade-rollup-version")
export OVERRIDES="bot.enabled=false"
NAMESPACE=upgrade-rollup-version FRESH_INSTALL=${FRESH_INSTALL:-true} INSTALL_METRICS=false ./scripts/test_kind.sh src/spartan/upgrade_rollup_version.test.ts ci.yaml
;;
"test-local")
# Isolate network stack in docker.
docker_isolate ../scripts/run_native_testnet.sh -i -val 3
Expand Down
12 changes: 8 additions & 4 deletions spartan/scripts/deploy_kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# AZTEC_DOCKER_TAG (default: current git commit)
# INSTALL_TIMEOUT (default: 30m)
# OVERRIDES (default: "", no overrides)
#
# Note on OVERRIDES:
# You can use like OVERRIDES="replicas=3,resources.limits.cpu=1"

source $(git rev-parse --show-toplevel)/ci3/source

Expand All @@ -18,6 +21,7 @@ set -x
namespace="$1"
values_file="${2:-default.yaml}"
sepolia_deployment="${3:-false}"
helm_instance="${4:-spartan}"

# Default values for environment variables
chaos_values="${CHAOS_VALUES:-}"
Expand Down Expand Up @@ -90,9 +94,9 @@ fi

# Install the Helm chart
echo "Cleaning up any existing Helm releases..."
helm uninstall spartan -n "$namespace" 2>/dev/null || true
kubectl delete clusterrole spartan-aztec-network-node 2>/dev/null || true
kubectl delete clusterrolebinding spartan-aztec-network-node 2>/dev/null || true
helm uninstall "$helm_instance" -n "$namespace" 2>/dev/null || true
kubectl delete clusterrole "$helm_instance"-aztec-network-node 2>/dev/null || true
kubectl delete clusterrolebinding "$helm_instance"-aztec-network-node 2>/dev/null || true

helm_set_args=(
--set images.aztec.image="aztecprotocol/aztec:$aztec_docker_tag"
Expand All @@ -118,7 +122,7 @@ if [ "$sepolia_deployment" = "true" ]; then
set -x
fi

helm upgrade --install spartan ../aztec-network \
helm upgrade --install "$helm_instance" ../aztec-network \
--namespace "$namespace" \
--create-namespace \
"${helm_set_args[@]}" \
Expand Down
Loading
Loading