@@ -175,7 +175,6 @@ contract ScrollChainTest is DSTestPlus {
175175 rollup.commitBatchWithBlobProof (4 , batchHeader0, chunks, bitmap, new bytes (0 ));
176176 hevm.stopPrank ();
177177
178- // revert when ErrorNoBlobFound
179178 // revert when ErrorNoBlobFound
180179 chunk0 = new bytes (1 + 60 );
181180 chunk0[0 ] = bytes1 (uint8 (1 )); // one block in this chunk
@@ -554,7 +553,7 @@ contract ScrollChainTest is DSTestPlus {
554553 messageQueue.appendCrossDomainMessage (address (this ), 1000000 , new bytes (0 ));
555554 }
556555
557- (bytes memory batchHeader0 , bytes memory batchHeader1 , bytes memory batchHeader2 ) = _commitBatchV3 ();
556+ (, , bytes memory batchHeader2 ) = _commitBatchV3 ();
558557
559558 // 1 ~ 4, zero
560559 for (uint256 i = 1 ; i < 4 ; i++ ) {
@@ -654,10 +653,16 @@ contract ScrollChainTest is DSTestPlus {
654653 function testFinalizeEuclidInitialBatch () external {
655654 bytes [] memory headers = _prepareFinalizeBundle ();
656655
656+ // commit v5 batch
657657 assertEq (rollup.initialEuclidBatchIndex (), 0 );
658658 bytes memory v5Header = _commitBatch (5 , headers[10 ], 0 , 0 );
659659 assertEq (rollup.initialEuclidBatchIndex (), 11 );
660660
661+ // commit 3 v6 batches
662+ bytes memory v6Header1 = _commitBatch (6 , v5Header, 1 , 1 );
663+ bytes memory v6Header2 = _commitBatch (6 , v6Header1, 2 , 1 );
664+ bytes memory v6Header3 = _commitBatch (6 , v6Header2, 3 , 1 );
665+
661666 // revert when caller is not owner
662667 hevm.startPrank (address (1 ));
663668 hevm.expectRevert ("Ownable: caller is not the owner " );
@@ -679,16 +684,42 @@ contract ScrollChainTest is DSTestPlus {
679684 hevm.expectRevert (ScrollChain.ErrorNotAllV4BatchFinalized.selector );
680685 rollup.finalizeEuclidInitialBatch (keccak256 ("011 " ));
681686
687+ // revert when ErrorFinalizePreAndPostEuclidBatchInOneBundle, v4+v5
688+ hevm.startPrank (address (0 ));
689+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
690+ rollup.finalizeBundleWithProof (v5Header, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
691+ hevm.stopPrank ();
692+
693+ // revert when ErrorFinalizePreAndPostEuclidBatchInOneBundle, v4+v5+v6
694+ hevm.startPrank (address (0 ));
695+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
696+ rollup.finalizeBundleWithProof (v6Header1, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
697+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
698+ rollup.finalizeBundleWithProof (v6Header2, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
699+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
700+ rollup.finalizeBundleWithProof (v6Header3, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
701+ hevm.stopPrank ();
702+
682703 // finalize batch 10
683704 hevm.startPrank (address (0 ));
684705 rollup.finalizeBundleWithProof (headers[10 ], keccak256 ("010 " ), keccak256 ("110 " ), new bytes (0 ));
685706 assertEq (rollup.lastFinalizedBatchIndex (), 10 );
686707 hevm.stopPrank ();
687708
688- // revert when try to finalize batch 11 in finalizeBundleWithProof
709+ // revert when ErrorFinalizePreAndPostEuclidBatchInOneBundle, v5
689710 hevm.startPrank (address (0 ));
690- hevm.expectRevert (ScrollChain.ErrorFinalizeEuclidBatchWithZkTrieRoot.selector );
691- rollup.finalizeBundleWithProof (v5Header, keccak256 ("010 " ), keccak256 ("110 " ), new bytes (0 ));
711+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
712+ rollup.finalizeBundleWithProof (v5Header, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
713+ hevm.stopPrank ();
714+
715+ // revert when ErrorFinalizePreAndPostEuclidBatchInOneBundle, v5+v6
716+ hevm.startPrank (address (0 ));
717+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
718+ rollup.finalizeBundleWithProof (v6Header1, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
719+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
720+ rollup.finalizeBundleWithProof (v6Header2, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
721+ hevm.expectRevert (ScrollChain.ErrorFinalizePreAndPostEuclidBatchInOneBundle.selector );
722+ rollup.finalizeBundleWithProof (v6Header3, keccak256 ("011 " ), keccak256 ("111 " ), new bytes (0 ));
692723 hevm.stopPrank ();
693724
694725 // succeed, withdraw root should be same as batch 10
@@ -704,45 +735,12 @@ contract ScrollChainTest is DSTestPlus {
704735 // revert when ErrorStateRootIsZero
705736 hevm.expectRevert (ScrollChain.ErrorBatchIsAlreadyVerified.selector );
706737 rollup.finalizeEuclidInitialBatch (keccak256 ("011 " ));
707- }
708-
709- function testFinalizeBundlePostEuclid () external {
710- bytes [] memory headers = _prepareFinalizeBundle ();
711-
712- assertEq (rollup.initialEuclidBatchIndex (), 0 );
713- bytes memory v5Header = _commitBatch (5 , headers[10 ], 0 , 0 );
714- assertEq (rollup.initialEuclidBatchIndex (), 11 );
715-
716- for (uint256 i = 1 ; i <= 10 ; ++ i) {
717- assertBoolEq (rollup.isBatchFinalized (i), false );
718- }
719- assertEq (messageQueue.nextUnfinalizedQueueIndex (), 0 );
720- hevm.prank (address (0 ));
721- rollup.finalizeBundleWithProof (headers[10 ], keccak256 ("010 " ), keccak256 ("110 " ), new bytes (0 ));
722- for (uint256 i = 1 ; i <= 10 ; ++ i) {
723- assertBoolEq (rollup.isBatchFinalized (i), true );
724- }
725- assertEq (messageQueue.nextUnfinalizedQueueIndex (), 10 );
726-
727- assertBoolEq (rollup.isBatchFinalized (11 ), false );
728- rollup.finalizeEuclidInitialBatch (keccak256 ("011 " ));
729- assertBoolEq (rollup.isBatchFinalized (11 ), true );
730- assertEq (rollup.lastFinalizedBatchIndex (), 11 );
731-
732- // commit 3 v6 batches
733- bytes memory v6Header1 = _commitBatch (6 , v5Header, 1 , 1 );
734- //revert();
735- bytes memory v6Header2 = _commitBatch (6 , v6Header1, 2 , 1 );
736- bytes memory v6Header3 = _commitBatch (6 , v6Header2, 3 , 1 );
737-
738- // revert when ErrorCallerIsNotProver
739- hevm.expectRevert (ScrollChain.ErrorCallerIsNotProver.selector );
740- rollup.finalizeBundlePostEuclid (new bytes (0 ), bytes32 (0 ), bytes32 (0 ), new bytes (0 ));
741738
739+ // finalize 3 v6 batches
742740 // revert when ErrorStateRootIsZero
743741 hevm.startPrank (address (0 ));
744742 hevm.expectRevert (ScrollChain.ErrorStateRootIsZero.selector );
745- rollup.finalizeBundlePostEuclid (v6Header1, bytes32 (0 ), bytes32 (0 ), new bytes (0 ));
743+ rollup.finalizeBundleWithProof (v6Header1, bytes32 (0 ), bytes32 (0 ), new bytes (0 ));
746744
747745 // finalize bundle with one batch
748746 assertEq (rollup.finalizedStateRoots (12 ), 0 );
@@ -752,7 +750,7 @@ contract ScrollChainTest is DSTestPlus {
752750 assertEq (messageQueue.nextUnfinalizedQueueIndex (), 10 );
753751 hevm.expectEmit (true , true , true , true );
754752 emit FinalizeBatch (12 , keccak256 (v6Header1), keccak256 ("001 " ), keccak256 ("101 " ));
755- rollup.finalizeBundlePostEuclid (v6Header1, keccak256 ("001 " ), keccak256 ("101 " ), new bytes (0 ));
753+ rollup.finalizeBundleWithProof (v6Header1, keccak256 ("001 " ), keccak256 ("101 " ), new bytes (0 ));
756754 assertEq (rollup.finalizedStateRoots (12 ), keccak256 ("001 " ));
757755 assertEq (rollup.withdrawRoots (12 ), keccak256 ("101 " ));
758756 assertEq (rollup.lastFinalizedBatchIndex (), 12 );
@@ -761,7 +759,7 @@ contract ScrollChainTest is DSTestPlus {
761759
762760 // revert when ErrorBatchIsAlreadyVerified
763761 hevm.expectRevert (ScrollChain.ErrorBatchIsAlreadyVerified.selector );
764- rollup.finalizeBundlePostEuclid (v6Header1, keccak256 ("001 " ), keccak256 ("101 " ), new bytes (0 ));
762+ rollup.finalizeBundleWithProof (v6Header1, keccak256 ("001 " ), keccak256 ("101 " ), new bytes (0 ));
765763
766764 // finalize bundle with two batch
767765 assertEq (rollup.finalizedStateRoots (14 ), 0 );
@@ -770,12 +768,11 @@ contract ScrollChainTest is DSTestPlus {
770768 assertEq (messageQueue.nextUnfinalizedQueueIndex (), 11 );
771769 hevm.expectEmit (true , true , true , true );
772770 emit FinalizeBatch (14 , keccak256 (v6Header3), keccak256 ("003 " ), keccak256 ("103 " ));
773- rollup.finalizeBundlePostEuclid (v6Header3, keccak256 ("003 " ), keccak256 ("103 " ), new bytes (0 ));
771+ rollup.finalizeBundleWithProof (v6Header3, keccak256 ("003 " ), keccak256 ("103 " ), new bytes (0 ));
774772 assertEq (rollup.finalizedStateRoots (14 ), keccak256 ("003 " ));
775773 assertEq (rollup.withdrawRoots (14 ), keccak256 ("103 " ));
776774 assertEq (rollup.lastFinalizedBatchIndex (), 14 );
777775 assertEq (messageQueue.nextUnfinalizedQueueIndex (), 16 );
778-
779776 hevm.stopPrank ();
780777 }
781778
@@ -788,7 +785,7 @@ contract ScrollChainTest is DSTestPlus {
788785 messageQueue.appendCrossDomainMessage (address (this ), 1000000 , new bytes (0 ));
789786 }
790787
791- (bytes memory batchHeader0 , bytes memory batchHeader1 , bytes memory batchHeader2 ) = _commitBatchV3 ();
788+ (, bytes memory batchHeader1 , bytes memory batchHeader2 ) = _commitBatchV3 ();
792789
793790 // 1 ~ 4, zero
794791 for (uint256 i = 1 ; i < 4 ; i++ ) {
@@ -943,13 +940,13 @@ contract ScrollChainTest is DSTestPlus {
943940
944941 hevm.startPrank (address (0 ));
945942 hevm.expectRevert ("Pausable: paused " );
946- rollup.commitBatchWithBlobProof (3 , new bytes (0 ), new bytes [](0 ), new bytes (0 ), new bytes (0 ));
947- hevm.expectRevert ("Pausable: paused " );
948943 rollup.commitBatchWithBlobProof (4 , new bytes (0 ), new bytes [](0 ), new bytes (0 ), new bytes (0 ));
949944 hevm.expectRevert ("Pausable: paused " );
950- rollup.finalizeBundleWithProof ( new bytes (0 ), bytes32 (0 ), bytes32 (0 ), new bytes (0 ));
945+ rollup.commitBatchWithBlobProof ( 5 , new bytes (0 ), new bytes [] (0 ), new bytes (0 ), new bytes (0 ));
951946 hevm.expectRevert ("Pausable: paused " );
952- rollup.finalizeBundlePostEuclid (new bytes (0 ), bytes32 (0 ), bytes32 (0 ), new bytes (0 ));
947+ rollup.commitBatchWithBlobProof (6 , new bytes (0 ), new bytes [](0 ), new bytes (0 ), new bytes (0 ));
948+ hevm.expectRevert ("Pausable: paused " );
949+ rollup.finalizeBundleWithProof (new bytes (0 ), bytes32 (0 ), bytes32 (0 ), new bytes (0 ));
953950 hevm.stopPrank ();
954951
955952 // unpause
0 commit comments