diff --git a/spartan/scripts/upgrade_rollup_with_lock.sh b/spartan/scripts/upgrade_rollup_with_lock.sh index e2fb15a34817..4de73750ad33 100755 --- a/spartan/scripts/upgrade_rollup_with_lock.sh +++ b/spartan/scripts/upgrade_rollup_with_lock.sh @@ -20,7 +20,9 @@ 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. @@ -28,6 +30,8 @@ set -exu # - 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 @@ -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="" @@ -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 @@ -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 @@ -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') diff --git a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts index 9f96d5877e36..30d693f23ed0 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts @@ -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, diff --git a/yarn-project/cli/src/cmds/l1/deploy_new_rollup.ts b/yarn-project/cli/src/cmds/l1/deploy_new_rollup.ts index 13b6f5f97ebe..08e4b44cfebb 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_new_rollup.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_new_rollup.ts @@ -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, @@ -15,6 +16,7 @@ export async function deployNewRollup( mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, + sponsoredFPC: boolean, json: boolean, initialValidators: EthAddress[], log: LogFn, @@ -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, diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index b792415807d4..74106953dee4 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -83,6 +83,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger .option('--salt ', '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'); @@ -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,