Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Apr 2, 2024
1 parent 5259848 commit 2d73273
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
import { computePublicDataTreeLeafSlot } from '@aztec/circuits.js/hash';
import { type L1ContractAddresses, createEthereumChain } from '@aztec/ethereum';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { padArrayEnd } from '@aztec/foundation/collection';
import { createDebugLogger } from '@aztec/foundation/log';
import { type AztecKVStore } from '@aztec/kv-store';
import { AztecLmdbStore } from '@aztec/kv-store/lmdb';
Expand Down Expand Up @@ -451,11 +452,9 @@ export class AztecNodeService implements AztecNode {
throw new Error('Block is not defined');
}

const l2ToL1Messages = block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs);

if (l2ToL1Messages.length !== L2_TO_L1_MESSAGE_LENGTH * block.body.txEffects.length) {
throw new Error('L2 to L1 Messages are not padded');
}
const l2ToL1Messages = block.body.txEffects.flatMap(txEffect =>
padArrayEnd(txEffect.l2ToL1Msgs, Fr.ZERO, L2_TO_L1_MESSAGE_LENGTH),
);

const indexOfL2ToL1Message = BigInt(
l2ToL1Messages.findIndex(l2ToL1MessageInBlock => l2ToL1MessageInBlock.equals(l2ToL1Message)),
Expand Down

0 comments on commit 2d73273

Please sign in to comment.