Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/client/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func defaultServerConfig(t *testing.T) server.Config {
ipfsAddr := util.MustParseAddr(ipfsAddrStr)

devnet := tests.LaunchDevnetDocker(t, 1, 300, ipfsAddrStr, false)
devnetAddr := util.MustParseAddr("/ip4/127.0.0.1/tcp/" + devnet.GetPort("7777/tcp"))
devnetAddr := "127.0.0.1/tcp/" + devnet.GetPort("7777/tcp")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should be:
devnetAddr := "127.0.0.1:" + devnet.GetPort("7777/tcp")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼


grpcMaddr := util.MustParseAddr(grpcHostAddress)
conf := server.Config{
Expand Down
2 changes: 1 addition & 1 deletion api/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type Config struct {
Devnet bool
IpfsAPIAddr ma.Multiaddr

LotusAddress ma.Multiaddr
LotusAddress string
LotusAuthToken string
LotusMasterAddr string
LotusConnectionRetries int
Expand Down
7 changes: 2 additions & 5 deletions cmd/powd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ func configFromFlags() (server.Config, error) {
return server.Config{}, fmt.Errorf("parsing grpchostaddr: %s", err)
}

lotusHost, err := ma.NewMultiaddr(config.GetString("lotushost"))
if err != nil {
return server.Config{}, fmt.Errorf("parsing lotus api multiaddr: %s", err)
}
lotusHost := config.GetString("lotushost")

walletInitialFunds := *big.NewInt(config.GetInt64("walletinitialfund"))
ipfsAPIAddr := util.MustParseAddr(config.GetString("ipfsapiaddr"))
Expand Down Expand Up @@ -365,7 +362,7 @@ func setupFlags() error {
pflag.String("grpcwebproxyaddr", "0.0.0.0:6002", "gRPC webproxy listening address.")
pflag.String("indexrawjsonhostaddr", "0.0.0.0:8889", "Indexes raw json output listening address")

pflag.String("lotushost", "/ip4/127.0.0.1/tcp/1234", "Lotus client API endpoint multiaddress.")
pflag.String("lotushost", "127.0.0.1:1234", "Lotus client API endpoint address.")
pflag.String("lotustoken", "", "Lotus API authorization token. This flag or --lotustoken file are mandatory.")
pflag.String("lotustokenfile", "", "Path of a file that contains the Lotus API authorization token.")
pflag.String("lotusmasteraddr", "", "Existing wallet address in Lotus to be used as source of funding for new FFS instances. (Optional)")
Expand Down
9 changes: 2 additions & 7 deletions ffs/minerselector/sr2/sr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"

"github.com/filecoin-project/go-address"
"github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
"github.com/textileio/powergate/v2/ffs"
"github.com/textileio/powergate/v2/lotus"
Expand All @@ -16,11 +15,9 @@ import (
// synced Lotus node.
func TestMS(t *testing.T) {
t.SkipNow()
lotusHost, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/5555")
require.NoError(t, err)
lotusToken := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.4KpuySIvV4n6kBEXQOle-hi1Ec3lyUmRYCknz4NQyLM"

cb, err := lotus.NewBuilder(lotusHost, lotusToken, 1)
cb, err := lotus.NewBuilder("127.0.0.1:5555", lotusToken, 1)
require.NoError(t, err)

url := "https://raw.githubusercontent.com/filecoin-project/slingshot/master/miners.json"
Expand All @@ -35,11 +32,9 @@ func TestMS(t *testing.T) {

func TestCustom(t *testing.T) {
t.SkipNow()
lotusHost, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/5555")
require.NoError(t, err)
lotusToken := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.4KpuySIvV4n6kBEXQOle-hi1Ec3lyUmRYCknz4NQyLM"

cb, err := lotus.NewBuilder(lotusHost, lotusToken, 1)
cb, err := lotus.NewBuilder("127.0.0.1:5555", lotusToken, 1)
require.NoError(t, err)

c, cls, err := cb(context.Background())
Expand Down
4 changes: 1 addition & 3 deletions index/miner/module/miner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ func TestIntegration(t *testing.T) {
metaRefreshInterval = time.Hour
minersRefreshInterval = time.Second

lotusHost, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/5555")
require.NoError(t, err)
lotusToken := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.4KpuySIvV4n6kBEXQOle-hi1Ec3lyUmRYCknz4NQyLM"

cb, err := lotus.NewBuilder(lotusHost, lotusToken, 1)
cb, err := lotus.NewBuilder("127.0.0.1:5555", lotusToken, 1)
require.NoError(t, err)

mi, err := New(tests.NewTxMapDatastore(), cb, &p2pHostMock{}, &lrMock{}, false, false)
Expand Down
9 changes: 1 addition & 8 deletions lotus/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/lotus/api/apistruct"
logging "github.com/ipfs/go-log/v2"
ma "github.com/multiformats/go-multiaddr"

"github.com/textileio/powergate/v2/util"
)

var (
Expand All @@ -22,11 +19,7 @@ var (
type ClientBuilder func(ctx context.Context) (*apistruct.FullNodeStruct, func(), error)

// NewBuilder creates a new ClientBuilder.
func NewBuilder(maddr ma.Multiaddr, authToken string, connRetries int) (ClientBuilder, error) {
addr, err := util.TCPAddrFromMultiAddr(maddr)
if err != nil {
return nil, err
}
func NewBuilder(addr string, authToken string, connRetries int) (ClientBuilder, error) {
headers := http.Header{
"Authorization": []string{"Bearer " + authToken},
}
Expand Down
3 changes: 1 addition & 2 deletions tests/ldevnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/ory/dockertest/v3/docker"
"github.com/stretchr/testify/require"
"github.com/textileio/powergate/v2/lotus"
"github.com/textileio/powergate/v2/util"
)

// TestingTWithCleanup is an augmented require.TestingT with a Cleanup function.
Expand Down Expand Up @@ -75,7 +74,7 @@ func LaunchDevnetDocker(t TestingTWithCleanup, numMiners, speed int, ipfsMaddr s
// CreateLocalDevnetWithIPFS creates a local devnet connected to an IPFS node.
func CreateLocalDevnetWithIPFS(t TestingTWithCleanup, numMiners, speed int, ipfsMaddr string, mountVolumes bool) (lotus.ClientBuilder, address.Address, []address.Address) {
lotusDevnet := LaunchDevnetDocker(t, numMiners, speed, ipfsMaddr, mountVolumes)
cb, err := lotus.NewBuilder(util.MustParseAddr("/ip4/127.0.0.1/tcp/"+lotusDevnet.GetPort("7777/tcp")), "", 1)
cb, err := lotus.NewBuilder("127.0.0.1:"+lotusDevnet.GetPort("7777/tcp"), "", 1)
require.NoError(t, err)
ctx, cls := context.WithTimeout(context.Background(), time.Second*10)
defer cls()
Expand Down