forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utility to verify verkle proofs in blocks (ethereum#114)
* utility to verify verkle proofs in blocks * fix: reading from a leaf node with a different stem * add new branch for workflow
- Loading branch information
Showing
5 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/hex" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/crate-crypto/go-ipa/banderwagon" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/rlp" | ||
"github.com/ethereum/go-ethereum/trie" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) != 3 { | ||
fmt.Printf("Usage: %s <path to block file> <pre-root>\n", os.Args[0]) | ||
os.Exit(-1) | ||
} | ||
|
||
serializedBlock, err := os.ReadFile(os.Args[1]) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
rootHex, err := hex.DecodeString(os.Args[2]) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
var root banderwagon.Element | ||
root.SetBytes(rootHex) | ||
|
||
var block types.Block | ||
rlp.DecodeBytes(serializedBlock, &block) | ||
|
||
if len(block.Header().VerkleProof) == 0 { | ||
panic("missing proof") | ||
} | ||
|
||
err = trie.DeserializeAndVerifyVerkleProof(block.Header().VerkleProof, &root, block.Header().VerkleKeyVals) | ||
if err != nil { | ||
fmt.Printf("error verifying proof: %v\n", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters