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
20 changes: 18 additions & 2 deletions spartan/scripts/upgrade_rollup_with_lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ set -exu
# --registry 0x29f815e32efdef19883cf2b92a766b7aebadd326 \
# --address 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 \
# --deposit-amount 200000000000000000000000 \
# --mint
# --mint \
# --test-accounts \
# --sponsored-fpc
#
# where:
# - aztec-docker-tag is the tag of the aztec docker image to use.
# - registry is the address of the registry contract.
# - address is the address that corresponds to whatever mnemonic/private key you are using.
# - deposit-amount is optional, and if provided, will deposit the specified amount of governance tokens to the address.
# - mint is optional, and if provided, will mint the governance tokens to the address before depositing.
# - test-accounts is optional, and if provided, will initialise the genesis state with funded test accounts.
# - sponsored-fpc is optional, and if provided, will initialise the genesis state with a funded FPC.
#
# It can also be used locally by providing an --aztec-bin argument to the path of the aztec binary.
# For example, --aztec-bin /usr/src/yarn-project/aztec/dest/bin/index.js
Expand All @@ -40,6 +44,8 @@ set -exu
# --address 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 \
# --deposit-amount 10000000000000000 \
# --mint
# --test-accounts \
# --sponsored-fpc

# First set from environment variables if they exist
DEPOSIT_AMOUNT=""
Expand All @@ -48,6 +54,8 @@ SALT=$((RANDOM % 1000000))
# The default path to the aztec binary within the docker image
AZTEC_BIN="/usr/src/yarn-project/aztec/dest/bin/index.js"
AZTEC_DOCKER_IMAGE=""
TEST_ACCOUNTS=""
SPONSORED_FPC=""

# Parse command line arguments (these will override env vars if provided)
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -80,6 +88,14 @@ while [[ $# -gt 0 ]]; do
MINT="--mint"
shift 1
;;
--test-accounts)
TEST_ACCOUNTS="--test-accounts"
shift 1
;;
--sponsored-fpc)
SPONSORED_FPC="--sponsored-fpc"
shift 1
;;
*)
echo "Unknown parameter: $1"
exit 1
Expand Down Expand Up @@ -126,7 +142,7 @@ if [ -n "$DEPOSIT_AMOUNT" ]; then
$EXE deposit-governance-tokens -r $REGISTRY --recipient $MY_ADDR -a $DEPOSIT_AMOUNT $MINT
fi

PAYLOAD=$($EXE deploy-new-rollup -r $REGISTRY --salt $SALT --json --test-accounts | jq -r '.payloadAddress')
PAYLOAD=$($EXE deploy-new-rollup -r $REGISTRY --salt $SALT --json $TEST_ACCOUNTS $SPONSORED_FPC | jq -r '.payloadAddress')

PROPOSAL_ID=$($EXE propose-with-lock -r $REGISTRY --payload-address $PAYLOAD --json | jq -r '.proposalId')

Expand Down
6 changes: 6 additions & 0 deletions yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export async function deployL1Contracts(
initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
);

log(`Deploying Aztec contracts to chain ${chainId}...`);
log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.address.toString()).join(', ')}`);
log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
log(`Genesis block hash: ${genesisBlockHash.toString()}`);
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);

const { l1ContractAddresses } = await deployAztecContracts(
rpcUrls,
chainId,
Expand Down
13 changes: 12 additions & 1 deletion yarn-project/cli/src/cmds/l1/deploy_new_rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
import { getGenesisValues } from '@aztec/world-state/testing';

import { deployNewRollupContracts } from '../../utils/aztec.js';
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';

export async function deployNewRollup(
registryAddress: EthAddress,
Expand All @@ -15,6 +16,7 @@ export async function deployNewRollup(
mnemonicIndex: number,
salt: number | undefined,
testAccounts: boolean,
sponsoredFPC: boolean,
json: boolean,
initialValidators: EthAddress[],
log: LogFn,
Expand All @@ -23,7 +25,16 @@ export async function deployNewRollup(
const config = getL1ContractsConfigEnvVars();

const initialFundedAccounts = testAccounts ? await getInitialTestAccounts() : [];
const { genesisBlockHash, genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
const { genesisBlockHash, genesisArchiveRoot } = await getGenesisValues(
initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
);

log(`Deploying new rollup contracts to chain ${chainId}...`);
log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.address.toString()).join(', ')}`);
log(`Initial validators: ${initialValidators.map(a => a.toString()).join(', ')}`);
log(`Genesis block hash: ${genesisBlockHash.toString()}`);
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);

const { payloadAddress, rollup } = await deployNewRollupContracts(
registryAddress,
Expand Down
2 changes: 2 additions & 0 deletions yarn-project/cli/src/cmds/l1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
.option('--json', 'Output the contract addresses in JSON format')
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
.action(async options => {
const { deployNewRollup } = await import('./deploy_new_rollup.js');

Expand All @@ -97,6 +98,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
options.mnemonicIndex,
options.salt,
options.testAccounts,
options.sponsoredFpc,
options.json,
initialValidators,
log,
Expand Down
Loading