From 7950eb9d7dc6fba7eed1c9970373e772f59bb43c Mon Sep 17 00:00:00 2001 From: Felipe Andrade Date: Thu, 18 May 2023 15:41:01 -0700 Subject: [PATCH 1/2] fix(proxyd): clean up cache initialization --- proxyd/proxyd/config.go | 4 +--- proxyd/proxyd/proxyd.go | 16 ---------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/proxyd/proxyd/config.go b/proxyd/proxyd/config.go index 2edd5f9..0e75769 100644 --- a/proxyd/proxyd/config.go +++ b/proxyd/proxyd/config.go @@ -26,9 +26,7 @@ type ServerConfig struct { } type CacheConfig struct { - Enabled bool `toml:"enabled"` - BlockSyncRPCURL string `toml:"block_sync_rpc_url"` - NumBlockConfirmations int `toml:"num_block_confirmations"` + Enabled bool `toml:"enabled"` } type RedisConfig struct { diff --git a/proxyd/proxyd/proxyd.go b/proxyd/proxyd/proxyd.go index b145b15..afb27bc 100644 --- a/proxyd/proxyd/proxyd.go +++ b/proxyd/proxyd/proxyd.go @@ -9,7 +9,6 @@ import ( "time" "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/log" "github.com/go-redis/redis/v8" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -206,27 +205,12 @@ func Start(config *Config) (*Server, func(), error) { rpcCache RPCCache ) 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 { log.Warn("redis is not configured, using in-memory cache") cache = newMemoryCache() } else { 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)) } From 5616f40a162432aeca01d6b301d67f745709776f Mon Sep 17 00:00:00 2001 From: Felipe Andrade Date: Thu, 18 May 2023 16:30:33 -0700 Subject: [PATCH 2/2] also remove from config files --- proxyd/proxyd/integration_tests/testdata/caching.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/proxyd/proxyd/integration_tests/testdata/caching.toml b/proxyd/proxyd/integration_tests/testdata/caching.toml index 246a16e..f3c1327 100644 --- a/proxyd/proxyd/integration_tests/testdata/caching.toml +++ b/proxyd/proxyd/integration_tests/testdata/caching.toml @@ -10,8 +10,6 @@ namespace = "proxyd" [cache] enabled = true -block_sync_rpc_url = "$GOOD_BACKEND_RPC_URL" - [backends] [backends.good]