Skip to content

Commit 186c7e8

Browse files
committed
fix: map L1ToL2MessageBundle messages to a fixed-length Noir array
The generated L1ToL2MessageBundle.messages type is a fixed-length (1024) array, but the bundle's messages field is a plain Fr[], so mapFieldArrayToNoir inferred length `number` and tsc rejected it (TS2322) at the six block-root mapper call sites. Pass MAX_L1_TO_L2_MSGS_PER_BLOCK explicitly to produce the fixed length.
1 parent 4b8a585 commit 186c7e8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • yarn-project/noir-protocol-circuits-types/src/conversion

yarn-project/noir-protocol-circuits-types/src/conversion/server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
1313
FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH,
1414
MAX_CHECKPOINTS_PER_EPOCH,
15+
MAX_L1_TO_L2_MSGS_PER_BLOCK,
1516
type NULLIFIER_TREE_HEIGHT,
1617
ULTRA_VK_LENGTH_IN_FIELDS,
1718
} from '@aztec/constants';
@@ -831,7 +832,9 @@ export function mapRevertCodeToNoir(revertCode: RevertCode): NoirField {
831832

832833
function mapL1ToL2MessageBundleToNoir(bundle: L1ToL2MessageBundle) {
833834
return {
834-
messages: mapFieldArrayToNoir(bundle.messages),
835+
// `messages` is a plain `Fr[]` (padded to the cap) rather than a fixed tuple, so pass the length explicitly to
836+
// get the fixed-length `FixedLengthArray` the generated `L1ToL2MessageBundle.messages` type requires.
837+
messages: mapFieldArrayToNoir(bundle.messages, MAX_L1_TO_L2_MSGS_PER_BLOCK),
835838
num_msgs: mapNumberToNoir(bundle.numMsgs),
836839
num_real_msgs: mapNumberToNoir(bundle.numRealMsgs),
837840
};

0 commit comments

Comments
 (0)