Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
2a062b11
Unverified
Commit
2a062b11
authored
Apr 15, 2022
by
Murphy Law
Committed by
GitHub
Apr 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proxyd: Log sanitized RPC requests (#2470)
parent
a4bfd9e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
blue-olives-add.md
.changeset/blue-olives-add.md
+5
-0
server.go
go/proxyd/server.go
+15
-0
No files found.
.changeset/blue-olives-add.md
0 → 100644
View file @
2a062b11
---
'
@eth-optimism/proxyd'
:
patch
---
proxyd: Log ssanitized RPC requests
go/proxyd/server.go
View file @
2a062b11
...
@@ -27,6 +27,7 @@ const (
...
@@ -27,6 +27,7 @@ const (
MaxBatchRPCCalls
=
100
MaxBatchRPCCalls
=
100
cacheStatusHdr
=
"X-Proxyd-Cache-Status"
cacheStatusHdr
=
"X-Proxyd-Cache-Status"
defaultServerTimeout
=
time
.
Second
*
10
defaultServerTimeout
=
time
.
Second
*
10
maxLogLength
=
1000
)
)
type
Server
struct
{
type
Server
struct
{
...
@@ -237,6 +238,12 @@ func (s *Server) handleSingleRPC(ctx context.Context, req *RPCReq) (*RPCRes, boo
...
@@ -237,6 +238,12 @@ func (s *Server) handleSingleRPC(ctx context.Context, req *RPCReq) (*RPCRes, boo
return
NewRPCErrorRes
(
req
.
ID
,
ErrMethodNotWhitelisted
),
false
return
NewRPCErrorRes
(
req
.
ID
,
ErrMethodNotWhitelisted
),
false
}
}
log
.
Info
(
"RPC request"
,
"method"
,
req
.
Method
,
"params"
,
truncate
(
string
(
req
.
Params
)),
"id"
,
truncate
(
string
(
req
.
ID
)),
)
var
backendRes
*
RPCRes
var
backendRes
*
RPCRes
backendRes
,
err
:=
s
.
cache
.
GetRPC
(
ctx
,
req
)
backendRes
,
err
:=
s
.
cache
.
GetRPC
(
ctx
,
req
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -457,3 +464,11 @@ func (n *NoopRPCCache) GetRPC(context.Context, *RPCReq) (*RPCRes, error) {
...
@@ -457,3 +464,11 @@ func (n *NoopRPCCache) GetRPC(context.Context, *RPCReq) (*RPCRes, error) {
func
(
n
*
NoopRPCCache
)
PutRPC
(
context
.
Context
,
*
RPCReq
,
*
RPCRes
)
error
{
func
(
n
*
NoopRPCCache
)
PutRPC
(
context
.
Context
,
*
RPCReq
,
*
RPCRes
)
error
{
return
nil
return
nil
}
}
func
truncate
(
str
string
)
string
{
if
len
(
str
)
>
maxLogLength
{
return
str
[
:
maxLogLength
]
+
"..."
}
else
{
return
str
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment