From a05d57cc3953be7cf3cc3c3ee4c0a5f5d061d758 Mon Sep 17 00:00:00 2001 From: George Zhang Date: Wed, 29 May 2024 14:22:16 +0800 Subject: [PATCH 1/2] Log request url for eth_sendRawTransaction --- server/request_handler.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/request_handler.go b/server/request_handler.go index 09f42b1..082f3d6 100644 --- a/server/request_handler.go +++ b/server/request_handler.go @@ -125,14 +125,16 @@ func (r *RpcRequestHandler) process() { r.logger = r.logger.New("rpc_method", jsonReq.Method) // Process single request - r.processRequest(client, jsonReq, origin, referer, isWhitehatBundleCollection, whitehatBundleId, urlParams) + r.processRequest(client, jsonReq, origin, referer, isWhitehatBundleCollection, whitehatBundleId, urlParams, r.req.URL.String()) } // processRequest handles single request -func (r *RpcRequestHandler) processRequest(client RPCProxyClient, jsonReq *types.JsonRpcRequest, origin, referer string, isWhitehatBundleCollection bool, whitehatBundleId string, urlParams URLParameters) { +func (r *RpcRequestHandler) processRequest(client RPCProxyClient, jsonReq *types.JsonRpcRequest, origin, referer string, isWhitehatBundleCollection bool, whitehatBundleId string, urlParams URLParameters, reqURL string) { var entry *database.EthSendRawTxEntry if jsonReq.Method == "eth_sendRawTransaction" { entry = r.requestRecord.AddEthSendRawTxEntry(uuid.New()) + // log the full url for debugging + r.logger.Info("[processRequest] Request URL", "url", reqURL) } // Handle single request rpcReq := NewRpcRequest(r.logger, client, jsonReq, r.relaySigningKey, r.relayUrl, origin, referer, isWhitehatBundleCollection, whitehatBundleId, entry, urlParams, r.chainID, r.rpcCache) @@ -149,7 +151,6 @@ func (r *RpcRequestHandler) finishRequest() { if err := r.requestRecord.SaveRecord(); err != nil { log.Error("saveRecord failed", "requestId", r.requestRecord.requestEntry.Id, "error", err, "requestId", r.uid) } - }() r.logger.Info("Request finished", "duration", reqDuration.Seconds()) } From 9fe2936971bb40a1128b5a5d4eddfe3ce70f658e Mon Sep 17 00:00:00 2001 From: TymKh Date: Wed, 29 May 2024 15:16:32 +0200 Subject: [PATCH 2/2] Update server/request_handler.go Co-authored-by: Chris Hager --- server/request_handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/request_handler.go b/server/request_handler.go index 082f3d6..60a4a97 100644 --- a/server/request_handler.go +++ b/server/request_handler.go @@ -134,7 +134,7 @@ func (r *RpcRequestHandler) processRequest(client RPCProxyClient, jsonReq *types if jsonReq.Method == "eth_sendRawTransaction" { entry = r.requestRecord.AddEthSendRawTxEntry(uuid.New()) // log the full url for debugging - r.logger.Info("[processRequest] Request URL", "url", reqURL) + r.logger.Info("[processRequest] eth_sendRawTransaction request URL", "url", reqURL) } // Handle single request rpcReq := NewRpcRequest(r.logger, client, jsonReq, r.relaySigningKey, r.relayUrl, origin, referer, isWhitehatBundleCollection, whitehatBundleId, entry, urlParams, r.chainID, r.rpcCache)