HTTP Beacon API: /eth/v1/validator/contribution_and_proofs (#12660)

* HTTP Beacon API: `/eth/v1/validator/contribution_and_proofs`

* add comment to invalid test case

* fix validation and test

* review

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
Radosław Kapka
2023-07-31 19:32:39 +02:00
committed by GitHub
parent 955175b7eb
commit a9b003e1fe
43 changed files with 792 additions and 936 deletions

View File

@@ -6,8 +6,6 @@ go_library(
"auth.go",
"endpoint.go",
"external_ip.go",
"reader.go",
"writer.go",
],
importpath = "github.com/prysmaticlabs/prysm/v4/network",
visibility = ["//visibility:public"],
@@ -26,7 +24,6 @@ go_test(
"auth_test.go",
"endpoint_test.go",
"external_ip_test.go",
"reader_test.go",
],
embed = [":go_default_library"],
deps = [

23
network/http/BUILD.bazel Normal file
View File

@@ -0,0 +1,23 @@
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"errors.go",
"reader.go",
"writer.go",
],
importpath = "github.com/prysmaticlabs/prysm/v4/network/http",
visibility = ["//visibility:public"],
deps = ["@com_github_sirupsen_logrus//:go_default_library"],
)
go_test(
name = "go_default_test",
srcs = ["reader_test.go"],
embed = [":go_default_library"],
deps = [
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
],
)

13
network/http/errors.go Normal file
View File

@@ -0,0 +1,13 @@
package http
import (
"net/http"
)
func HandleError(w http.ResponseWriter, message string, code int) {
errJson := &DefaultErrorJson{
Message: message,
Code: code,
}
WriteError(w, errJson)
}

View File

@@ -1,4 +1,4 @@
package network
package http
import (
"net/http"

View File

@@ -1,4 +1,4 @@
package network
package http
import (
"fmt"

View File

@@ -1,4 +1,4 @@
package network
package http
import (
"bytes"