fix: lint error

This commit is contained in:
fearlseefe 2024-09-11 16:36:29 +08:00
parent 218c05df9a
commit d9a379d3fa
2 changed files with 16 additions and 16 deletions

View file

@ -321,19 +321,19 @@ func (bn *BeaconNetwork) processContentLoop(ctx context.Context) {
func (bn *BeaconNetwork) generalSummariesValidation(contentKey, content []byte) (*ForkedHistoricalSummariesWithProof, error) {
key := &HistoricalSummariesWithProofKey{}
err := key.Deserialize(codec.NewDecodingReader(bytes.NewReader(contentKey[1:]), uint64(len(contentKey[1:]))))
if err != nil {
return nil, err
}
forkedHistoricalSummariesWithProof := &ForkedHistoricalSummariesWithProof{}
err = forkedHistoricalSummariesWithProof.Deserialize(bn.spec, codec.NewDecodingReader(bytes.NewReader(content), uint64(len(content))))
if err != nil {
return nil, err
}
if forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH != common.Epoch(key.Epoch) {
return nil, fmt.Errorf("historical summaries with proof epoch does not match the content key epoch: %d != %d", forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH, key.Epoch)
}
return forkedHistoricalSummariesWithProof, nil
err := key.Deserialize(codec.NewDecodingReader(bytes.NewReader(contentKey[1:]), uint64(len(contentKey[1:]))))
if err != nil {
return nil, err
}
forkedHistoricalSummariesWithProof := &ForkedHistoricalSummariesWithProof{}
err = forkedHistoricalSummariesWithProof.Deserialize(bn.spec, codec.NewDecodingReader(bytes.NewReader(content), uint64(len(content))))
if err != nil {
return nil, err
}
if forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH != common.Epoch(key.Epoch) {
return nil, fmt.Errorf("historical summaries with proof epoch does not match the content key epoch: %d != %d", forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH, key.Epoch)
}
return forkedHistoricalSummariesWithProof, nil
}
func (bn *BeaconNetwork) stateSummariesValidation(f ForkedHistoricalSummariesWithProof, latestFinalizedRoot common.Root) bool {

View file

@ -165,18 +165,18 @@ func GetHistorySummariesWithProof() (HistoricalSummariesWithProof, common.Root,
}
data, err := snappy.Decode(nil, file)
if err != nil {
return HistoricalSummariesWithProof{}, common.Root{},err
return HistoricalSummariesWithProof{}, common.Root{}, err
}
beaconState := &deneb.BeaconState{}
err = beaconState.Deserialize(configs.Mainnet, codec.NewDecodingReader(bytes.NewReader(data), uint64(len(data))))
if err != nil {
return HistoricalSummariesWithProof{}, common.Root{},err
return HistoricalSummariesWithProof{}, common.Root{}, err
}
root := beaconState.HashTreeRoot(configs.Mainnet, tree.GetHashFn())
proof, err := BuildHistoricalSummariesProof(*beaconState)
if err != nil {
return HistoricalSummariesWithProof{}, common.Root{},err
return HistoricalSummariesWithProof{}, common.Root{}, err
}
summariesProof := [5]common.Bytes32{tree.Root(proof[0]), tree.Root(proof[1]), tree.Root(proof[2]), tree.Root(proof[3]), tree.Root(proof[4])}
return HistoricalSummariesWithProof{