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
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ cp ~/.svm/0.8.30/solc-0.8.30 ./solc-0.8.30
# Copy the HonkVerifier to the generated directory (required for build)
mkdir -p generated
cp src/HonkVerifier.sol generated/HonkVerifier.sol
echo '{}' > generated/default.json

# Remove zkpassport-dependent files (not needed for rollup deployment)
rm -f src/mock/StakingAssetHandler.sol
Expand Down
1 change: 1 addition & 0 deletions l1-contracts/.rebuild_patterns
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
^l1-contracts/foundry.lock
^l1-contracts/package.json
^l1-contracts/scripts/forge_broadcast.js
^l1-contracts/scripts/network-defaults.json
^l1-contracts/l1-artifacts/scripts/.*
^l1-contracts/l1-artifacts/package.json
^l1-contracts/l1-artifacts/tsconfig.json
3 changes: 0 additions & 3 deletions l1-contracts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ function build_verifier {
if ! cache_download $artifact; then
mkdir -p generated

# Generate network defaults from spartan (canonical source of truth for config values)
yq -o json 'explode(.) | ."l1-contracts" // {}' ../spartan/environments/network-defaults.yml > generated/default.json

# Copy from noir-projects. Bootstrap must have ran in noir-projects.
local rollup_verifier_path=../noir-projects/noir-protocol-circuits/target/keys/rollup_root_verifier.sol
if [ -f "$rollup_verifier_path" ]; then
Expand Down
4 changes: 2 additions & 2 deletions l1-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ fs_permissions = [
{ access = "read", path = "./test/fixtures/boosted_rewards/shares.json" },
{ access = "read", path = "./test/fixtures/boosted_rewards/activity_scores.json" },
{ access = "read", path = "./script/registration_data.json" },
# Network defaults - copied from spartan/environments/default.json by bootstrap.sh
{ access = "read", path = "./generated/default.json" }
# Network defaults - the canonical L1 contract config values (source of truth).
{ access = "read", path = "./scripts/network-defaults.json" }
]
no_match_contract = "(ScreamAndShoutTest|UniswapPortalTest|MerkleCheck)"

Expand Down
1 change: 1 addition & 0 deletions l1-contracts/l1-artifacts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"type": "module",
"exports": {
"./network-defaults.json": "./l1-contracts/scripts/network-defaults.json",
"./*": "./dest/*.js",
".": "./dest/index.js"
},
Expand Down
4 changes: 3 additions & 1 deletion l1-contracts/l1-artifacts/scripts/copy-foundry-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ mkdir -p "l1-contracts/test/script"
cp -p "$src/test/shouting.t.sol" "l1-contracts/test/"
cp -p "$src"/test/script/*.sol "l1-contracts/test/script/"
cp -p "$src"/{foundry.toml,foundry.lock,package.json,solc-*} "l1-contracts/"
# Copy the forge broadcast wrapper (now a plain .js source file).
# Copy the forge broadcast wrapper (now a plain .js source file) and the network defaults
# (read at deploy time via foundry fs_permissions / vm.readFile).
mkdir -p "l1-contracts/scripts"
cp -p "$src/scripts/forge_broadcast.js" "l1-contracts/scripts/"
cp -p "$src/scripts/network-defaults.json" "l1-contracts/scripts/"
abs_dest=$(pwd)/l1-contracts
# Keep only the foundry relevant files from lib
(cd "$src" && find lib \( -name "*.sol" -o -name "remappings.txt" -o -name "foundry.toml" \) -exec cp --parents -t "$abs_dest" {} +)
Expand Down
12 changes: 6 additions & 6 deletions l1-contracts/script/deploy/RollupConfiguration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ contract RollupConfiguration is IRollupConfiguration, Test {

function getStakingQueueConfiguration() external view returns (StakingQueueConfig memory) {
return StakingQueueConfig({
bootstrapValidatorSetSize: vm.envOr("AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE", uint256(0)),
bootstrapFlushSize: vm.envOr("AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE", uint256(0)),
normalFlushSizeMin: vm.envOr("AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN", uint256(48)),
normalFlushSizeQuotient: vm.envOr("AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT", uint256(2)),
maxQueueFlushSize: vm.envOr("AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE", uint256(48))
bootstrapValidatorSetSize: vm.envUint("AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE"),
bootstrapFlushSize: vm.envUint("AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE"),
normalFlushSizeMin: vm.envUint("AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN"),
normalFlushSizeQuotient: vm.envUint("AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT"),
maxQueueFlushSize: vm.envUint("AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE")
});
}

Expand Down Expand Up @@ -118,7 +118,7 @@ contract RollupConfiguration is IRollupConfiguration, Test {
config.slashingExecutionDelayInRounds = vm.envUint("AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS");
config.slashAmounts = _getSlashAmounts();
config.slashingOffsetInRounds = _getSlashingOffset();
config.slasherEnabled = vm.envOr("AZTEC_SLASHER_ENABLED", true);
config.slasherEnabled = vm.envBool("AZTEC_SLASHER_ENABLED");
config.slashingVetoer = vm.envAddress("AZTEC_SLASHING_VETOER");
config.slashingDisableDuration = vm.envUint("AZTEC_SLASHING_DISABLE_DURATION");
config.manaTarget = vm.envUint("AZTEC_MANA_TARGET");
Expand Down
21 changes: 7 additions & 14 deletions l1-contracts/scripts/load_network_defaults.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

# Load L1 contract defaults from network-defaults.yml for a given network.
# Exports AZTEC_* and ETHEREUM_* env vars with YAML anchor inheritance resolved.
# Load the canonical L1 contract defaults from network-defaults.json.
# Exports every key in the file as an env var (all AZTEC_* / ETHEREUM_*).
#
# Usage:
# source ./scripts/load_network_defaults.sh <network>
#
# Networks: mainnet, testnet, devnet
# source ./scripts/load_network_defaults.sh

network="${1:?Usage: $0 <network>}"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
network_defaults="${script_dir}/../../spartan/environments/network-defaults.yml"
network_defaults="${script_dir}/network-defaults.json"

if [[ ! -f "$network_defaults" ]]; then
echo "ERROR: network-defaults.yml not found at $network_defaults" >&2
echo "ERROR: network-defaults.json not found at $network_defaults" >&2
exit 1
fi

# explode(.) resolves YAML anchors (<<: *prodlike inheritance)
# Output as props, filter comments, normalize spacing
# jq preserves large integer literals verbatim (e.g. 100000000000000000000), which vm.envUint requires.
while IFS='=' read -r key value; do
export "$key"="$value"
done < <(yq -o=props "explode(.) | .networks.$network | with_entries(select(.key | test(\"^AZTEC_|^ETHEREUM_\")))" "$network_defaults" \
| grep -v '^#' \
| grep -v '^$' \
| sed 's/ = /=/')
done < <(jq -r 'to_entries[] | "\(.key)=\(.value)"' "$network_defaults")
34 changes: 34 additions & 0 deletions l1-contracts/scripts/network-defaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"ETHEREUM_SLOT_DURATION": 12,
"AZTEC_SLOT_DURATION": 72,
"AZTEC_EPOCH_DURATION": 32,
"AZTEC_TARGET_COMMITTEE_SIZE": 48,
"AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET": 2,
"AZTEC_LAG_IN_EPOCHS_FOR_RANDAO": 2,
"AZTEC_ACTIVATION_THRESHOLD": 100000000000000000000,
"AZTEC_EJECTION_THRESHOLD": 50000000000000000000,
"AZTEC_LOCAL_EJECTION_THRESHOLD": 98000000000000000000,
"AZTEC_EXIT_DELAY_SECONDS": 172800,
"AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE": 0,
"AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE": 0,
"AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN": 48,
"AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT": 2,
"AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE": 48,
"AZTEC_INBOX_LAG": 1,
"AZTEC_PROOF_SUBMISSION_EPOCHS": 1,
"AZTEC_MANA_TARGET": 100000000,
"AZTEC_PROVING_COST_PER_MANA": 100,
"AZTEC_INITIAL_ETH_PER_FEE_ASSET": 10000000,
"AZTEC_SLASHER_ENABLED": true,
"AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS": 4,
"AZTEC_SLASHING_QUORUM": 65,
"AZTEC_SLASHING_LIFETIME_IN_ROUNDS": 5,
"AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS": 0,
"AZTEC_SLASHING_OFFSET_IN_ROUNDS": 2,
"AZTEC_SLASHING_VETOER": "0x0000000000000000000000000000000000000000",
"AZTEC_SLASHING_DISABLE_DURATION": 432000,
"AZTEC_SLASH_AMOUNT_SMALL": 10000000000000000000,
"AZTEC_SLASH_AMOUNT_MEDIUM": 20000000000000000000,
"AZTEC_SLASH_AMOUNT_LARGE": 50000000000000000000,
"AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE": 300
}
2 changes: 1 addition & 1 deletion l1-contracts/scripts/stress_test_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mkdir -p "$RESULTS_DIR"
echo "=== Stress test: $TOTAL_RUNS runs across $WORKERS workers ==="
echo "=== Results dir: $RESULTS_DIR ==="

source ./scripts/load_network_defaults.sh devnet
source ./scripts/load_network_defaults.sh

PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"

Expand Down
6 changes: 3 additions & 3 deletions l1-contracts/scripts/test_rollup_upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

# Test rollup upgrade deployment on local anvil with devnet defaults.
# Test rollup upgrade deployment on local anvil with the base l1-contracts defaults.

cd "$(dirname "$0")/.."

echo "=== Loading devnet defaults ==="
source ./scripts/load_network_defaults.sh devnet
echo "=== Loading L1 contract defaults ==="
source ./scripts/load_network_defaults.sh

cleanup() {
if [[ -n "${anvil_pid:-}" ]]; then
Expand Down
19 changes: 16 additions & 3 deletions l1-contracts/test/script/DeployAztecL1Contracts.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ contract DeployAztecL1ContractsTest is Test {
return vm.envOr("FORGE_COVERAGE", false);
}

// Load environment variables from generated/default.json
// This file is copied from spartan/environments/default.json by bootstrap.sh
// Load environment variables from scripts/network-defaults.json (the canonical L1 config defaults).
function setUp() public skipWhenCoverage {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/generated/default.json");
string memory path = string.concat(root, "/scripts/network-defaults.json");
string memory json = vm.readFile(path);

// Timing config
Expand All @@ -43,6 +42,20 @@ contract DeployAztecL1ContractsTest is Test {
vm.setEnv("AZTEC_LOCAL_EJECTION_THRESHOLD", json.readString(".AZTEC_LOCAL_EJECTION_THRESHOLD"));
vm.setEnv("AZTEC_EXIT_DELAY_SECONDS", vm.toString(json.readUint(".AZTEC_EXIT_DELAY_SECONDS")));

// Entry queue config
vm.setEnv(
"AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE",
vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE"))
);
vm.setEnv(
"AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE"))
);
vm.setEnv("AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN")));
vm.setEnv(
"AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT"))
);
vm.setEnv("AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE")));

// Fees config
vm.setEnv("AZTEC_MANA_TARGET", vm.toString(json.readUint(".AZTEC_MANA_TARGET")));
vm.setEnv("AZTEC_PROVING_COST_PER_MANA", vm.toString(json.readUint(".AZTEC_PROVING_COST_PER_MANA")));
Expand Down
19 changes: 16 additions & 3 deletions l1-contracts/test/script/DeployRollupForUpgrade.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ contract DeployRollupForUpgradeTest is Test {
return vm.envOr("FORGE_COVERAGE", false);
}

// Load environment variables from generated/default.json
// This file is copied from spartan/environments/default.json by bootstrap.sh
// Load environment variables from scripts/network-defaults.json (the canonical L1 config defaults).
function setUp() public skipWhenCoverage {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/generated/default.json");
string memory path = string.concat(root, "/scripts/network-defaults.json");
string memory json = vm.readFile(path);

// Timing config
Expand All @@ -54,6 +53,20 @@ contract DeployRollupForUpgradeTest is Test {
vm.setEnv("AZTEC_LOCAL_EJECTION_THRESHOLD", json.readString(".AZTEC_LOCAL_EJECTION_THRESHOLD"));
vm.setEnv("AZTEC_EXIT_DELAY_SECONDS", vm.toString(json.readUint(".AZTEC_EXIT_DELAY_SECONDS")));

// Entry queue config
vm.setEnv(
"AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE",
vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE"))
);
vm.setEnv(
"AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE"))
);
vm.setEnv("AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN")));
vm.setEnv(
"AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT"))
);
vm.setEnv("AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE", vm.toString(json.readUint(".AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE")));

// Fees config
vm.setEnv("AZTEC_MANA_TARGET", vm.toString(json.readUint(".AZTEC_MANA_TARGET")));
vm.setEnv("AZTEC_PROVING_COST_PER_MANA", vm.toString(json.readUint(".AZTEC_PROVING_COST_PER_MANA")));
Expand Down
Loading
Loading