Skip to content

Commit

Permalink
chore: Delete unused contract tree ts code
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Mar 14, 2024
1 parent f68ff28 commit 93227ae
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 252 deletions.
62 changes: 1 addition & 61 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ import { RunningPromise } from '@aztec/foundation/running-promise';
import { RollupAbi } from '@aztec/l1-artifacts';
import { ClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer';
import { InstanceDeployerAddress } from '@aztec/protocol-contracts/instance-deployer';
import {
ContractClass,
ContractClassPublic,
ContractInstance,
ContractInstanceWithAddress,
} from '@aztec/types/contracts';
import { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/types/contracts';

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

Expand Down Expand Up @@ -381,25 +376,6 @@ export class Archiver implements ArchiveSource {
}
}

/**
* Stores extended contract data as classes and instances.
* Temporary solution until we source this data from the contract class registerer and instance deployer.
* @param contracts - The extended contract data to be stored.
* @param l2BlockNum - The L2 block number to which the contract data corresponds.
* TODO(palla/purge-old-contract-deploy): Delete this method
*/
async storeContractDataAsClassesAndInstances(contracts: ExtendedContractData[], l2BlockNum: number) {
const classesAndInstances = contracts.map(extendedContractDataToContractClassAndInstance);
await this.store.addContractClasses(
classesAndInstances.map(([c, _]) => c),
l2BlockNum,
);
await this.store.addContractInstances(
classesAndInstances.map(([_, i]) => i),
l2BlockNum,
);
}

/**
* Stops the archiver.
* @returns A promise signalling completion of the stop process.
Expand Down Expand Up @@ -587,39 +563,3 @@ export class Archiver implements ArchiveSource {
return this.store.getContractClassIds();
}
}

/**
* Converts ExtendedContractData into contract classes and instances.
* Note that the conversion is not correct, since there is some data missing from the broadcasted ExtendedContractData.
* The archiver will trust the ids broadcasted instead of trying to recompute them.
* Eventually this function and ExtendedContractData altogether will be removed.
*/
function extendedContractDataToContractClassAndInstance(
data: ExtendedContractData,
): [ContractClassPublic, ContractInstanceWithAddress] {
const contractClass: ContractClass = {
version: 1,
artifactHash: Fr.ZERO,
publicFunctions: data.publicFunctions.map(f => ({
selector: f.selector,
bytecode: f.bytecode,
isInternal: f.isInternal,
})),
privateFunctions: [],
packedBytecode: data.bytecode,
};
const contractClassId = data.contractClassId;
const contractInstance: ContractInstance = {
version: 1,
salt: data.saltedInitializationHash,
contractClassId,
initializationHash: data.saltedInitializationHash,
portalContractAddress: data.contractData.portalContractAddress,
publicKeysHash: data.publicKeyHash,
};
const address = data.contractData.contractAddress;
return [
{ ...contractClass, id: contractClassId, privateFunctionsRoot: Fr.ZERO },
{ ...contractInstance, address },
];
}
2 changes: 1 addition & 1 deletion yarn-project/circuits.js/src/contract/contract_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ export function getContractClassFromArtifact(
* Returns zero for consistency with Noir.
*/
function getVerificationKeyHash(_verificationKeyInBase64: string) {
// return Fr.fromBuffer(hashVKStr(verificationKeyInBase64));
// return Fr.fromBuffer(hashVK(Buffer.from(verificationKeyInBase64, 'hex')));
return Fr.ZERO;
}
109 changes: 0 additions & 109 deletions yarn-project/circuits.js/src/contract/contract_tree/contract_tree.ts

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions yarn-project/circuits.js/src/contract/contract_tree/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion yarn-project/circuits.js/src/contract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ export * from './contract_class_id.js';
export * from './contract_class_registered_event.js';
export * from './contract_instance.js';
export * from './contract_instance_deployed_event.js';
export * from './contract_tree/index.js';
export * from './private_function.js';
export * from './public_bytecode.js';

0 comments on commit 93227ae

Please sign in to comment.