Rename block interfaces (#11975)

This commit is contained in:
terencechain
2023-02-09 01:23:32 -08:00
committed by GitHub
parent e1f7c52e6b
commit d4f3257f60
153 changed files with 575 additions and 575 deletions

View File

@@ -298,9 +298,9 @@ func TestBlocksFetcher_RoundRobin(t *testing.T) {
fetcher.stop()
}()
processFetchedBlocks := func() ([]interfaces.SignedBeaconBlock, error) {
processFetchedBlocks := func() ([]interfaces.ReadOnlySignedBeaconBlock, error) {
defer cancel()
var unionRespBlocks []interfaces.SignedBeaconBlock
var unionRespBlocks []interfaces.ReadOnlySignedBeaconBlock
for {
select {
@@ -446,7 +446,7 @@ func TestBlocksFetcher_handleRequest(t *testing.T) {
}
}()
var blocks []interfaces.SignedBeaconBlock
var blocks []interfaces.ReadOnlySignedBeaconBlock
select {
case <-ctx.Done():
t.Error(ctx.Err())
@@ -633,7 +633,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
req *ethpb.BeaconBlocksByRangeRequest
handlerGenFn func(req *ethpb.BeaconBlocksByRangeRequest) func(stream network.Stream)
wantedErr string
validate func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock)
validate func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock)
}{
{
name: "no error",
@@ -655,7 +655,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
assert.NoError(t, stream.Close())
}
},
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, req.Count, uint64(len(blocks)))
},
},
@@ -679,7 +679,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
assert.NoError(t, stream.Close())
}
},
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 0, len(blocks))
},
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
@@ -708,7 +708,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
assert.NoError(t, stream.Close())
}
},
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 0, len(blocks))
},
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
@@ -738,7 +738,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
assert.NoError(t, stream.Close())
}
},
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 0, len(blocks))
},
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
@@ -774,7 +774,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
}
},
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 0, len(blocks))
},
},
@@ -809,7 +809,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
}
},
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 0, len(blocks))
},
},
@@ -837,7 +837,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
assert.NoError(t, stream.Close())
}
},
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 2, len(blocks))
},
},
@@ -865,7 +865,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T)
assert.NoError(t, stream.Close())
}
},
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.SignedBeaconBlock) {
validate: func(req *ethpb.BeaconBlocksByRangeRequest, blocks []interfaces.ReadOnlySignedBeaconBlock) {
assert.Equal(t, 0, len(blocks))
},
wantedErr: beaconsync.ErrInvalidFetchedData.Error(),