Skip to content

Commit 858f377

Browse files
authored
feat: add RPCs to support new slashing data entities (#33)
2 parents 750d51d + e223fc6 commit 858f377

File tree

99 files changed

+15043
-3758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+15043
-3758
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.idea
22
.DS_Store
3-
*.sw*
43
node_modules
54
!gen
65
/buf-plugin-openapi/bin
76
/openapi-debug.log
7+
/submodules
8+
!/submodules/README.md

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "protos/protobuf-libs"]
2+
path = protos/protobuf-libs
3+
url = https://github.com/Layr-Labs/protobuf-libs.git
4+
[submodule "submodules/protobuf-libs"]
5+
path = submodules/protobuf-libs
6+
url = https://github.com/Layr-Labs/protobuf-libs.git

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ deps/go:
2121
npm install
2222

2323
pre-build:
24-
cd protocol-apis-annotations && make proto
25-
cd buf-plugin-openapi && make install
24+
git submodule update --init --recursive
25+
cd buf-plugin-openapi && make clean install
2626

2727
.PHONY: proto
2828
proto: pre-build

buf-plugin-openapi/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module github.com/Layr-Labs/buf-plugin-openapi
33
go 1.23.6
44

55
require (
6-
github.com/Layr-Labs/protocol-apis-annotations v0.0.0-00010101000000-000000000000
76
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80
87
google.golang.org/protobuf v1.36.5
98
)
109

11-
require google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
12-
13-
replace github.com/Layr-Labs/protocol-apis-annotations => ../protocol-apis-annotations
10+
require (
11+
github.com/Layr-Labs/protobuf-libs v0.0.0-20250305032038-8d1047b56aab // indirect
12+
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
13+
)

buf-plugin-openapi/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/Layr-Labs/protobuf-libs v0.0.0-20250305032038-8d1047b56aab h1:O3mHv0TxACM+575aVjPRwPOd7Ygf4CAmZmNWs/2zjaA=
2+
github.com/Layr-Labs/protobuf-libs v0.0.0-20250305032038-8d1047b56aab/go.mod h1:xc4NKuzjHpf6Xr9EnI7r6Uc99B1it1bkzQH6kJvhtW4=
13
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
24
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
35
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

buf-plugin-openapi/main.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99
"unicode"
1010

11-
openapiAnnotations "github.com/Layr-Labs/protocol-apis-annotations/protos/annotations"
11+
openapiAnnotations "github.com/Layr-Labs/protobuf-libs/protos/eigenlayer/lib/annotations"
1212
"google.golang.org/genproto/googleapis/api/annotations"
1313
"google.golang.org/protobuf/compiler/protogen"
1414
"google.golang.org/protobuf/proto"
@@ -219,10 +219,10 @@ func main() {
219219
// Add tag if not seen before
220220
if !seenTags[moduleTag] {
221221
seenTags[moduleTag] = true
222-
allPathsSpec.Tags = append(allPathsSpec.Tags, Tag{
223-
Name: moduleTag,
224-
Description: fmt.Sprintf("Operations from package %s", moduleTag),
225-
})
222+
// allPathsSpec.Tags = append(allPathsSpec.Tags, Tag{
223+
// Name: moduleTag,
224+
// Description: fmt.Sprintf("Operations from package %s", moduleTag),
225+
// })
226226
}
227227

228228
// Process all services in the file
@@ -231,10 +231,10 @@ func main() {
231231
serviceTag := fmt.Sprintf("%s/%s", moduleTag, strings.ToLower(service.GoName))
232232
if !seenTags[serviceTag] {
233233
seenTags[serviceTag] = true
234-
allPathsSpec.Tags = append(allPathsSpec.Tags, Tag{
235-
Name: serviceTag,
236-
Description: fmt.Sprintf("Operations for service %s", service.GoName),
237-
})
234+
// allPathsSpec.Tags = append(allPathsSpec.Tags, Tag{
235+
// Name: serviceTag,
236+
// Description: fmt.Sprintf("Operations for service %s", service.GoName),
237+
// })
238238
}
239239

240240
for _, method := range service.Methods {
@@ -261,7 +261,7 @@ func main() {
261261
Summary: method.GoName,
262262
Description: extractLeadingComments(method),
263263
OperationID: fmt.Sprintf("%s_%s", service.GoName, method.GoName),
264-
Tags: []string{moduleTag, serviceTag},
264+
Tags: []string{moduleTag}, // []string{moduleTag, serviceTag},
265265
Responses: map[string]Response{
266266
"200": {
267267
Description: "Successful response",
@@ -281,7 +281,7 @@ func main() {
281281
if isPublicVal != nil {
282282
isPublic = isPublicVal.(bool)
283283
if isPublic {
284-
operation.Tags = append(operation.Tags, "public_rpc")
284+
//operation.Tags = append(operation.Tags, "public_rpc")
285285
}
286286
}
287287
}
@@ -342,10 +342,10 @@ func main() {
342342
}
343343
if !seenPublicTags[serviceTag] {
344344
seenPublicTags[serviceTag] = true
345-
publicPathsSpec.Tags = append(publicPathsSpec.Tags, Tag{
346-
Name: serviceTag,
347-
Description: fmt.Sprintf("Operations for service %s", service.GoName),
348-
})
345+
// publicPathsSpec.Tags = append(publicPathsSpec.Tags, Tag{
346+
// Name: serviceTag,
347+
// Description: fmt.Sprintf("Operations for service %s", service.GoName),
348+
// })
349349
}
350350

351351
// Add operation to publicPathsSpec

buf.gen.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@ plugins:
66
- plugin: go
77
out: gen/protos
88
opt: paths=source_relative
9-
10-
# Then generate the OpenAPI spec
9+
- plugin: go-grpc
10+
out: gen/protos
11+
opt: paths=source_relative,require_unimplemented_servers=false
12+
- plugin: grpc-gateway
13+
out: gen/protos
14+
opt: paths=source_relative
15+
- plugin: openapiv2
16+
out: gen/openapiv2
17+
opt: allow_merge=true,merge_file_name=apidocs
18+
strategy: all
19+
# https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/customizing_openapi_output/#merging-output
20+
- plugin: grpc-gateway-ts
21+
out: gen/api-ts
22+
- name: gateway-client
23+
path: protoc-gen-grpc-gateway-client
24+
out: gen/protos
25+
opt:
26+
- paths=source_relative
1127
- plugin: buf-plugin-openapi
1228
out: gen/openapi
1329
strategy: all

buf.work.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
version: v1
22
directories:
3-
- protocol-apis-annotations/protos
3+
- submodules/protobuf-libs/protos
44
- protos

gen/api-ts/eigenlayer/sidecar/v1/events/events.pb.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
55
*/
66

7-
import * as fm from "../../../../fetch.pb"
87
import * as EigenlayerSidecarV1EigenStateEigenState from "../eigenState/eigenState.pb"
98
import * as EigenlayerSidecarV1EthereumTypesEthereumTypes from "../ethereumTypes/ethereumTypes.pb"
109

@@ -50,13 +49,4 @@ export type StreamIndexedBlocksResponse = {
5049
block?: EigenlayerSidecarV1EthereumTypesEthereumTypes.Block
5150
stateRoot?: EigenlayerSidecarV1EigenStateEigenState.StateRoot
5251
changes?: EigenlayerSidecarV1EigenStateEigenState.EigenStateChange[]
53-
}
54-
55-
export class Events {
56-
static StreamEigenStateChanges(req: StreamEigenStateChangesRequest, entityNotifier?: fm.NotifyStreamEntityArrival<StreamEigenStateChangesResponse>, initReq?: fm.InitReq): Promise<void> {
57-
return fm.fetchStreamingRequest<StreamEigenStateChangesRequest, StreamEigenStateChangesResponse>(`/events/v1/stream-eigen-state-changes`, entityNotifier, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
58-
}
59-
static StreamIndexedBlocks(req: StreamIndexedBlocksRequest, entityNotifier?: fm.NotifyStreamEntityArrival<StreamIndexedBlocksResponse>, initReq?: fm.InitReq): Promise<void> {
60-
return fm.fetchStreamingRequest<StreamIndexedBlocksRequest, StreamIndexedBlocksResponse>(`/events/v1/stream-indexed-blocks`, entityNotifier, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
61-
}
6252
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable */
2+
// @ts-nocheck
3+
/*
4+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5+
*/
6+
7+
import * as fm from "../../../../fetch.pb"
8+
import * as EigenlayerSidecarV1EventsEvents from "./events.pb"
9+
export class Events {
10+
static StreamEigenStateChanges(req: EigenlayerSidecarV1EventsEvents.StreamEigenStateChangesRequest, entityNotifier?: fm.NotifyStreamEntityArrival<EigenlayerSidecarV1EventsEvents.StreamEigenStateChangesResponse>, initReq?: fm.InitReq): Promise<void> {
11+
return fm.fetchStreamingRequest<EigenlayerSidecarV1EventsEvents.StreamEigenStateChangesRequest, EigenlayerSidecarV1EventsEvents.StreamEigenStateChangesResponse>(`/events/v1/stream-eigen-state-changes`, entityNotifier, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
12+
}
13+
static StreamIndexedBlocks(req: EigenlayerSidecarV1EventsEvents.StreamIndexedBlocksRequest, entityNotifier?: fm.NotifyStreamEntityArrival<EigenlayerSidecarV1EventsEvents.StreamIndexedBlocksResponse>, initReq?: fm.InitReq): Promise<void> {
14+
return fm.fetchStreamingRequest<EigenlayerSidecarV1EventsEvents.StreamIndexedBlocksRequest, EigenlayerSidecarV1EventsEvents.StreamIndexedBlocksResponse>(`/events/v1/stream-indexed-blocks`, entityNotifier, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
15+
}
16+
}

0 commit comments

Comments
 (0)