Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2/5] light client http api #12984

Merged
merged 46 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
30fd059
light client handler: GetLightClientBootstrap
nicopernas Sep 15, 2023
f494954
light client handler: GetLightClientUpdatesByRange
nicopernas Sep 15, 2023
12d0075
light client handler: GetLightClientFinalityUpdate
nicopernas Sep 15, 2023
565c83c
light client handler: GetLightClientOptimisticUpdate
nicopernas Sep 15, 2023
3301327
refactor: change http2.HandleError string format
qinlz2 Nov 7, 2023
9d268d1
refactor: use bytesutil.ToBytes32 function
qinlz2 Nov 7, 2023
8b13c73
refactor: remove ethpbv2 deps
qinlz2 Nov 7, 2023
ef18330
fix: return lower case version according to api spec
qinlz2 Nov 7, 2023
14c4c22
refactor: avoid duplicate function call
qinlz2 Nov 7, 2023
b9a3961
refactor: change fmt.Errorf format
qinlz2 Nov 7, 2023
cba9f70
feat: add V1Alpha1HeaderToV1 conversion function
qinlz2 Nov 10, 2023
29adde2
feat: add BeaconBlockHeader.ToConsensus() function
qinlz2 Nov 10, 2023
f0c6948
feat: add SyncCommittee share data structure
qinlz2 Nov 10, 2023
4959edb
feat: LightClientBootstrap avoid using `apimiddleware` data structures
qinlz2 Nov 10, 2023
e3bab5f
feat: CreateLightClientBootstrap use `share` instead `apimiddleware`
qinlz2 Nov 10, 2023
7d6f5e6
feat: add V1Alpha1SyncCommitteeToV2 migration function
qinlz2 Nov 10, 2023
f1c4072
feat: migrate syncCommittee decoding from apimiddleware to shared
qinlz2 Nov 10, 2023
c1b4c2f
fix: add missing stateRoot in Bootstrap response
qinlz2 Nov 10, 2023
415657b
refactor: move NextSyncCommitteeBranchDepth to fieldparams
qinlz2 Nov 10, 2023
536e88c
feat: add V1HeaderToV1Alpha1 migration func
qinlz2 Nov 10, 2023
16c4f86
fix: NPE
qinlz2 Nov 10, 2023
d499e87
refactor: remove apimiddleware deps
qinlz2 Nov 10, 2023
2c976dc
refactor: use Blocker instead of BeaconDB
qinlz2 Nov 10, 2023
c14f235
test: use MockBlocker instead of TestDB
qinlz2 Nov 11, 2023
b536a66
test: unit tests check not-nil
qinlz2 Nov 11, 2023
b4c7cfb
fix: avoid NPE
qinlz2 Nov 11, 2023
8848e97
fix: patch bazel build
qinlz2 Nov 11, 2023
2360a58
refactor: use ToEpoch
qinlz2 Nov 12, 2023
af8bbc7
refactor: use shared.UintFromQuery
qinlz2 Nov 12, 2023
0396074
refactor: another shared.UintFromQuery
qinlz2 Nov 12, 2023
be9fb29
refactor: lXXXX variable rename
qinlz2 Nov 12, 2023
d323cb1
refactor: use pointer directly
qinlz2 Nov 12, 2023
8916e7e
refactor: do not export unneccessary functions
qinlz2 Nov 12, 2023
14bf4fa
fix: correct comments
qinlz2 Nov 12, 2023
9c351ef
refactor: rename handler Server receiver
qinlz2 Nov 12, 2023
45858a1
fix: fix too early period request handling
qinlz2 Nov 13, 2023
b1c820a
test: add two more GetLightClientUpdatesByRange unit tests
qinlz2 Nov 13, 2023
cae1990
fix: re-org startPeriod / endPeriod adjustment
qinlz2 Nov 13, 2023
9710d83
test: more GetLightClientUpdatesByRange test
qinlz2 Nov 13, 2023
e70363f
refactor: allow 0 updates
qinlz2 Nov 13, 2023
3796442
test: len(updates) == 0 test
qinlz2 Nov 13, 2023
00d2b0a
test: add getLightClientEventBlock unit tests
qinlz2 Nov 13, 2023
18dbc20
chore: remove no-use checking based on comment
qinlz2 Nov 17, 2023
48cfc79
fix: patch the error due to rebase
qinlz2 Nov 18, 2023
30fdabe
chore: gazelle fix
qinlz2 Nov 21, 2023
d03fa9a
fix: patch TestGetSpec unit test
qinlz2 Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions beacon-chain/rpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ go_library(
"//beacon-chain/rpc/eth/config:go_default_library",
"//beacon-chain/rpc/eth/debug:go_default_library",
"//beacon-chain/rpc/eth/events:go_default_library",
"//beacon-chain/rpc/eth/light-client:go_default_library",
"//beacon-chain/rpc/eth/node:go_default_library",
"//beacon-chain/rpc/eth/rewards:go_default_library",
"//beacon-chain/rpc/eth/validator:go_default_library",
Expand Down
5 changes: 4 additions & 1 deletion beacon-chain/rpc/eth/config/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"

"github.com/prysmaticlabs/prysm/v4/config/params"
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
Expand Down Expand Up @@ -171,7 +172,7 @@ func TestGetSpec(t *testing.T) {
data, ok := resp.Data.(map[string]interface{})
require.Equal(t, true, ok)

assert.Equal(t, 112, len(data))
assert.Equal(t, 113, len(data))
for k, v := range data {
switch k {
case "CONFIG_NAME":
Expand Down Expand Up @@ -414,6 +415,8 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "160", v)
case "MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT":
assert.Equal(t, "8", v)
case "MAX_REQUEST_LIGHT_CLIENT_UPDATES":
assert.Equal(t, "128", v)
case "SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY":
default:
t.Errorf("Incorrect key: %s", k)
Expand Down
55 changes: 55 additions & 0 deletions beacon-chain/rpc/eth/light-client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
load("@prysm//tools/go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
srcs = [
"handlers.go",
"helpers.go",
"server.go",
"structs.go",
],
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/light-client",
visibility = ["//beacon-chain:__subpackages__"],
deps = [
"//beacon-chain/blockchain:go_default_library",
"//beacon-chain/rpc/eth/shared:go_default_library",
"//beacon-chain/rpc/lookup:go_default_library",
"//beacon-chain/state:go_default_library",
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
"//network/http:go_default_library",
"//proto/eth/v1:go_default_library",
"//proto/eth/v2:go_default_library",
"//proto/migration:go_default_library",
"//runtime/version:go_default_library",
"//time/slots:go_default_library",
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
"@com_github_gorilla_mux//:go_default_library",
"@com_github_wealdtech_go_bytesutil//:go_default_library",
"@io_opencensus_go//trace:go_default_library",
],
)

go_test(
name = "go_default_test",
srcs = ["handlers_test.go"],
embed = [":go_default_library"],
deps = [
"//beacon-chain/blockchain/testing:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/rpc/testutil:go_default_library",
"//beacon-chain/state:go_default_library",
"//config/params:go_default_library",
"//consensus-types/blocks:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
"//encoding/bytesutil:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//testing/require:go_default_library",
"//testing/util:go_default_library",
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
"@com_github_gorilla_mux//:go_default_library",
],
)
Loading