Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
import { type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
import { type ViemPublicClient, createEthereumChain, fallback } from '@aztec/ethereum';
import type { EthAddress } from '@aztec/foundation/eth-address';
import { Fr } from '@aztec/foundation/fields';
import { type Logger, createLogger } from '@aztec/foundation/log';
Expand Down Expand Up @@ -55,7 +55,7 @@ import { Attributes, type TelemetryClient, type Traceable, type Tracer, trackSpa

import { EventEmitter } from 'events';
import groupBy from 'lodash.groupby';
import { type GetContractReturnType, createPublicClient, fallback, getContract, http } from 'viem';
import { type GetContractReturnType, createPublicClient, getContract, http } from 'viem';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's add a rule to eslint so we don't accidentally import viem's fallback instead of our own: https://eslint.org/docs/latest/rules/no-restricted-imports#importnames


import type { ArchiverDataStore, ArchiverL1SynchPoint } from './archiver_store.js';
import type { ArchiverConfig } from './config.js';
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/aztec-faucet/src/faucet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ViemPublicClient, type ViemWalletClient, createEthereumChain } from '@aztec/ethereum';
import { type ViemPublicClient, type ViemWalletClient, createEthereumChain, fallback } from '@aztec/ethereum';
import type { EthAddress } from '@aztec/foundation/eth-address';
import { createLogger } from '@aztec/foundation/log';
import { TestERC20Abi } from '@aztec/l1-artifacts';
Expand All @@ -12,7 +12,6 @@ import {
type WalletClient,
createPublicClient,
createWalletClient,
fallback,
getContract,
parseEther,
http as viemHttp,
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/api/ethereum/cheat_codes.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { ViemPublicClient } from '@aztec/ethereum';
import { type ViemPublicClient, fallback } from '@aztec/ethereum';
import { EthCheatCodes } from '@aztec/ethereum/eth-cheatcodes';
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
import { EthAddress } from '@aztec/foundation/eth-address';
import { createLogger } from '@aztec/foundation/log';
import { RollupAbi } from '@aztec/l1-artifacts';

import { type GetContractReturnType, type Hex, createPublicClient, fallback, getContract, http, keccak256 } from 'viem';
import { type GetContractReturnType, type Hex, createPublicClient, getContract, http, keccak256 } from 'viem';
import { foundry } from 'viem/chains';

export { EthCheatCodes };
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/aztec/src/sandbox/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
NULL_KEY,
createEthereumChain,
deployL1Contracts,
fallback,
getL1ContractsConfigEnvVars,
waitForPublicClient,
} from '@aztec/ethereum';
Expand All @@ -27,7 +28,7 @@ import {
} from '@aztec/telemetry-client';
import { getGenesisValues } from '@aztec/world-state/testing';

import { type HDAccount, type PrivateKeyAccount, createPublicClient, fallback, http as httpViemTransport } from 'viem';
import { type HDAccount, type PrivateKeyAccount, createPublicClient, http as httpViemTransport } from 'viem';
import { mnemonicToAccount } from 'viem/accounts';
import { foundry } from 'viem/chains';

Expand Down
1 change: 1 addition & 0 deletions yarn-project/blob-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
},
"dependencies": {
"@aztec/blob-lib": "workspace:^",
"@aztec/ethereum": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/kv-store": "workspace:*",
"@aztec/stdlib": "workspace:^",
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/blob-sink/src/client/http.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Blob, BlobDeserializationError, type BlobJson } from '@aztec/blob-lib';
import { fallback } from '@aztec/ethereum';
import { type Logger, createLogger } from '@aztec/foundation/log';
import { makeBackoff, retry } from '@aztec/foundation/retry';

import { type RpcBlock, createPublicClient, fallback, http } from 'viem';
import { type RpcBlock, createPublicClient, http } from 'viem';

import { outboundTransform } from '../encoding/index.js';
import { type BlobSinkConfig, getBlobSinkConfigFromEnv } from './config.js';
Expand Down
3 changes: 3 additions & 0 deletions yarn-project/blob-sink/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
{
"path": "../blob-lib"
},
{
"path": "../ethereum"
},
{
"path": "../foundation"
},
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/cli/src/cmds/infrastructure/sequencers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createCompatibleClient } from '@aztec/aztec.js';
import { createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
import { createEthereumChain, fallback, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
import type { LogFn, Logger } from '@aztec/foundation/log';
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';

import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
import { createPublicClient, createWalletClient, getContract, http } from 'viem';
import { mnemonicToAccount } from 'viem/accounts';

export async function sequencers(opts: {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/cli/src/cmds/l1/get_l1_addresses.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EthAddress } from '@aztec/aztec.js';
import { RegistryContract, type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
import { RegistryContract, type ViemPublicClient, createEthereumChain, fallback } from '@aztec/ethereum';
import type { LogFn } from '@aztec/foundation/log';

import { createPublicClient, fallback, http } from 'viem';
import { createPublicClient, http } from 'viem';

export async function getL1Addresses(
registryAddress: EthAddress,
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/cli/src/cmds/l1/get_l1_balance.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createEthereumChain } from '@aztec/ethereum';
import { createEthereumChain, fallback } from '@aztec/ethereum';
import type { EthAddress } from '@aztec/foundation/eth-address';
import type { LogFn } from '@aztec/foundation/log';
import { TestERC20Abi } from '@aztec/l1-artifacts';

import { createPublicClient, fallback, getContract, http } from 'viem';
import { createPublicClient, getContract, http } from 'viem';

import { prettyPrintJSON } from '../../utils/commands.js';

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/cli/src/cmds/l1/prover_stats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { retrieveL2ProofVerifiedEvents } from '@aztec/archiver';
import { type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
import { type ViemPublicClient, createEthereumChain, fallback } from '@aztec/ethereum';
import { compactArray, mapValues, unique } from '@aztec/foundation/collection';
import { EthAddress } from '@aztec/foundation/eth-address';
import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log';
Expand All @@ -8,7 +8,7 @@ import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';

import chunk from 'lodash.chunk';
import groupBy from 'lodash.groupby';
import { createPublicClient, fallback, getAbiItem, getAddress, http } from 'viem';
import { createPublicClient, getAbiItem, getAddress, http } from 'viem';

export async function proverStats(opts: {
l1RpcUrls: string[];
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/cli/src/cmds/l1/update_l1_validators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
EthCheatCodes,
createEthereumChain,
fallback,
getExpectedAddress,
getL1ContractsConfigEnvVars,
isAnvilTestChain,
Expand All @@ -9,7 +10,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
import type { LogFn, Logger } from '@aztec/foundation/log';
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';

import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
import { createPublicClient, createWalletClient, getContract, http } from 'viem';
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';

export interface RollupCommandArgs {
Expand Down
10 changes: 5 additions & 5 deletions yarn-project/end-to-end/src/spartan/4epochs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('token transfer test', () => {

let testWallets: TestWallets;
let PXE_URL: string;
let ETHEREUM_HOSTS: string;
let ETHEREUM_HOSTS: string[];
const forwardProcesses: ChildProcess[] = [];

beforeAll(async () => {
Expand All @@ -47,12 +47,12 @@ describe('token transfer test', () => {
containerPort: config.CONTAINER_ETHEREUM_PORT,
});
forwardProcesses.push(ethProcess);
ETHEREUM_HOSTS = `http://127.0.0.1:${ethPort}`;
ETHEREUM_HOSTS = [`http://127.0.0.1:${ethPort}`];
} else {
if (!config.ETHEREUM_HOSTS) {
throw new Error('ETHEREUM_HOSTS must be set for sepolia runs');
}
ETHEREUM_HOSTS = config.ETHEREUM_HOSTS;
ETHEREUM_HOSTS = config.ETHEREUM_HOSTS.split(',');
}

const { process: sequencerProcess, port: sequencerPort } = await startPortForward({
Expand All @@ -75,7 +75,7 @@ describe('token transfer test', () => {
);
} else {
PXE_URL = config.PXE_URL;
ETHEREUM_HOSTS = config.ETHEREUM_HOSTS;
ETHEREUM_HOSTS = config.ETHEREUM_HOSTS.split(',');
testWallets = await setupTestWalletsWithTokens(PXE_URL, MINT_AMOUNT, logger);
}

Expand All @@ -94,7 +94,7 @@ describe('token transfer test', () => {
});

it('transfer tokens for 4 epochs', async () => {
const ethCheatCodes = new EthCheatCodesWithState([ETHEREUM_HOSTS]);
const ethCheatCodes = new EthCheatCodesWithState(ETHEREUM_HOSTS);
const l1ContractAddresses = await testWallets.pxe.getNodeInfo().then(n => n.l1ContractAddresses);
// Get 4 epochs
const rollupCheatCodes = new RollupCheatCodes(ethCheatCodes, l1ContractAddresses);
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/end-to-end/src/spartan/setup_test_wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function setupTestWalletsWithTokens(
export async function deployTestWalletWithTokens(
pxeUrl: string,
nodeUrl: string,
l1RpcUrl: string,
l1RpcUrls: string[],
mnemonicOrPrivateKey: string,
mintAmount: bigint,
logger: Logger,
Expand All @@ -71,7 +71,7 @@ export async function deployTestWalletWithTokens(

const claims = await Promise.all(
fundedAccounts.map(a =>
bridgeL1FeeJuice(l1RpcUrl, mnemonicOrPrivateKey, pxe, a.getAddress(), initialFeeJuice, logger),
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), initialFeeJuice, logger),
),
);

Expand All @@ -97,15 +97,15 @@ export async function deployTestWalletWithTokens(
}

async function bridgeL1FeeJuice(
l1RpcUrl: string,
l1RpcUrls: string[],
mnemonicOrPrivateKey: string,
pxe: PXE,
recipient: AztecAddress,
amount: bigint,
log: Logger,
) {
const { l1ChainId } = await pxe.getNodeInfo();
const chain = createEthereumChain([l1RpcUrl], l1ChainId);
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);

const portal = await L1FeeJuicePortalManager.new(pxe, publicClient, walletClient, log);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/spartan/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('token transfer test', () => {

let testWallets: TestWallets;
let PXE_URL: string;
let ETHEREUM_HOSTS: string;
let ETHEREUM_HOSTS: string[];
const forwardProcesses: ChildProcess[] = [];

afterAll(() => {
Expand All @@ -43,7 +43,7 @@ describe('token transfer test', () => {
containerPort: config.CONTAINER_ETHEREUM_PORT,
});
forwardProcesses.push(ethProcess);
ETHEREUM_HOSTS = `http://127.0.0.1:${ethPort}`;
ETHEREUM_HOSTS = [`http://127.0.0.1:${ethPort}`];

const { process: sequencerProcess, port: sequencerPort } = await startPortForward({
resource: `svc/${config.INSTANCE_NAME}-aztec-network-validator`,
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/epoch-cache/src/epoch_cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RollupContract, createEthereumChain } from '@aztec/ethereum';
import { RollupContract, createEthereumChain, fallback } from '@aztec/ethereum';
import { EthAddress } from '@aztec/foundation/eth-address';
import { type Logger, createLogger } from '@aztec/foundation/log';
import { DateProvider } from '@aztec/foundation/timer';
Expand All @@ -10,7 +10,7 @@ import {
} from '@aztec/stdlib/epoch-helpers';

import { EventEmitter } from 'node:events';
import { createPublicClient, encodeAbiParameters, fallback, http, keccak256 } from 'viem';
import { createPublicClient, encodeAbiParameters, http, keccak256 } from 'viem';

import { type EpochCacheConfig, getEpochCacheConfigEnvVars } from './config.js';

Expand Down
3 changes: 2 additions & 1 deletion yarn-project/ethereum/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { Logger } from '@aztec/foundation/log';
import { retryUntil } from '@aztec/foundation/retry';

import { createPublicClient, fallback, http } from 'viem';
import { createPublicClient, http } from 'viem';

import { createEthereumChain } from './chain.js';
import { fallback } from './fallback_transport.js';
import type { ViemPublicClient } from './types.js';

type Config = {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
createPublicClient,
createWalletClient,
encodeDeployData,
fallback,
getAddress,
getContract,
getContractAddress,
Expand All @@ -59,6 +58,7 @@ import { isAnvilTestChain } from './chain.js';
import type { L1ContractsConfig } from './config.js';
import { RegistryContract } from './contracts/registry.js';
import { RollupContract } from './contracts/rollup.js';
import { fallback } from './fallback_transport.js';
import type { L1ContractAddresses } from './l1_contract_addresses.js';
import { L1TxUtils, type L1TxUtilsConfig, defaultL1TxUtilsConfig } from './l1_tx_utils.js';
import type { L1Clients, ViemPublicClient, ViemWalletClient } from './types.js';
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/ethereum/src/eth_cheat_codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { keccak256 } from '@aztec/foundation/crypto';
import type { EthAddress } from '@aztec/foundation/eth-address';
import { createLogger } from '@aztec/foundation/log';

import { type Hex, createPublicClient, fallback, http } from 'viem';
import { type Hex, createPublicClient, http } from 'viem';

import { fallback } from './fallback_transport.js';
import type { ViemPublicClient } from './types.js';

/**
Expand Down
Loading