Skip to content

Commit d72e573

Browse files
fix: On malformed proof, return false instead of throwing
* update rust verkle * add a test with a prestate root that is false * replace test data with explicitly wrong preState root --------- Co-authored-by: Gabriel Rocheleau <[email protected]>
1 parent f5250a8 commit d72e573

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src.rs/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ default = ["console_error_panic_hook"]
1515
serde = { version = "1.0", features = ["derive"] }
1616
serde-wasm-bindgen = "0.3.0"
1717
wasm-bindgen = { version = "0.2.90", features = ["serde-serialize"] }
18-
ipa-multipoint = { git = "https://github.com/crate-crypto/rust-verkle", rev = "1c2cd88661e0bf54df29239333baba4bd115c3d3" }
19-
banderwagon = { git = "https://github.com/crate-crypto/rust-verkle", rev = "1c2cd88661e0bf54df29239333baba4bd115c3d3" }
20-
ffi_interface = { git = "https://github.com/crate-crypto/rust-verkle", rev = "1c2cd88661e0bf54df29239333baba4bd115c3d3" }
18+
ipa-multipoint = { git = "https://github.com/crate-crypto/rust-verkle", rev = "309cdcba4088e698689dc33b8ee071c2d064b2ae" }
19+
banderwagon = { git = "https://github.com/crate-crypto/rust-verkle", rev = "309cdcba4088e698689dc33b8ee071c2d064b2ae" }
20+
ffi_interface = { git = "https://github.com/crate-crypto/rust-verkle", rev = "309cdcba4088e698689dc33b8ee071c2d064b2ae" }
2121

2222
hex = "0.4.3"
2323
# This is needed so that we can enable the js feature, which is being used in ark-serialize

src.ts/tests/ffi.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bytesToHex } from '@ethereumjs/util'
1+
import { bytesToHex, randomBytes } from '@ethereumjs/util'
22
import { beforeAll, describe, expect, test } from 'vitest'
33

44
import { VerkleCrypto, loadVerkleCrypto } from '../index.js'
@@ -192,7 +192,6 @@ describe('bindings', () => {
192192
expect(verified).toBe(true)
193193
})
194194

195-
// This one is for a much larger block (~100 txs) and currently fails
196195
test('verifyExecutionProof: block with many txs', () => {
197196
// Src: Kaustinen6 testnet, block 72 state root (parent of block 73)
198197
const prestateRoot = '0x18d1dfcc6ccc6f34d14af48a865895bf34bde7f3571d9ba24a4b98122841048c'
@@ -202,6 +201,14 @@ describe('bindings', () => {
202201
expect(verified).toBe(true)
203202
})
204203

204+
test('verifyExecutionProof: invalid state root', () => {
205+
const prestateRoot = bytesToHex(randomBytes(32))
206+
const executionWitness = JSON.stringify(kaustinenBlock73.executionWitness)
207+
208+
const verified = verifyExecutionWitnessPreState(prestateRoot, executionWitness)
209+
expect(verified).toBe(false)
210+
})
211+
205212
test('smoke test errors are thrown', () => {
206213
const scalar = new Uint8Array([0])
207214

0 commit comments

Comments
 (0)