Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/dvsekhvalno…
Browse files Browse the repository at this point in the history
…v/jose2go-1.6.0
  • Loading branch information
ramin authored Feb 26, 2024
2 parents 594e341 + 1a20776 commit 3c8e4a0
Show file tree
Hide file tree
Showing 30 changed files with 415 additions and 174 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

# TODO: permission issue, but not worth fixing as this should be refactored
# into the celestiaorg/.github repo, at which point any permission issues will
# be resolved.
#
# docker:
# needs: [release]
# uses: ./.github/workflows/docker-build.yml
48 changes: 48 additions & 0 deletions .github/workflows/github_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: github-pages

on:
push:
branches:
- main
paths:
- specs/**
pull_request:
paths:
- specs/**
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"

- name: Build book
run: mdbook build specs

- name: Deploy main
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./specs/book
# keep_files is to prevent PR preview files from being overwritten.
# If we need to overwrite such files, trigger this workflow manually.
keep_files: ${{ github.event_name != 'workflow_dispatch' }}

- name: Deploy PR preview
# Only run this job if the PR was created from a branch on celestiaorg/celestia-node
# because this job will fail for branches from forks.
# https://github.com/celestiaorg/celestia-app/issues/1506
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./specs/book
6 changes: 3 additions & 3 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
go-version: ${{ inputs.go-version }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
uses: golangci/golangci-lint-action@v4.0.0
with:
args: --timeout 10m
version: v1.55
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-14]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
Expand All @@ -98,7 +98,7 @@ jobs:
retention-days: 5

- name: upload coverage
uses: codecov/codecov-action@v3.1.6
uses: codecov/codecov-action@v4.0.1
with:
env_vars: OS
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ jobs:
- name: run blob tests
run: make test-integration TAGS=blob

da_tests:
name: Da 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 da tests
run: make test-integration SHORT=true TAGS=da

fraud_tests:
name: Integration Tests Fraud
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion api/docgen/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package docgen
import (
_ "embed"
"encoding/json"
"errors"
"fmt"
"reflect"

Expand Down Expand Up @@ -51,6 +52,7 @@ var ExampleValues = map[reflect.Type]interface{}{
reflect.TypeOf(42): 42,
reflect.TypeOf(byte(7)): byte(7),
reflect.TypeOf(float64(42)): float64(42),
reflect.TypeOf(blob.GasPrice(0)): blob.GasPrice(0.002),
reflect.TypeOf(true): true,
reflect.TypeOf([]byte{}): []byte("byte array"),
reflect.TypeOf(node.Full): node.Full,
Expand All @@ -65,7 +67,7 @@ var ExampleValues = map[reflect.Type]interface{}{
Shares: []*byzantine.ShareWithProof{},
},
),
reflect.TypeOf((*error)(nil)).Elem(): fmt.Errorf("error"),
reflect.TypeOf((*error)(nil)).Elem(): errors.New("error"),
}

func init() {
Expand Down
4 changes: 3 additions & 1 deletion api/gateway/health.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package gateway

import "net/http"
import (
"net/http"
)

const (
healthEndpoint = "/status/health"
Expand Down
13 changes: 6 additions & 7 deletions api/rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ func (s *Server) verifyAuth(_ context.Context, token string) ([]auth.Permission,

// RegisterService registers a service onto the RPC server. All methods on the service will then be
// exposed over the RPC.
func (s *Server) RegisterService(namespace string, service interface{}) {
s.rpc.Register(namespace, service)
}
func (s *Server) RegisterService(namespace string, service interface{}, out interface{}) {
if s.authDisabled {
s.rpc.Register(namespace, service)
return
}

// RegisterAuthedService registers a service onto the RPC server. All methods on the service will
// then be exposed over the RPC.
func (s *Server) RegisterAuthedService(namespace string, service interface{}, out interface{}) {
auth.PermissionedProxy(perms.AllPerms, perms.DefaultPerms, service, getInternalStruct(out))
s.RegisterService(namespace, out)
s.rpc.Register(namespace, out)
}

func getInternalStruct(api interface{}) interface{} {
Expand Down
18 changes: 9 additions & 9 deletions api/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ func setupNodeWithAuthedRPC(t *testing.T, auth jwt.Signer) (*nodebuilder.Node, *
// given the behavior of fx.Invoke, this invoke will be called last as it is added at the root
// level module. For further information, check the documentation on fx.Invoke.
invokeRPC := fx.Invoke(func(srv *rpc.Server) {
srv.RegisterAuthedService("state", mockAPI.State, &statemod.API{})
srv.RegisterAuthedService("share", mockAPI.Share, &share.API{})
srv.RegisterAuthedService("fraud", mockAPI.Fraud, &fraud.API{})
srv.RegisterAuthedService("header", mockAPI.Header, &header.API{})
srv.RegisterAuthedService("das", mockAPI.Das, &das.API{})
srv.RegisterAuthedService("p2p", mockAPI.P2P, &p2p.API{})
srv.RegisterAuthedService("node", mockAPI.Node, &node.API{})
srv.RegisterAuthedService("blob", mockAPI.Blob, &blob.API{})
srv.RegisterAuthedService("da", mockAPI.DA, &da.API{})
srv.RegisterService("fraud", mockAPI.Fraud, &fraud.API{})
srv.RegisterService("das", mockAPI.Das, &das.API{})
srv.RegisterService("header", mockAPI.Header, &header.API{})
srv.RegisterService("state", mockAPI.State, &statemod.API{})
srv.RegisterService("share", mockAPI.Share, &share.API{})
srv.RegisterService("p2p", mockAPI.P2P, &p2p.API{})
srv.RegisterService("node", mockAPI.Node, &node.API{})
srv.RegisterService("blob", mockAPI.Blob, &blob.API{})
srv.RegisterService("da", mockAPI.DA, &da.API{})
})
// fx.Replace does not work here, but fx.Decorate does
nd := nodebuilder.TestNode(t, node.Full, invokeRPC, fx.Decorate(func() (jwt.Signer, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func AuthCmd(fsets ...*flag.FlagSet) *cobra.Command {
"the node has already been initialized and started.",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("must specify permissions")
return errors.New("must specify permissions")
}
permissions, err := convertToPerms(args[0])
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions cmd/cel-shed/header.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -30,12 +31,12 @@ Custom store path is not supported yet.`,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 3 {
return fmt.Errorf("not enough arguments")
return errors.New("not enough arguments")
}

tp := node.ParseType(args[0])
if !tp.IsValid() {
return fmt.Errorf("invalid node-type")
return errors.New("invalid node-type")
}

network := args[1]
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func InitClient(cmd *cobra.Command, _ []string) error {
if authTokenFlag == "" {
storePath := ""
if !cmd.Flag(nodeStoreFlag).Changed {
return fmt.Errorf("cant get the access to the auth token: token/node-store flag was not specified")
return errors.New("cant get the access to the auth token: token/node-store flag was not specified")
}
storePath = cmd.Flag(nodeStoreFlag).Value.String()
token, err := getToken(storePath)
Expand Down
3 changes: 2 additions & 1 deletion core/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package core

import (
"context"
"errors"
"fmt"

logging "github.com/ipfs/go-log/v2"
Expand Down Expand Up @@ -127,7 +128,7 @@ func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.
func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (<-chan types.EventDataSignedBlock, error) {
// start the client if not started yet
if !f.client.IsRunning() {
return nil, fmt.Errorf("client not running")
return nil, errors.New("client not running")
}

ctx, cancel := context.WithCancel(ctx)
Expand Down
2 changes: 1 addition & 1 deletion core/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewListener(
// Start kicks off the Listener listener loop.
func (cl *Listener) Start(context.Context) error {
if cl.cancel != nil {
return fmt.Errorf("listener: already started")
return errors.New("listener: already started")
}

ctx, cancel := context.WithCancel(context.Background())
Expand Down
2 changes: 1 addition & 1 deletion das/daser.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func NewDASer(
// Start initiates subscription for new ExtendedHeaders and spawns a sampling routine.
func (d *DASer) Start(ctx context.Context) error {
if !atomic.CompareAndSwapInt32(&d.running, 0, 1) {
return fmt.Errorf("da: DASer already started")
return errors.New("da: DASer already started")
}

sub, err := d.hsub.Subscribe()
Expand Down
3 changes: 2 additions & 1 deletion das/options.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package das

import (
"errors"
"fmt"
"time"
)

// ErrInvalidOption is an error that is returned by Parameters.Validate
// when supplied with invalid values.
// This error will also be returned by NewDASer if supplied with an invalid option
var ErrInvalidOption = fmt.Errorf("das: invalid option")
var ErrInvalidOption = errors.New("das: invalid option")

// errInvalidOptionValue is a utility function to dedup code for error-returning
// when dealing with invalid parameter values
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ 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.18.0
golang.org/x/crypto v0.19.0
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e
golang.org/x/sync v0.6.0
golang.org/x/text v0.14.0
Expand Down Expand Up @@ -321,8 +321,8 @@ require (
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.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.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
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2513,8 +2513,8 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -2861,8 +2861,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -2871,8 +2871,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
Loading

0 comments on commit 3c8e4a0

Please sign in to comment.