Skip to content

Commit

Permalink
refactor: merge from main into lid branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Mar 29, 2023
1 parent 7b745c3 commit 10c10fa
Show file tree
Hide file tree
Showing 106 changed files with 1,687 additions and 1,290 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
executors:
golang:
docker:
- image: cimg/go:1.18.6
- image: cimg/go:1.19.7
resource_class: 2xlarge
ubuntu:
docker:
Expand Down Expand Up @@ -242,7 +242,7 @@ jobs:
default: golang
golangci-lint-version:
type: string
default: 1.46.2
default: 1.52.2
concurrency:
type: string
default: '2'
Expand Down
8 changes: 4 additions & 4 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package api
import (
"context"

"github.com/filecoin-project/boost-gfm/retrievalmarket"
"github.com/filecoin-project/boost-gfm/storagemarket"
smtypes "github.com/filecoin-project/boost/storagemarket/types"
"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"
lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
Expand Down Expand Up @@ -68,8 +68,8 @@ type Boost interface {
MarketGetRetrievalAsk(ctx context.Context) (*retrievalmarket.Ask, error) //perm:read
MarketSetAsk(ctx context.Context, price types.BigInt, verifiedPrice types.BigInt, duration abi.ChainEpoch, minPieceSize abi.PaddedPieceSize, maxPieceSize abi.PaddedPieceSize) error //perm:admin
MarketGetAsk(ctx context.Context) (*storagemarket.SignedStorageAsk, error) //perm:read
MarketListDataTransfers(ctx context.Context) ([]lapi.DataTransferChannel, error) //perm:write
MarketDataTransferUpdates(ctx context.Context) (<-chan lapi.DataTransferChannel, error) //perm:write
MarketListDataTransfers(ctx context.Context) ([]DataTransferChannel, error) //perm:write
MarketDataTransferUpdates(ctx context.Context) (<-chan DataTransferChannel, error) //perm:write
MarketRestartDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error //perm:write
MarketCancelDataTransfer(ctx context.Context, transferID datatransfer.TransferID, otherPeer peer.ID, isInitiator bool) error //perm:write
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
Expand Down
4 changes: 2 additions & 2 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/boost-gfm/retrievalmarket"
"github.com/filecoin-project/boost-gfm/storagemarket"

"github.com/filecoin-project/go-state-types/builtin/v8/paych"
"github.com/filecoin-project/lotus/chain/actors/builtin"
Expand Down
17 changes: 8 additions & 9 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ import (
"time"
"unicode"

"github.com/filecoin-project/boost-gfm/filestore"
"github.com/filecoin-project/boost-gfm/retrievalmarket"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-graphsync"
graphsync "github.com/ipfs/go-graphsync"
textselector "github.com/ipld/go-ipld-selector-text-lite"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/metrics"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/multiformats/go-multiaddr"

datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/filestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-jsonrpc/auth"
textselector "github.com/ipld/go-ipld-selector-text-lite"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/go-state-types/crypto"
Expand Down Expand Up @@ -141,8 +140,8 @@ func init() {
addExample(map[string]int{"name": 42})
addExample(map[string]time.Time{"name": time.Unix(1615243938, 0).UTC()})
addExample(&types.ExecutionTrace{
Msg: ExampleValue("init", reflect.TypeOf(&types.Message{}), nil).(*types.Message),
MsgRct: ExampleValue("init", reflect.TypeOf(&types.MessageReceipt{}), nil).(*types.MessageReceipt),
Msg: ExampleValue("init", reflect.TypeOf(types.MessageTrace{}), nil).(types.MessageTrace),
MsgRct: ExampleValue("init", reflect.TypeOf(types.ReturnTrace{}), nil).(types.ReturnTrace),
})
addExample(map[string]types.Actor{
"t01236": ExampleValue("init", reflect.TypeOf(types.Actor{}), nil).(types.Actor),
Expand Down
20 changes: 10 additions & 10 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/boost-gfm/retrievalmarket"
"github.com/filecoin-project/lotus/chain/types"

datatransfer "github.com/filecoin-project/go-data-transfer"
Expand Down
2 changes: 1 addition & 1 deletion build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package build

var CurrentCommit string

const BuildVersion = "1.6.1-rc1"
const BuildVersion = "1.6.2-rc1"

func UserVersion() string {
return BuildVersion + CurrentCommit
Expand Down
5 changes: 2 additions & 3 deletions cli/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -62,7 +61,7 @@ func Setup(cfgdir string) (*Node, error) {
}

func loadOrInitPeerKey(kf string) (crypto.PrivKey, error) {
data, err := ioutil.ReadFile(kf)
data, err := os.ReadFile(kf)
if err != nil {
if !os.IsNotExist(err) {
return nil, err
Expand All @@ -78,7 +77,7 @@ func loadOrInitPeerKey(kf string) (crypto.PrivKey, error) {
return nil, err
}

if err := ioutil.WriteFile(kf, data, 0600); err != nil {
if err := os.WriteFile(kf, data, 0600); err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/boost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"

"github.com/filecoin-project/boost/cmd"
Expand All @@ -19,7 +19,7 @@ import (
var log = logging.Logger("boost")

func init() {
llog.SetOutput(ioutil.Discard)
llog.SetOutput(io.Discard)
}

func main() {
Expand Down
14 changes: 9 additions & 5 deletions cmd/boost/provider_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"sort"
"strings"

"github.com/filecoin-project/boost-gfm/retrievalmarket"
"github.com/filecoin-project/boost-gfm/storagemarket/network"
bcli "github.com/filecoin-project/boost/cli"
clinode "github.com/filecoin-project/boost/cli/node"
"github.com/filecoin-project/boost/cmd"
"github.com/filecoin-project/boost/retrievalmarket/lp2pimpl"
"github.com/filecoin-project/boostd-data/shared/cliutil"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket/network"
// TODO: This multiaddr util library should probably live in its own repo
multiaddrutil "github.com/filecoin-project/go-legs/httpsync/multiaddr"
"github.com/filecoin-project/lotus/chain/types"
Expand Down Expand Up @@ -84,7 +84,11 @@ var libp2pInfoCmd = &cli.Command{
if err != nil {
return fmt.Errorf("getting protocols for peer %s: %w", addrInfo.ID, err)
}
sort.Strings(protos)
protostrs := make([]string, 0, len(protos))
for _, proto := range protos {
protostrs = append(protostrs, string(proto))
}
sort.Strings(protostrs)

agentVersionI, err := n.Host.Peerstore().Get(addrInfo.ID, "AgentVersion")
if err != nil {
Expand All @@ -98,7 +102,7 @@ var libp2pInfoCmd = &cli.Command{
"agent": agentVersion,
"id": addrInfo.ID.String(),
"multiaddrs": addrInfo.Addrs,
"protocols": protos,
"protocols": protostrs,
})
}

Expand All @@ -109,7 +113,7 @@ var libp2pInfoCmd = &cli.Command{
for _, addr := range addrInfo.Addrs {
fmt.Println(" " + addr.String())
}
fmt.Println("Protocols:\n" + " " + strings.Join(protos, "\n "))
fmt.Println("Protocols:\n" + " " + strings.Join(protostrs, "\n "))
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/boost/retrieve_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
levelds "github.com/ipfs/go-ds-leveldb"
blockstore "github.com/ipfs/go-ipfs-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline"
files "github.com/ipfs/go-ipfs-files"
"github.com/ipfs/go-libipfs/files"
"github.com/ipfs/go-merkledag"
unixfile "github.com/ipfs/go-unixfs/file"
"github.com/ipld/go-car"
Expand Down
3 changes: 1 addition & 2 deletions cmd/boost/wallet_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -395,7 +394,7 @@ var walletImport = &cli.Command{
inpdata = indata

} else {
fdata, err := ioutil.ReadFile(cctx.Args().First())
fdata, err := os.ReadFile(cctx.Args().First())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/boostci/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"io/ioutil"
"io"
"log"
"os"

Expand All @@ -11,7 +11,7 @@ import (
)

func init() {
llog.SetOutput(ioutil.Discard)
llog.SetOutput(io.Discard)
}

func main() {
Expand Down
5 changes: 2 additions & 3 deletions cmd/boostd/dummydeal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"os"
Expand Down Expand Up @@ -239,12 +238,12 @@ func serveCarFile(dealUuid uuid.UUID, fpath string) (string, error) {
carName := dealUuid.String() + ".car"
destPath := path.Join(gql.DummyDealsDir, carName)

bytes, err := ioutil.ReadFile(fpath)
bytes, err := os.ReadFile(fpath)
if err != nil {
return "", fmt.Errorf("reading source car file: %w", err)
}

err = ioutil.WriteFile(destPath, bytes, 0644)
err = os.WriteFile(destPath, bytes, 0644)
if err != nil {
return "", fmt.Errorf("writing destination car file: %w", err)
}
Expand Down
18 changes: 15 additions & 3 deletions cmd/boostd/import_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package main

import (
"fmt"
"github.com/ipfs/go-cid"
"os"
"path/filepath"
"strings"

bcli "github.com/filecoin-project/boost/cli"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
"github.com/mitchellh/go-homedir"
"github.com/urfave/cli/v2"
)

Expand All @@ -21,9 +23,19 @@ var importDataCmd = &cli.Command{
}

id := cctx.Args().Get(0)
filePath := cctx.Args().Get(1)
tpath := cctx.Args().Get(1)

path, err := homedir.Expand(tpath)
if err != nil {
return fmt.Errorf("expanding file path: %w", err)
}

filePath, err := filepath.Abs(path)
if err != nil {
return fmt.Errorf("failed get absolute path for file: %w", err)
}

_, err := os.Stat(filePath)
_, err = os.Stat(filePath)
if err != nil {
return fmt.Errorf("opening file %s: %w", filePath, err)
}
Expand Down
Loading

0 comments on commit 10c10fa

Please sign in to comment.