Skip to content

Commit

Permalink
fix: remove fundFpc step from bootstrap (#8245)
Browse files Browse the repository at this point in the history
  • Loading branch information
spypsy authored Aug 28, 2024
1 parent aa6791d commit a742531
Showing 1 changed file with 48 additions and 46 deletions.
94 changes: 48 additions & 46 deletions yarn-project/cli/src/cmds/devnet/bootstrap_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { type DebugLogger, type LogFn } from '@aztec/foundation/log';
import { getContract } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';

import { FeeJuicePortalManager } from '../../utils/portal_manager.js';
// import { FeeJuicePortalManager } from '../../utils/portal_manager.js';

type ContractDeploymentInfo = {
address: AztecAddress;
Expand Down Expand Up @@ -52,7 +52,8 @@ export async function bootstrapNetwork(
const fpc = await deployFPC(wallet, token.address);

const counter = await deployCounter(wallet);
await fundFPC(counter.address, wallet, l1Clients, fpc.address, debugLog);
// NOTE: Disabling for now in order to get devnet running
// await fundFPC(counter.address, wallet, l1Clients, fpc.address, debugLog);

if (json) {
log(
Expand Down Expand Up @@ -215,47 +216,48 @@ async function deployCounter(wallet: Wallet): Promise<ContractDeploymentInfo> {
return info;
}

async function fundFPC(
counterAddress: AztecAddress,
wallet: Wallet,
l1Clients: L1Clients,
fpcAddress: AztecAddress,
debugLog: DebugLogger,
) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
const { FeeJuiceContract, CounterContract } = await import('@aztec/noir-contracts.js');
const {
protocolContractAddresses: { feeJuice },
} = await wallet.getPXEInfo();

const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);

const feeJuicePortal = await FeeJuicePortalManager.new(
wallet,
l1Clients.publicClient,
l1Clients.walletClient,
debugLog,
);

const amount = 10n ** 21n;
const { claimAmount, claimSecret } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, amount, true);

const counter = await CounterContract.at(counterAddress, wallet);

// TODO (alexg) remove this once sequencer builds blocks continuously
// advance the chain
await counter.methods
.increment(wallet.getAddress(), wallet.getAddress())
.send()
.wait({ proven: true, provenTimeout: 600 });
await counter.methods
.increment(wallet.getAddress(), wallet.getAddress())
.send()
.wait({ proven: true, provenTimeout: 600 });

await feeJuiceContract.methods
.claim(fpcAddress, claimAmount, claimSecret)
.send()
.wait({ proven: true, provenTimeout: 600 });
}
// NOTE: Disabling for now in order to get devnet running
// async function fundFPC(
// counterAddress: AztecAddress,
// wallet: Wallet,
// l1Clients: L1Clients,
// fpcAddress: AztecAddress,
// debugLog: DebugLogger,
// ) {
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
// const { FeeJuiceContract, CounterContract } = await import('@aztec/noir-contracts.js');
// const {
// protocolContractAddresses: { feeJuice },
// } = await wallet.getPXEInfo();

// const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);

// const feeJuicePortal = await FeeJuicePortalManager.new(
// wallet,
// l1Clients.publicClient,
// l1Clients.walletClient,
// debugLog,
// );

// const amount = 10n ** 21n;
// const { claimAmount, claimSecret } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, amount, true);

// const counter = await CounterContract.at(counterAddress, wallet);

// // TODO (alexg) remove this once sequencer builds blocks continuously
// // advance the chain
// await counter.methods
// .increment(wallet.getAddress(), wallet.getAddress())
// .send()
// .wait({ proven: true, provenTimeout: 600 });
// await counter.methods
// .increment(wallet.getAddress(), wallet.getAddress())
// .send()
// .wait({ proven: true, provenTimeout: 600 });

// await feeJuiceContract.methods
// .claim(fpcAddress, claimAmount, claimSecret)
// .send()
// .wait({ proven: true, provenTimeout: 600 });
// }

0 comments on commit a742531

Please sign in to comment.