*If we have missing storageProofs, log and throw an error

This commit is contained in:
Derrick Hammer 2023-03-29 11:42:50 -04:00
parent 191ef04b46
commit 62c6950957
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 2 deletions

View File

@ -596,7 +596,13 @@ export class VerifyingProvider {
const isAccountValid = account
.serialize()
.equals(expectedAccountRLP ? expectedAccountRLP : emptyAccountSerialize);
if (!isAccountValid) return false;
if (!isAccountValid) {
return false;
}
if (storageKeys.length !== proof?.storageProof.length) {
console.error("missing storageProof");
throw new Error("missing storageProof");
}
for (let i = 0; i < storageKeys.length; i++) {
const sp = proof.storageProof[i];
@ -612,7 +618,9 @@ export class VerifyingProvider {
(!expectedStorageRLP && sp.value === "0x0") ||
(!!expectedStorageRLP &&
expectedStorageRLP.equals(Buffer.from(rlp.encode(sp.value))));
if (!isStorageValid) return false;
if (!isStorageValid) {
return false;
}
}
return true;