diff --git a/yarn-project/simulator/src/client/client_execution_context.ts b/yarn-project/simulator/src/client/client_execution_context.ts index 161a4f06c53..ab66af72af1 100644 --- a/yarn-project/simulator/src/client/client_execution_context.ts +++ b/yarn-project/simulator/src/client/client_execution_context.ts @@ -21,7 +21,7 @@ import { type TxContext, } from '@aztec/circuits.js'; import { Aes128 } from '@aztec/circuits.js/barretenberg'; -import { computePublicDataTreeLeafSlot, computeUniqueNoteHash, siloNoteHash } from '@aztec/circuits.js/hash'; +import { computeUniqueNoteHash, siloNoteHash } from '@aztec/circuits.js/hash'; import { type FunctionAbi, type FunctionArtifact, countArgumentsSize } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { pedersenHash } from '@aztec/foundation/crypto'; @@ -676,20 +676,13 @@ export class ClientExecutionContext extends ViewDataOracle { * @param numberOfElements - Number of elements to read from the starting storage slot. */ public override async storageRead(startStorageSlot: Fr, numberOfElements: number): Promise { - // TODO(#4320): This is a hack to work around not having directly access to the public data tree but - // still having access to the witnesses - const bn = await this.db.getBlockNumber(); - const values = []; for (let i = 0n; i < numberOfElements; i++) { const storageSlot = new Fr(startStorageSlot.value + i); - const leafSlot = computePublicDataTreeLeafSlot(this.callContext.storageContractAddress, storageSlot); - const witness = await this.db.getPublicDataTreeWitness(bn, leafSlot); - if (!witness) { - throw new Error(`No witness for slot ${storageSlot.toString()}`); - } - const value = witness.leafPreimage.value; + + const value = await this.aztecNode.getPublicStorageAt(this.callContext.storageContractAddress, storageSlot); this.log.debug(`Oracle storage read: slot=${storageSlot.toString()} value=${value}`); + values.push(value); } return values;