*If we have missing storageProofs, log and throw an error
This commit is contained in:
parent
191ef04b46
commit
62c6950957
|
@ -596,7 +596,13 @@ export class VerifyingProvider {
|
||||||
const isAccountValid = account
|
const isAccountValid = account
|
||||||
.serialize()
|
.serialize()
|
||||||
.equals(expectedAccountRLP ? expectedAccountRLP : emptyAccountSerialize);
|
.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++) {
|
for (let i = 0; i < storageKeys.length; i++) {
|
||||||
const sp = proof.storageProof[i];
|
const sp = proof.storageProof[i];
|
||||||
|
@ -612,7 +618,9 @@ export class VerifyingProvider {
|
||||||
(!expectedStorageRLP && sp.value === "0x0") ||
|
(!expectedStorageRLP && sp.value === "0x0") ||
|
||||||
(!!expectedStorageRLP &&
|
(!!expectedStorageRLP &&
|
||||||
expectedStorageRLP.equals(Buffer.from(rlp.encode(sp.value))));
|
expectedStorageRLP.equals(Buffer.from(rlp.encode(sp.value))));
|
||||||
if (!isStorageValid) return false;
|
if (!isStorageValid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue