@@ -257,7 +257,7 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
257257 step <<= 1 ;
258258 }
259259 step >>= 1 ;
260- while (step > 1 ) {
260+ while (step > 0 ) {
261261 if (committedBatches[index + step] != bytes32 (0 )) {
262262 index += step;
263263 }
@@ -363,6 +363,11 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
363363 _totalL1MessagesPoppedOverallFirstBatch - l1MessagePoppedFirstBatch
364364 );
365365 }
366+
367+ // update lastCommittedBatchIndex
368+ unchecked {
369+ enforcedBatchParameters.lastCommittedBatchIndex = uint64 (_firstBatchIndex - 1 );
370+ }
366371 }
367372
368373 /// @inheritdoc IScrollChain
@@ -556,21 +561,14 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
556561 }
557562 }
558563
559- /// @dev Internal function to get the blob versioned hash.
564+ /// @dev Internal function to get and check the blob versioned hash.
565+ /// @param _blobDataProof The blob data proof passing to point evaluation precompile.
560566 /// @return _blobVersionedHash The retrieved blob versioned hash.
561- function _checkAndGetBlobVersionedHash (bytes calldata _blobDataProof )
567+ function _getAndCheckBlobVersionedHash (bytes calldata _blobDataProof )
562568 internal
563- virtual
564569 returns (bytes32 _blobVersionedHash )
565570 {
566- bytes32 _secondBlob;
567- // Get blob's versioned hash
568- assembly {
569- _blobVersionedHash := blobhash (0 )
570- _secondBlob := blobhash (1 )
571- }
572- if (_blobVersionedHash == bytes32 (0 )) revert ErrorNoBlobFound ();
573- if (_secondBlob != bytes32 (0 )) revert ErrorFoundMultipleBlobs ();
571+ _blobVersionedHash = _getBlobVersionedHash ();
574572
575573 // Calls the point evaluation precompile and verifies the output
576574 (bool success , bytes memory data ) = POINT_EVALUATION_PRECOMPILE_ADDR.staticcall (
@@ -583,6 +581,19 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
583581 if (result != BLS_MODULUS) revert ErrorUnexpectedPointEvaluationPrecompileOutput ();
584582 }
585583
584+ /// @dev Internal function to get the blob versioned hash.
585+ /// @return _blobVersionedHash The retrieved blob versioned hash.
586+ function _getBlobVersionedHash () internal virtual returns (bytes32 _blobVersionedHash ) {
587+ bytes32 _secondBlob;
588+ // Get blob's versioned hash
589+ assembly {
590+ _blobVersionedHash := blobhash (0 )
591+ _secondBlob := blobhash (1 )
592+ }
593+ if (_blobVersionedHash == bytes32 (0 )) revert ErrorNoBlobFound ();
594+ if (_secondBlob != bytes32 (0 )) revert ErrorFoundMultipleBlobs ();
595+ }
596+
586597 /// @dev Internal function to commit a batch.
587598 function _commitBatch (
588599 uint8 _version ,
@@ -639,7 +650,7 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
639650 BatchHeaderV0Codec.storeDataHash (batchPtr, _dataHash);
640651
641652 // verify blob versioned hash
642- BatchHeaderV1Codec.storeBlobVersionedHash (batchPtr, _checkAndGetBlobVersionedHash (_blobDataProof));
653+ BatchHeaderV1Codec.storeBlobVersionedHash (batchPtr, _getAndCheckBlobVersionedHash (_blobDataProof));
643654 BatchHeaderV1Codec.storeParentBatchHash (batchPtr, _parentBatchHash);
644655
645656 uint256 lastBlockTimestamp;
0 commit comments