From 8f768a71ee11614b49001490347fc33cdd2997a6 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 22 Jan 2024 10:39:06 -0600
Subject: [PATCH 1/6] chore(deps): Bump the otel group with 4 updates (#3121)
Bumps the otel group with 4 updates:
[go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go),
[go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp](https://github.com/open-telemetry/opentelemetry-go),
[go.opentelemetry.io/otel/exporters/otlp/otlptrace](https://github.com/open-telemetry/opentelemetry-go)
and
[go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://github.com/open-telemetry/opentelemetry-go).
Updates `go.opentelemetry.io/otel` from 1.21.0 to 1.22.0
Changelog
Sourced from go.opentelemetry.io/otel's
changelog.
[1.22.0/0.45.0] 2024-01-17
Added
- The
go.opentelemetry.io/otel/semconv/v1.22.0
package.
The package contains semantic conventions from the v1.22.0
version of the OpenTelemetry Semantic Conventions. (#4735)
- The
go.opentelemetry.io/otel/semconv/v1.23.0
package.
The package contains semantic conventions from the v1.23.0
version of the OpenTelemetry Semantic Conventions. (#4746)
- The
go.opentelemetry.io/otel/semconv/v1.23.1
package.
The package contains semantic conventions from the v1.23.1
version of the OpenTelemetry Semantic Conventions. (#4749)
- The
go.opentelemetry.io/otel/semconv/v1.24.0
package.
The package contains semantic conventions from the v1.24.0
version of the OpenTelemetry Semantic Conventions. (#4770)
- Add
WithResourceAsConstantLabels
option to apply
resource attributes for every metric emitted by the Prometheus exporter.
(#4733)
- Experimental cardinality limiting is added to the metric SDK.
See metric
documentation for more information about this feature and how to
enable it. (#4457)
- Add
NewMemberRaw
and
NewKeyValuePropertyRaw
in
go.opentelemetry.io/otel/baggage
. (#4804)
Changed
- Upgrade all use of
go.opentelemetry.io/otel/semconv
to
use v1.24.0
. (#4754)
- Update transformations in
go.opentelemetry.io/otel/exporters/zipkin
to follow
v1.19.0
version of the OpenTelemetry specification. (#4754)
- Record synchronous measurements when the passed context is canceled
instead of dropping in
go.opentelemetry.io/otel/sdk/metric
.
If you do not want to make a measurement when the context is cancelled,
you need to handle it yourself (e.g if ctx.Err() != nil
).
(#4671)
- Improve
go.opentelemetry.io/otel/trace.TraceState
's
performance. (#4722)
- Improve
go.opentelemetry.io/otel/propagation.TraceContext
's
performance. (#4721)
- Improve
go.opentelemetry.io/otel/baggage
performance.
(#4743)
- Improve performance of the
(*Set).Filter
method in
go.opentelemetry.io/otel/attribute
when the passed filter
does not filter out any attributes from the set. (#4774)
Member.String
in
go.opentelemetry.io/otel/baggage
percent-encodes only when
necessary. (#4775)
- Improve
go.opentelemetry.io/otel/trace.Span
's
performance when adding multiple attributes. (#4818)
Property.Value
in
go.opentelemetry.io/otel/baggage
now returns a raw string
instead of a percent-encoded value. (#4804)
Fixed
- Fix
Parse
in
go.opentelemetry.io/otel/baggage
to validate member value
before percent-decoding. (#4755)
- Fix whitespace encoding of
Member.String
in
go.opentelemetry.io/otel/baggage
. (#4756)
- Fix observable not registered error when the asynchronous instrument
has a drop aggregation in
go.opentelemetry.io/otel/sdk/metric
. (#4772)
- Fix baggage item key so that it is not canonicalized in
go.opentelemetry.io/otel/bridge/opentracing
. (#4776)
- Fix
go.opentelemetry.io/otel/bridge/opentracing
to
properly handle baggage values that requires escaping during
propagation. (#4804)
- Fix a bug where using multiple readers resulted in incorrect
asynchronous counter values in
go.opentelemetry.io/otel/sdk/metric
. (#4742)
Commits
279c549
Release v1.22.0/v0.45.0 (#4821)
237ed37
Fix link changes from instrumentation to languages (#4828)
5ed29d9
Bump lycheeverse/lychee-action from 1.9.0 to 1.9.1 (#4824)
4491b39
sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() (#4818)
19622d3
chore(docs): explicitly mark lizthegrey emeritus (#4822)
7fa7d1b
sdk/metric: Fix observable not registered error when the asynchronous
instrum...
01472db
Upgrade use of semconv to v1.24.0 (#4754)
259143a
baggage: Add NewMemberRaw and NewKeyValuePropertyRaw (#4804)
6ead8d8
Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /internal/tools
(#4815)
deddec3
Optimize (attribute.Set).Filter
for no filtered case (#4774)
- Additional commits viewable in compare
view
Updates
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` from
0.44.0 to 0.45.0
Changelog
Sourced from go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp's
changelog.
[1.22.0/0.45.0] 2024-01-17
Added
- The
go.opentelemetry.io/otel/semconv/v1.22.0
package.
The package contains semantic conventions from the v1.22.0
version of the OpenTelemetry Semantic Conventions. (#4735)
- The
go.opentelemetry.io/otel/semconv/v1.23.0
package.
The package contains semantic conventions from the v1.23.0
version of the OpenTelemetry Semantic Conventions. (#4746)
- The
go.opentelemetry.io/otel/semconv/v1.23.1
package.
The package contains semantic conventions from the v1.23.1
version of the OpenTelemetry Semantic Conventions. (#4749)
- The
go.opentelemetry.io/otel/semconv/v1.24.0
package.
The package contains semantic conventions from the v1.24.0
version of the OpenTelemetry Semantic Conventions. (#4770)
- Add
WithResourceAsConstantLabels
option to apply
resource attributes for every metric emitted by the Prometheus exporter.
(#4733)
- Experimental cardinality limiting is added to the metric SDK.
See metric
documentation for more information about this feature and how to
enable it. (#4457)
- Add
NewMemberRaw
and
NewKeyValuePropertyRaw
in
go.opentelemetry.io/otel/baggage
. (#4804)
Changed
- Upgrade all use of
go.opentelemetry.io/otel/semconv
to
use v1.24.0
. (#4754)
- Update transformations in
go.opentelemetry.io/otel/exporters/zipkin
to follow
v1.19.0
version of the OpenTelemetry specification. (#4754)
- Record synchronous measurements when the passed context is canceled
instead of dropping in
go.opentelemetry.io/otel/sdk/metric
.
If you do not want to make a measurement when the context is cancelled,
you need to handle it yourself (e.g if ctx.Err() != nil
).
(#4671)
- Improve
go.opentelemetry.io/otel/trace.TraceState
's
performance. (#4722)
- Improve
go.opentelemetry.io/otel/propagation.TraceContext
's
performance. (#4721)
- Improve
go.opentelemetry.io/otel/baggage
performance.
(#4743)
- Improve performance of the
(*Set).Filter
method in
go.opentelemetry.io/otel/attribute
when the passed filter
does not filter out any attributes from the set. (#4774)
Member.String
in
go.opentelemetry.io/otel/baggage
percent-encodes only when
necessary. (#4775)
- Improve
go.opentelemetry.io/otel/trace.Span
's
performance when adding multiple attributes. (#4818)
Property.Value
in
go.opentelemetry.io/otel/baggage
now returns a raw string
instead of a percent-encoded value. (#4804)
Fixed
- Fix
Parse
in
go.opentelemetry.io/otel/baggage
to validate member value
before percent-decoding. (#4755)
- Fix whitespace encoding of
Member.String
in
go.opentelemetry.io/otel/baggage
. (#4756)
- Fix observable not registered error when the asynchronous instrument
has a drop aggregation in
go.opentelemetry.io/otel/sdk/metric
. (#4772)
- Fix baggage item key so that it is not canonicalized in
go.opentelemetry.io/otel/bridge/opentracing
. (#4776)
- Fix
go.opentelemetry.io/otel/bridge/opentracing
to
properly handle baggage values that requires escaping during
propagation. (#4804)
- Fix a bug where using multiple readers resulted in incorrect
asynchronous counter values in
go.opentelemetry.io/otel/sdk/metric
. (#4742)
Commits
279c549
Release v1.22.0/v0.45.0 (#4821)
237ed37
Fix link changes from instrumentation to languages (#4828)
5ed29d9
Bump lycheeverse/lychee-action from 1.9.0 to 1.9.1 (#4824)
4491b39
sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() (#4818)
19622d3
chore(docs): explicitly mark lizthegrey emeritus (#4822)
7fa7d1b
sdk/metric: Fix observable not registered error when the asynchronous
instrum...
01472db
Upgrade use of semconv to v1.24.0 (#4754)
259143a
baggage: Add NewMemberRaw and NewKeyValuePropertyRaw (#4804)
6ead8d8
Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /internal/tools
(#4815)
deddec3
Optimize (attribute.Set).Filter
for no filtered case (#4774)
- Additional commits viewable in compare
view
Updates `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from 1.21.0
to 1.22.0
Changelog
Sourced from go.opentelemetry.io/otel/exporters/otlp/otlptrace's
changelog.
[1.22.0/0.45.0] 2024-01-17
Added
- The
go.opentelemetry.io/otel/semconv/v1.22.0
package.
The package contains semantic conventions from the v1.22.0
version of the OpenTelemetry Semantic Conventions. (#4735)
- The
go.opentelemetry.io/otel/semconv/v1.23.0
package.
The package contains semantic conventions from the v1.23.0
version of the OpenTelemetry Semantic Conventions. (#4746)
- The
go.opentelemetry.io/otel/semconv/v1.23.1
package.
The package contains semantic conventions from the v1.23.1
version of the OpenTelemetry Semantic Conventions. (#4749)
- The
go.opentelemetry.io/otel/semconv/v1.24.0
package.
The package contains semantic conventions from the v1.24.0
version of the OpenTelemetry Semantic Conventions. (#4770)
- Add
WithResourceAsConstantLabels
option to apply
resource attributes for every metric emitted by the Prometheus exporter.
(#4733)
- Experimental cardinality limiting is added to the metric SDK.
See metric
documentation for more information about this feature and how to
enable it. (#4457)
- Add
NewMemberRaw
and
NewKeyValuePropertyRaw
in
go.opentelemetry.io/otel/baggage
. (#4804)
Changed
- Upgrade all use of
go.opentelemetry.io/otel/semconv
to
use v1.24.0
. (#4754)
- Update transformations in
go.opentelemetry.io/otel/exporters/zipkin
to follow
v1.19.0
version of the OpenTelemetry specification. (#4754)
- Record synchronous measurements when the passed context is canceled
instead of dropping in
go.opentelemetry.io/otel/sdk/metric
.
If you do not want to make a measurement when the context is cancelled,
you need to handle it yourself (e.g if ctx.Err() != nil
).
(#4671)
- Improve
go.opentelemetry.io/otel/trace.TraceState
's
performance. (#4722)
- Improve
go.opentelemetry.io/otel/propagation.TraceContext
's
performance. (#4721)
- Improve
go.opentelemetry.io/otel/baggage
performance.
(#4743)
- Improve performance of the
(*Set).Filter
method in
go.opentelemetry.io/otel/attribute
when the passed filter
does not filter out any attributes from the set. (#4774)
Member.String
in
go.opentelemetry.io/otel/baggage
percent-encodes only when
necessary. (#4775)
- Improve
go.opentelemetry.io/otel/trace.Span
's
performance when adding multiple attributes. (#4818)
Property.Value
in
go.opentelemetry.io/otel/baggage
now returns a raw string
instead of a percent-encoded value. (#4804)
Fixed
- Fix
Parse
in
go.opentelemetry.io/otel/baggage
to validate member value
before percent-decoding. (#4755)
- Fix whitespace encoding of
Member.String
in
go.opentelemetry.io/otel/baggage
. (#4756)
- Fix observable not registered error when the asynchronous instrument
has a drop aggregation in
go.opentelemetry.io/otel/sdk/metric
. (#4772)
- Fix baggage item key so that it is not canonicalized in
go.opentelemetry.io/otel/bridge/opentracing
. (#4776)
- Fix
go.opentelemetry.io/otel/bridge/opentracing
to
properly handle baggage values that requires escaping during
propagation. (#4804)
- Fix a bug where using multiple readers resulted in incorrect
asynchronous counter values in
go.opentelemetry.io/otel/sdk/metric
. (#4742)
Commits
279c549
Release v1.22.0/v0.45.0 (#4821)
237ed37
Fix link changes from instrumentation to languages (#4828)
5ed29d9
Bump lycheeverse/lychee-action from 1.9.0 to 1.9.1 (#4824)
4491b39
sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() (#4818)
19622d3
chore(docs): explicitly mark lizthegrey emeritus (#4822)
7fa7d1b
sdk/metric: Fix observable not registered error when the asynchronous
instrum...
01472db
Upgrade use of semconv to v1.24.0 (#4754)
259143a
baggage: Add NewMemberRaw and NewKeyValuePropertyRaw (#4804)
6ead8d8
Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /internal/tools
(#4815)
deddec3
Optimize (attribute.Set).Filter
for no filtered case (#4774)
- Additional commits viewable in compare
view
Updates
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` from
1.21.0 to 1.22.0
Changelog
Sourced from go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp's
changelog.
[1.22.0/0.45.0] 2024-01-17
Added
- The
go.opentelemetry.io/otel/semconv/v1.22.0
package.
The package contains semantic conventions from the v1.22.0
version of the OpenTelemetry Semantic Conventions. (#4735)
- The
go.opentelemetry.io/otel/semconv/v1.23.0
package.
The package contains semantic conventions from the v1.23.0
version of the OpenTelemetry Semantic Conventions. (#4746)
- The
go.opentelemetry.io/otel/semconv/v1.23.1
package.
The package contains semantic conventions from the v1.23.1
version of the OpenTelemetry Semantic Conventions. (#4749)
- The
go.opentelemetry.io/otel/semconv/v1.24.0
package.
The package contains semantic conventions from the v1.24.0
version of the OpenTelemetry Semantic Conventions. (#4770)
- Add
WithResourceAsConstantLabels
option to apply
resource attributes for every metric emitted by the Prometheus exporter.
(#4733)
- Experimental cardinality limiting is added to the metric SDK.
See metric
documentation for more information about this feature and how to
enable it. (#4457)
- Add
NewMemberRaw
and
NewKeyValuePropertyRaw
in
go.opentelemetry.io/otel/baggage
. (#4804)
Changed
- Upgrade all use of
go.opentelemetry.io/otel/semconv
to
use v1.24.0
. (#4754)
- Update transformations in
go.opentelemetry.io/otel/exporters/zipkin
to follow
v1.19.0
version of the OpenTelemetry specification. (#4754)
- Record synchronous measurements when the passed context is canceled
instead of dropping in
go.opentelemetry.io/otel/sdk/metric
.
If you do not want to make a measurement when the context is cancelled,
you need to handle it yourself (e.g if ctx.Err() != nil
).
(#4671)
- Improve
go.opentelemetry.io/otel/trace.TraceState
's
performance. (#4722)
- Improve
go.opentelemetry.io/otel/propagation.TraceContext
's
performance. (#4721)
- Improve
go.opentelemetry.io/otel/baggage
performance.
(#4743)
- Improve performance of the
(*Set).Filter
method in
go.opentelemetry.io/otel/attribute
when the passed filter
does not filter out any attributes from the set. (#4774)
Member.String
in
go.opentelemetry.io/otel/baggage
percent-encodes only when
necessary. (#4775)
- Improve
go.opentelemetry.io/otel/trace.Span
's
performance when adding multiple attributes. (#4818)
Property.Value
in
go.opentelemetry.io/otel/baggage
now returns a raw string
instead of a percent-encoded value. (#4804)
Fixed
- Fix
Parse
in
go.opentelemetry.io/otel/baggage
to validate member value
before percent-decoding. (#4755)
- Fix whitespace encoding of
Member.String
in
go.opentelemetry.io/otel/baggage
. (#4756)
- Fix observable not registered error when the asynchronous instrument
has a drop aggregation in
go.opentelemetry.io/otel/sdk/metric
. (#4772)
- Fix baggage item key so that it is not canonicalized in
go.opentelemetry.io/otel/bridge/opentracing
. (#4776)
- Fix
go.opentelemetry.io/otel/bridge/opentracing
to
properly handle baggage values that requires escaping during
propagation. (#4804)
- Fix a bug where using multiple readers resulted in incorrect
asynchronous counter values in
go.opentelemetry.io/otel/sdk/metric
. (#4742)
Commits
279c549
Release v1.22.0/v0.45.0 (#4821)
237ed37
Fix link changes from instrumentation to languages (#4828)
5ed29d9
Bump lycheeverse/lychee-action from 1.9.0 to 1.9.1 (#4824)
4491b39
sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() (#4818)
19622d3
chore(docs): explicitly mark lizthegrey emeritus (#4822)
7fa7d1b
sdk/metric: Fix observable not registered error when the asynchronous
instrum...
01472db
Upgrade use of semconv to v1.24.0 (#4754)
259143a
baggage: Add NewMemberRaw and NewKeyValuePropertyRaw (#4804)
6ead8d8
Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /internal/tools
(#4815)
deddec3
Optimize (attribute.Set).Filter
for no filtered case (#4774)
- Additional commits viewable in compare
view
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore ` will
remove the ignore condition of the specified dependency and ignore
conditions
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 16 ++++++++--------
go.sum | 32 ++++++++++++++++----------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/go.mod b/go.mod
index c75a4023cb..0291091e53 100644
--- a/go.mod
+++ b/go.mod
@@ -57,14 +57,14 @@ require (
github.com/stretchr/testify v1.8.4
github.com/tendermint/tendermint v0.34.28
go.opentelemetry.io/contrib/instrumentation/runtime v0.45.0
- go.opentelemetry.io/otel v1.21.0
- go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0
- go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0
- go.opentelemetry.io/otel/metric v1.21.0
- go.opentelemetry.io/otel/sdk v1.21.0
- go.opentelemetry.io/otel/sdk/metric v1.21.0
- go.opentelemetry.io/otel/trace v1.21.0
+ go.opentelemetry.io/otel v1.22.0
+ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0
+ go.opentelemetry.io/otel/metric v1.22.0
+ go.opentelemetry.io/otel/sdk v1.22.0
+ go.opentelemetry.io/otel/sdk/metric v1.22.0
+ go.opentelemetry.io/otel/trace v1.22.0
go.opentelemetry.io/proto/otlp v1.0.0
go.uber.org/fx v1.20.1
go.uber.org/zap v1.26.0
diff --git a/go.sum b/go.sum
index 30c8df771e..bfa5181462 100644
--- a/go.sum
+++ b/go.sum
@@ -2387,32 +2387,32 @@ go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzox
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg=
go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs=
-go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
-go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
-go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0 h1:bflGWrfYyuulcdxf14V6n9+CoQcu5SAAdHmDPAJnlps=
-go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0/go.mod h1:qcTO4xHAxZLaLxPd60TdE88rxtItPHgHWqOhOGRr0as=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 h1:cl5P5/GIfFh4t6xyruOgJP5QiA1pw4fYYdv6nc6CBWw=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0/go.mod h1:zgBdWWAu7oEEMC06MMKc5NLbA/1YDXV1sMpSqEeLQLg=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 h1:digkEZCJWobwBqMwC0cwCq8/wkkRy/OowZg5OArWZrM=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0/go.mod h1:/OpE/y70qVkndM0TrxT4KBoN3RsFZP0QaofcfYrj76I=
+go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y=
+go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI=
+go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0 h1:+RbSCde0ERway5FwKvXR3aRJIFeDu9rtwC6E7BC6uoM=
+go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0/go.mod h1:zcI8u2EJxbLPyoZ3SkVAAcQPgYb1TDRzW93xLFnsggU=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0=
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM=
-go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
-go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
+go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg=
+go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY=
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
-go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8=
-go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E=
-go.opentelemetry.io/otel/sdk/metric v1.21.0 h1:smhI5oD714d6jHE6Tie36fPx4WDFIg+Y6RfAY4ICcR0=
-go.opentelemetry.io/otel/sdk/metric v1.21.0/go.mod h1:FJ8RAsoPGv/wYMgBdUJXOm+6pzFY3YdljnXtv1SBE8Q=
+go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw=
+go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc=
+go.opentelemetry.io/otel/sdk/metric v1.22.0 h1:ARrRetm1HCVxq0cbnaZQlfwODYJHo3gFL8Z3tSmHBcI=
+go.opentelemetry.io/otel/sdk/metric v1.22.0/go.mod h1:KjQGeMIDlBNEOo6HvjhxIec1p/69/kULDcp4gr0oLQQ=
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds=
go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU=
-go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
-go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
+go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0=
+go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
From c173a1e34710fd33c485e5b8ada10222fd98669f Mon Sep 17 00:00:00 2001
From: ramin
Date: Tue, 23 Jan 2024 10:31:55 +0000
Subject: [PATCH 2/6] test(gateway): slight refactor of some presentation and
add some endpoint registration tests (#2939)
goals: readability, test coverage
Appreciate that the gateway is v unimportant but is exists. I was
starting at the top just looking for places to give a clean up and add
some unit test coverage and found this.
Mostly trying to make it cleaner to read, then added some tests, also
wanted to add a `/status/health` endpoint just for ease, i would want
this as a node operator if i was running with `--gateway` for whatever
reason
Also took liberty to take some error handling code out of `writeError`
that would never execute. In trying to write a test to trigger the
json.Marshal error case, i realized that as err.Error() always returns a
string it could never trigger json.Unmarshal to fail without panic
before even getting there, so removed that code path.
i might revisit this and give it another refactor at some point soon,
unless we're planning to remove this completely?
on to next area
---
api/gateway/bindings.go | 73 +++++++++++++++++++++
api/gateway/bindings_test.go | 119 +++++++++++++++++++++++++++++++++++
api/gateway/endpoints.go | 32 ----------
api/gateway/health.go | 16 +++++
api/gateway/server.go | 4 ++
api/gateway/util.go | 16 +++--
api/gateway/util_test.go | 24 +++++++
cmd/celestia/cmd_test.go | 4 +-
8 files changed, 245 insertions(+), 43 deletions(-)
create mode 100644 api/gateway/bindings.go
create mode 100644 api/gateway/bindings_test.go
delete mode 100644 api/gateway/endpoints.go
create mode 100644 api/gateway/health.go
create mode 100644 api/gateway/util_test.go
diff --git a/api/gateway/bindings.go b/api/gateway/bindings.go
new file mode 100644
index 0000000000..c01bd2da47
--- /dev/null
+++ b/api/gateway/bindings.go
@@ -0,0 +1,73 @@
+package gateway
+
+import (
+ "fmt"
+ "net/http"
+)
+
+func (h *Handler) RegisterEndpoints(rpc *Server) {
+ // state endpoints
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf("%s/{%s}", balanceEndpoint, addrKey),
+ h.handleBalanceRequest,
+ http.MethodGet,
+ )
+
+ rpc.RegisterHandlerFunc(
+ submitTxEndpoint,
+ h.handleSubmitTx,
+ http.MethodPost,
+ )
+
+ rpc.RegisterHandlerFunc(
+ healthEndpoint,
+ h.handleHealthRequest,
+ http.MethodGet,
+ )
+
+ // share endpoints
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf(
+ "%s/{%s}/height/{%s}",
+ namespacedSharesEndpoint,
+ namespaceKey,
+ heightKey,
+ ),
+ h.handleSharesByNamespaceRequest,
+ http.MethodGet,
+ )
+
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf("%s/{%s}", namespacedSharesEndpoint, namespaceKey),
+ h.handleSharesByNamespaceRequest,
+ http.MethodGet,
+ )
+
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf("%s/{%s}/height/{%s}", namespacedDataEndpoint, namespaceKey, heightKey),
+ h.handleDataByNamespaceRequest,
+ http.MethodGet,
+ )
+
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf("%s/{%s}", namespacedDataEndpoint, namespaceKey),
+ h.handleDataByNamespaceRequest,
+ http.MethodGet,
+ )
+
+ // DAS endpoints
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf("%s/{%s}", heightAvailabilityEndpoint, heightKey),
+ h.handleHeightAvailabilityRequest,
+ http.MethodGet,
+ )
+
+ // header endpoints
+ rpc.RegisterHandlerFunc(
+ fmt.Sprintf("%s/{%s}", headerByHeightEndpoint, heightKey),
+ h.handleHeaderRequest,
+ http.MethodGet,
+ )
+
+ rpc.RegisterHandlerFunc(headEndpoint, h.handleHeadRequest, http.MethodGet)
+}
diff --git a/api/gateway/bindings_test.go b/api/gateway/bindings_test.go
new file mode 100644
index 0000000000..5d27d5e4c7
--- /dev/null
+++ b/api/gateway/bindings_test.go
@@ -0,0 +1,119 @@
+package gateway
+
+import (
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/gorilla/mux"
+ "github.com/stretchr/testify/require"
+)
+
+func TestRegisterEndpoints(t *testing.T) {
+ handler := &Handler{}
+ rpc := NewServer("localhost", "6969")
+
+ handler.RegisterEndpoints(rpc)
+
+ testCases := []struct {
+ name string
+ path string
+ method string
+ expected bool
+ }{
+ {
+ name: "Get balance endpoint",
+ path: fmt.Sprintf("%s/{%s}", balanceEndpoint, addrKey),
+ method: http.MethodGet,
+ expected: true,
+ },
+ {
+ name: "Submit transaction endpoint",
+ path: submitTxEndpoint,
+ method: http.MethodPost,
+ expected: true,
+ },
+ {
+ name: "Get namespaced shares by height endpoint",
+ path: fmt.Sprintf("%s/{%s}/height/{%s}", namespacedSharesEndpoint, namespaceKey, heightKey),
+ method: http.MethodGet,
+ expected: true,
+ },
+ {
+ name: "Get namespaced shares endpoint",
+ path: fmt.Sprintf("%s/{%s}", namespacedSharesEndpoint, namespaceKey),
+ method: http.MethodGet,
+ expected: true,
+ },
+ {
+ name: "Get namespaced data by height endpoint",
+ path: fmt.Sprintf("%s/{%s}/height/{%s}", namespacedDataEndpoint, namespaceKey, heightKey),
+ method: http.MethodGet,
+ expected: true,
+ },
+ {
+ name: "Get namespaced data endpoint",
+ path: fmt.Sprintf("%s/{%s}", namespacedDataEndpoint, namespaceKey),
+ method: http.MethodGet,
+ expected: true,
+ },
+ {
+ name: "Get health endpoint",
+ path: "/status/health",
+ method: http.MethodGet,
+ expected: true,
+ },
+
+ // Going forward, we can add previously deprecated and since
+ // removed endpoints here to ensure we don't accidentally re-enable
+ // them in the future and accidentally expand surface area
+ {
+ name: "example totally bogus endpoint",
+ path: fmt.Sprintf("/wutang/{%s}/%s", "chambers", "36"),
+ method: http.MethodGet,
+ expected: false,
+ },
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.name, func(t *testing.T) {
+ require.Equal(
+ t,
+ tc.expected,
+ hasEndpointRegistered(rpc.Router(), tc.path, tc.method),
+ "Endpoint registration mismatch for: %s %s %s", tc.name, tc.method, tc.path)
+ })
+ }
+}
+
+func hasEndpointRegistered(router *mux.Router, path string, method string) bool {
+ var registered bool
+ err := router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
+ template, err := route.GetPathTemplate()
+ if err != nil {
+ return err
+ }
+
+ if template == path {
+ methods, err := route.GetMethods()
+ if err != nil {
+ return err
+ }
+
+ for _, m := range methods {
+ if m == method {
+ registered = true
+ return nil
+ }
+ }
+ }
+ return nil
+ })
+
+ if err != nil {
+ fmt.Println("Error walking through routes:", err)
+ return false
+ }
+
+ return registered
+}
diff --git a/api/gateway/endpoints.go b/api/gateway/endpoints.go
deleted file mode 100644
index 104d01b053..0000000000
--- a/api/gateway/endpoints.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package gateway
-
-import (
- "fmt"
- "net/http"
-)
-
-func (h *Handler) RegisterEndpoints(rpc *Server) {
- // state endpoints
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}", balanceEndpoint, addrKey), h.handleBalanceRequest,
- http.MethodGet)
- rpc.RegisterHandlerFunc(submitTxEndpoint, h.handleSubmitTx, http.MethodPost)
-
- // share endpoints
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}/height/{%s}", namespacedSharesEndpoint, namespaceKey, heightKey),
- h.handleSharesByNamespaceRequest, http.MethodGet)
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}", namespacedSharesEndpoint, namespaceKey),
- h.handleSharesByNamespaceRequest, http.MethodGet)
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}/height/{%s}", namespacedDataEndpoint, namespaceKey, heightKey),
- h.handleDataByNamespaceRequest, http.MethodGet)
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}", namespacedDataEndpoint, namespaceKey),
- h.handleDataByNamespaceRequest, http.MethodGet)
-
- // DAS endpoints
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}", heightAvailabilityEndpoint, heightKey),
- h.handleHeightAvailabilityRequest, http.MethodGet)
-
- // header endpoints
- rpc.RegisterHandlerFunc(fmt.Sprintf("%s/{%s}", headerByHeightEndpoint, heightKey), h.handleHeaderRequest,
- http.MethodGet)
- rpc.RegisterHandlerFunc(headEndpoint, h.handleHeadRequest, http.MethodGet)
-}
diff --git a/api/gateway/health.go b/api/gateway/health.go
new file mode 100644
index 0000000000..0ddb56bb67
--- /dev/null
+++ b/api/gateway/health.go
@@ -0,0 +1,16 @@
+package gateway
+
+import "net/http"
+
+const (
+ healthEndpoint = "/status/health"
+)
+
+func (h *Handler) handleHealthRequest(w http.ResponseWriter, _ *http.Request) {
+ _, err := w.Write([]byte("ok"))
+ if err != nil {
+ log.Errorw("serving request", "endpoint", healthEndpoint, "err", err)
+ writeError(w, http.StatusBadGateway, healthEndpoint, err)
+ return
+ }
+}
diff --git a/api/gateway/server.go b/api/gateway/server.go
index 181bfdfe55..7eab7c7bf9 100644
--- a/api/gateway/server.go
+++ b/api/gateway/server.go
@@ -36,6 +36,10 @@ func NewServer(address, port string) *Server {
return server
}
+func (s *Server) Router() *mux.Router {
+ return s.srvMux
+}
+
// Start starts the gateway Server, listening on the given address.
func (s *Server) Start(context.Context) error {
couldStart := s.started.CompareAndSwap(false, true)
diff --git a/api/gateway/util.go b/api/gateway/util.go
index bffd7ebc88..d3739f9e9c 100644
--- a/api/gateway/util.go
+++ b/api/gateway/util.go
@@ -1,7 +1,6 @@
package gateway
import (
- "encoding/json"
"net/http"
)
@@ -9,13 +8,12 @@ func writeError(w http.ResponseWriter, statusCode int, endpoint string, err erro
log.Debugw("serving request", "endpoint", endpoint, "err", err)
w.WriteHeader(statusCode)
- errBody, jerr := json.Marshal(err.Error())
- if jerr != nil {
- log.Errorw("serializing error", "endpoint", endpoint, "err", jerr)
- return
- }
- _, werr := w.Write(errBody)
- if werr != nil {
- log.Errorw("writing error response", "endpoint", endpoint, "err", werr)
+
+ errorMessage := err.Error() // Get the error message as a string
+ errorBytes := []byte(errorMessage)
+
+ _, err = w.Write(errorBytes)
+ if err != nil {
+ log.Errorw("writing error response", "endpoint", endpoint, "err", err)
}
}
diff --git a/api/gateway/util_test.go b/api/gateway/util_test.go
new file mode 100644
index 0000000000..d41b0918d2
--- /dev/null
+++ b/api/gateway/util_test.go
@@ -0,0 +1,24 @@
+package gateway
+
+import (
+ "errors"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestWriteError(t *testing.T) {
+ t.Run("writeError", func(t *testing.T) {
+ // Create a mock HTTP response writer
+ w := httptest.NewRecorder()
+
+ testErr := errors.New("test error")
+
+ writeError(w, http.StatusInternalServerError, "/api/endpoint", testErr)
+ assert.Equal(t, http.StatusInternalServerError, w.Code)
+ responseBody := w.Body.Bytes()
+ assert.Equal(t, testErr.Error(), string(responseBody))
+ })
+}
diff --git a/cmd/celestia/cmd_test.go b/cmd/celestia/cmd_test.go
index 9c26489e14..94dd3625b8 100644
--- a/cmd/celestia/cmd_test.go
+++ b/cmd/celestia/cmd_test.go
@@ -33,7 +33,7 @@ func TestCompletionHelpString(t *testing.T) {
}
methods := reflect.VisibleFields(reflect.TypeOf(TestFields{}))
for i, method := range methods {
- require.Equal(t, testOutputs[i], parseSignatureForHelpstring(method))
+ require.Equal(t, testOutputs[i], parseSignatureForHelpString(method))
}
}
@@ -129,7 +129,7 @@ func TestBridge(t *testing.T) {
*/
}
-func parseSignatureForHelpstring(methodSig reflect.StructField) string {
+func parseSignatureForHelpString(methodSig reflect.StructField) string {
simplifiedSignature := "("
in, out := methodSig.Type.NumIn(), methodSig.Type.NumOut()
for i := 1; i < in; i++ {
From dd18169ec8a0fa088df39998ed47149500197c23 Mon Sep 17 00:00:00 2001
From: Viacheslav
Date: Tue, 23 Jan 2024 13:01:56 +0200
Subject: [PATCH 3/6] feat(blob/service): cover getByCommitment with benchmark
(#3116)
Added the benchmark for `getByCommitment`
`BenchmarkGetByCommitment-12 3139 380827 ns/op 701647 B/op 4990
allocs/op`
[profile.pdf](https://github.com/celestiaorg/celestia-node/files/13987571/profile.pdf)
---
blob/service_test.go | 23 ++++++++++++++++++++++-
header/headertest/testing.go | 2 +-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/blob/service_test.go b/blob/service_test.go
index 6777084eb4..3e22f887af 100644
--- a/blob/service_test.go
+++ b/blob/service_test.go
@@ -414,7 +414,28 @@ func TestService_GetAllWithoutPadding(t *testing.T) {
require.NoError(t, err)
}
-func createService(ctx context.Context, t *testing.T, blobs []*Blob) *Service {
+// BenchmarkGetByCommitment-12 3139 380827 ns/op 701647 B/op 4990 allocs/op
+func BenchmarkGetByCommitment(b *testing.B) {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
+ b.Cleanup(cancel)
+ appBlobs, err := blobtest.GenerateV0Blobs([]int{32, 32}, true)
+ require.NoError(b, err)
+
+ blobs, err := convertBlobs(appBlobs...)
+ require.NoError(b, err)
+
+ service := createService(ctx, b, blobs)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ b.ReportAllocs()
+ _, _, err = service.getByCommitment(
+ ctx, 1, blobs[1].Namespace(), blobs[1].Commitment,
+ )
+ require.NoError(b, err)
+ }
+}
+
+func createService(ctx context.Context, t testing.TB, blobs []*Blob) *Service {
bs := ipld.NewMemBlockservice()
batching := ds_sync.MutexWrap(ds.NewMapDatastore())
headerStore, err := store.NewStore[*header.ExtendedHeader](batching)
diff --git a/header/headertest/testing.go b/header/headertest/testing.go
index 9907fd7eb4..e97f7f7825 100644
--- a/header/headertest/testing.go
+++ b/header/headertest/testing.go
@@ -297,7 +297,7 @@ func RandBlockID(testing.TB) types.BlockID {
return bid
}
-func ExtendedHeaderFromEDS(t *testing.T, height uint64, eds *rsmt2d.ExtendedDataSquare) *header.ExtendedHeader {
+func ExtendedHeaderFromEDS(t testing.TB, height uint64, eds *rsmt2d.ExtendedDataSquare) *header.ExtendedHeader {
valSet, vals := RandValidatorSet(10, 10)
gen := RandRawHeader(t)
dah, err := share.NewRoot(eds)
From ba969f9fb8e52b3ad1fc0831abed71ed5305dcae Mon Sep 17 00:00:00 2001
From: ramin
Date: Tue, 23 Jan 2024 14:16:10 +0000
Subject: [PATCH 4/6] chore: make CI green (#3114)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Building off @vgonkivs's [work to skip
tests](https://github.com/celestiaorg/celestia-node/pull/2802), this
attempts to get a baseline "green" ci for us. There are still a couple
of tests that VERY intermittently flake in CI, but this way they will
stand out WHEN they happen and we can track down vs entire thing being
red always.
This does quite a few things
- introduces build tags on swamp tests in each named file to allow us to
run parts of the swamp/integration tests independently (ie: `go test
./... -tags=blob`
- adds an `integration` tag to allow running all still
- splits the integration tests into it's own workflow file
(`integration-tests.yml`) which is now triggered from `go-ci.yml`
- splits each swamp/integration tests to run as its own job so we can
see which are failing/flakey more explicitly
- utilizes go's -short test flag to Skip a few swamp/integration tests
that are consistently failing. Current we are skipping
`TestFullReconstructFromFulls`, `TestFullReconstructFromLights`,
`TestSyncStartStopLightWithBridge` which is less than we were originally
skipping in https://github.com/celestiaorg/celestia-node/pull/2802/
- plugs in our verbose/debug stuff to integration tests in addition to
unit which we had before
Unit tests
- splits some of the unit tests that were "race flakey" into
`*_no_race_test.go` and adds `!race` tag to some others to get to pass
consistently when running unit tests with -race flag
- macos-latest unit tests still fail on race test ONLY in GitHub actions
CI 🤷♂️
Next Steps
- create issues for each short run / skipped
- create issues for any tests that fail race that are NOT the race issue
on upstream cosmos-sdk
- create issue for macos-latest in GitHub race fail
- create issue for macos-latest intermittent fail
I think we let this run for a while, then once we see it be consistently
green for a bit and isolate any more flakes that pop up, we can toggle
on more branch requirements, then in fixing the above issues, we can be
green. [Being green is not
easy](https://www.youtube.com/watch?v=51BQfPeSK8k).
---
.github/workflows/go-ci.yml | 29 ++----
.github/workflows/integration-tests.yml | 115 ++++++++++++++++++++++++
Makefile | 27 +++---
core/fetcher_no_race_test.go | 55 ++++++++++++
core/fetcher_test.go | 43 ---------
core/listener_no_race_test.go | 71 +++++++++++++++
core/listener_test.go | 59 ------------
nodebuilder/node_test.go | 2 +
nodebuilder/store_test.go | 2 +
nodebuilder/tests/api_test.go | 20 ++---
nodebuilder/tests/blob_test.go | 2 +
nodebuilder/tests/fraud_test.go | 2 +
nodebuilder/tests/helpers_test.go | 35 ++++++++
nodebuilder/tests/nd_test.go | 2 +
nodebuilder/tests/p2p_test.go | 7 +-
nodebuilder/tests/reconstruct_test.go | 13 ++-
nodebuilder/tests/sync_test.go | 12 ++-
share/eds/retriever_no_race_test.go | 55 ++++++++++++
share/eds/retriever_test.go | 36 --------
share/p2p/discovery/discovery_test.go | 2 +
state/core_access_test.go | 2 +
21 files changed, 390 insertions(+), 201 deletions(-)
create mode 100644 .github/workflows/integration-tests.yml
create mode 100644 core/fetcher_no_race_test.go
create mode 100644 core/listener_no_race_test.go
create mode 100644 nodebuilder/tests/helpers_test.go
create mode 100644 share/eds/retriever_no_race_test.go
diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml
index 3e73290500..5da90de33e 100644
--- a/.github/workflows/go-ci.yml
+++ b/.github/workflows/go-ci.yml
@@ -14,6 +14,7 @@ concurrency:
jobs:
setup:
+ name: Setup
runs-on: ubuntu-latest
outputs:
debug: ${{ steps.debug.outputs.debug }}
@@ -104,11 +105,10 @@ jobs:
file: ./coverage.txt
name: coverage-${{ matrix.os }}
- unit_race_test:
+ unit_test_race:
needs: [lint, go_mod_tidy_check]
- name: Run Unit Tests with Race Detector
+ name: Unit Tests with Race Detector (ubuntu-latest)
runs-on: ubuntu-latest
- continue-on-error: true
steps:
- uses: actions/checkout@v4
@@ -119,24 +119,11 @@ jobs:
go-version: ${{ inputs.go-version }}
- name: execute test run
- run: make test-unit-race
+ run: make test-unit-race ENABLE_VERBOSE=${{ needs.setup.outputs.debug }}
integration_test:
+ name: Integration Tests
needs: [lint, go_mod_tidy_check]
- name: Run Integration Tests
- runs-on: ubuntu-latest
- continue-on-error: true
-
- steps:
- - uses: actions/checkout@v4
-
- - name: set up go
- uses: actions/setup-go@v5
- with:
- go-version: ${{ inputs.go-version }}
-
- - name: Integration Tests
- run: make test-integration
-
- - name: Integration Tests with Race Detector
- run: make test-integration-race
+ uses: ./.github/workflows/integration-tests.yml
+ with:
+ go-version: ${{ inputs.go-version }}
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
new file mode 100644
index 0000000000..cd0fc62385
--- /dev/null
+++ b/.github/workflows/integration-tests.yml
@@ -0,0 +1,115 @@
+name: Integration Tests
+
+on:
+ workflow_call:
+ inputs:
+ go-version:
+ description: 'Go version'
+ required: true
+ type: string
+
+jobs:
+ api_tests:
+ name: Integration Tests API
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run API tests
+ run: make test-integration TAGS=api
+
+ blob_tests:
+ name: Integration Tests Blob
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run blob tests
+ run: make test-integration TAGS=blob
+
+ fraud_tests:
+ name: Integration Tests Fraud
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run fraud tests
+ run: make test-integration TAGS=fraud
+
+ nd_tests:
+ name: Integration Tests ND
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run nd tests
+ run: make test-integration TAGS=nd
+
+ p2p_tests:
+ name: Integration Tests p2p
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run p2p tests
+ run: make test-integration TAGS=p2p
+
+ reconstruction_tests:
+ name: Integration Tests Reconstruction
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run reconstruction tests
+ run: make test-integration SHORT=true TAGS=reconstruction
+
+ sync_tests:
+ name: Integration Tests Sync
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: set up go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ inputs.go-version }}
+
+ - name: run sync tests
+ run: make test-integration SHORT=true TAGS=sync
diff --git a/Makefile b/Makefile
index b3b3739cb7..87bcbbf61c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,8 @@ PROJECTNAME=$(shell basename "$(PWD)")
DIR_FULLPATH=$(shell pwd)
versioningPath := "github.com/celestiaorg/celestia-node/nodebuilder/node"
LDFLAGS=-ldflags="-X '$(versioningPath).buildTime=$(shell date)' -X '$(versioningPath).lastCommit=$(shell git rev-parse HEAD)' -X '$(versioningPath).semanticVersion=$(shell git describe --tags --dirty=-dev 2>/dev/null || git rev-parse --abbrev-ref HEAD)'"
+TAGS=integration
+SHORT=
ifeq (${PREFIX},)
PREFIX := /usr/local
endif
@@ -13,6 +15,11 @@ else
VERBOSE =
LOG_AND_FILTER =
endif
+ifeq ($(SHORT),true)
+ INTEGRATION_RUN_LENGTH = -short
+else
+ INTEGRATION_RUN_LENGTH =
+endif
## help: Get more info on make commands.
help: Makefile
@echo " Choose a command run in "$(PROJECTNAME)":"
@@ -118,29 +125,21 @@ test-unit:
## test-unit-race: Running unit tests with data race detector
test-unit-race:
@echo "--> Running unit tests with data race detector"
- @go test -race `go list ./... | grep -v nodebuilder/tests`
+ @go test $(VERBOSE) -race -covermode=atomic -coverprofile=coverage.txt `go list ./... | grep -v nodebuilder/tests` $(LOG_AND_FILTER)
.PHONY: test-unit-race
## test-integration: Running /integration tests located in nodebuilder/tests
test-integration:
- @echo "--> Running integrations tests"
- @go test ./nodebuilder/tests
+ @echo "--> Running integrations tests $(VERBOSE) -tags=$(TAGS) $(INTEGRATION_RUN_LENGTH)"
+ @go test $(VERBOSE) -tags=$(TAGS) $(INTEGRATION_RUN_LENGTH) ./nodebuilder/tests
.PHONY: test-integration
## test-integration-race: Running integration tests with data race detector located in node/tests
test-integration-race:
- @echo "--> Running integration tests with data race detector"
- @go test -race ./nodebuilder/tests
+ @echo "--> Running integration tests with data race detector -tags=$(TAGS)"
+ @go test -race -tags=$(TAGS) ./nodebuilder/tests
.PHONY: test-integration-race
-## test: Running both unit and integrations tests
-test:
- @echo "--> Running all tests without data race detector"
- @go test ./...
- @echo "--> Running all tests with data race detector"
- @go test -race ./...
-.PHONY: test
-
## benchmark: Running all benchmarks
benchmark:
@echo "--> Running benchmarks"
@@ -164,7 +163,6 @@ pb-gen:
done;
.PHONY: pb-gen
-
## openrpc-gen: Generate OpenRPC spec for Celestia-Node's RPC api
openrpc-gen:
@echo "--> Generating OpenRPC spec"
@@ -221,7 +219,6 @@ goreleaser-release:
.PHONY: goreleaser-release
# Copied from https://github.com/dgraph-io/badger/blob/main/Makefile
-
USER_ID = $(shell id -u)
HAS_JEMALLOC = $(shell test -f /usr/local/lib/libjemalloc.a && echo "jemalloc")
JEMALLOC_URL = "https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2"
diff --git a/core/fetcher_no_race_test.go b/core/fetcher_no_race_test.go
new file mode 100644
index 0000000000..890b7c35c1
--- /dev/null
+++ b/core/fetcher_no_race_test.go
@@ -0,0 +1,55 @@
+//go:build !race
+
+package core
+
+import (
+ "context"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "github.com/tendermint/tendermint/types"
+)
+
+// TestBlockFetcherHeaderValues tests that both the Commit and ValidatorSet
+// endpoints are working as intended.
+func TestBlockFetcherHeaderValues(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
+ t.Cleanup(cancel)
+
+ client := StartTestNode(t).Client
+ fetcher := NewBlockFetcher(client)
+
+ // generate some blocks
+ newBlockChan, err := fetcher.SubscribeNewBlockEvent(ctx)
+ require.NoError(t, err)
+ // read once from channel to generate next block
+ var h int64
+ select {
+ case evt := <-newBlockChan:
+ h = evt.Header.Height
+ case <-ctx.Done():
+ require.NoError(t, ctx.Err())
+ }
+ // get Commit from current height
+ commit, err := fetcher.Commit(ctx, &h)
+ require.NoError(t, err)
+ // get ValidatorSet from current height
+ valSet, err := fetcher.ValidatorSet(ctx, &h)
+ require.NoError(t, err)
+ // get next block
+ var nextBlock types.EventDataSignedBlock
+ select {
+ case nextBlock = <-newBlockChan:
+ case <-ctx.Done():
+ require.NoError(t, ctx.Err())
+ }
+ // compare LastCommit from next block to Commit from first block height
+ assert.Equal(t, nextBlock.Header.LastCommitHash, commit.Hash())
+ assert.Equal(t, nextBlock.Header.Height, commit.Height+1)
+ // compare ValidatorSet hash to the ValidatorsHash from first block height
+ hexBytes := valSet.Hash()
+ assert.Equal(t, nextBlock.ValidatorSet.Hash(), hexBytes)
+ require.NoError(t, fetcher.UnsubscribeNewBlockEvent(ctx))
+}
diff --git a/core/fetcher_test.go b/core/fetcher_test.go
index 3380dbb402..261b84d78c 100644
--- a/core/fetcher_test.go
+++ b/core/fetcher_test.go
@@ -7,7 +7,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/types"
)
func TestBlockFetcher_GetBlock_and_SubscribeNewBlockEvent(t *testing.T) {
@@ -38,45 +37,3 @@ func TestBlockFetcher_GetBlock_and_SubscribeNewBlockEvent(t *testing.T) {
}
require.NoError(t, fetcher.UnsubscribeNewBlockEvent(ctx))
}
-
-// TestBlockFetcherHeaderValues tests that both the Commit and ValidatorSet
-// endpoints are working as intended.
-func TestBlockFetcherHeaderValues(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
- t.Cleanup(cancel)
-
- client := StartTestNode(t).Client
- fetcher := NewBlockFetcher(client)
-
- // generate some blocks
- newBlockChan, err := fetcher.SubscribeNewBlockEvent(ctx)
- require.NoError(t, err)
- // read once from channel to generate next block
- var h int64
- select {
- case evt := <-newBlockChan:
- h = evt.Header.Height
- case <-ctx.Done():
- require.NoError(t, ctx.Err())
- }
- // get Commit from current height
- commit, err := fetcher.Commit(ctx, &h)
- require.NoError(t, err)
- // get ValidatorSet from current height
- valSet, err := fetcher.ValidatorSet(ctx, &h)
- require.NoError(t, err)
- // get next block
- var nextBlock types.EventDataSignedBlock
- select {
- case nextBlock = <-newBlockChan:
- case <-ctx.Done():
- require.NoError(t, ctx.Err())
- }
- // compare LastCommit from next block to Commit from first block height
- assert.Equal(t, nextBlock.Header.LastCommitHash, commit.Hash())
- assert.Equal(t, nextBlock.Header.Height, commit.Height+1)
- // compare ValidatorSet hash to the ValidatorsHash from first block height
- hexBytes := valSet.Hash()
- assert.Equal(t, nextBlock.ValidatorSet.Hash(), hexBytes)
- require.NoError(t, fetcher.UnsubscribeNewBlockEvent(ctx))
-}
diff --git a/core/listener_no_race_test.go b/core/listener_no_race_test.go
new file mode 100644
index 0000000000..eac12785ee
--- /dev/null
+++ b/core/listener_no_race_test.go
@@ -0,0 +1,71 @@
+//go:build !race
+
+package core
+
+import (
+ "bytes"
+ "context"
+ "testing"
+ "time"
+
+ "github.com/cosmos/cosmos-sdk/client/flags"
+ "github.com/stretchr/testify/require"
+
+ "github.com/celestiaorg/celestia-node/share"
+)
+
+// TestListenerWithNonEmptyBlocks ensures that non-empty blocks are actually
+// stored to eds.Store.
+func TestListenerWithNonEmptyBlocks(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
+ t.Cleanup(cancel)
+
+ // create mocknet with two pubsub endpoints
+ ps0, _ := createMocknetWithTwoPubsubEndpoints(ctx, t)
+
+ // create one block to store as Head in local store and then unsubscribe from block events
+ cfg := DefaultTestConfig()
+ cfg.ChainID = networkID
+ fetcher, cctx := createCoreFetcher(t, cfg)
+ eds := createEdsPubSub(ctx, t)
+
+ store := createStore(t)
+ err := store.Start(ctx)
+ require.NoError(t, err)
+ t.Cleanup(func() {
+ err = store.Stop(ctx)
+ require.NoError(t, err)
+ })
+
+ // create Listener and start listening
+ cl := createListener(ctx, t, fetcher, ps0, eds, store, networkID)
+ err = cl.Start(ctx)
+ require.NoError(t, err)
+
+ // listen for eds hashes broadcasted through eds-sub and ensure store has
+ // already stored them
+ sub, err := eds.Subscribe()
+ require.NoError(t, err)
+ t.Cleanup(sub.Cancel)
+
+ empty := share.EmptyRoot()
+ // TODO extract 16
+ for i := 0; i < 16; i++ {
+ _, err := cctx.FillBlock(16, cfg.Accounts, flags.BroadcastBlock)
+ require.NoError(t, err)
+ msg, err := sub.Next(ctx)
+ require.NoError(t, err)
+
+ if bytes.Equal(empty.Hash(), msg.DataHash) {
+ continue
+ }
+
+ has, err := store.Has(ctx, msg.DataHash)
+ require.NoError(t, err)
+ require.True(t, has)
+ }
+
+ err = cl.Stop(ctx)
+ require.NoError(t, err)
+ require.Nil(t, cl.cancel)
+}
diff --git a/core/listener_test.go b/core/listener_test.go
index 5ddcd5541d..b3ed11e571 100644
--- a/core/listener_test.go
+++ b/core/listener_test.go
@@ -1,12 +1,10 @@
package core
import (
- "bytes"
"context"
"testing"
"time"
- "github.com/cosmos/cosmos-sdk/client/flags"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/event"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
@@ -17,7 +15,6 @@ import (
"github.com/celestiaorg/celestia-node/header"
nodep2p "github.com/celestiaorg/celestia-node/nodebuilder/p2p"
- "github.com/celestiaorg/celestia-node/share"
"github.com/celestiaorg/celestia-node/share/eds"
"github.com/celestiaorg/celestia-node/share/p2p/shrexsub"
)
@@ -73,62 +70,6 @@ func TestListener(t *testing.T) {
require.Nil(t, cl.cancel)
}
-// TestListenerWithNonEmptyBlocks ensures that non-empty blocks are actually
-// stored to eds.Store.
-func TestListenerWithNonEmptyBlocks(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
- t.Cleanup(cancel)
-
- // create mocknet with two pubsub endpoints
- ps0, _ := createMocknetWithTwoPubsubEndpoints(ctx, t)
-
- // create one block to store as Head in local store and then unsubscribe from block events
- cfg := DefaultTestConfig()
- cfg.ChainID = networkID
- fetcher, cctx := createCoreFetcher(t, cfg)
- eds := createEdsPubSub(ctx, t)
-
- store := createStore(t)
- err := store.Start(ctx)
- require.NoError(t, err)
- t.Cleanup(func() {
- err = store.Stop(ctx)
- require.NoError(t, err)
- })
-
- // create Listener and start listening
- cl := createListener(ctx, t, fetcher, ps0, eds, store, networkID)
- err = cl.Start(ctx)
- require.NoError(t, err)
-
- // listen for eds hashes broadcasted through eds-sub and ensure store has
- // already stored them
- sub, err := eds.Subscribe()
- require.NoError(t, err)
- t.Cleanup(sub.Cancel)
-
- empty := share.EmptyRoot()
- // TODO extract 16
- for i := 0; i < 16; i++ {
- _, err := cctx.FillBlock(16, cfg.Accounts, flags.BroadcastBlock)
- require.NoError(t, err)
- msg, err := sub.Next(ctx)
- require.NoError(t, err)
-
- if bytes.Equal(empty.Hash(), msg.DataHash) {
- continue
- }
-
- has, err := store.Has(ctx, msg.DataHash)
- require.NoError(t, err)
- require.True(t, has)
- }
-
- err = cl.Stop(ctx)
- require.NoError(t, err)
- require.Nil(t, cl.cancel)
-}
-
func TestListenerWithWrongChainRPC(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
t.Cleanup(cancel)
diff --git a/nodebuilder/node_test.go b/nodebuilder/node_test.go
index 1d0f3c4fad..41eff32fab 100644
--- a/nodebuilder/node_test.go
+++ b/nodebuilder/node_test.go
@@ -1,3 +1,5 @@
+//go:build !race
+
package nodebuilder
import (
diff --git a/nodebuilder/store_test.go b/nodebuilder/store_test.go
index bd179c1258..51bd89c5a7 100644
--- a/nodebuilder/store_test.go
+++ b/nodebuilder/store_test.go
@@ -1,3 +1,5 @@
+//go:build !race
+
package nodebuilder
import (
diff --git a/nodebuilder/tests/api_test.go b/nodebuilder/tests/api_test.go
index 2fd4b2d3da..a793ba7b33 100644
--- a/nodebuilder/tests/api_test.go
+++ b/nodebuilder/tests/api_test.go
@@ -1,3 +1,5 @@
+//go:build api || integration
+
package tests
import (
@@ -13,26 +15,14 @@ import (
"github.com/celestiaorg/celestia-node/api/rpc/client"
"github.com/celestiaorg/celestia-node/blob"
"github.com/celestiaorg/celestia-node/blob/blobtest"
- "github.com/celestiaorg/celestia-node/libs/authtoken"
"github.com/celestiaorg/celestia-node/nodebuilder"
"github.com/celestiaorg/celestia-node/nodebuilder/node"
"github.com/celestiaorg/celestia-node/nodebuilder/tests/swamp"
)
-func getAdminClient(ctx context.Context, nd *nodebuilder.Node, t *testing.T) *client.Client {
- t.Helper()
-
- signer := nd.AdminSigner
- listenAddr := "ws://" + nd.RPCServer.ListenAddr()
-
- jwt, err := authtoken.NewSignedJWT(signer, []auth.Permission{"public", "read", "write", "admin"})
- require.NoError(t, err)
-
- client, err := client.NewClient(ctx, listenAddr, jwt)
- require.NoError(t, err)
-
- return client
-}
+const (
+ btime = time.Millisecond * 300
+)
func TestNodeModule(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), swamp.DefaultTestTimeout)
diff --git a/nodebuilder/tests/blob_test.go b/nodebuilder/tests/blob_test.go
index 627dd850d0..a30e91b2e6 100644
--- a/nodebuilder/tests/blob_test.go
+++ b/nodebuilder/tests/blob_test.go
@@ -1,3 +1,5 @@
+//go:build blob || integration
+
package tests
import (
diff --git a/nodebuilder/tests/fraud_test.go b/nodebuilder/tests/fraud_test.go
index cb07dbb73a..6496cdbb53 100644
--- a/nodebuilder/tests/fraud_test.go
+++ b/nodebuilder/tests/fraud_test.go
@@ -1,3 +1,5 @@
+//go:build fraud || integration
+
package tests
import (
diff --git a/nodebuilder/tests/helpers_test.go b/nodebuilder/tests/helpers_test.go
new file mode 100644
index 0000000000..1e7f14d823
--- /dev/null
+++ b/nodebuilder/tests/helpers_test.go
@@ -0,0 +1,35 @@
+//nolint:unused
+package tests
+
+import (
+ "context"
+ "testing"
+ "time"
+
+ "github.com/celestiaorg/celestia-node/api/rpc/client"
+ "github.com/celestiaorg/celestia-node/libs/authtoken"
+ "github.com/celestiaorg/celestia-node/nodebuilder"
+
+ "github.com/filecoin-project/go-jsonrpc/auth"
+ "github.com/stretchr/testify/require"
+)
+
+func getAdminClient(ctx context.Context, nd *nodebuilder.Node, t *testing.T) *client.Client {
+ t.Helper()
+
+ signer := nd.AdminSigner
+ listenAddr := "ws://" + nd.RPCServer.ListenAddr()
+
+ jwt, err := authtoken.NewSignedJWT(signer, []auth.Permission{"public", "read", "write", "admin"})
+ require.NoError(t, err)
+
+ client, err := client.NewClient(ctx, listenAddr, jwt)
+ require.NoError(t, err)
+
+ return client
+}
+
+func setTimeInterval(cfg *nodebuilder.Config, interval time.Duration) {
+ cfg.P2P.RoutingTableRefreshPeriod = interval
+ cfg.Share.Discovery.AdvertiseInterval = interval
+}
diff --git a/nodebuilder/tests/nd_test.go b/nodebuilder/tests/nd_test.go
index f3338ec294..338aa6d0c1 100644
--- a/nodebuilder/tests/nd_test.go
+++ b/nodebuilder/tests/nd_test.go
@@ -1,3 +1,5 @@
+//go:build nd || integration
+
package tests
import (
diff --git a/nodebuilder/tests/p2p_test.go b/nodebuilder/tests/p2p_test.go
index 9fe63fb931..98e9fc15b4 100644
--- a/nodebuilder/tests/p2p_test.go
+++ b/nodebuilder/tests/p2p_test.go
@@ -1,3 +1,5 @@
+//go:build p2p || integration
+
package tests
import (
@@ -199,8 +201,3 @@ func TestRestartNodeDiscovery(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, connectedness, network.Connected)
}
-
-func setTimeInterval(cfg *nodebuilder.Config, interval time.Duration) {
- cfg.P2P.RoutingTableRefreshPeriod = interval
- cfg.Share.Discovery.AdvertiseInterval = interval
-}
diff --git a/nodebuilder/tests/reconstruct_test.go b/nodebuilder/tests/reconstruct_test.go
index 89f4a0171a..d047182669 100644
--- a/nodebuilder/tests/reconstruct_test.go
+++ b/nodebuilder/tests/reconstruct_test.go
@@ -1,7 +1,4 @@
-// Test with light nodes spawns more goroutines than in the race detectors budget,
-// and thus we're disabling the race detector.
-// TODO(@Wondertan): Remove this once we move to go1.19 with unlimited race detector
-//go:build !race
+//go:build reconstruction || integration
package tests
@@ -89,6 +86,10 @@ Test-Case: Full Node reconstructs blocks from each other, after unsuccessfully s
block from LN subnetworks. Analog to TestShareAvailable_DisconnectedFullNodes.
*/
func TestFullReconstructFromFulls(t *testing.T) {
+ if testing.Short() {
+ t.Skip()
+ }
+
light.DefaultSampleAmount = 10 // s
const (
blocks = 10
@@ -255,6 +256,10 @@ Steps:
9. Check that the FN can retrieve shares from 1 to 20 blocks
*/
func TestFullReconstructFromLights(t *testing.T) {
+ if testing.Short() {
+ t.Skip()
+ }
+
eds.RetrieveQuadrantTimeout = time.Millisecond * 100
light.DefaultSampleAmount = 20
const (
diff --git a/nodebuilder/tests/sync_test.go b/nodebuilder/tests/sync_test.go
index 8b939749d6..ec8386ea43 100644
--- a/nodebuilder/tests/sync_test.go
+++ b/nodebuilder/tests/sync_test.go
@@ -1,3 +1,5 @@
+//go:build sync || integration
+
package tests
import (
@@ -16,7 +18,7 @@ import (
const (
numBlocks = 20
bsize = 16
- btime = time.Millisecond * 300
+ sbtime = time.Millisecond * 300
)
/*
@@ -45,7 +47,7 @@ func TestSyncAgainstBridge_NonEmptyChain(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), swamp.DefaultTestTimeout)
t.Cleanup(cancel)
- sw := swamp.NewSwamp(t, swamp.WithBlockTime(btime))
+ sw := swamp.NewSwamp(t, swamp.WithBlockTime(sbtime))
// wait for core network to fill 20 blocks
fillDn := swamp.FillBlocks(ctx, sw.ClientContext, sw.Accounts, bsize, numBlocks)
sw.WaitTillHeight(ctx, numBlocks)
@@ -138,7 +140,7 @@ func TestSyncAgainstBridge_EmptyChain(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), swamp.DefaultTestTimeout)
t.Cleanup(cancel)
- sw := swamp.NewSwamp(t, swamp.WithBlockTime(btime))
+ sw := swamp.NewSwamp(t, swamp.WithBlockTime(sbtime))
sw.WaitTillHeight(ctx, numBlocks)
// create bridge node and set it as the bootstrapper for the suite
@@ -211,6 +213,10 @@ Steps:
9. Check LN is synced to height 40
*/
func TestSyncStartStopLightWithBridge(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping TestSyncStartStopLightWithBridge test in short mode.")
+ }
+
ctx, cancel := context.WithTimeout(context.Background(), swamp.DefaultTestTimeout)
defer cancel()
diff --git a/share/eds/retriever_no_race_test.go b/share/eds/retriever_no_race_test.go
new file mode 100644
index 0000000000..15c6aa2fc4
--- /dev/null
+++ b/share/eds/retriever_no_race_test.go
@@ -0,0 +1,55 @@
+// go:build !race
+
+package eds
+
+import (
+ "context"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/celestiaorg/celestia-app/pkg/da"
+ "github.com/celestiaorg/celestia-app/pkg/wrapper"
+ "github.com/celestiaorg/nmt"
+ "github.com/celestiaorg/rsmt2d"
+
+ "github.com/celestiaorg/celestia-node/share"
+ "github.com/celestiaorg/celestia-node/share/eds/byzantine"
+ "github.com/celestiaorg/celestia-node/share/eds/edstest"
+ "github.com/celestiaorg/celestia-node/share/ipld"
+)
+
+func TestRetriever_ByzantineError(t *testing.T) {
+ const width = 8
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
+ defer cancel()
+
+ bserv := ipld.NewMemBlockservice()
+ shares := edstest.RandEDS(t, width).Flattened()
+ _, err := ipld.ImportShares(ctx, shares, bserv)
+ require.NoError(t, err)
+
+ // corrupt shares so that eds erasure coding does not match
+ copy(shares[14][share.NamespaceSize:], shares[15][share.NamespaceSize:])
+
+ // import corrupted eds
+ batchAdder := ipld.NewNmtNodeAdder(ctx, bserv, ipld.MaxSizeBatchOption(width*2))
+ attackerEDS, err := rsmt2d.ImportExtendedDataSquare(
+ shares,
+ share.DefaultRSMT2DCodec(),
+ wrapper.NewConstructor(uint64(width),
+ nmt.NodeVisitor(batchAdder.Visit)),
+ )
+ require.NoError(t, err)
+ err = batchAdder.Commit()
+ require.NoError(t, err)
+
+ // ensure we rcv an error
+ dah, err := da.NewDataAvailabilityHeader(attackerEDS)
+ require.NoError(t, err)
+ r := NewRetriever(bserv)
+ _, err = r.Retrieve(ctx, &dah)
+ var errByz *byzantine.ErrByzantine
+ require.ErrorAs(t, err, &errByz)
+}
diff --git a/share/eds/retriever_test.go b/share/eds/retriever_test.go
index f3f7ccca64..95da345d17 100644
--- a/share/eds/retriever_test.go
+++ b/share/eds/retriever_test.go
@@ -12,8 +12,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/celestiaorg/celestia-app/pkg/da"
- "github.com/celestiaorg/celestia-app/pkg/wrapper"
- "github.com/celestiaorg/nmt"
"github.com/celestiaorg/rsmt2d"
"github.com/celestiaorg/celestia-node/header"
@@ -67,40 +65,6 @@ func TestRetriever_Retrieve(t *testing.T) {
}
}
-func TestRetriever_ByzantineError(t *testing.T) {
- const width = 8
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
- defer cancel()
-
- bserv := ipld.NewMemBlockservice()
- shares := edstest.RandEDS(t, width).Flattened()
- _, err := ipld.ImportShares(ctx, shares, bserv)
- require.NoError(t, err)
-
- // corrupt shares so that eds erasure coding does not match
- copy(shares[14][share.NamespaceSize:], shares[15][share.NamespaceSize:])
-
- // import corrupted eds
- batchAdder := ipld.NewNmtNodeAdder(ctx, bserv, ipld.MaxSizeBatchOption(width*2))
- attackerEDS, err := rsmt2d.ImportExtendedDataSquare(
- shares,
- share.DefaultRSMT2DCodec(),
- wrapper.NewConstructor(uint64(width),
- nmt.NodeVisitor(batchAdder.Visit)),
- )
- require.NoError(t, err)
- err = batchAdder.Commit()
- require.NoError(t, err)
-
- // ensure we rcv an error
- dah, err := da.NewDataAvailabilityHeader(attackerEDS)
- require.NoError(t, err)
- r := NewRetriever(bserv)
- _, err = r.Retrieve(ctx, &dah)
- var errByz *byzantine.ErrByzantine
- require.ErrorAs(t, err, &errByz)
-}
-
// TestRetriever_MultipleRandQuadrants asserts that reconstruction succeeds
// when any three random quadrants requested.
func TestRetriever_MultipleRandQuadrants(t *testing.T) {
diff --git a/share/p2p/discovery/discovery_test.go b/share/p2p/discovery/discovery_test.go
index c02931e1a4..1d0078196f 100644
--- a/share/p2p/discovery/discovery_test.go
+++ b/share/p2p/discovery/discovery_test.go
@@ -1,3 +1,5 @@
+// go:build !race
+
package discovery
import (
diff --git a/state/core_access_test.go b/state/core_access_test.go
index 68d05a955a..ad7b916ea3 100644
--- a/state/core_access_test.go
+++ b/state/core_access_test.go
@@ -1,3 +1,5 @@
+//go:build !race
+
package state
import (
From af417b098d4fb29971d18ae8de976cf30d3c4c33 Mon Sep 17 00:00:00 2001
From: rene <41963722+renaynay@users.noreply.github.com>
Date: Tue, 23 Jan 2024 11:52:01 -0600
Subject: [PATCH 5/6] fix(libs/pidstore): Detect corruption on startup and
reset pidstore (#3132)
The recovery of an existing pidstore is not critical to node
functionality and should not block the node's start-up if it was
corrupted during an ungraceful shutdown. If corruption is detected, a
fresh pidstore can be instantiated and used by the node.
Found by conduit.
---
libs/pidstore/pidstore.go | 20 ++++++++++++++++++++
libs/pidstore/pidstore_test.go | 22 ++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/libs/pidstore/pidstore.go b/libs/pidstore/pidstore.go
index 7e416d98a0..17241aa4a9 100644
--- a/libs/pidstore/pidstore.go
+++ b/libs/pidstore/pidstore.go
@@ -28,6 +28,7 @@ func NewPeerIDStore(ctx context.Context, ds datastore.Datastore) (*PeerIDStore,
pidstore := &PeerIDStore{
ds: namespace.Wrap(ds, storePrefix),
}
+
// check if pidstore is already initialized, and if not,
// initialize the pidstore
exists, err := pidstore.ds.Has(ctx, peersKey)
@@ -37,6 +38,14 @@ func NewPeerIDStore(ctx context.Context, ds datastore.Datastore) (*PeerIDStore,
if !exists {
return pidstore, pidstore.Put(ctx, []peer.ID{})
}
+
+ // if pidstore exists, ensure its contents are uncorrupted
+ _, err = pidstore.Load(ctx)
+ if err != nil {
+ log.Warn("pidstore: corrupted pidstore detected, resetting...", "err", err)
+ return pidstore, pidstore.reset(ctx)
+ }
+
return pidstore, nil
}
@@ -75,3 +84,14 @@ func (p *PeerIDStore) Put(ctx context.Context, peers []peer.ID) error {
log.Infow("Persisted peers successfully", "amount", len(peers))
return nil
}
+
+// reset resets the pidstore in case of corruption.
+func (p *PeerIDStore) reset(ctx context.Context) error {
+ log.Warn("pidstore: resetting the pidstore...")
+ err := p.ds.Delete(ctx, peersKey)
+ if err != nil {
+ return fmt.Errorf("pidstore: error resetting datastore: %w", err)
+ }
+
+ return p.Put(ctx, []peer.ID{})
+}
diff --git a/libs/pidstore/pidstore_test.go b/libs/pidstore/pidstore_test.go
index d8d214c83e..56f8a308ec 100644
--- a/libs/pidstore/pidstore_test.go
+++ b/libs/pidstore/pidstore_test.go
@@ -8,6 +8,7 @@ import (
"time"
"github.com/ipfs/go-datastore"
+ "github.com/ipfs/go-datastore/namespace"
"github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
@@ -29,6 +30,27 @@ func TestPutLoad(t *testing.T) {
})
}
+// TestCorruptedPidstore tests whether a pidstore can detect
+// corruption and reset itself on construction.
+func TestCorruptedPidstore(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
+ defer t.Cleanup(cancel)
+
+ ds := sync.MutexWrap(datastore.NewMapDatastore())
+
+ // intentionally corrupt the store
+ wrappedDS := namespace.Wrap(ds, storePrefix)
+ err := wrappedDS.Put(ctx, peersKey, []byte("corrupted"))
+ require.NoError(t, err)
+
+ pidstore, err := NewPeerIDStore(ctx, ds)
+ require.NoError(t, err)
+
+ got, err := pidstore.Load(ctx)
+ require.NoError(t, err)
+ assert.Equal(t, []peer.ID{}, got)
+}
+
func testPutLoad(ctx context.Context, ds datastore.Datastore, t *testing.T) {
peerstore, err := NewPeerIDStore(ctx, ds)
require.NoError(t, err)
From debad37cdd8db3858651b2c0506f7ef24fe43293 Mon Sep 17 00:00:00 2001
From: Ryan
Date: Tue, 23 Jan 2024 17:06:50 -0600
Subject: [PATCH 6/6] refactor(blob)!: replace SubmitOptions with a GasPrice
parameter (#3094)
This PR modifies the blob interface to replace SubmitOptions with
GasLimit. The reasoning here is that setting a gas price is a lot more
intuitive/easier than calculating the fee and gas limit, which take
cosmossdk and celestia-app imports to calculate without much effort.
Related: https://github.com/rollkit/go-da/issues/30
Based on a suggestion from @vgonkivs we alias float64 to be able to
provide a default value, but now that its there I think we can just have
float64 and the same constructor, as it doesn't change that much.
Breaks the API, cc @jcstein, @tuxcanfly, and @Ferret-san .
Closes #3053.
---
blob/service.go | 32 +++++++++++++++++++-----
nodebuilder/blob/blob.go | 8 +++---
nodebuilder/blob/cmd/blob.go | 29 +++++++--------------
nodebuilder/blob/mocks/api.go | 5 ++--
nodebuilder/das/mocks/api.go | 3 +--
nodebuilder/fraud/mocks/api.go | 3 +--
nodebuilder/header/mocks/api.go | 3 +--
nodebuilder/node/mocks/api.go | 3 +--
nodebuilder/share/mocks/api.go | 13 +++++-----
nodebuilder/state/mocks/api.go | 5 ++--
nodebuilder/tests/api_test.go | 2 +-
nodebuilder/tests/blob_test.go | 6 ++---
share/availability/mocks/availability.go | 3 +--
share/mocks/getter.go | 3 +--
14 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/blob/service.go b/blob/service.go
index 79e7dd7937..6a70772797 100644
--- a/blob/service.go
+++ b/blob/service.go
@@ -4,13 +4,17 @@ import (
"context"
"errors"
"fmt"
+ "math"
"sync"
- "cosmossdk.io/math"
+ sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/types"
+ auth "github.com/cosmos/cosmos-sdk/x/auth/types"
logging "github.com/ipfs/go-log/v2"
+ "github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/pkg/shares"
+ blobtypes "github.com/celestiaorg/celestia-app/x/blob/types"
"github.com/celestiaorg/celestia-node/header"
"github.com/celestiaorg/celestia-node/share"
@@ -23,11 +27,21 @@ var (
log = logging.Logger("blob")
)
+// GasPrice represents the amount to be paid per gas unit. Fee is set by
+// multiplying GasPrice by GasLimit, which is determined by the blob sizes.
+type GasPrice float64
+
+// DefaultGasPrice returns the default gas price, letting node automatically
+// determine the Fee based on the passed blob sizes.
+func DefaultGasPrice() GasPrice {
+ return -1.0
+}
+
// Submitter is an interface that allows submitting blobs to the celestia-core. It is used to
// avoid a circular dependency between the blob and the state package, since the state package needs
// the blob.Blob type for this signature.
type Submitter interface {
- SubmitPayForBlob(ctx context.Context, fee math.Int, gasLim uint64, blobs []*Blob) (*types.TxResponse, error)
+ SubmitPayForBlob(ctx context.Context, fee sdkmath.Int, gasLim uint64, blobs []*Blob) (*types.TxResponse, error)
}
type Service struct {
@@ -66,15 +80,21 @@ func DefaultSubmitOptions() *SubmitOptions {
}
}
-// Submit sends PFB transaction and reports the height in which it was included.
+// Submit sends PFB transaction and reports the height at which it was included.
// Allows sending multiple Blobs atomically synchronously.
// Uses default wallet registered on the Node.
// Handles gas estimation and fee calculation.
-func (s *Service) Submit(ctx context.Context, blobs []*Blob, options *SubmitOptions) (uint64, error) {
+func (s *Service) Submit(ctx context.Context, blobs []*Blob, gasPrice GasPrice) (uint64, error) {
log.Debugw("submitting blobs", "amount", len(blobs))
- if options == nil {
- options = DefaultSubmitOptions()
+ options := DefaultSubmitOptions()
+ if gasPrice >= 0 {
+ blobSizes := make([]uint32, len(blobs))
+ for i, blob := range blobs {
+ blobSizes[i] = uint32(len(blob.Data))
+ }
+ options.GasLimit = blobtypes.EstimateGas(blobSizes, appconsts.DefaultGasPerBlobByte, auth.DefaultTxSizeCostPerByte)
+ options.Fee = types.NewInt(int64(math.Ceil(float64(gasPrice) * float64(options.GasLimit)))).Int64()
}
resp, err := s.blobSubmitter.SubmitPayForBlob(ctx, types.NewInt(options.Fee), options.GasLimit, blobs)
diff --git a/nodebuilder/blob/blob.go b/nodebuilder/blob/blob.go
index 47ab255ac6..f87105541a 100644
--- a/nodebuilder/blob/blob.go
+++ b/nodebuilder/blob/blob.go
@@ -16,7 +16,7 @@ type Module interface {
// Submit sends Blobs and reports the height in which they were included.
// Allows sending multiple Blobs atomically synchronously.
// Uses default wallet registered on the Node.
- Submit(_ context.Context, _ []*blob.Blob, _ *blob.SubmitOptions) (height uint64, _ error)
+ Submit(_ context.Context, _ []*blob.Blob, _ blob.GasPrice) (height uint64, _ error)
// Get retrieves the blob by commitment under the given namespace and height.
Get(_ context.Context, height uint64, _ share.Namespace, _ blob.Commitment) (*blob.Blob, error)
// GetAll returns all blobs at the given height under the given namespaces.
@@ -30,7 +30,7 @@ type Module interface {
type API struct {
Internal struct {
- Submit func(context.Context, []*blob.Blob, *blob.SubmitOptions) (uint64, error) `perm:"write"`
+ Submit func(context.Context, []*blob.Blob, blob.GasPrice) (uint64, error) `perm:"write"`
Get func(context.Context, uint64, share.Namespace, blob.Commitment) (*blob.Blob, error) `perm:"read"`
GetAll func(context.Context, uint64, []share.Namespace) ([]*blob.Blob, error) `perm:"read"`
GetProof func(context.Context, uint64, share.Namespace, blob.Commitment) (*blob.Proof, error) `perm:"read"`
@@ -38,8 +38,8 @@ type API struct {
}
}
-func (api *API) Submit(ctx context.Context, blobs []*blob.Blob, options *blob.SubmitOptions) (uint64, error) {
- return api.Internal.Submit(ctx, blobs, options)
+func (api *API) Submit(ctx context.Context, blobs []*blob.Blob, gasPrice blob.GasPrice) (uint64, error) {
+ return api.Internal.Submit(ctx, blobs, gasPrice)
}
func (api *API) Get(
diff --git a/nodebuilder/blob/cmd/blob.go b/nodebuilder/blob/cmd/blob.go
index f3510edfe1..7862eaa204 100644
--- a/nodebuilder/blob/cmd/blob.go
+++ b/nodebuilder/blob/cmd/blob.go
@@ -16,8 +16,7 @@ import (
var (
base64Flag bool
- fee int64
- gasLimit uint64
+ gasPrice float64
)
func init() {
@@ -37,23 +36,13 @@ func init() {
"printed blob's data as a base64 string",
)
- submitCmd.PersistentFlags().Int64Var(
- &fee,
- "fee",
- -1,
- "specifies fee (in utia) for blob submission.\n"+
- "Fee will be automatically calculated if negative value is passed [optional]",
+ submitCmd.PersistentFlags().Float64Var(
+ &gasPrice,
+ "gas.price",
+ float64(blob.DefaultGasPrice()),
+ "specifies gas price (in utia) for blob submission.\n"+
+ "Gas price will be set to default (0.002) if no value is passed",
)
-
- submitCmd.PersistentFlags().Uint64Var(
- &gasLimit,
- "gas.limit",
- 0,
- "sets the amount of gas that is consumed during blob submission [optional]",
- )
-
- // unset the default value to avoid users confusion
- submitCmd.PersistentFlags().Lookup("fee").DefValue = "0"
}
var Cmd = &cobra.Command{
@@ -135,7 +124,7 @@ var submitCmd = &cobra.Command{
Short: "Submit the blob at the given namespace.\n" +
"Note:\n" +
"* only one blob is allowed to submit through the RPC.\n" +
- "* fee and gas.limit params will be calculated automatically if they are not provided as arguments",
+ "* fee and gas limit params will be calculated automatically.\n",
RunE: func(cmd *cobra.Command, args []string) error {
client, err := cmdnode.ParseClientFromCtx(cmd.Context())
if err != nil {
@@ -156,7 +145,7 @@ var submitCmd = &cobra.Command{
height, err := client.Blob.Submit(
cmd.Context(),
[]*blob.Blob{parsedBlob},
- &blob.SubmitOptions{Fee: fee, GasLimit: gasLimit},
+ blob.GasPrice(gasPrice),
)
response := struct {
diff --git a/nodebuilder/blob/mocks/api.go b/nodebuilder/blob/mocks/api.go
index 40bf299da1..0898e70459 100644
--- a/nodebuilder/blob/mocks/api.go
+++ b/nodebuilder/blob/mocks/api.go
@@ -8,10 +8,9 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
blob "github.com/celestiaorg/celestia-node/blob"
share "github.com/celestiaorg/celestia-node/share"
+ gomock "github.com/golang/mock/gomock"
)
// MockModule is a mock of Module interface.
@@ -98,7 +97,7 @@ func (mr *MockModuleMockRecorder) Included(arg0, arg1, arg2, arg3, arg4 interfac
}
// Submit mocks base method.
-func (m *MockModule) Submit(arg0 context.Context, arg1 []*blob.Blob, arg2 *blob.SubmitOptions) (uint64, error) {
+func (m *MockModule) Submit(arg0 context.Context, arg1 []*blob.Blob, arg2 blob.GasPrice) (uint64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Submit", arg0, arg1, arg2)
ret0, _ := ret[0].(uint64)
diff --git a/nodebuilder/das/mocks/api.go b/nodebuilder/das/mocks/api.go
index 68ffaf3c8c..c4046e90e8 100644
--- a/nodebuilder/das/mocks/api.go
+++ b/nodebuilder/das/mocks/api.go
@@ -8,9 +8,8 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
das "github.com/celestiaorg/celestia-node/das"
+ gomock "github.com/golang/mock/gomock"
)
// MockModule is a mock of Module interface.
diff --git a/nodebuilder/fraud/mocks/api.go b/nodebuilder/fraud/mocks/api.go
index 10111b81a8..fcc7a58231 100644
--- a/nodebuilder/fraud/mocks/api.go
+++ b/nodebuilder/fraud/mocks/api.go
@@ -8,10 +8,9 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
fraud "github.com/celestiaorg/celestia-node/nodebuilder/fraud"
fraud0 "github.com/celestiaorg/go-fraud"
+ gomock "github.com/golang/mock/gomock"
)
// MockModule is a mock of Module interface.
diff --git a/nodebuilder/header/mocks/api.go b/nodebuilder/header/mocks/api.go
index 9b15f2242e..b0d2b961d9 100644
--- a/nodebuilder/header/mocks/api.go
+++ b/nodebuilder/header/mocks/api.go
@@ -8,11 +8,10 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
header "github.com/celestiaorg/celestia-node/header"
header0 "github.com/celestiaorg/go-header"
sync "github.com/celestiaorg/go-header/sync"
+ gomock "github.com/golang/mock/gomock"
)
// MockModule is a mock of Module interface.
diff --git a/nodebuilder/node/mocks/api.go b/nodebuilder/node/mocks/api.go
index 14357316dc..d8789a771c 100644
--- a/nodebuilder/node/mocks/api.go
+++ b/nodebuilder/node/mocks/api.go
@@ -8,10 +8,9 @@ import (
context "context"
reflect "reflect"
+ node "github.com/celestiaorg/celestia-node/nodebuilder/node"
auth "github.com/filecoin-project/go-jsonrpc/auth"
gomock "github.com/golang/mock/gomock"
-
- node "github.com/celestiaorg/celestia-node/nodebuilder/node"
)
// MockModule is a mock of Module interface.
diff --git a/nodebuilder/share/mocks/api.go b/nodebuilder/share/mocks/api.go
index 87f98e4f73..4e21cecae0 100644
--- a/nodebuilder/share/mocks/api.go
+++ b/nodebuilder/share/mocks/api.go
@@ -8,11 +8,10 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
- da "github.com/celestiaorg/celestia-app/pkg/da"
+ header "github.com/celestiaorg/celestia-node/header"
share "github.com/celestiaorg/celestia-node/share"
rsmt2d "github.com/celestiaorg/rsmt2d"
+ gomock "github.com/golang/mock/gomock"
)
// MockModule is a mock of Module interface.
@@ -39,7 +38,7 @@ func (m *MockModule) EXPECT() *MockModuleMockRecorder {
}
// GetEDS mocks base method.
-func (m *MockModule) GetEDS(arg0 context.Context, arg1 *da.DataAvailabilityHeader) (*rsmt2d.ExtendedDataSquare, error) {
+func (m *MockModule) GetEDS(arg0 context.Context, arg1 *header.ExtendedHeader) (*rsmt2d.ExtendedDataSquare, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetEDS", arg0, arg1)
ret0, _ := ret[0].(*rsmt2d.ExtendedDataSquare)
@@ -54,7 +53,7 @@ func (mr *MockModuleMockRecorder) GetEDS(arg0, arg1 interface{}) *gomock.Call {
}
// GetShare mocks base method.
-func (m *MockModule) GetShare(arg0 context.Context, arg1 *da.DataAvailabilityHeader, arg2, arg3 int) ([]byte, error) {
+func (m *MockModule) GetShare(arg0 context.Context, arg1 *header.ExtendedHeader, arg2, arg3 int) ([]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetShare", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].([]byte)
@@ -69,7 +68,7 @@ func (mr *MockModuleMockRecorder) GetShare(arg0, arg1, arg2, arg3 interface{}) *
}
// GetSharesByNamespace mocks base method.
-func (m *MockModule) GetSharesByNamespace(arg0 context.Context, arg1 *da.DataAvailabilityHeader, arg2 share.Namespace) (share.NamespacedShares, error) {
+func (m *MockModule) GetSharesByNamespace(arg0 context.Context, arg1 *header.ExtendedHeader, arg2 share.Namespace) (share.NamespacedShares, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetSharesByNamespace", arg0, arg1, arg2)
ret0, _ := ret[0].(share.NamespacedShares)
@@ -84,7 +83,7 @@ func (mr *MockModuleMockRecorder) GetSharesByNamespace(arg0, arg1, arg2 interfac
}
// SharesAvailable mocks base method.
-func (m *MockModule) SharesAvailable(arg0 context.Context, arg1 *da.DataAvailabilityHeader) error {
+func (m *MockModule) SharesAvailable(arg0 context.Context, arg1 *header.ExtendedHeader) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SharesAvailable", arg0, arg1)
ret0, _ := ret[0].(error)
diff --git a/nodebuilder/state/mocks/api.go b/nodebuilder/state/mocks/api.go
index 6499a6dfd8..1861a86e66 100644
--- a/nodebuilder/state/mocks/api.go
+++ b/nodebuilder/state/mocks/api.go
@@ -9,13 +9,12 @@ import (
reflect "reflect"
math "cosmossdk.io/math"
+ blob "github.com/celestiaorg/celestia-node/blob"
+ state "github.com/celestiaorg/celestia-node/state"
types "github.com/cosmos/cosmos-sdk/types"
types0 "github.com/cosmos/cosmos-sdk/x/staking/types"
gomock "github.com/golang/mock/gomock"
types1 "github.com/tendermint/tendermint/types"
-
- blob "github.com/celestiaorg/celestia-node/blob"
- state "github.com/celestiaorg/celestia-node/state"
)
// MockModule is a mock of Module interface.
diff --git a/nodebuilder/tests/api_test.go b/nodebuilder/tests/api_test.go
index a793ba7b33..960ce38875 100644
--- a/nodebuilder/tests/api_test.go
+++ b/nodebuilder/tests/api_test.go
@@ -113,7 +113,7 @@ func TestBlobRPC(t *testing.T) {
)
require.NoError(t, err)
- height, err := rpcClient.Blob.Submit(ctx, []*blob.Blob{newBlob}, nil)
+ height, err := rpcClient.Blob.Submit(ctx, []*blob.Blob{newBlob}, blob.DefaultGasPrice())
require.NoError(t, err)
require.True(t, height != 0)
}
diff --git a/nodebuilder/tests/blob_test.go b/nodebuilder/tests/blob_test.go
index a30e91b2e6..d0aeefd568 100644
--- a/nodebuilder/tests/blob_test.go
+++ b/nodebuilder/tests/blob_test.go
@@ -60,7 +60,7 @@ func TestBlobModule(t *testing.T) {
fullClient := getAdminClient(ctx, fullNode, t)
lightClient := getAdminClient(ctx, lightNode, t)
- height, err := fullClient.Blob.Submit(ctx, blobs, nil)
+ height, err := fullClient.Blob.Submit(ctx, blobs, blob.DefaultGasPrice())
require.NoError(t, err)
_, err = fullClient.Header.WaitForHeight(ctx, height)
@@ -143,7 +143,7 @@ func TestBlobModule(t *testing.T) {
)
require.NoError(t, err)
- height, err := fullClient.Blob.Submit(ctx, []*blob.Blob{b, b}, nil)
+ height, err := fullClient.Blob.Submit(ctx, []*blob.Blob{b, b}, blob.DefaultGasPrice())
require.NoError(t, err)
_, err = fullClient.Header.WaitForHeight(ctx, height)
@@ -172,7 +172,7 @@ func TestBlobModule(t *testing.T) {
// different pfbs.
name: "Submit the same blob in different pfb",
doFn: func(t *testing.T) {
- h, err := fullClient.Blob.Submit(ctx, []*blob.Blob{blobs[0]}, nil)
+ h, err := fullClient.Blob.Submit(ctx, []*blob.Blob{blobs[0]}, blob.DefaultGasPrice())
require.NoError(t, err)
_, err = fullClient.Header.WaitForHeight(ctx, h)
diff --git a/share/availability/mocks/availability.go b/share/availability/mocks/availability.go
index bb1c01bf85..fc68d3d2bc 100644
--- a/share/availability/mocks/availability.go
+++ b/share/availability/mocks/availability.go
@@ -8,9 +8,8 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
header "github.com/celestiaorg/celestia-node/header"
+ gomock "github.com/golang/mock/gomock"
)
// MockAvailability is a mock of Availability interface.
diff --git a/share/mocks/getter.go b/share/mocks/getter.go
index 2adfa50cfe..738e2b246c 100644
--- a/share/mocks/getter.go
+++ b/share/mocks/getter.go
@@ -8,11 +8,10 @@ import (
context "context"
reflect "reflect"
- gomock "github.com/golang/mock/gomock"
-
header "github.com/celestiaorg/celestia-node/header"
share "github.com/celestiaorg/celestia-node/share"
rsmt2d "github.com/celestiaorg/rsmt2d"
+ gomock "github.com/golang/mock/gomock"
)
// MockGetter is a mock of Getter interface.