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
d0de085d
Unverified
Commit
d0de085d
authored
May 19, 2023
by
OptimismBot
Committed by
GitHub
May 19, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5739 from ethereum-optimism/felipe/cache-fix-b
fix(proxyd): clean up cache initialization
parents
4f228fe9
3eaf194c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
21 deletions
+1
-21
config.go
proxyd/config.go
+1
-3
caching.toml
proxyd/integration_tests/testdata/caching.toml
+0
-2
proxyd.go
proxyd/proxyd.go
+0
-16
No files found.
proxyd/config.go
View file @
d0de085d
...
@@ -26,9 +26,7 @@ type ServerConfig struct {
...
@@ -26,9 +26,7 @@ type ServerConfig struct {
}
}
type
CacheConfig
struct
{
type
CacheConfig
struct
{
Enabled
bool
`toml:"enabled"`
Enabled
bool
`toml:"enabled"`
BlockSyncRPCURL
string
`toml:"block_sync_rpc_url"`
NumBlockConfirmations
int
`toml:"num_block_confirmations"`
}
}
type
RedisConfig
struct
{
type
RedisConfig
struct
{
...
...
proxyd/integration_tests/testdata/caching.toml
View file @
d0de085d
...
@@ -10,8 +10,6 @@ namespace = "proxyd"
...
@@ -10,8 +10,6 @@ namespace = "proxyd"
[cache]
[cache]
enabled
=
true
enabled
=
true
block_sync_rpc_url
=
"$GOOD_BACKEND_RPC_URL"
[backends]
[backends]
[backends.good]
[backends.good]
...
...
proxyd/proxyd.go
View file @
d0de085d
...
@@ -9,7 +9,6 @@ import (
...
@@ -9,7 +9,6 @@ import (
"time"
"time"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/go-redis/redis/v8"
"github.com/go-redis/redis/v8"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/client_golang/prometheus/promhttp"
...
@@ -206,27 +205,12 @@ func Start(config *Config) (*Server, func(), error) {
...
@@ -206,27 +205,12 @@ func Start(config *Config) (*Server, func(), error) {
rpcCache
RPCCache
rpcCache
RPCCache
)
)
if
config
.
Cache
.
Enabled
{
if
config
.
Cache
.
Enabled
{
if
config
.
Cache
.
BlockSyncRPCURL
==
""
{
return
nil
,
nil
,
fmt
.
Errorf
(
"block sync node required for caching"
)
}
blockSyncRPCURL
,
err
:=
ReadFromEnvOrConfig
(
config
.
Cache
.
BlockSyncRPCURL
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
if
redisClient
==
nil
{
if
redisClient
==
nil
{
log
.
Warn
(
"redis is not configured, using in-memory cache"
)
log
.
Warn
(
"redis is not configured, using in-memory cache"
)
cache
=
newMemoryCache
()
cache
=
newMemoryCache
()
}
else
{
}
else
{
cache
=
newRedisCache
(
redisClient
,
config
.
Redis
.
Namespace
)
cache
=
newRedisCache
(
redisClient
,
config
.
Redis
.
Namespace
)
}
}
// Ideally, the BlocKSyncRPCURL should be the sequencer or a HA replica that's not far behind
ethClient
,
err
:=
ethclient
.
Dial
(
blockSyncRPCURL
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
defer
ethClient
.
Close
()
rpcCache
=
newRPCCache
(
newCacheWithCompression
(
cache
))
rpcCache
=
newRPCCache
(
newCacheWithCompression
(
cache
))
}
}
...
...
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