Skip to content

Commit

Permalink
Merge branch 'celestiaorg:main' into discovery-peer
Browse files Browse the repository at this point in the history
  • Loading branch information
nodersteam authored Jan 15, 2024
2 parents 767c424 + a7c49d2 commit 2832f1c
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 94 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
needs: [lint, go_mod_tidy_check]
name: Run Unit Tests with Race Detector
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v4
Expand All @@ -124,6 +125,7 @@ jobs:
needs: [lint, go_mod_tidy_check]
name: Run Integration Tests
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v4
Expand Down
20 changes: 0 additions & 20 deletions api/gateway/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@ package gateway

import (
"context"
"errors"
"net/http"
"time"

"github.com/gorilla/mux"

"github.com/celestiaorg/celestia-node/nodebuilder/state"
)

const timeout = time.Minute

func (h *Handler) RegisterMiddleware(srv *Server) {
srv.RegisterMiddleware(
setContentType,
checkPostDisabled(h.state),
wrapRequestContext,
enableCors,
)
Expand All @@ -36,20 +30,6 @@ func setContentType(next http.Handler) http.Handler {
})
}

// checkPostDisabled ensures that context was canceled and prohibit POST requests.
func checkPostDisabled(state state.Module) mux.MiddlewareFunc {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// check if state service was halted and deny the transaction
if r.Method == http.MethodPost && state.IsStopped(r.Context()) {
writeError(w, http.StatusMethodNotAllowed, r.URL.Path, errors.New("not possible to submit data"))
return
}
next.ServeHTTP(w, r)
})
}
}

// wrapRequestContext ensures we implement a deadline on serving requests
// via the gateway server-side to prevent context leaks.
func wrapRequestContext(next http.Handler) http.Handler {
Expand Down
2 changes: 1 addition & 1 deletion core/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (ce *Exchange) GetRangeByHeight(
ce.metrics.requestDurationPerHeader(ctx, time.Since(start), amount)

for _, h := range headers {
err := from.Verify(h)
err := libhead.Verify[*header.ExtendedHeader](from, h, libhead.DefaultHeightThreshold)
if err != nil {
return nil, fmt.Errorf("verifying next header against last verified height: %d: %w",
from.Height(), err)
Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/celestiaorg/celestia-app v1.4.0
github.com/celestiaorg/go-ds-badger4 v0.0.0-20230712104058-7ede1c814ac5
github.com/celestiaorg/go-fraud v0.2.0
github.com/celestiaorg/go-header v0.5.1
github.com/celestiaorg/go-header v0.5.2
github.com/celestiaorg/go-libp2p-messenger v0.2.0
github.com/celestiaorg/nmt v0.20.0
github.com/celestiaorg/rsmt2d v0.11.0
Expand All @@ -36,14 +36,14 @@ require (
github.com/ipfs/go-ipld-format v0.6.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipld/go-car v0.6.2
github.com/libp2p/go-libp2p v0.32.1
github.com/libp2p/go-libp2p v0.32.2
github.com/libp2p/go-libp2p-kad-dht v0.25.2
github.com/libp2p/go-libp2p-pubsub v0.10.0
github.com/libp2p/go-libp2p-record v0.2.0
github.com/libp2p/go-libp2p-routing-helpers v0.7.3
github.com/mitchellh/go-homedir v1.1.0
github.com/multiformats/go-base32 v0.1.0
github.com/multiformats/go-multiaddr v0.12.0
github.com/multiformats/go-multiaddr v0.12.1
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/multiformats/go-multihash v0.2.3
github.com/open-rpc/meta-schema v0.0.0-20201029221707-1b72ef2ea333
Expand All @@ -66,9 +66,9 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0
go.uber.org/fx v1.20.1
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/sync v0.5.0
golang.org/x/crypto v0.18.0
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e
golang.org/x/sync v0.6.0
golang.org/x/text v0.14.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
Expand Down Expand Up @@ -157,7 +157,7 @@ require (
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
Expand All @@ -180,7 +180,7 @@ require (
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
Expand Down Expand Up @@ -232,7 +232,7 @@ require (
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/klauspost/reedsolomon v1.11.8 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/lib/pq v1.10.7 // indirect
Expand Down Expand Up @@ -285,7 +285,7 @@ require (
github.com/pyroscope-io/godeltaprof v0.1.2 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.4 // indirect
github.com/quic-go/quic-go v0.39.3 // indirect
github.com/quic-go/quic-go v0.39.4 // indirect
github.com/quic-go/webtransport-go v0.6.0 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
Expand Down Expand Up @@ -321,12 +321,12 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/tools v0.16.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/api v0.128.0 // indirect
Expand Down
Loading

0 comments on commit 2832f1c

Please sign in to comment.