Commit d40468c1 authored by Alina's avatar Alina Committed by GitHub

global root index check (#106)

parent b2ad9408
...@@ -125,7 +125,7 @@ contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_Fr ...@@ -125,7 +125,7 @@ contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_Fr
_preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index == _transactionBatchHeader.prevTotalElements + _transactionProof.index, _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index == _transactionBatchHeader.prevTotalElements + _transactionProof.index,
"Pre-state root global index must equal to the transaction root global index." "Pre-state root global index must equal to the transaction root global index."
); );
deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index); deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index);
} }
...@@ -173,9 +173,9 @@ contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_Fr ...@@ -173,9 +173,9 @@ contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_Fr
"State transition process must be completed prior to finalization." "State transition process must be completed prior to finalization."
); );
require( require (
_postStateRootProof.index == _preStateRootProof.index + 1, _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1,
"Invalid post-state root index." "Post-state root global index must equal to the pre state root global index plus one."
); );
require( require(
...@@ -201,7 +201,7 @@ contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_Fr ...@@ -201,7 +201,7 @@ contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_Fr
_postStateRoot != transitioner.getPostStateRoot(), _postStateRoot != transitioner.getPostStateRoot(),
"State transition has not been proven fraudulent." "State transition has not been proven fraudulent."
); );
cancelStateTransition(_postStateRootBatchHeader, _preStateRoot); cancelStateTransition(_postStateRootBatchHeader, _preStateRoot);
} }
......
...@@ -274,7 +274,7 @@ describe('OVM_FraudVerifier', () => { ...@@ -274,7 +274,7 @@ describe('OVM_FraudVerifier', () => {
DUMMY_BATCH_HEADERS[0], DUMMY_BATCH_HEADERS[0],
batchProof batchProof
) )
).to.be.revertedWith('Invalid post-state root index.') ).to.be.revertedWith('Post-state root global index must equal to the pre state root global index plus one.')
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment