MCPcopy Create free account
hub / github.com/devlongs/gean / TestHashTreeRootBlockHeader

Function TestHashTreeRootBlockHeader

common/ssz/containers_test.go:70–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestHashTreeRootBlockHeader(t *testing.T) {
71 header := &types.BlockHeader{
72 Slot: types.Slot(100),
73 ProposerIndex: types.ValidatorIndex(7),
74 ParentRoot: types.Root{1, 2, 3},
75 StateRoot: types.Root{4, 5, 6},
76 BodyRoot: types.Root{7, 8, 9},
77 }
78
79 root := HashTreeRootBlockHeader(header)
80
81 if root == ZeroHash {
82 t.Error("expected non-zero root for block header")
83 }
84
85 // Same header should produce same root
86 root2 := HashTreeRootBlockHeader(header)
87 if root != root2 {
88 t.Error("same header should produce same root")
89 }
90}
91
92func TestHashTreeRootBlock(t *testing.T) {
93 block := &types.Block{

Callers

nothing calls this directly

Calls 3

SlotTypeAlias · 0.92
ValidatorIndexTypeAlias · 0.92
HashTreeRootBlockHeaderFunction · 0.85

Tested by

no test coverage detected