From ebc5db6ffe97f7003376d406420703849a9aec93 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 9 Dec 2022 20:53:33 +0800 Subject: [PATCH] feat: allow txList with zero byte --- packages/protocol/contracts/L1/v1/V1Proposing.sol | 2 +- packages/protocol/contracts/libs/LibInvalidTxList.sol | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/protocol/contracts/L1/v1/V1Proposing.sol b/packages/protocol/contracts/L1/v1/V1Proposing.sol index 6add00c3b10..0ef68db1b5d 100644 --- a/packages/protocol/contracts/L1/v1/V1Proposing.sol +++ b/packages/protocol/contracts/L1/v1/V1Proposing.sol @@ -77,7 +77,7 @@ library V1Proposing { bytes calldata txList = inputs[1]; // perform validation and populate some fields require( - txList.length > 0 && + txList.length >= 0 && txList.length <= LibConstants.K_TXLIST_MAX_BYTES && meta.txListHash == txList.hashTxList(), "L1:txList" diff --git a/packages/protocol/contracts/libs/LibInvalidTxList.sol b/packages/protocol/contracts/libs/LibInvalidTxList.sol index 40d31051297..162dbcf3834 100644 --- a/packages/protocol/contracts/libs/LibInvalidTxList.sol +++ b/packages/protocol/contracts/libs/LibInvalidTxList.sol @@ -53,6 +53,10 @@ library LibInvalidTxList { Reason hint, uint256 txIdx ) internal pure returns (Reason) { + if (encoded.length == 0) { + return Reason.OK; + } + if (encoded.length > LibConstants.K_TXLIST_MAX_BYTES) { return Reason.BINARY_TOO_LARGE; }