Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eigenda client subsystem logger #136

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/load_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
12 changes: 8 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion store/eigenda.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading