MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestClient_SequentialVerification

Function TestClient_SequentialVerification

light/client_test.go:121–255  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func TestClient_SequentialVerification(t *testing.T) {
122 newKeys := genPrivKeys(4)
123 newVals := newKeys.ToValidators(10, 1)
124 differentVals, _ := types.RandValidatorSet(10, 100)
125
126 testCases := []struct {
127 name string
128 otherHeaders map[int64]*types.SignedHeader // all except ^
129 vals map[int64]*types.ValidatorSet
130 initErr bool
131 verifyErr bool
132 }{
133 {
134 "good",
135 headerSet,
136 valSet,
137 false,
138 false,
139 },
140 {
141 "bad: different first header",
142 map[int64]*types.SignedHeader{
143 // different header
144 1: keys.GenSignedHeader(chainID, 1, bTime.Add(1*time.Hour), nil, vals, vals,
145 hash("app_hash"), hash("cons_hash"), hash("results_hash"), 0, len(keys)),
146 },
147 map[int64]*types.ValidatorSet{
148 1: vals,
149 },
150 true,
151 false,
152 },
153 {
154 "bad: no first signed header",
155 map[int64]*types.SignedHeader{},
156 map[int64]*types.ValidatorSet{
157 1: differentVals,
158 },
159 true,
160 true,
161 },
162 {
163 "bad: different first validator set",
164 map[int64]*types.SignedHeader{
165 1: h1,
166 },
167 map[int64]*types.ValidatorSet{
168 1: differentVals,
169 },
170 true,
171 true,
172 },
173 {
174 "bad: 1/3 signed interim header",
175 map[int64]*types.SignedHeader{
176 // trusted header
177 1: h1,
178 // interim header (1/3 signed)

Callers

nothing calls this directly

Calls 13

RandValidatorSetFunction · 0.92
NewClientFunction · 0.92
SequentialVerificationFunction · 0.92
LoggerFunction · 0.92
TestingLoggerFunction · 0.92
genPrivKeysFunction · 0.85
hashFunction · 0.85
ToValidatorsMethod · 0.80
GenSignedHeaderMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected