beacon/light: removed old TODOs and non-functional test

This commit is contained in:
Zsolt Felfoldi 2024-01-30 02:07:37 +01:00 committed by Felix Lange
parent 7c51f57ded
commit 544d75daf7
3 changed files with 0 additions and 45 deletions

View file

@ -154,7 +154,6 @@ func (api *BeaconLightApi) httpGetf(format string, params ...any) ([]byte, error
// equals update.NextSyncCommitteeRoot). // equals update.NextSyncCommitteeRoot).
// Note that the results are validated but the update signature should be verified // Note that the results are validated but the update signature should be verified
// by the caller as its validity depends on the update chain. // by the caller as its validity depends on the update chain.
// TODO handle valid partial results
func (api *BeaconLightApi) GetBestUpdatesAndCommittees(firstPeriod, count uint64) ([]*types.LightClientUpdate, []*types.SerializedSyncCommittee, error) { func (api *BeaconLightApi) GetBestUpdatesAndCommittees(firstPeriod, count uint64) ([]*types.LightClientUpdate, []*types.SerializedSyncCommittee, error) {
resp, err := api.httpGetf("/eth/v1/beacon/light_client/updates?start_period=%d&count=%d", firstPeriod, count) resp, err := api.httpGetf("/eth/v1/beacon/light_client/updates?start_period=%d&count=%d", firstPeriod, count)
if err != nil { if err != nil {

View file

@ -1,43 +0,0 @@
package api
import (
"bytes"
"io"
"net/http"
"testing"
"github.com/ethereum/go-ethereum/common"
)
type testFetcher struct {
response string
}
type nopCloser struct {
io.Reader
}
func (nopCloser) Close() error { return nil }
func makeApi(response string) *BeaconLightApi {
return &BeaconLightApi{client: &testFetcher{response}}
}
func (f *testFetcher) Do(req *http.Request) (*http.Response, error) {
res := new(http.Response)
res.StatusCode = 200
res.Body = nopCloser{bytes.NewBufferString(f.response)}
return res, nil
}
func TestGetCheckpointData(t *testing.T) {
resp :=
`{ "data":
{
"header": {}
}
}`
_, err := makeApi(resp).GetCheckpointData(common.HexToHash("0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c"))
t.Logf("err: %v", err)
//TODO finish this test
}

View file

@ -133,7 +133,6 @@ func (s *HeadSync) processUnvalidated() {
// setServerHead processes non-validated server head announcements and updates // setServerHead processes non-validated server head announcements and updates
// the prefetch head if necessary. // the prefetch head if necessary.
// TODO report server failure if a server announces many heads that do not become validated soon.
func (s *HeadSync) setServerHead(server request.Server, head types.HeadInfo) bool { func (s *HeadSync) setServerHead(server request.Server, head types.HeadInfo) bool {
if oldHead, ok := s.serverHeads[server]; ok { if oldHead, ok := s.serverHeads[server]; ok {
if head == oldHead { if head == oldHead {