Skip to content

Commit

Permalink
Switch eth/v1 and v1alpha1 to protoc-gen-go-cast (#210)
Browse files Browse the repository at this point in the history
* Set fields as optional

* Remove unneeded

* Support protoc-gen-go-cast for v1

* WIP

* Replace gengo with go-cast and update

* Change to go-cast

* Change to optional and compile

* Add new PBs

* Update version

* Remove optional for now

* Fixes

* Revert "Remove optional for now"

This reverts commit 617ed8d.

* Generate ssz and protos (not optional)

* Add grpc and finish script for v1

* Add v1lpha1

* Script improvements

* Fixes

* Add back import

* Fixes

* Improve script

* Compile grpc

* Compile

* Fix ssz target

* remove all gogoproto

* Update gocast

* Fix go_proto target

* Fix target

* Fix ssz

* Rename to deposit data

* compile

* Fixes

* Merge branch 'master' of github.com:prysmaticlabs/ethereumapis into gen-go-cast

* Remove optional and use standard proto

* Properly build with grpc plugin

* Update

* Final look through

* Fix

* Add gateway to v1

* readme

* Fix after review

* Fix DepositData

* Regen pbs

* remove

* Fix

* Move options.proto to separate package

* Update

* Merge gateway into normal protos

* temp change compilers

* Merge gateway and protos

* Fix target embed

* Fix bazel

* Fix deps

* Fix spacing

* Fixes
 Please enter the commit message for your changes. Lines starting

* Fix bazels

* Fix script

* Fixes

* change to use glob

* Add grpc-gateway fork

* FIX GRPCCCCCC

* FIX  GRPC

* Run script

* Fix perms

* FIX SCRIPT

* Fix perms

* Update commit

* Properly cast arrays

* Replace @com_github_golang_protobuf//descriptor:go_default_library with @io_bazel_rules_go//proto/wkt:descriptor_go_proto. Same as #232

* use wkt protos

* use wkt protos more

* use wkt protos more 2

* use wkt protos more 3

* fix dup dep

* fix dup dep 2

* Compile

* Rename to move forward

* Compile

* Fix interface bug!!!

* Fix nested fields

* Update grpc-gateway

* Undo spec change

* Use newer go-cast

* Update ver

* Make gateway targets private

* Add back readmes

* Update grpc-gateway

* Properly set body in order to use outbound marshaler

* Update with using parser

* Update for sing optionalsptiona

* Update endpoints path and structures

* Update to latest spec minus missing functoins

* Review fixes

* Fix optionals

* Fix imports

* Revert "Fix imports"

This reverts commit b798ec6.

* fix types

* Fix types

* Fix index

* Update go.mod

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* Update version

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
  • Loading branch information
0xKiwi and prestonvanloon authored May 11, 2021
1 parent 26f696a commit 89fcd65
Show file tree
Hide file tree
Showing 68 changed files with 23,999 additions and 68,489 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
3.7.0
22 changes: 11 additions & 11 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "0c10738a488239750dbf35336be13252bad7c74348f867d30c3c3e0001906096",
sha256 = "7c10271940c6bce577d51a075ae77728964db285dac0a46614a7934dc34303e6",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.23.2/rules_go-v0.23.2.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.23.2/rules_go-v0.23.2.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.26.0/rules_go-v0.26.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.26.0/rules_go-v0.26.0.tar.gz",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "cdb02a887a7187ea4d5a27452311a75ed8637379a1287d8eeb952138ea485f7d",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.1/bazel-gazelle-v0.21.1.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.1/bazel-gazelle-v0.21.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")

go_rules_dependencies()

go_register_toolchains()
go_register_toolchains(go_version = "1.16.4")

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
http_archive(
name = "com_google_protobuf",
commit = "4059c61f27eb1b06c4ee979546a238be792df0a4",
remote = "https://github.com/protocolbuffers/protobuf",
shallow_since = "1558721209 -0700",
sha256 = "65e020a42bdab44a66664d34421995829e9e79c60e5adaa08282fd14ca552f57",
strip_prefix = "protobuf-3.15.6",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.15.6.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
Expand Down
65 changes: 65 additions & 0 deletions eth/ext/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
##############################################################################
# Common
##############################################################################

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")

proto_library(
name = "proto",
srcs = [
"options.proto",
],
visibility = ["//visibility:public"],
deps = [
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:empty_proto",
],
)

##############################################################################
# Go
##############################################################################
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal")

go_proto_library(
name = "go_proto",
compilers = [
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast",
],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/ext",
proto = ":proto",
visibility = ["//visibility:public"],
deps = [
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//types/descriptorpb:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
],
)

go_library(
name = "go_default_library",
embed = [":go_proto"],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/ext",
visibility = ["//visibility:public"],
deps = SSZ_DEPS + [
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
], # keep
)

##############################################################################
# Java
##############################################################################
java_proto_library(
name = "java_proto",
deps = [":proto"],
)
148 changes: 148 additions & 0 deletions eth/ext/options.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions eth/ext/options.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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.
syntax = "proto3";

package ethereum.eth.ext;

import "google/protobuf/descriptor.proto";

option csharp_namespace = "Ethereum.Eth.ext";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/ext";
option java_multiple_files = true;
option java_outer_classname = "OptionsProto";
option java_package = "org.ethereum.eth.ext";
option php_namespace = "Ethereum\\Eth\\ext";

extend google.protobuf.FieldOptions {
string cast_type = 50000;
string ssz_size = 50001;
string ssz_max = 50002;
string spec_name = 50003;
}
Loading

0 comments on commit 89fcd65

Please sign in to comment.