Skip to content

Commit

Permalink
[skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
just-mitch committed May 27, 2024
1 parent f67d6f3 commit f779eda
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export class PublicAccumulatedData {
/**
* All the public data update requests made in this transaction.
*/
public publicDataUpdateRequests: Tuple<PublicDataUpdateRequest, typeof MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>,
public readonly publicDataUpdateRequests: Tuple<
PublicDataUpdateRequest,
typeof MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
>,
/**
* Current public call stack.
*/
Expand Down
20 changes: 0 additions & 20 deletions yarn-project/simulator/src/public/abstract_phase_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import {
type PublicExecutor,
accumulateReturnValues,
collectPublicDataReads,
collectPublicDataUpdateRequests,
isPublicExecutionResult,
} from '@aztec/simulator';
import { type MerkleTreeOperations } from '@aztec/world-state';
Expand Down Expand Up @@ -511,9 +510,6 @@ export abstract class AbstractPhaseManager {
publicInputs: PublicKernelCircuitPublicInputs,
execResult: PublicExecutionResult,
) {
const { publicDataUpdateRequests } = PhaseIsRevertible[this.phase]
? publicInputs.end
: publicInputs.endNonRevertibleData;
const { publicDataReads } = publicInputs.validationRequests;

// Convert ContractStorage* objects to PublicData* objects and sort them in execution order.
Expand All @@ -522,13 +518,9 @@ export abstract class AbstractPhaseManager {

const simPublicDataReads = collectPublicDataReads(execResult);

const simPublicDataUpdateRequests = collectPublicDataUpdateRequests(execResult);

// We only want to reorder the items from the public inputs of the
// most recently processed top/enqueued call.

const effectSet = PhaseIsRevertible[this.phase] ? 'end' : 'endNonRevertibleData';

const numReadsInKernel = arrayNonEmptyLength(publicDataReads, f => f.isEmpty());
const numReadsBeforeThisEnqueuedCall = numReadsInKernel - simPublicDataReads.length;
publicInputs.validationRequests.publicDataReads = padArrayEnd(
Expand All @@ -540,18 +532,6 @@ export abstract class AbstractPhaseManager {
PublicDataRead.empty(),
MAX_PUBLIC_DATA_READS_PER_TX,
);

const numUpdatesInKernel = arrayNonEmptyLength(publicDataUpdateRequests, f => f.isEmpty());
const numUpdatesBeforeThisEnqueuedCall = numUpdatesInKernel - simPublicDataUpdateRequests.length;

publicInputs[effectSet].publicDataUpdateRequests = padArrayEnd(
[
...publicInputs[effectSet].publicDataUpdateRequests.slice(0, numUpdatesBeforeThisEnqueuedCall),
...simPublicDataUpdateRequests,
],
PublicDataUpdateRequest.empty(),
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
);
}
}

Expand Down
6 changes: 3 additions & 3 deletions yarn-project/simulator/src/public/public_processor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,13 +973,13 @@ describe('public_processor', () => {
const txEffect = toTxEffect(processed[0], GasFees.default());
expect(arrayNonEmptyLength(txEffect.publicDataWrites, PublicDataWrite.isEmpty)).toEqual(3);
expect(txEffect.publicDataWrites[0]).toEqual(
new PublicDataWrite(computePublicDataTreeLeafSlot(baseContractAddress, contractSlotC), fr(0x201)),
new PublicDataWrite(computePublicDataTreeLeafSlot(baseContractAddress, contractSlotB), fr(0x152)),
);
expect(txEffect.publicDataWrites[1]).toEqual(
new PublicDataWrite(computePublicDataTreeLeafSlot(baseContractAddress, contractSlotA), fr(0x103)),
new PublicDataWrite(computePublicDataTreeLeafSlot(baseContractAddress, contractSlotA), fr(0x102)),
);
expect(txEffect.publicDataWrites[2]).toEqual(
new PublicDataWrite(computePublicDataTreeLeafSlot(baseContractAddress, contractSlotB), fr(0x152)),
new PublicDataWrite(computePublicDataTreeLeafSlot(baseContractAddress, contractSlotC), fr(0x201)),
);
expect(txEffect.encryptedLogs.getTotalLogCount()).toBe(0);
expect(txEffect.unencryptedLogs.getTotalLogCount()).toBe(0);
Expand Down

0 comments on commit f779eda

Please sign in to comment.