From 9116aa422fdf505cd3bb9475c7429a0e262ba109 Mon Sep 17 00:00:00 2001 From: Andrew Raffensperger Date: Fri, 6 Dec 2024 01:28:18 -0800 Subject: [PATCH] fix parens on prefix mask --- contracts/scroll/ScrollVerifierHooks.sol | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contracts/scroll/ScrollVerifierHooks.sol b/contracts/scroll/ScrollVerifierHooks.sol index f2d0423c..33fbf244 100755 --- a/contracts/scroll/ScrollVerifierHooks.sol +++ b/contracts/scroll/ScrollVerifierHooks.sol @@ -130,10 +130,8 @@ contract ScrollVerifierHooks is IVerifierHooks { // If the trie does not contain a value for key, the returned proof contains all // nodes of the longest existing prefix of the key (at least the root node), ending // with the node that proves the absence of the key. - if (i > 0) { - bytes32 p = bytes32(1 << (i - 1)); // prefix mask - if ((temp & p) != (keyHash & p)) revert InvalidProof(); - } + bytes32 p = bytes32((1 << i) - 1); // prefix mask + if ((temp & p) != (keyHash & p)) revert InvalidProof(); // this is a proof for a different value that traverses to the same place keyHash = temp; }