File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -236,12 +236,9 @@ contract ScrollChain is OwnableUpgradeable, IScrollChain {
236
236
// check whether the batch is empty
237
237
require (_batch.blocks.length > 0 , "Batch is empty " );
238
238
239
- uint64 accTotalL1Messages;
240
- if (! _isGenesis) {
241
- BatchStored storage _parentBatch = batches[_batch.parentBatchHash];
242
- require (_parentBatch.newStateRoot != bytes32 (0 ), "Parent batch is not committed " );
243
- accTotalL1Messages = _parentBatch.totalL1Messages;
244
- }
239
+ BatchStored storage _parentBatch = batches[_batch.parentBatchHash];
240
+ require (_parentBatch.newStateRoot == _batch.prevStateRoot, "prevStateRoot is different from newStateRoot in the parent batch " );
241
+ uint64 accTotalL1Messages = _parentBatch.totalL1Messages;
245
242
246
243
bytes32 publicInputHash;
247
244
uint64 numTransactionsInBatch;
@@ -253,7 +250,6 @@ contract ScrollChain is OwnableUpgradeable, IScrollChain {
253
250
254
251
BatchStored storage _batchInStorage = batches[publicInputHash];
255
252
256
- // @todo maybe add parent batch check later.
257
253
require (_batchInStorage.newStateRoot == bytes32 (0 ), "Batch already commited " );
258
254
_batchInStorage.newStateRoot = _batch.newStateRoot;
259
255
_batchInStorage.withdrawTrieRoot = _batch.withdrawTrieRoot;
You can’t perform that action at this time.
0 commit comments