Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate lib/trie from gossamer #6

Open
seunlanlege opened this issue Apr 4, 2022 · 1 comment
Open

Investigate lib/trie from gossamer #6

seunlanlege opened this issue Apr 4, 2022 · 1 comment
Assignees

Comments

@seunlanlege
Copy link

Get this test working

func TestTrieProof(t *testing.T) {
key, err := hex.DecodeString("f0c365c3cf59d671eb72da0e7a4113c4bbd108c4899964f707fdaffb82636065")
if err != nil {
panic(err)
}
root, err := hex.DecodeString("5e1eb8e577ea88deaa94b456da24ab0c9f4c0c6d9372af1568edd7aeef3b4c4e")
if err != nil {
panic(err)
}
bytes1, err := hex.DecodeString("80fffd8028b54b9a0a90d41b7941c43e6a0597d5914e3b62bdcb244851b9fc806c28ea2480e2f0847174b6f8ea15133a8d70de58d1a6174b7542e8e12028154c611bc3ee5280ddd81bdda149a8bc6990d3548a719d4a90ddbe5ea4a598211aacf6afd0b23bf58038fe7e08c8e684bd600f25631f32e6510ed7d37f43fce0d5aa974009857aeb5b80aafc60caa3519d4b861e6b8da226266a15060e2071bba4184e194da61dfb208e80b34a4ee6e2f949f58b7cb7f4a7fb1aaea8cdc2a5cb27557d32da7096fdf157c58024a760a8f6c27928ae9e2fed9968bc5f6e17c3ae647398d8a615e5b2bb4b425f8085a0da830399f25fca4b653de654ffd3c92be39f3ae4f54e7c504961b5bd00cf80c2d44d371e5fc1f50227d7491ad65ad049630361cefb4ab1844831237609f08380c8ae6a1e8df858b43e050a3959a25b90d711413ee1a863622c3914d45250738980b5955ff982ab818fcba39b2d507a6723504cef4969fc7c722ee175df95a33ae280509bb016f2887d12137e73d26d7ddcd7f9c8ff458147cb9d309494655fe68de180009f8697d760fbe020564b07f407e6aad58ba9451b3d2d88b3ee03e12db7c47480952dcc0804e1120508a1753f1de4aa5b7481026a3320df8b48e918f0cecbaed380fff4f175da5ff30200fabfdc2bbdd45f864d84f339ec2432f80b5749ac35bbfc")
if err != nil {
panic(err)
}
bytes2, err := hex.DecodeString("9ec365c3cf59d671eb72da0e7a4113c41002505f0e7b9012096b41c4eb3aaf947f6ea429080000685f0f1f0515f462cdcf84e0f1d6045dfcbb2056145f077f010000")
if err != nil {
panic(err)
}
bytes3, err := hex.DecodeString("80050880149156720805d0ad098ae52fcffae34ff637b1d1f1a0fa8e7f94201b8615695580c1638f702aaa71e4b78cc8538ecae03e827bb494cc54279606b201ec071a5e24806d2a1e6d5236e1e13c5a5c84831f5f5383f97eba32df6f9faf80e32cf2f129bc")
if err != nil {
panic(err)
}
var proof = [][]byte{
bytes1, bytes2, bytes3,
}
trie := trie.NewEmptyTrie()
errd := trie.LoadFromProof(proof, root)
if errd != nil {
panic(err)
}
value := trie.Get(key)
fmt.Printf("value: %s\n", value)
}

@qdm12
Copy link

qdm12 commented Aug 17, 2022

FYI you should subscribe to ChainSafe/gossamer#2418 to know when this is done.

There are also many PRs mentioning this issue, it's still a work in progress, and not as trivial as it might seem. I have been working most of my time on this since May, and it's almost ready.

Note for proof verification, you will have to pass in a state version parameter (0 or 1).
If that can help, in Gossamer for proof verification, the runtime injects this state version to the host function (the Go proof verification). For some other calls such as ones interacting with the state trie, this is found from querying the runtime Core_version/WASM custom section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Blocked
Development

No branches or pull requests

3 participants