From f6f95f7c5ef656f19ba7d6bb2134be43ab6207da Mon Sep 17 00:00:00 2001 From: David Date: Fri, 9 Dec 2022 21:06:07 +0800 Subject: [PATCH] feat: allow txList with zero byte --- packages/protocol/contracts/L1/v1/V1Proposing.sol | 2 +- packages/protocol/contracts/libs/LibTxDecoder.sol | 3 +++ 2 files changed, 4 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/LibTxDecoder.sol b/packages/protocol/contracts/libs/LibTxDecoder.sol index a6c0d6e5db2..9dff797f56a 100644 --- a/packages/protocol/contracts/libs/LibTxDecoder.sol +++ b/packages/protocol/contracts/libs/LibTxDecoder.sol @@ -78,6 +78,9 @@ library LibTxDecoder { function decodeTxList( bytes calldata encoded ) public pure returns (TxList memory txList) { + if (encoded.length == 0) { + return txList; + } LibRLPReader.RLPItem[] memory txs = LibRLPReader.readList(encoded); Tx[] memory _txList = new Tx[](txs.length);