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
9ddfe570
Unverified
Commit
9ddfe570
authored
May 23, 2023
by
OptimismBot
Committed by
GitHub
May 23, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5752 from ethereum-optimism/felipe/dont-cache-tx-methods
fix(proxyd): avoid caching tx hash based methods
parents
17e98729
2c1237cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
56 deletions
+12
-56
cache.go
proxyd/cache.go
+0
-2
cache_test.go
proxyd/cache_test.go
+0
-42
caching_test.go
proxyd/integration_tests/caching_test.go
+12
-12
No files found.
proxyd/cache.go
View file @
9ddfe570
...
@@ -130,10 +130,8 @@ func newRPCCache(cache Cache) RPCCache {
...
@@ -130,10 +130,8 @@ func newRPCCache(cache Cache) RPCCache {
"eth_getBlockTransactionCountByHash"
:
staticHandler
,
"eth_getBlockTransactionCountByHash"
:
staticHandler
,
"eth_getUncleCountByBlockHash"
:
staticHandler
,
"eth_getUncleCountByBlockHash"
:
staticHandler
,
"eth_getBlockByHash"
:
staticHandler
,
"eth_getBlockByHash"
:
staticHandler
,
"eth_getTransactionByHash"
:
staticHandler
,
"eth_getTransactionByBlockHashAndIndex"
:
staticHandler
,
"eth_getTransactionByBlockHashAndIndex"
:
staticHandler
,
"eth_getUncleByBlockHashAndIndex"
:
staticHandler
,
"eth_getUncleByBlockHashAndIndex"
:
staticHandler
,
"eth_getTransactionReceipt"
:
staticHandler
,
}
}
return
&
rpcCache
{
return
&
rpcCache
{
cache
:
cache
,
cache
:
cache
,
...
...
proxyd/cache_test.go
View file @
9ddfe570
...
@@ -87,34 +87,6 @@ func TestRPCCacheImmutableRPCs(t *testing.T) {
...
@@ -87,34 +87,6 @@ func TestRPCCacheImmutableRPCs(t *testing.T) {
},
},
name
:
"eth_getBlockByHash"
,
name
:
"eth_getBlockByHash"
,
},
},
{
req
:
&
RPCReq
{
JSONRPC
:
"2.0"
,
Method
:
"eth_getTransactionByHash"
,
Params
:
mustMarshalJSON
([]
string
{
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
}),
ID
:
ID
,
},
res
:
&
RPCRes
{
JSONRPC
:
"2.0"
,
Result
:
`{"eth_getTransactionByHash":"!"}`
,
ID
:
ID
,
},
name
:
"eth_getTransactionByHash"
,
},
{
req
:
&
RPCReq
{
JSONRPC
:
"2.0"
,
Method
:
"eth_getTransactionByBlockHashAndIndex"
,
Params
:
mustMarshalJSON
([]
string
{
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
,
"0x55"
}),
ID
:
ID
,
},
res
:
&
RPCRes
{
JSONRPC
:
"2.0"
,
Result
:
`{"eth_getTransactionByBlockHashAndIndex":"!"}`
,
ID
:
ID
,
},
name
:
"eth_getTransactionByBlockHashAndIndex"
,
},
{
{
req
:
&
RPCReq
{
req
:
&
RPCReq
{
JSONRPC
:
"2.0"
,
JSONRPC
:
"2.0"
,
...
@@ -129,20 +101,6 @@ func TestRPCCacheImmutableRPCs(t *testing.T) {
...
@@ -129,20 +101,6 @@ func TestRPCCacheImmutableRPCs(t *testing.T) {
},
},
name
:
"eth_getUncleByBlockHashAndIndex"
,
name
:
"eth_getUncleByBlockHashAndIndex"
,
},
},
{
req
:
&
RPCReq
{
JSONRPC
:
"2.0"
,
Method
:
"eth_getTransactionReceipt"
,
Params
:
mustMarshalJSON
([]
string
{
"0x85d995eba9763907fdf35cd2034144dd9d53ce32cbec21349d4b12823c6860c5"
}),
ID
:
ID
,
},
res
:
&
RPCRes
{
JSONRPC
:
"2.0"
,
Result
:
`{"eth_getTransactionReceipt":"!"}`
,
ID
:
ID
,
},
name
:
"eth_getTransactionReceipt"
,
},
}
}
for
_
,
rpc
:=
range
rpcs
{
for
_
,
rpc
:=
range
rpcs
{
...
...
proxyd/integration_tests/caching_test.go
View file @
9ddfe570
...
@@ -77,12 +77,6 @@ func TestCaching(t *testing.T) {
...
@@ -77,12 +77,6 @@ func TestCaching(t *testing.T) {
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getBlockByHash
\"
,
\"
id
\"
: 999}"
,
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getBlockByHash
\"
,
\"
id
\"
: 999}"
,
1
,
1
,
},
},
{
"eth_getTransactionByHash"
,
[]
interface
{}{
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
},
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getTransactionByHash
\"
,
\"
id
\"
: 999}"
,
1
,
},
{
{
"eth_getTransactionByBlockHashAndIndex"
,
"eth_getTransactionByBlockHashAndIndex"
,
[]
interface
{}{
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
,
"0x55"
},
[]
interface
{}{
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
,
"0x55"
},
...
@@ -95,12 +89,6 @@ func TestCaching(t *testing.T) {
...
@@ -95,12 +89,6 @@ func TestCaching(t *testing.T) {
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getUncleByBlockHashAndIndex
\"
,
\"
id
\"
: 999}"
,
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getUncleByBlockHashAndIndex
\"
,
\"
id
\"
: 999}"
,
1
,
1
,
},
},
{
"eth_getTransactionReceipt"
,
[]
interface
{}{
"0x85d995eba9763907fdf35cd2034144dd9d53ce32cbec21349d4b12823c6860c5"
},
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getTransactionReceipt
\"
,
\"
id
\"
: 999}"
,
1
,
},
/* not cacheable */
/* not cacheable */
{
{
"eth_getBlockByNumber"
,
"eth_getBlockByNumber"
,
...
@@ -111,6 +99,18 @@ func TestCaching(t *testing.T) {
...
@@ -111,6 +99,18 @@ func TestCaching(t *testing.T) {
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getBlockByNumber
\"
,
\"
id
\"
: 999}"
,
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getBlockByNumber
\"
,
\"
id
\"
: 999}"
,
2
,
2
,
},
},
{
"eth_getTransactionReceipt"
,
[]
interface
{}{
"0x85d995eba9763907fdf35cd2034144dd9d53ce32cbec21349d4b12823c6860c5"
},
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getTransactionReceipt
\"
,
\"
id
\"
: 999}"
,
2
,
},
{
"eth_getTransactionByHash"
,
[]
interface
{}{
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
},
"{
\"
jsonrpc
\"
:
\"
2.0
\"
,
\"
result
\"
:
\"
eth_getTransactionByHash
\"
,
\"
id
\"
: 999}"
,
2
,
},
{
{
"eth_call"
,
"eth_call"
,
[]
interface
{}{
[]
interface
{}{
...
...
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