Skip to content

Commit

Permalink
Move consts, ipfs, and ipld to pkg (#508)
Browse files Browse the repository at this point in the history
* move ipfs and ipld packages to new pkg/da/

* moved consts to pkg

* clean up
  • Loading branch information
evan-forbes authored Aug 26, 2021
1 parent 7925474 commit c4f2a98
Show file tree
Hide file tree
Showing 37 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion abci/example/dummyapp/app/dummyapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"github.com/celestiaorg/celestia-core/abci/example/kvstore"
"github.com/celestiaorg/celestia-core/abci/types"
"github.com/celestiaorg/celestia-core/pkg/consts"
tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

type Application struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tendermint/commands/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/spf13/cobra"

"github.com/celestiaorg/celestia-core/crypto/merkle"
"github.com/celestiaorg/celestia-core/ipfs"
dbm "github.com/celestiaorg/celestia-core/libs/db"
"github.com/celestiaorg/celestia-core/libs/db/badgerdb"
"github.com/celestiaorg/celestia-core/libs/log"
Expand All @@ -26,6 +25,7 @@ import (
lproxy "github.com/celestiaorg/celestia-core/light/proxy"
lrpc "github.com/celestiaorg/celestia-core/light/rpc"
dbs "github.com/celestiaorg/celestia-core/light/store/db"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs"
rpchttp "github.com/celestiaorg/celestia-core/rpc/client/http"
rpcserver "github.com/celestiaorg/celestia-core/rpc/jsonrpc/server"
)
Expand Down
2 changes: 1 addition & 1 deletion light/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
tmsync "github.com/celestiaorg/celestia-core/libs/sync"
"github.com/celestiaorg/celestia-core/light/provider"
"github.com/celestiaorg/celestia-core/light/store"
"github.com/celestiaorg/celestia-core/p2p/ipld"
"github.com/celestiaorg/celestia-core/pkg/da/ipld"
"github.com/celestiaorg/celestia-core/types"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ipfs/mock.go → pkg/da/ipfs/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/libp2p/go-libp2p-core/routing"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
)

// Mock provides simple mock IPFS API useful for testing
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
ipfsplugin "github.com/ipfs/go-ipfs/plugin"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
)

// Plugins is an exported list of plugins that will be loaded by go-ipfs.
Expand Down
2 changes: 1 addition & 1 deletion ipfs/plugin/nmt.go → pkg/da/ipfs/plugin/nmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"

"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/nmt"
mh "github.com/multiformats/go-multihash"
)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ipfs/plugins.go → pkg/da/ipfs/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/ipfs/go-ipfs/plugin/loader"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
)

// pluginsOnce ensures that plugins are loaded/injected only once in a runtime.
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions p2p/ipld/net_test.go → pkg/da/ipld/net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/libs/log"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
"github.com/celestiaorg/celestia-core/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

func TestDiscovery(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion p2p/ipld/nmt_adder.go → pkg/da/ipld/nmt_adder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
)

// NmtNodeAdder adds ipld.Nodes to the underlying ipld.Batch if it is inserted
Expand Down
6 changes: 3 additions & 3 deletions p2p/ipld/read.go → pkg/da/ipld/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/p2p/ipld/wrapper"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipld/wrapper"
"github.com/celestiaorg/celestia-core/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

const baseErrorMsg = "failure to retrieve block data:"
Expand Down
8 changes: 4 additions & 4 deletions p2p/ipld/read_test.go → pkg/da/ipld/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/celestiaorg/celestia-core/ipfs"
"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/libs/log"
"github.com/celestiaorg/celestia-core/p2p/ipld/wrapper"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipld/wrapper"
"github.com/celestiaorg/celestia-core/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

func TestGetLeafData(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion p2p/ipld/sample.go → pkg/da/ipld/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/celestiaorg/nmt/namespace"
"github.com/ipfs/go-cid"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
"github.com/celestiaorg/celestia-core/types"
)

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions p2p/ipld/validate_test.go → pkg/da/ipld/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/celestiaorg/celestia-core/ipfs"
"github.com/celestiaorg/celestia-core/libs/log"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs"
"github.com/celestiaorg/celestia-core/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

// TODO(@Wondertan): Add test to simulate ErrValidationFailed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/celestiaorg/nmt"
"github.com/celestiaorg/rsmt2d"

"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/celestia-core/pkg/consts"
)

// Fulfills the rsmt2d.Tree interface and rsmt2d.TreeConstructorFn function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sort"
"testing"

"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/nmt"
"github.com/celestiaorg/rsmt2d"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions p2p/ipld/write.go → pkg/da/ipld/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/libp2p/go-libp2p-core/routing"
kbucket "github.com/libp2p/go-libp2p-kbucket"

"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/libs/log"
"github.com/celestiaorg/celestia-core/libs/sync"
"github.com/celestiaorg/celestia-core/p2p/ipld/wrapper"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
"github.com/celestiaorg/celestia-core/pkg/da/ipld/wrapper"
"github.com/celestiaorg/celestia-core/types"
)

Expand Down
6 changes: 3 additions & 3 deletions p2p/ipld/write_test.go → pkg/da/ipld/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (

abci "github.com/celestiaorg/celestia-core/abci/types"
"github.com/celestiaorg/celestia-core/crypto/tmhash"
"github.com/celestiaorg/celestia-core/ipfs"
"github.com/celestiaorg/celestia-core/ipfs/plugin"
"github.com/celestiaorg/celestia-core/libs/log"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs"
"github.com/celestiaorg/celestia-core/pkg/da/ipfs/plugin"
tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types"
"github.com/celestiaorg/celestia-core/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

func TestPutBlock(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion testutils/blockdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

tmbytes "github.com/celestiaorg/celestia-core/libs/bytes"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

// GenerateRandomBlockData returns randomly generated block data for testing purposes.
Expand Down
4 changes: 2 additions & 2 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
tmmath "github.com/celestiaorg/celestia-core/libs/math"
"github.com/celestiaorg/celestia-core/libs/protoio"
tmsync "github.com/celestiaorg/celestia-core/libs/sync"
"github.com/celestiaorg/celestia-core/p2p/ipld/wrapper"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/celestia-core/pkg/da/ipld/wrapper"
tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types"
tmversion "github.com/celestiaorg/celestia-core/proto/tendermint/version"
"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/celestia-core/version"
)

Expand Down
2 changes: 1 addition & 1 deletion types/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"github.com/celestiaorg/celestia-core/libs/bits"
"github.com/celestiaorg/celestia-core/libs/bytes"
tmrand "github.com/celestiaorg/celestia-core/libs/rand"
"github.com/celestiaorg/celestia-core/pkg/consts"
tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types"
tmversion "github.com/celestiaorg/celestia-core/proto/tendermint/version"
"github.com/celestiaorg/celestia-core/types/consts"
tmtime "github.com/celestiaorg/celestia-core/types/time"
"github.com/celestiaorg/celestia-core/version"
)
Expand Down
2 changes: 1 addition & 1 deletion types/share_merging.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"errors"

tmbytes "github.com/celestiaorg/celestia-core/libs/bytes"
"github.com/celestiaorg/celestia-core/pkg/consts"
tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types"
"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/rsmt2d"
"github.com/gogo/protobuf/proto"
)
Expand Down
2 changes: 1 addition & 1 deletion types/share_splitting.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"bytes"

"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/nmt/namespace"
)

Expand Down
2 changes: 1 addition & 1 deletion types/shares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

tmbytes "github.com/celestiaorg/celestia-core/libs/bytes"
"github.com/celestiaorg/celestia-core/libs/protoio"
"github.com/celestiaorg/celestia-core/types/consts"
"github.com/celestiaorg/celestia-core/pkg/consts"
"github.com/celestiaorg/nmt/namespace"
"github.com/celestiaorg/rsmt2d"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion types/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/celestiaorg/celestia-core/crypto/merkle"
"github.com/celestiaorg/celestia-core/crypto/tmhash"
tmbytes "github.com/celestiaorg/celestia-core/libs/bytes"
"github.com/celestiaorg/celestia-core/pkg/consts"
tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types"
"github.com/celestiaorg/celestia-core/types/consts"
)

// Tx is an arbitrary byte array.
Expand Down

0 comments on commit c4f2a98

Please sign in to comment.