ethereum / go-verkle

A go implementation of Verkle trees
The Unlicense
209 stars 64 forks source link

What does HashNode have a `hash` field? #258

Closed GrapeBaBa closed 2 years ago

GrapeBaBa commented 2 years ago
type HashedNode struct {
    hash       *Fr
    commitment *Point
}

In current code base, actually serializing and parsing node are just using commitment, what is the purpose for hash?

gballet commented 2 years ago

Hash is used to cache the serialization when needed. I don't think it's used in too many places anymore, but its presence makes sense because calculating the serialization of a commitment is quite expensive. I expect it will be used again when optimization becomes a topic, assuming we keep the same serialization algorithm.