-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into quaq/blob-verification
- Loading branch information
Showing
96 changed files
with
3,561 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Security Policy | ||
|
||
## Version Information | ||
|
||
Please see [Releases](https://github.com/Layr-Labs/eigenda/releases) and we recommend using the [most recently released version](https://github.com/Layr-Labs/eigenda/releases/latest). | ||
|
||
## Audit reports | ||
|
||
Audit reports are published in the `docs` folder: https://github.com/Layr-Labs/eigenda/master/docs/audits | ||
|
||
| Date | Report Link | | ||
| ------- | ----------- | | ||
| 202404 | [pdf](https://github.com/Layr-Labs/eigenda/blob/security-doc/docs/audits/Sigma_Prime_EigenDA_Offchain_Security_Assessment_Report.pdf) | | ||
|
||
## Reporting a Vulnerability | ||
|
||
**Please do not file a public ticket** mentioning the vulnerability. | ||
|
||
Please report security vulnerabilities to [email protected] with the all the relavent details included in the email. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package metrics | ||
|
||
// Config provides configuration for a Metrics instance. | ||
type Config struct { | ||
// Namespace is the namespace for the metrics. | ||
Namespace string | ||
|
||
// HTTPPort is the port to serve metrics on. | ||
HTTPPort int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package metrics | ||
|
||
import ( | ||
"fmt" | ||
"github.com/Layr-Labs/eigensdk-go/logging" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
var _ CountMetric = &countMetric{} | ||
|
||
// countMetric a standard implementation of the CountMetric. | ||
type countMetric struct { | ||
Metric | ||
|
||
// logger is the logger used to log errors. | ||
logger logging.Logger | ||
|
||
// name is the name of the metric. | ||
name string | ||
|
||
// description is the description of the metric. | ||
description string | ||
|
||
// counter is the prometheus counter used to report this metric. | ||
vec *prometheus.CounterVec | ||
|
||
// labeler is the label maker used to create labels for this metric. | ||
labeler *labelMaker | ||
} | ||
|
||
// newCountMetric creates a new CountMetric instance. | ||
func newCountMetric( | ||
logger logging.Logger, | ||
registry *prometheus.Registry, | ||
namespace string, | ||
name string, | ||
description string, | ||
labelTemplate any) (CountMetric, error) { | ||
|
||
labeler, err := newLabelMaker(labelTemplate) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
vec := promauto.With(registry).NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: namespace, | ||
Name: fmt.Sprintf("%s_count", name), | ||
}, | ||
labeler.getKeys(), | ||
) | ||
|
||
return &countMetric{ | ||
logger: logger, | ||
name: name, | ||
description: description, | ||
vec: vec, | ||
labeler: labeler, | ||
}, nil | ||
} | ||
|
||
func (m *countMetric) Name() string { | ||
return m.name | ||
} | ||
|
||
func (m *countMetric) Unit() string { | ||
return "count" | ||
} | ||
|
||
func (m *countMetric) Description() string { | ||
return m.description | ||
} | ||
|
||
func (m *countMetric) Type() string { | ||
return "counter" | ||
} | ||
|
||
func (m *countMetric) LabelFields() []string { | ||
return m.labeler.getKeys() | ||
} | ||
|
||
func (m *countMetric) Increment(label ...any) { | ||
m.Add(1, label...) | ||
} | ||
|
||
func (m *countMetric) Add(value float64, label ...any) { | ||
var l any | ||
if len(label) > 0 { | ||
l = label[0] | ||
} | ||
|
||
values, err := m.labeler.extractValues(l) | ||
if err != nil { | ||
m.logger.Errorf("error extracting values from label for metric %s: %v", m.name, err) | ||
return | ||
} | ||
|
||
observer := m.vec.WithLabelValues(values...) | ||
observer.Add(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package metrics | ||
|
||
import ( | ||
"fmt" | ||
"github.com/Layr-Labs/eigensdk-go/logging" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
var _ GaugeMetric = &gaugeMetric{} | ||
|
||
// gaugeMetric is a standard implementation of the GaugeMetric interface via prometheus. | ||
type gaugeMetric struct { | ||
Metric | ||
|
||
// logger is the logger used to log errors. | ||
logger logging.Logger | ||
|
||
// name is the name of the metric. | ||
name string | ||
|
||
// unit is the unit of the metric. | ||
unit string | ||
|
||
// description is the description of the metric. | ||
description string | ||
|
||
// gauge is the prometheus gauge used to report this metric. | ||
vec *prometheus.GaugeVec | ||
|
||
// labeler is the label maker used to create labels for this metric. | ||
labeler *labelMaker | ||
} | ||
|
||
// newGaugeMetric creates a new GaugeMetric instance. | ||
func newGaugeMetric( | ||
logger logging.Logger, | ||
registry *prometheus.Registry, | ||
namespace string, | ||
name string, | ||
unit string, | ||
description string, | ||
labelTemplate any) (GaugeMetric, error) { | ||
|
||
labeler, err := newLabelMaker(labelTemplate) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
vec := promauto.With(registry).NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Name: fmt.Sprintf("%s_%s", name, unit), | ||
}, | ||
labeler.getKeys(), | ||
) | ||
|
||
return &gaugeMetric{ | ||
logger: logger, | ||
name: name, | ||
unit: unit, | ||
description: description, | ||
vec: vec, | ||
labeler: labeler, | ||
}, nil | ||
} | ||
|
||
func (m *gaugeMetric) Name() string { | ||
return m.name | ||
} | ||
|
||
func (m *gaugeMetric) Unit() string { | ||
return m.unit | ||
} | ||
|
||
func (m *gaugeMetric) Description() string { | ||
return m.description | ||
} | ||
|
||
func (m *gaugeMetric) Type() string { | ||
return "gauge" | ||
} | ||
|
||
func (m *gaugeMetric) LabelFields() []string { | ||
return m.labeler.getKeys() | ||
} | ||
|
||
func (m *gaugeMetric) Set(value float64, label ...any) { | ||
var l any | ||
if len(label) > 0 { | ||
l = label[0] | ||
} | ||
|
||
values, err := m.labeler.extractValues(l) | ||
if err != nil { | ||
m.logger.Errorf("failed to extract values from label: %v", err) | ||
return | ||
} | ||
|
||
observer := m.vec.WithLabelValues(values...) | ||
|
||
observer.Set(value) | ||
} |
Oops, something went wrong.