Skip to content

Commit

Permalink
Add StateRootMismatch error
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto committed May 20, 2024
1 parent 21709e4 commit d7ca0ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scroll-verifier/contracts/ScrollVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct StateProof {

contract ScrollVerifier is IEVMVerifier {
error InvalidSlotSize(uint256 size);
error StateRootMismatch(bytes32 expected, bytes32 actual);
IScrollChainCommitmentVerifier public immutable verifier;
string[] _gatewayURLs;

Expand All @@ -57,7 +58,9 @@ contract ScrollVerifier is IEVMVerifier {

function getTrieProof(address target, uint256 slot, bytes memory compressedProof, bytes32 root) internal view returns(bytes memory){
(bytes32 stateRoot, bytes32 storageValue) = verifier.verifyZkTrieProof(target, bytes32(slot), compressedProof);
require(stateRoot == root, "stateRoot not matched");
if(stateRoot != root) {
revert StateRootMismatch(stateRoot, root);
}
return abi.encodePacked(storageValue);
}

Expand Down

0 comments on commit d7ca0ad

Please sign in to comment.