From bba8dd6f1e64d81213838ea5958281981695c9e3 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Thu, 16 Nov 2023 12:41:37 -0600 Subject: [PATCH] bazel: Run buildifier, general cleanup (#13193) * Run buildifier * Other BUILD.bazel cleanup, rm swagger stuff. --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- api/gateway/gateway.go | 20 ------ proto/eth/service/BUILD.bazel | 22 +++---- proto/eth/v1/BUILD.bazel | 14 ++-- proto/prysm/v1alpha1/BUILD.bazel | 40 +++++------- proto/prysm/v1alpha1/swagger.proto | 48 -------------- proto/prysm/v1alpha1/swagger.swagger.json | 64 ------------------- proto/prysm/v1alpha1/swagger_description.md | 31 --------- .../v1alpha1/validator-client/BUILD.bazel | 34 +++++----- proto/ssz_proto_library.bzl | 7 +- tools/image_deps.bzl | 2 +- tools/ssz.bzl | 55 ++++++++-------- 11 files changed, 84 insertions(+), 253 deletions(-) delete mode 100644 proto/prysm/v1alpha1/swagger.proto delete mode 100644 proto/prysm/v1alpha1/swagger.swagger.json delete mode 100644 proto/prysm/v1alpha1/swagger_description.md diff --git a/api/gateway/gateway.go b/api/gateway/gateway.go index 13992958d..1e76c7287 100644 --- a/api/gateway/gateway.go +++ b/api/gateway/gateway.go @@ -6,8 +6,6 @@ import ( "fmt" "net" "net/http" - "path" - "strings" "time" "github.com/gorilla/mux" @@ -179,24 +177,6 @@ func (g *Gateway) corsMiddleware(h http.Handler) http.Handler { return c.Handler(h) } -const swaggerDir = "proto/prysm/v1alpha1/" - -// SwaggerServer returns swagger specification files located under "/swagger/" -func SwaggerServer() http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - if !strings.HasSuffix(r.URL.Path, ".swagger.json") { - log.Debugf("Not found: %s", r.URL.Path) - http.NotFound(w, r) - return - } - - log.Debugf("Serving %s\n", r.URL.Path) - p := strings.TrimPrefix(r.URL.Path, "/swagger/") - p = path.Join(swaggerDir, p) - http.ServeFile(w, r, p) - } -} - // dial the gRPC server. func (g *Gateway) dial(ctx context.Context, network, addr string) (*grpc.ClientConn, error) { switch network { diff --git a/proto/eth/service/BUILD.bazel b/proto/eth/service/BUILD.bazel index 07d5d0431..5cd1f6722 100644 --- a/proto/eth/service/BUILD.bazel +++ b/proto/eth/service/BUILD.bazel @@ -15,30 +15,30 @@ proto_library( "//proto/eth/ext:proto", "//proto/eth/v1:proto", "//proto/eth/v2:proto", + "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:event_source_proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:timestamp_proto", "@googleapis//google/api:annotations_proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:event_source_proto", ], ) go_proto_library( name = "go_proto", - compilers = ["@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",], + compilers = ["@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc"], importpath = "github.com/prysmaticlabs/prysm/v4/proto/eth/service", proto = ":proto", visibility = ["//visibility:public"], deps = [ + "//consensus-types/primitives:go_default_library", "//proto/eth/ext:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", - "//consensus-types/primitives:go_default_library", - "@googleapis//google/api:annotations_go_proto", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", + "@googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", "@org_golang_google_protobuf//types/descriptorpb:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], @@ -77,13 +77,13 @@ go_proto_library( visibility = ["//proto:__subpackages__"], deps = [ "//proto/eth/ext:go_default_library", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", ], ) @@ -93,7 +93,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v4/proto/eth/service", visibility = ["//visibility:public"], deps = [ - "@org_golang_google_protobuf//types/descriptorpb", - "@org_golang_google_protobuf//types/known/emptypb", + "@org_golang_google_protobuf//types/descriptorpb", + "@org_golang_google_protobuf//types/known/emptypb", ], ) diff --git a/proto/eth/v1/BUILD.bazel b/proto/eth/v1/BUILD.bazel index 0346002d4..a8bf091c1 100644 --- a/proto/eth/v1/BUILD.bazel +++ b/proto/eth/v1/BUILD.bazel @@ -8,8 +8,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( name = "proto", srcs = [ - "beacon_chain.proto", "attestation.proto", + "beacon_chain.proto", "events.proto", "node.proto", "validator.proto", @@ -17,8 +17,8 @@ proto_library( ], visibility = ["//visibility:public"], deps = [ - "//proto/eth/ext:proto", "//proto/engine/v1:proto", + "//proto/eth/ext:proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:timestamp_proto", ], @@ -71,15 +71,15 @@ go_proto_library( proto = ":proto", visibility = ["//visibility:public"], deps = [ - "//proto/eth/ext:go_default_library", + "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "//proto/eth/ext:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep - "//consensus-types/primitives:go_default_library", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", "@org_golang_google_protobuf//types/descriptorpb:go_default_library", + "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", ], ) @@ -105,7 +105,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v4/proto/eth/v1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ - "@org_golang_google_protobuf//types/descriptorpb", + "@org_golang_google_protobuf//types/descriptorpb", ], ) diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 769d031d9..2f7e39fd9 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -13,25 +13,19 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("//proto:ssz_proto_library.bzl", "ssz_proto_files") load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal") -############################################################################## -# OpenAPI (Swagger) V2 -############################################################################## -load("@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2:defs.bzl", "protoc_gen_openapiv2") - proto_library( name = "proto", srcs = [ - "node.proto", "beacon_chain.proto", "debug.proto", "finalized_block_root_container.proto", "health.proto", + "node.proto", + "p2p_messages.proto", "powchain.proto", "slasher.proto", "validator.proto", - "p2p_messages.proto", ":ssz_proto_files", - # ":generated_swagger_proto", ], visibility = ["//visibility:public"], deps = [ @@ -158,12 +152,12 @@ go_proto_library( "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", - "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", "@org_golang_google_protobuf//types/descriptorpb:go_default_library", + "@org_golang_google_protobuf//types/known/emptypb:go_default_library", + "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", ], ) @@ -183,9 +177,9 @@ go_proto_library( "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", - "@org_golang_google_protobuf//types/descriptorpb:go_default_library", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@org_golang_google_protobuf//types/descriptorpb:go_default_library", + "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], ) @@ -203,27 +197,27 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1", visibility = ["//visibility:public"], deps = SSZ_DEPS + [ - "//proto/eth/ext:go_default_library", - "//proto/engine/v1:go_default_library", "//encoding/bytesutil:go_default_library", + "//proto/engine/v1:go_default_library", + "//proto/eth/ext:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep + "@googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@com_github_golang_protobuf//proto:go_default_library", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep - "@googleapis//google/api:annotations_go_proto", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", - "@org_golang_google_protobuf//types/descriptorpb:go_default_library", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@org_golang_google_protobuf//types/descriptorpb:go_default_library", + "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/swagger.proto b/proto/prysm/v1alpha1/swagger.proto deleted file mode 100644 index 15aac378f..000000000 --- a/proto/prysm/v1alpha1/swagger.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020 Prysmatic Labs. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This is an optional proto that provides some gRPC gateway metadata for -// generating the OpenAPIv2(swagger) header. -syntax = "proto3"; - -package ethereum.eth.v1alpha1; - -import "protoc-gen-openapiv2/options/annotations.proto"; - -option go_package = "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1;eth"; - -option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { - info: { - title: "Ethereum Serenity APIs"; - version: "v1alpha1"; - license: { - name: "Licenced under Apache 2.0"; - url: "http://www.apache.org/licenses/LICENSE-2.0"; - }; - description: "{{ index . "description" }}"; - }; - external_docs: { - url: "https://github.com/ethereum/consensus-specs"; - description: "Ethereum Consensus Specification on Github"; - }; - host: "api.prylabs.net", - schemes: HTTPS; - schemes: WSS; - consumes: "application/json"; - consumes: "application/grpc-web-text"; - consumes: "application/grpc-web-json"; - produces: "application/json"; - produces: "application/grpc-web-text"; - produces: "application/grpc-web-json"; -}; diff --git a/proto/prysm/v1alpha1/swagger.swagger.json b/proto/prysm/v1alpha1/swagger.swagger.json deleted file mode 100644 index 0943daab3..000000000 --- a/proto/prysm/v1alpha1/swagger.swagger.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Ethereum Serenity APIs", - "description": "{{ index . description }}", - "version": "v1alpha1", - "license": { - "name": "Licenced under Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0" - } - }, - "host": "api.prylabs.net", - "schemes": [ - "https", - "wss" - ], - "consumes": [ - "application/json", - "application/grpc-web-text", - "application/grpc-web-json" - ], - "produces": [ - "application/json", - "application/grpc-web-text", - "application/grpc-web-json" - ], - "paths": {}, - "definitions": { - "protobufAny": { - "type": "object", - "properties": { - "typeUrl": { - "type": "string" - }, - "value": { - "type": "string", - "format": "byte" - } - } - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "$ref": "#/definitions/protobufAny" - } - } - } - } - }, - "externalDocs": { - "description": "Ethereum Consensus Specification on Github", - "url": "https://github.com/ethereum/consensus-specs" - } -} diff --git a/proto/prysm/v1alpha1/swagger_description.md b/proto/prysm/v1alpha1/swagger_description.md deleted file mode 100644 index 28c5408cd..000000000 --- a/proto/prysm/v1alpha1/swagger_description.md +++ /dev/null @@ -1,31 +0,0 @@ -[![Build status](https://badge.buildkite.com/62be08099e9e228b165c2dba69c637eb9ca7a1ca95efd54b9f.svg?branch=master)](https://buildkite.com/prysmatic-labs/ethereum-apis)[![Discord](https://user-images.githubusercontent.com/7288322/34471967-1df7808a-efbb-11e7-9088-ed0b04151291.png)](https://discord.gg/KSA7rPr)[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/prysmaticlabs/geth-sharding?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)[![ETH2.0_Spec_Version 0.12.1](https://img.shields.io/badge/ETH2.0%20Spec%20Version-v0.12.1-blue.svg)](https://github.com/ethereum/consensus-specs/tree/v0.12.1) - -This swagger site hosts the service interface definitions for the Ethereum Serenity JSON API. - -## Service Overview - -At the core of Ethereum Serenity lies the "Beacon Chain", a proof-of-stake based blockchain managing a set of validators and "shards" across a network, which are stateful, smaller blockchains used for transaction and smart contract execution. The Beacon Chain reconciles consensus results across shards to provide the backbone of Ethereum Serenity. The services below allow for retrieval of current and historical information relating to validators, consensus, blocks, and staking participation. - -| Package | Service | Version | Description | -|---------|---------|---------|-------------| -| eth | BeaconChain | v1alpha1 | This service is used to retrieve critical data relevant to the Ethereum Beacon Chain, including the most recent head block, current pending deposits, the chain state and more. | -| eth | Node | v1alpha1 | The Node service returns information about the Ethereum node itself, including versioning and general information as well as network sync status and a list of services currently implemented on the node. -| eth | Validator | v1alpha1 | This API provides the information a validator needs to retrieve throughout its lifecycle, including received assignments from the network, its current index in the state, as well the rewards and penalties that have been applied to it. - -### JSON Mapping - -The majority of field primitive types for Ethereum are either `bytes` or `uint64`. The canonical JSON mapping for those fields are a Base64 encoded string for `bytes`, or a string representation of `uint64`. Since JavaScript loses precision for values over [MAX_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER), uint64 must be a JSON string in order to accommodate those values. If the field value not changed and is still set to protobuf's default, this field will be omitted from the JSON encoding entirely. - -For more details on JSON mapping for other types, view the relevant section in the [proto3 language guide](https://developers.google.com/protocol-buffers/docs/proto3#json). - -### Helpful gRPC Tooling and Resources - -- [Google's API Style Guide](https://cloud.google.com/apis/design/) -- [Language reference for protoc3](https://developers.google.com/protocol-buffers/docs/proto3) -- [Awesome gRPC](https://github.com/grpc-ecosystem/awesome-grpc) -- [Protocol Buffer Basics: Go](https://developers.google.com/protocol-buffers/docs/gotutorial) -- [Transcoding gRPC to JSON/HTTP using Envoy](https://blog.jdriven.com/2018/11/transcoding-grpc-to-http-json-using-envoy/) - - -## Contributing -We have put all of our contribution guidelines into [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/master/CONTRIBUTING.md)! Check it out to get started. \ No newline at end of file diff --git a/proto/prysm/v1alpha1/validator-client/BUILD.bazel b/proto/prysm/v1alpha1/validator-client/BUILD.bazel index 8f95e1ba7..ce78ac726 100644 --- a/proto/prysm/v1alpha1/validator-client/BUILD.bazel +++ b/proto/prysm/v1alpha1/validator-client/BUILD.bazel @@ -44,21 +44,21 @@ go_proto_library( proto = ":proto", visibility = ["//visibility:public"], deps = [ - "//proto/eth/ext:go_default_library", - "//proto/prysm/v1alpha1:go_default_library", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@com_github_golang_protobuf//proto:go_default_library", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "//consensus-types/primitives:go_default_library", "//consensus-types/validator:go_default_library", + "//proto/eth/ext:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", + "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", ], ) @@ -74,12 +74,12 @@ go_proto_library( deps = [ "//proto/eth/ext:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@googleapis//google/api:annotations_go_proto", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", ], ) @@ -96,21 +96,21 @@ go_library( deps = [ "//proto/eth/ext:go_default_library", "//proto/prysm/v1alpha1:go_default_library", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep + "@googleapis//google/api:annotations_go_proto", + "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@com_github_golang_protobuf//proto:go_default_library", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep - "@googleapis//google/api:annotations_go_proto", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", ], # keep ) diff --git a/proto/ssz_proto_library.bzl b/proto/ssz_proto_library.bzl index 00f642c9d..ab667af9d 100644 --- a/proto/ssz_proto_library.bzl +++ b/proto/ssz_proto_library.bzl @@ -2,7 +2,6 @@ SSZ proto templating rules. These rules allow for variable substitution for hardcoded tag values like ssz-size and ssz-max. - """ ####### Configuration ####### @@ -15,7 +14,7 @@ mainnet = { "previous_epoch_attestations.max": "4096", # MAX_ATTESTATIONS * SLOTS_PER_EPOCH "current_epoch_attestations.max": "4096", # MAX_ATTESTATIONS * SLOTS_PER_EPOCH "slashings.size": "8192", # EPOCHS_PER_SLASHINGS_VECTOR - "sync_committee_bits.size": "512", # SYNC_COMMITTEE_SIZE + "sync_committee_bits.size": "512", # SYNC_COMMITTEE_SIZE "sync_committee_bytes.size": "64", "sync_committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector512", "sync_committee_aggregate_bytes.size": "16", @@ -25,7 +24,7 @@ mainnet = { "logs_bloom.size": "256", "extra_data.size": "32", "max_blobs_per_block.size": "6", - "max_blob_commitments.size":"4096", + "max_blob_commitments.size": "4096", "kzg_commitment_inclusion_proof_depth.size": "17", } @@ -47,7 +46,7 @@ minimal = { "logs_bloom.size": "256", "extra_data.size": "32", "max_blobs_per_block.size": "6", - "max_blob_commitments.size":"16", + "max_blob_commitments.size": "16", "kzg_commitment_inclusion_proof_depth.size": "9", } diff --git a/tools/image_deps.bzl b/tools/image_deps.bzl index cf01ab807..1c7b11b1a 100644 --- a/tools/image_deps.bzl +++ b/tools/image_deps.bzl @@ -9,7 +9,7 @@ def prysm_image_deps(): "http://http.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb", "http://ftp.uk.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb", "http://ftp.au.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb", - "https://prysmaticlabs.com/uploads/bash_5.1-2+deb11u1_amd64.deb", + "https://prysmaticlabs.com/uploads/bash_5.1-2+deb11u1_amd64.deb", ], ) diff --git a/tools/ssz.bzl b/tools/ssz.bzl index 7dc7dae54..e5630e832 100644 --- a/tools/ssz.bzl +++ b/tools/ssz.bzl @@ -1,3 +1,29 @@ +""" +A rule that uses the generated pb.go files from a go_proto_library target to generate SSZ marshal +and unmarshal functions as pointer receivers on the specified objects. To use this rule, provide a +go_proto_library target and specify the structs to generate methods in the "objs" field. Lastly, +include your new target as a source for the go_library that embeds the go_proto_library. +Example: +go_proto_library( + name = "example_go_proto", + ... +) +ssz_gen_marshal( + name = "ssz_generated_sources", + go_proto = ":example_go_proto", + objs = [ # omit this field to generate for all structs in the package. + "AddressBook", + "Person", + ], +) +go_library( + name = "go_default_library", + srcs = [":ssz_generated_sources"], + embed = [":example_go_proto"], + deps = SSZ_DEPS, +) +""" + load( "@io_bazel_rules_go//go:def.bzl", "GoLibrary", @@ -32,7 +58,7 @@ def _ssz_go_proto_library_impl(ctx): args.append("--include=%s" % ",".join(incs)) if len(ctx.attr.objs) > 0: - args += ["--objs=%s" % ",".join(ctx.attr.objs)] + args.append("--objs=%s" % ",".join(ctx.attr.objs)) ctx.actions.run( executable = ctx.executable.sszgen, @@ -42,31 +68,6 @@ def _ssz_go_proto_library_impl(ctx): outputs = [output], ) -""" -A rule that uses the generated pb.go files from a go_proto_library target to generate SSZ marshal -and unmarshal functions as pointer receivers on the specified objects. To use this rule, provide a -go_proto_library target and specify the structs to generate methods in the "objs" field. Lastly, -include your new target as a source for the go_library that embeds the go_proto_library. -Example: -go_proto_library( - name = "example_go_proto", - ... -) -ssz_gen_marshal( - name = "ssz_generated_sources", - go_proto = ":example_go_proto", - objs = [ # omit this field to generate for all structs in the package. - "AddressBook", - "Person", - ], -) -go_library( - name = "go_default_library", - srcs = [":ssz_generated_sources"], - embed = [":example_go_proto"], - deps = SSZ_DEPS, -) -""" ssz_gen_marshal = rule( implementation = _ssz_go_proto_library_impl, attrs = { @@ -75,7 +76,7 @@ ssz_gen_marshal = rule( "sszgen": attr.label( default = Label("@com_github_prysmaticlabs_fastssz//sszgen:sszgen"), executable = True, - cfg = "host", + cfg = "exec", ), "objs": attr.string_list(), "includes": attr.label_list(providers = [GoLibrary]),