Documentation
¶
Overview ¶
Package walker drives both sszutils.HashWalker implementations over the same generated call sequence and compares what they build. hasher.Hasher carries one byte buffer and cuts chunks when a region is reduced; treeproof.Wrapper builds the tree. They must agree for any sequence, including one a delegate leaves on a partial chunk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
compareWalkers runs one program through both walkers twice: once comparing the tail after every call, which forces the hasher to flush its deferred reductions, and once without, which leaves the deferral path as callers see it. Both runs must agree on the root, and a panic must happen in both or in neither.
Types ¶
type Op ¶
type Op struct {
// contains filtered or unexported fields
}
walkerOp is one call. n carries a length, a count or a value, and treeType the shape of a scope.
func CloseScopes ¶
closeScopes returns the reductions that close the given open scopes, innermost first, so a prefix of a program can be finished and compared.
func Generate ¶
generateProgram builds one program: an outer scope, a body of random calls with a shadow scope stack so reductions mostly close a scope that is open, then the closing reductions. The body deliberately includes the sequences a delegate that breaks its contract produces: raw appends that leave a partial chunk before a scope opens or a value is written.
func GenerateWithScopes ¶
generateProgramWithScopes also reports, for every prefix of the program, the scopes still open after it, so a prefix can be closed and compared on its own.