diff --git a/yarn-project/types/src/l2_block.ts b/yarn-project/types/src/l2_block.ts index 380cb789c794..8df578bd6d0c 100644 --- a/yarn-project/types/src/l2_block.ts +++ b/yarn-project/types/src/l2_block.ts @@ -705,30 +705,24 @@ export class L2Block { ); } - const newCommitments = this.newCommitments.slice( - MAX_NEW_COMMITMENTS_PER_TX * txIndex, - MAX_NEW_COMMITMENTS_PER_TX * (txIndex + 1), - ); - const newNullifiers = this.newNullifiers.slice( - MAX_NEW_NULLIFIERS_PER_TX * txIndex, - MAX_NEW_NULLIFIERS_PER_TX * (txIndex + 1), - ); - const newPublicDataWrites = this.newPublicDataWrites.slice( - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * txIndex, - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * (txIndex + 1), - ); - const newL2ToL1Msgs = this.newL2ToL1Msgs.slice( - MAX_NEW_L2_TO_L1_MSGS_PER_TX * txIndex, - MAX_NEW_L2_TO_L1_MSGS_PER_TX * (txIndex + 1), - ); - const newContracts = this.newContracts.slice( - MAX_NEW_CONTRACTS_PER_TX * txIndex, - MAX_NEW_CONTRACTS_PER_TX * (txIndex + 1), - ); - const newContractData = this.newContractData.slice( - MAX_NEW_CONTRACTS_PER_TX * txIndex, - MAX_NEW_CONTRACTS_PER_TX * (txIndex + 1), - ); + const newCommitments = this.newCommitments + .slice(MAX_NEW_COMMITMENTS_PER_TX * txIndex, MAX_NEW_COMMITMENTS_PER_TX * (txIndex + 1)) + .filter(x => !x.isZero()); + const newNullifiers = this.newNullifiers + .slice(MAX_NEW_NULLIFIERS_PER_TX * txIndex, MAX_NEW_NULLIFIERS_PER_TX * (txIndex + 1)) + .filter(x => !x.isZero()); + const newPublicDataWrites = this.newPublicDataWrites + .slice(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * txIndex, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * (txIndex + 1)) + .filter(x => !x.isEmpty()); + const newL2ToL1Msgs = this.newL2ToL1Msgs + .slice(MAX_NEW_L2_TO_L1_MSGS_PER_TX * txIndex, MAX_NEW_L2_TO_L1_MSGS_PER_TX * (txIndex + 1)) + .filter(x => !x.isZero()); + const newContracts = this.newContracts + .slice(MAX_NEW_CONTRACTS_PER_TX * txIndex, MAX_NEW_CONTRACTS_PER_TX * (txIndex + 1)) + .filter(x => !x.isZero()); + const newContractData = this.newContractData + .slice(MAX_NEW_CONTRACTS_PER_TX * txIndex, MAX_NEW_CONTRACTS_PER_TX * (txIndex + 1)) + .filter(x => !x.isEmpty()); return new L2Tx( newCommitments,