From 157269c6a621cf99ca5f773f0a115fee3991541b Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Thu, 19 Sep 2024 20:08:57 -0700 Subject: [PATCH 1/3] format: middleware function signatures for better readability --- server/server.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/server.go b/server/server.go index 862ac9e9..a9b1231d 100644 --- a/server/server.go +++ b/server/server.go @@ -60,8 +60,10 @@ func NewServer(host string, port int, router store.IRouter, log log.Logger, } // WithMetrics is a middleware that records metrics for the route path. -func WithMetrics(handleFn func(http.ResponseWriter, *http.Request) (commitments.CommitmentMeta, error), - m metrics.Metricer) func(http.ResponseWriter, *http.Request) error { +func WithMetrics( + handleFn func(http.ResponseWriter, *http.Request) (commitments.CommitmentMeta, error), + m metrics.Metricer, +) func(http.ResponseWriter, *http.Request) error { return func(w http.ResponseWriter, r *http.Request) error { recordDur := m.RecordRPCServerRequest(r.Method) @@ -73,8 +75,10 @@ func WithMetrics(handleFn func(http.ResponseWriter, *http.Request) (commitments. } // WithLogging is a middleware that logs the request method and URL. -func WithLogging(handleFn func(http.ResponseWriter, *http.Request) error, - log log.Logger) func(http.ResponseWriter, *http.Request) { +func WithLogging( + handleFn func(http.ResponseWriter, *http.Request) error, + log log.Logger, +) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { log.Info("request", "method", r.Method, "url", r.URL) err := handleFn(w, r) From b80e97bdf2943426a7489b9b8a8dc7def622c3bf Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Thu, 19 Sep 2024 20:09:15 -0700 Subject: [PATCH 2/3] chore: wrap an error for easier debugging --- store/eigenda.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/eigenda.go b/store/eigenda.go index 52dced8e..4387a483 100644 --- a/store/eigenda.go +++ b/store/eigenda.go @@ -143,7 +143,7 @@ func (e EigenDAStore) Verify(key []byte, value []byte) error { // verify kzg data commitment err = e.verifier.VerifyCommitment(cert.BlobHeader.Commitment, encodedBlob) if err != nil { - return err + return fmt.Errorf("failed to verify commitment: %w", err) } // verify DA certificate against on-chain From 51d3c616fae703fd0d6091aff8dc28bcd1867dd4 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Thu, 19 Sep 2024 20:09:43 -0700 Subject: [PATCH 3/3] chore: give eigenda-client its own logger with subsystem label --- server/load_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/load_store.go b/server/load_store.go index 3e8904cc..1b1bf548 100644 --- a/server/load_store.go +++ b/server/load_store.go @@ -95,7 +95,7 @@ func LoadStoreRouter(ctx context.Context, cfg CLIConfig, log log.Logger) (store. } else { var client *clients.EigenDAClient log.Info("Using EigenDA backend") - client, err = clients.NewEigenDAClient(log, daCfg.ClientConfig) + client, err = clients.NewEigenDAClient(log.With("subsystem", "eigenda-client"), daCfg.ClientConfig) if err != nil { return nil, err }