diff --git a/yarn-project/end-to-end/src/e2e_block_building.test.ts b/yarn-project/end-to-end/src/e2e_block_building.test.ts index a9218ff6b1ac..cf2d21ee20d0 100644 --- a/yarn-project/end-to-end/src/e2e_block_building.test.ts +++ b/yarn-project/end-to-end/src/e2e_block_building.test.ts @@ -35,7 +35,6 @@ import { } from '@aztec/simulator/server'; import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client'; import { TX_ERROR_EXISTING_NULLIFIER, type Tx } from '@aztec/stdlib/tx'; -import type { TelemetryClient } from '@aztec/telemetry-client'; import { jest } from '@jest/globals'; import 'jest-extended'; @@ -644,15 +643,7 @@ class TestPublicProcessorFactory extends PublicProcessorFactory { globalVariables: GlobalVariables, doMerkleOperations: boolean, skipFeeEnforcement: boolean, - telemetryClient?: TelemetryClient, ) { - return new TestPublicTxSimulator( - treesDB, - contractsDB, - globalVariables, - doMerkleOperations, - skipFeeEnforcement, - telemetryClient, - ); + return new TestPublicTxSimulator(treesDB, contractsDB, globalVariables, doMerkleOperations, skipFeeEnforcement); } } diff --git a/yarn-project/simulator/src/public/public_db_sources.ts b/yarn-project/simulator/src/public/public_db_sources.ts index 9f2578d248e5..5b51e0ff97a7 100644 --- a/yarn-project/simulator/src/public/public_db_sources.ts +++ b/yarn-project/simulator/src/public/public_db_sources.ts @@ -393,7 +393,7 @@ class ForwardMerkleTree implements MerkleTreeWriteOperations { export class PublicTreesDB extends ForwardMerkleTree implements PublicStateDBInterface { private logger = createLogger('simulator:public-trees-db'); - constructor(private readonly db: MerkleTreeWriteOperations) { + constructor(db: MerkleTreeWriteOperations) { super(db); } diff --git a/yarn-project/simulator/src/public/public_processor/public_processor.ts b/yarn-project/simulator/src/public/public_processor/public_processor.ts index 7824781f37b2..ddbce629d9d6 100644 --- a/yarn-project/simulator/src/public/public_processor/public_processor.ts +++ b/yarn-project/simulator/src/public/public_processor/public_processor.ts @@ -67,7 +67,6 @@ export class PublicProcessorFactory { globalVariables, /*doMerkleOperations=*/ true, skipFeeEnforcement, - this.telemetryClient, ); return new PublicProcessor( @@ -86,7 +85,6 @@ export class PublicProcessorFactory { globalVariables: GlobalVariables, doMerkleOperations: boolean, skipFeeEnforcement: boolean, - telemetryClient: TelemetryClient, ): PublicTxSimulator { return new TelemetryPublicTxSimulator( treesDB, @@ -94,7 +92,7 @@ export class PublicProcessorFactory { globalVariables, doMerkleOperations, skipFeeEnforcement, - telemetryClient, + this.telemetryClient, ); } } diff --git a/yarn-project/txe/src/oracle/txe_oracle.ts b/yarn-project/txe/src/oracle/txe_oracle.ts index 31c7e6ad0fa5..ce8d0396bc78 100644 --- a/yarn-project/txe/src/oracle/txe_oracle.ts +++ b/yarn-project/txe/src/oracle/txe_oracle.ts @@ -46,6 +46,7 @@ import { createTxForPublicCalls } from '@aztec/simulator/public/fixtures'; import { ExecutionError, PublicContractsDB, + PublicTreesDB, type PublicTxResult, PublicTxSimulator, createSimulationError, @@ -112,7 +113,6 @@ import { ForkCheckpoint, NativeWorldStateService } from '@aztec/world-state/nati import { TXENode } from '../node/txe_node.js'; import { TXEAccountDataProvider } from '../util/txe_account_data_provider.js'; import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js'; -import { TXEPublicTreesDB } from '../util/txe_public_dbs.js'; export class TXE implements TypedOracle { private blockNumber = 1; @@ -945,7 +945,7 @@ export class TXE implements TypedOracle { // See note at revert below. const checkpoint = await ForkCheckpoint.new(db); try { - const treesDB = new TXEPublicTreesDB(db, this); + const treesDB = new PublicTreesDB(db); const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(this)); const simulator = new PublicTxSimulator(treesDB, contractsDB, globalVariables, /*doMerkleOperations=*/ true); diff --git a/yarn-project/txe/src/util/txe_public_dbs.ts b/yarn-project/txe/src/util/txe_public_dbs.ts deleted file mode 100644 index fc13e46c9809..000000000000 --- a/yarn-project/txe/src/util/txe_public_dbs.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Fr } from '@aztec/foundation/fields'; -import { PublicTreesDB } from '@aztec/simulator/server'; -import { PublicDataWrite } from '@aztec/stdlib/avm'; -import type { AztecAddress } from '@aztec/stdlib/aztec-address'; -import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash'; -import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server'; -import { MerkleTreeId, type PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees'; - -import type { TXE } from '../oracle/txe_oracle.js'; - -export class TXEPublicTreesDB extends PublicTreesDB { - constructor(private merkleDb: MerkleTreeWriteOperations, private txe: TXE) { - super(merkleDb); - } - - override async storageRead(contract: AztecAddress, slot: Fr): Promise { - const leafSlot = (await computePublicDataTreeLeafSlot(contract, slot)).toBigInt(); - - const lowLeafResult = await this.merkleDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot); - - let value = Fr.ZERO; - if (lowLeafResult && lowLeafResult.alreadyPresent) { - const preimage = (await this.merkleDb.getLeafPreimage( - MerkleTreeId.PUBLIC_DATA_TREE, - lowLeafResult.index, - )) as PublicDataTreeLeafPreimage; - value = preimage.leaf.value; - } - return value; - } - - override async storageWrite(contract: AztecAddress, slot: Fr, newValue: Fr): Promise { - await this.txe.addPublicDataWrites([ - new PublicDataWrite(await computePublicDataTreeLeafSlot(contract, slot), newValue), - ]); - } -}