optimism icon indicating copy to clipboard operation
optimism copied to clipboard

proxyd sometimes not working

Open imtipi opened this issue 3 years ago • 0 comments

I am trying to use proxyd to proxy multiple node providers because sometimes I can't pull alchemy's data for unknown reason(not network issues) in my replica. so I am using proxyd to provide RPC to my replica. But when I use proxyd, something wrong happened... my proxyd.toml

# List of WS methods to whitelist.
ws_method_whitelist = [
  "eth_subscribe",
  
]
# Enable WS on this backend group. There can only be one WS-enabled backend group.
ws_backend_group = "ws"

[server]
# Host for the proxyd RPC server to listen on.
rpc_host = "0.0.0.0"
# Port for the above.
rpc_port = 8084
# Host for the proxyd WS server to listen on.
ws_host = "0.0.0.0"
# Port for the above
ws_port = 8085
# Maximum client body size, in bytes, that the server will accept.
max_body_size_bytes = 10485760
max_concurrent_rpcs = 1000

#[redis]
# URL to a Redis instance.
#url = "redis://localhost:6379"

[metrics]
# Whether or not to enable Prometheus metrics.
enabled = true
# Host for the Prometheus metrics endpoint to listen on.
host = "0.0.0.0"
# Port for the above.
port = 9761

[backend]
# How long proxyd should wait for a backend response before timing out.
response_timeout_seconds = 5
# Maximum response size, in bytes, that proxyd will accept from a backend.
max_response_size_bytes = 5242880
# Maximum number of times proxyd will try a backend before giving up.
max_retries = 5
# Number of seconds to wait before trying an unhealthy backend again.
out_of_service_seconds = 25

[backends]
# A map of backends by name.
[backends.infura]
# The URL to contact the backend at. Will be read from the environment
# if an environment variable prefixed with $ is provided.
rpc_url = "https://optimism-mainnet.infura.io/v3/redacted"
# The WS URL to contact the backend at. Will be read from the environment
# if an environment variable prefixed with $ is provided.
ws_url = "https://optimism-mainnet.infura.io/v3/redacted"
username = ""
# An HTTP Basic password to authenticate with the backend. Will be read from
# the environment if an environment variable prefixed with $ is provided.
password = ""
max_rps = 3
max_ws_conns = 0
# Path to a custom root CA.
ca_file = ""
# Path to a custom client cert file.
client_cert_file = ""
# Path to a custom client key file.
client_key_file = ""

[backends.alchemy]
rpc_url = "https://opt-mainnet.g.alchemy.com/v2/redacted"
ws_url = "wss://opt-mainnet.g.alchemy.com/v2/redacted"
username = ""
password = ""
max_rps = 30
max_ws_conns = 1

[backends.getblock]
rpc_url = "https://optimism.getblock.io/mainnet/redacted"
ws_url = "wss://optimism.getblock.io/mainnet/redacted"
username = ""
password = ""
max_rps = 30
max_ws_conns = 1

[backends.optimism]
rpc_url = "https://mainnet.optimism.io/"
ws_url = "https://mainnet.optimism.io/"
username = ""
password = ""
max_rps = 3
max_ws_conns = 0

[backends.blockvision]
rpc_url = "https://opt-mainnet.blockvision.org/v1/redacted"
ws_url = "wss://opt-mainnet.blockvision.org/v1/redacted"
username = ""
password = ""
max_rps = 30
max_ws_conns = 1

[backend_groups]
[backend_groups.main]
backends = ["alchemy","infura","blockvision","getblock","optimism"]

[backend_groups.blockrangeenable]
backends = ["blockvision","getblock","infura","optimism"]

[backend_groups.ws]
backends = ["alchemy","blockvision","getblock"]

# If the authentication group below is in the config,
# proxyd will only accept authenticated requests.
#[authentication]
# Mapping of auth key to alias. The alias is used to provide a human-
# readable name for the auth key in monitoring. The auth key will be
# read from the environment if an environment variable prefixed with $
# is provided. Note that you will need to quote the environment variable
# in order for it to be value TOML, e.g. "$FOO_AUTH_KEY" = "foo_alias".
#secret = "test"

# Mapping of methods to backend groups.
[rpc_method_mappings]
eth_getBlockRange = "blockrangeenable"
net_version ="main"
eth_chainId = "main"
eth_blockNumber = "main"

and when I start the proxyd,I received these logs

Updating CA certificates.
WARNING: ca-certificates.crt does not contain exactly one certificate or CRL: skipping

Running CMD.
{"commit":"936033efcf0fcbd9c2592f3d558a863622deca6d","date":"05-05-2022","lvl":"info","msg":"starting proxyd","t":"2022-05-26T15:27:22.344563888Z","version":"3.8.6"}
{"lvl":"warn","msg":"redis is not configured, using local rate limiter","t":"2022-05-26T15:27:22.345155843Z"}
{"lvl":"warn","msg":"proxied requests' XFF header will not contain the proxyd ip address","t":"2022-05-26T15:27:22.345201992Z"}
{"lvl":"info","msg":"configured backend","name":"blockvision","rpc_url":"https://opt-mainnet.blockvision.org/v1/redacted","t":"2022-05-26T15:27:22.345221734Z","ws_url":"wss://opt-mainnet.blockvision.org/v1/redacted"}
{"lvl":"warn","msg":"proxied requests' XFF header will not contain the proxyd ip address","t":"2022-05-26T15:27:22.345272679Z"}
{"lvl":"info","msg":"configured backend","name":"infura","rpc_url":"https://optimism-mainnet.infura.io/v3/redacted","t":"2022-05-26T15:27:22.345290537Z","ws_url":"https://optimism-mainnet.infura.io/v3/redacted"}
{"lvl":"warn","msg":"proxied requests' XFF header will not contain the proxyd ip address","t":"2022-05-26T15:27:22.345341715Z"}
{"lvl":"info","msg":"configured backend","name":"alchemy","rpc_url":"https://opt-mainnet.g.alchemy.com/v2/redacted","t":"2022-05-26T15:27:22.345359827Z","ws_url":"wss://opt-mainnet.g.alchemy.com/v2/redacted"}
{"lvl":"warn","msg":"proxied requests' XFF header will not contain the proxyd ip address","t":"2022-05-26T15:27:22.345384011Z"}
{"lvl":"info","msg":"configured backend","name":"getblock","rpc_url":"https://optimism.getblock.io/mainnet/?api_key=redacted","t":"2022-05-26T15:27:22.345396535Z","ws_url":"wss://optimism.getblock.io/mainnet/?api_key=redacted"}
{"lvl":"warn","msg":"proxied requests' XFF header will not contain the proxyd ip address","t":"2022-05-26T15:27:22.345409674Z"}
{"lvl":"info","msg":"configured backend","name":"optimism","rpc_url":"https://mainnet.optimism.io/","t":"2022-05-26T15:27:22.345420418Z","ws_url":"https://mainnet.optimism.io/"}
{"addr":"0.0.0.0:9761","lvl":"info","msg":"starting metrics server","t":"2022-05-26T15:27:22.345445992Z"}
{"addr":"0.0.0.0:8085","lvl":"info","msg":"starting WS server","t":"2022-05-26T15:27:22.345596426Z"}
{"addr":"0.0.0.0:8084","lvl":"info","msg":"starting HTTP server","t":"2022-05-26T15:27:22.34565186Z"}
{"lvl":"info","msg":"started proxyd","t":"2022-05-26T15:27:22.356018886Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"3a0b0205cd140e1975f2","t":"2022-05-26T15:27:23.591991159Z","user_agent":"data-transport-layer"}
{"auth":"none","body":"{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":15342,\"jsonrpc\":\"2.0\"}","lvl":"info","msg":"Raw RPC request","req_id":"3a0b0205cd140e1975f2","t":"2022-05-26T15:27:23.592126078Z"}
{"auth":"none","backend":"alchemy","batch_size":1,"lvl":"info","msg":"forwarded RPC request","req_id":"3a0b0205cd140e1975f2","t":"2022-05-26T15:27:23.734068553Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:23.740823484Z","user_agent":"axios/0.21.2"}
{"auth":"none","body":"{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockRange\",\"params\":[\"0x899a17\",\"0x899dff\",true],\"id\":\"1\"}","lvl":"info","msg":"Raw RPC request","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:23.740913258Z"}
{"err":"response code 507","lvl":"warn","msg":"backend request failed, trying again","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:24.456017876Z"}
{"err":"response code 507","lvl":"warn","msg":"backend request failed, trying again","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:25.831681721Z"}
{"err":"response code 507","lvl":"warn","msg":"backend request failed, trying again","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:28.098615981Z"}
{"err":"response code 507","lvl":"warn","msg":"backend request failed, trying again","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:31.314362319Z"}
{"err":"error in backend request Post \"https://opt-mainnet.blockvision.org/v1/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741021053Z"}
{"err":"error in backend request Post \"https://opt-mainnet.blockvision.org/v1/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741295485Z"}
{"auth":"none","err":"permanent error forwarding request error in backend request Post \"https://opt-mainnet.blockvision.org/v1/redacted\": context deadline exceeded","lvl":"eror","msg":"error forwarding request to backend","name":"blockvision","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741409984Z"}
{"err":"error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741551245Z"}
{"err":"error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741612101Z"}
{"err":"error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741654055Z"}
{"err":"error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741713162Z"}
{"err":"error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.74181962Z"}
{"err":"error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741914464Z"}
{"auth":"none","err":"permanent error forwarding request error in backend request Post \"https://optimism.getblock.io/mainnet/?api_key=redacted\": context deadline exceeded","lvl":"eror","msg":"error forwarding request to backend","name":"getblock","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.741968079Z"}
{"err":"error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742067381Z"}
{"err":"error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742121706Z"}
{"err":"error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742164072Z"}
{"err":"error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742225099Z"}
{"err":"error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742491229Z"}
{"err":"error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.74256003Z"}
{"auth":"none","err":"permanent error forwarding request error in backend request Post \"https://optimism-mainnet.infura.io/v3/redacted\": context deadline exceeded","lvl":"eror","msg":"error forwarding request to backend","name":"infura","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742587347Z"}
{"err":"error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742657226Z"}
{"err":"error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742698632Z"}
{"err":"error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.74273376Z"}
{"err":"error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742770085Z"}
{"err":"error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742803467Z"}
{"err":"error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"warn","msg":"backend request failed, trying again","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.74283722Z"}
{"auth":"none","err":"permanent error forwarding request error in backend request Post \"https://mainnet.optimism.io/\": context deadline exceeded","lvl":"eror","msg":"error forwarding request to backend","name":"optimism","req_id":"9b520e209b218cfdf0a3","t":"2022-05-26T15:27:33.742860522Z"}
{"backend_group":"{groupID:1 backendGroup:blockrangeenable}","batch_size":1,"err":"no backends available for method","lvl":"eror","msg":"error forwarding RPC batch","t":"2022-05-26T15:27:33.742912559Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"9cb2e697e1ffbc108dd4","t":"2022-05-26T15:27:34.247707415Z","user_agent":"data-transport-layer"}
{"auth":"none","body":"{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":15343,\"jsonrpc\":\"2.0\"}","lvl":"info","msg":"Raw RPC request","req_id":"9cb2e697e1ffbc108dd4","t":"2022-05-26T15:27:34.247796612Z"}
{"auth":"none","backend":"alchemy","batch_size":1,"lvl":"info","msg":"forwarded RPC request","req_id":"9cb2e697e1ffbc108dd4","t":"2022-05-26T15:27:34.325324346Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"21c96141a3a7932d193d","t":"2022-05-26T15:27:34.327878318Z","user_agent":"axios/0.21.2"}
{"auth":"none","body":"{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockRange\",\"params\":[\"0x899a17\",\"0x899dff\",true],\"id\":\"1\"}","lvl":"info","msg":"Raw RPC request","req_id":"21c96141a3a7932d193d","t":"2022-05-26T15:27:34.328023129Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"blockvision","req_id":"21c96141a3a7932d193d","t":"2022-05-26T15:27:34.32809561Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"getblock","req_id":"21c96141a3a7932d193d","t":"2022-05-26T15:27:34.328156394Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"infura","req_id":"21c96141a3a7932d193d","t":"2022-05-26T15:27:34.328176816Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"optimism","req_id":"21c96141a3a7932d193d","t":"2022-05-26T15:27:34.328195238Z"}
{"backend_group":"{groupID:1 backendGroup:blockrangeenable}","batch_size":1,"err":"no backends available for method","lvl":"eror","msg":"error forwarding RPC batch","t":"2022-05-26T15:27:34.328211786Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"9048e8965f5aead80a84","t":"2022-05-26T15:27:34.836027935Z","user_agent":"data-transport-layer"}
{"auth":"none","body":"{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":15344,\"jsonrpc\":\"2.0\"}","lvl":"info","msg":"Raw RPC request","req_id":"9048e8965f5aead80a84","t":"2022-05-26T15:27:34.836134497Z"}
{"auth":"none","backend":"alchemy","batch_size":1,"lvl":"info","msg":"forwarded RPC request","req_id":"9048e8965f5aead80a84","t":"2022-05-26T15:27:34.922351865Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"11129c99af5e1979fac0","t":"2022-05-26T15:27:34.925834201Z","user_agent":"axios/0.21.2"}
{"auth":"none","body":"{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockRange\",\"params\":[\"0x899a17\",\"0x899dff\",true],\"id\":\"1\"}","lvl":"info","msg":"Raw RPC request","req_id":"11129c99af5e1979fac0","t":"2022-05-26T15:27:34.925923209Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"blockvision","req_id":"11129c99af5e1979fac0","t":"2022-05-26T15:27:34.925979261Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"getblock","req_id":"11129c99af5e1979fac0","t":"2022-05-26T15:27:34.926069048Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"infura","req_id":"11129c99af5e1979fac0","t":"2022-05-26T15:27:34.926092649Z"}
{"auth":"none","lvl":"warn","msg":"skipping offline backend","name":"optimism","req_id":"11129c99af5e1979fac0","t":"2022-05-26T15:27:34.926109126Z"}
{"backend_group":"{groupID:1 backendGroup:blockrangeenable}","batch_size":1,"err":"no backends available for method","lvl":"eror","msg":"error forwarding RPC batch","t":"2022-05-26T15:27:34.926125339Z"}
{"auth":"none","lvl":"info","msg":"received RPC request","req_id":"87963c7dda1b81533058","t":"2022-05-26T15:27:35.430489809Z","user_agent":"data-transport-layer"}
{"auth":"none","body":"{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":15345,\"jsonrpc\":\"2.0\"}","lvl":"info","msg":"Raw RPC request","req_id":"87963c7dda1b81533058","t":"2022-05-26T15:27:35.430587085Z"}

Snipaste_2022-05-26_23-21-24

btw,proxyd not accept the backend with empty ws_url, but not every node provided WebSocket...

imtipi avatar May 26 '22 15:05 imtipi