(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func 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) |
nothing calls this directly
no test coverage detected