Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Aug 23, 2023
1 parent 6deee3a commit 8db8d54
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ lint-imports:
.PHONY: lint-imports

sort-imports:
@goimports-reviser -company-prefixes "github.com/celestiaorg" -project-name "github.com/celestiaorg/"$(PROJECTNAME)"" -output stdout .
@for file in `find . -type f -name '*.go'`; \
do goimports-reviser -company-prefixes "github.com/celestiaorg" -project-name "github.com/celestiaorg/"$(PROJECTNAME)"" $$file \
|| exit 1; \
done;
.PHONY: sort-imports

pb-gen:
Expand Down
3 changes: 2 additions & 1 deletion headertest/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"testing"
"time"

"github.com/celestiaorg/go-header"
"github.com/stretchr/testify/assert"

"github.com/celestiaorg/go-header"
)

func TestVerify(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion p2p/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/celestiaorg/go-libp2p-messenger/serde"

"github.com/celestiaorg/go-header"
"github.com/celestiaorg/go-header/headertest"
p2p_pb "github.com/celestiaorg/go-header/p2p/pb"
"github.com/celestiaorg/go-libp2p-messenger/serde"
)

const networkID = "test" // must match the chain-id in test suite
Expand Down
3 changes: 2 additions & 1 deletion p2p/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"

"github.com/celestiaorg/go-libp2p-messenger/serde"

"github.com/celestiaorg/go-header"
p2p_pb "github.com/celestiaorg/go-header/p2p/pb"
"github.com/celestiaorg/go-libp2p-messenger/serde"
)

func protocolID(networkID string) protocol.ID {
Expand Down
3 changes: 2 additions & 1 deletion p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"

"github.com/celestiaorg/go-libp2p-messenger/serde"

"github.com/celestiaorg/go-header"
p2p_pb "github.com/celestiaorg/go-header/p2p/pb"
"github.com/celestiaorg/go-libp2p-messenger/serde"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions store/heightsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestHeightSub(t *testing.T) {
// assert subscription returns nil for past heights
{
h := headertest.RandDummyHeader(t)
h.Raw.Height = 100
h.HeightI = 100
hs.SetHeight(99)
hs.Pub(h)

Expand All @@ -35,9 +35,9 @@ func TestHeightSub(t *testing.T) {
time.Sleep(time.Millisecond)

h1 := headertest.RandDummyHeader(t)
h1.Raw.Height = 101
h1.HeightI = 101
h2 := headertest.RandDummyHeader(t)
h2.Raw.Height = 102
h2.HeightI = 102
hs.Pub(h1, h2)
}()

Expand Down
8 changes: 4 additions & 4 deletions verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ func verify[H Header](trstd, untrstd H, heightThreshold int64) error {
}

var (
ErrZeroHeader = errors.New("zero header")
ErrWrongChainID = errors.New("wrong chain id")
ErrUnorderedTime = errors.New("unordered headers")
ErrZeroHeader = errors.New("zero header")
ErrWrongChainID = errors.New("wrong chain id")
ErrUnorderedTime = errors.New("unordered headers")
ErrFromFuture = errors.New("header is from the future")
ErrKnownHeader = errors.New("known header")
ErrHeightFromFuture = errors.New("header height is far from future")
Expand Down Expand Up @@ -117,4 +117,4 @@ var clockDrift = 10 * time.Second

func formatTime(t time.Time) string {
return t.UTC().Format(time.RFC3339)
}
}

0 comments on commit 8db8d54

Please sign in to comment.