Skip to content

Commit

Permalink
chore: Delete ContractData
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Mar 15, 2024
1 parent 2917f85 commit d0a19da
Show file tree
Hide file tree
Showing 28 changed files with 73 additions and 252 deletions.
32 changes: 6 additions & 26 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
ContractData,
ContractDataSource,
GetUnencryptedLogsResponse,
L1ToL2Message,
L1ToL2MessageSource,
Expand All @@ -25,7 +23,12 @@ import { DebugLogger, createDebugLogger } from '@aztec/foundation/log';
import { RunningPromise } from '@aztec/foundation/running-promise';
import { RollupAbi } from '@aztec/l1-artifacts';
import { ClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer';
import { ContractClassPublic, ContractInstanceWithAddress, PublicFunction } from '@aztec/types/contracts';
import {
ContractClassPublic,
ContractDataSource,
ContractInstanceWithAddress,
PublicFunction,
} from '@aztec/types/contracts';

import { Chain, HttpTransport, PublicClient, createPublicClient, getAddress, getContract, http } from 'viem';

Expand Down Expand Up @@ -423,29 +426,6 @@ export class Archiver implements ArchiveSource {
return this.store.getSettledTxReceipt(txHash);
}

/**
* Lookup the contract data for this contract.
* Contains contract address & the ethereum portal address.
* @param contractAddress - The contract data address.
* @returns ContractData with the portal address (if we didn't throw an error).
*/
public getContractData(contractAddress: AztecAddress): Promise<ContractData | undefined> {
return this.makeContractDataFor(contractAddress);
}

/**
* Temporary method for creating a fake contract data out of classes and instances registered in the node.
* Used as a fallback if the extended contract data is not found.
*/
private async makeContractDataFor(address: AztecAddress): Promise<ContractData | undefined> {
const instance = await this.store.getContractInstance(address);
if (!instance) {
return undefined;
}

return new ContractData(address, instance.portalContractAddress);
}

/**
* Gets the public function data for a contract.
* @param address - The contract address containing the function to fetch.
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/archiver/src/rpc/archiver_client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ContractData,
ExtendedUnencryptedL2Log,
L1ToL2Message,
L2Block,
Expand All @@ -16,7 +15,6 @@ export const createArchiverClient = (url: string, fetch = makeFetch([1, 2, 3], t
createJsonRpcClient<ArchiveSource>(
url,
{
ContractData,
EthAddress,
ExtendedUnencryptedL2Log,
Fr,
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/archiver/src/rpc/archiver_server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ContractData,
ExtendedUnencryptedL2Log,
L1ToL2Message,
L2Block,
Expand All @@ -22,7 +21,6 @@ export function createArchiverRpcServer(archiverService: Archiver): JsonRpcServe
return new JsonRpcServer(
archiverService,
{
ContractData,
EthAddress,
ExtendedUnencryptedL2Log,
Fr,
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/aztec-node/src/aztec-node/http_rpc_server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
AztecNode,
ContractData,
ExtendedUnencryptedL2Log,
L1ToL2MessageAndIndex,
L2Block,
Expand Down Expand Up @@ -31,7 +30,6 @@ export function createAztecNodeRpcServer(node: AztecNode) {
AztecAddress,
EthAddress,
ExtendedUnencryptedL2Log,
ContractData,
Fr,
FunctionSelector,
Header,
Expand Down
14 changes: 1 addition & 13 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ArchiveSource, Archiver, KVArchiverDataStore, createArchiverClient } from '@aztec/archiver';
import {
AztecNode,
ContractData,
ContractDataSource,
GetUnencryptedLogsResponse,
L1ToL2MessageAndIndex,
L1ToL2MessageSource,
Expand Down Expand Up @@ -54,7 +52,7 @@ import {
getGlobalVariableBuilder,
partitionReverts,
} from '@aztec/sequencer-client';
import { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/types/contracts';
import { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/types/contracts';
import {
MerkleTrees,
ServerWorldStateSynchronizer,
Expand Down Expand Up @@ -231,16 +229,6 @@ export class AztecNodeService implements AztecNode {
return Promise.resolve(this.chainId);
}

/**
* Lookup the contract data for this contract.
* Contains the ethereum portal address .
* @param contractAddress - The contract data address.
* @returns The contract's address & portal address.
*/
public async getContractData(contractAddress: AztecAddress): Promise<ContractData | undefined> {
return await this.contractDataSource.getContractData(contractAddress);
}

public getContractClass(id: Fr): Promise<ContractClassPublic | undefined> {
return this.contractDataSource.getContractClass(id);
}
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/aztec.js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export {
AztecAddressLike,
FunctionSelectorLike,
WrappedFieldLike,
isContractDeployed,
EthCheatCodes,
computeAuthWitMessageHash,
computeInnerAuthWitHash,
Expand Down Expand Up @@ -83,7 +82,6 @@ export {
AztecNode,
Body,
CompleteAddress,
ContractData,
DeployedContract,
ExtendedNote,
FunctionCall,
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/aztec.js/src/rpc_clients/pxe_client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
AuthWitness,
ContractData,
ExtendedNote,
ExtendedUnencryptedL2Log,
L2Block,
Expand Down Expand Up @@ -39,7 +38,6 @@ export const createPXEClient = (url: string, fetch = makeFetch([1, 2, 3], false)
AuthWitness,
AztecAddress,
CompleteAddress,
ContractData,
FunctionSelector,
EthAddress,
ExtendedNote,
Expand Down
1 change: 0 additions & 1 deletion yarn-project/aztec.js/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './pub_key.js';
export * from './l1_contracts.js';
export * from './l2_contracts.js';
export * from './abi_types.js';
export * from './cheat_codes.js';
export * from './authwit.js';
Expand Down
12 changes: 0 additions & 12 deletions yarn-project/aztec.js/src/utils/l2_contracts.ts

This file was deleted.

4 changes: 0 additions & 4 deletions yarn-project/aztec.js/src/wallet/base_wallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
AuthWitness,
ContractData,
DeployedContract,
ExtendedNote,
FunctionCall,
Expand Down Expand Up @@ -102,9 +101,6 @@ export abstract class BaseWallet implements Wallet {
viewTx(functionName: string, args: any[], to: AztecAddress, from?: AztecAddress | undefined): Promise<any> {
return this.pxe.viewTx(functionName, args, to, from);
}
getContractData(contractAddress: AztecAddress): Promise<ContractData | undefined> {
return this.pxe.getContractData(contractAddress);
}
getUnencryptedLogs(filter: LogFilter): Promise<GetUnencryptedLogsResponse> {
return this.pxe.getUnencryptedLogs(filter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { EthAddress } from '@aztec/foundation/eth-address';
import { Fr } from '@aztec/foundation/fields';
import { createJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rpc/client';

import { ContractData } from '../../contract_data.js';
import { AztecNode } from '../../interfaces/aztec-node.js';
import { NullifierMembershipWitness } from '../../interfaces/nullifier_tree.js';
import { L1ToL2MessageAndIndex } from '../../l1_to_l2_message.js';
Expand All @@ -28,7 +27,6 @@ export function createAztecNodeClient(url: string, fetch = defaultFetch): AztecN
AztecAddress,
EthAddress,
ExtendedUnencryptedL2Log,
ContractData,
Fr,
EventSelector,
FunctionSelector,
Expand Down
17 changes: 0 additions & 17 deletions yarn-project/circuit-types/src/contract_data.test.ts

This file was deleted.

119 changes: 0 additions & 119 deletions yarn-project/circuit-types/src/contract_data.ts

This file was deleted.

1 change: 0 additions & 1 deletion yarn-project/circuit-types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './contract_data.js';
export * from './function_call.js';
export * from './keys/index.js';
export * from './notes/index.js';
Expand Down
9 changes: 0 additions & 9 deletions yarn-project/circuit-types/src/interfaces/aztec-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { AztecAddress } from '@aztec/foundation/aztec-address';
import { Fr } from '@aztec/foundation/fields';
import { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/types/contracts';

import { ContractData } from '../contract_data.js';
import { L1ToL2MessageAndIndex } from '../l1_to_l2_message.js';
import { L2Block } from '../l2_block.js';
import { GetUnencryptedLogsResponse, L2BlockL2Logs, LogFilter, LogType } from '../logs/index.js';
Expand Down Expand Up @@ -194,14 +193,6 @@ export interface AztecNode {
*/
getL1ContractAddresses(): Promise<L1ContractAddresses>;

/**
* Lookup the contract data for this contract.
* Contains the ethereum portal address .
* @param contractAddress - The contract data address.
* @returns The contract's address & portal address.
*/
getContractData(contractAddress: AztecAddress): Promise<ContractData | undefined>;

/**
* Gets up to `limit` amount of logs starting from `from`.
* @param from - Number of the L2 block to which corresponds the first logs to be returned.
Expand Down
Loading

0 comments on commit d0a19da

Please sign in to comment.