Merge pull request #10382 from filecoin-project/feat/go-data-transfer-v2

Update to go-data-transfer v2 and libp2p, still wip
This commit is contained in:
Łukasz Magiera 2023-03-15 12:45:01 +01:00 committed by GitHub
commit b8589e8c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 1994 additions and 2353 deletions

View File

@ -7,12 +7,12 @@ executors:
golang:
docker:
# Must match GO_VERSION_MIN in project root
- image: cimg/go:1.18.8
- image: cimg/go:1.19.7
resource_class: medium+
golang-2xl:
docker:
# Must match GO_VERSION_MIN in project root
- image: cimg/go:1.18.8
- image: cimg/go:1.19.7
resource_class: 2xlarge
ubuntu:
docker:

View File

@ -7,12 +7,12 @@ executors:
golang:
docker:
# Must match GO_VERSION_MIN in project root
- image: cimg/go:1.18.8
- image: cimg/go:1.19.7
resource_class: medium+
golang-2xl:
docker:
# Must match GO_VERSION_MIN in project root
- image: cimg/go:1.18.8
- image: cimg/go:1.19.7
resource_class: 2xlarge
ubuntu:
docker:

View File

@ -1 +1 @@
1.18.8
1.19.7

View File

@ -13,7 +13,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-jsonrpc"

View File

@ -11,7 +11,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
@ -212,9 +212,11 @@ type StorageMiner interface {
StorageDetachLocal(ctx context.Context, path string) error //perm:admin
StorageRedeclareLocal(ctx context.Context, id *storiface.ID, dropMissing bool) error //perm:admin
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read
MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) //perm:read
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read
// MarketListRetrievalDeals is deprecated, returns empty list
MarketListRetrievalDeals(ctx context.Context) ([]struct{}, error) //perm:read
MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) //perm:read
MarketListIncompleteDeals(ctx context.Context) ([]storagemarket.MinerDeal, 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

View File

@ -50,22 +50,6 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.WaitSentinel (cid.Cid) (struct)
if len("WaitSentinel") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"WaitSentinel\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WaitSentinel"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("WaitSentinel")); err != nil {
return err
}
if err := cbg.WriteCid(cw, t.WaitSentinel); err != nil {
return xerrors.Errorf("failed to write cid field t.WaitSentinel: %w", err)
}
// t.Vouchers ([]*paych.SignedVoucher) (slice)
if len("Vouchers") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Vouchers\" was too long")
@ -90,6 +74,23 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
return err
}
}
// t.WaitSentinel (cid.Cid) (struct)
if len("WaitSentinel") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"WaitSentinel\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WaitSentinel"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("WaitSentinel")); err != nil {
return err
}
if err := cbg.WriteCid(cw, t.WaitSentinel); err != nil {
return xerrors.Errorf("failed to write cid field t.WaitSentinel: %w", err)
}
return nil
}
@ -140,19 +141,6 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) {
return xerrors.Errorf("unmarshaling t.Channel: %w", err)
}
}
// t.WaitSentinel (cid.Cid) (struct)
case "WaitSentinel":
{
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.WaitSentinel: %w", err)
}
t.WaitSentinel = c
}
// t.Vouchers ([]*paych.SignedVoucher) (slice)
case "Vouchers":
@ -184,6 +172,20 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) {
t.Vouchers[i] = &v
}
// t.WaitSentinel (cid.Cid) (struct)
case "WaitSentinel":
{
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.WaitSentinel: %w", err)
}
t.WaitSentinel = c
}
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
@ -204,19 +206,19 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
return err
}
// t.SectorID (abi.SectorNumber) (uint64)
if len("SectorID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"SectorID\" was too long")
// t.Size (abi.UnpaddedPieceSize) (uint64)
if len("Size") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Size\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorID"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Size"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("SectorID")); err != nil {
if _, err := io.WriteString(w, string("Size")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorID)); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil {
return err
}
@ -236,19 +238,19 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
return err
}
// t.Size (abi.UnpaddedPieceSize) (uint64)
if len("Size") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Size\" was too long")
// t.SectorID (abi.SectorNumber) (uint64)
if len("SectorID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"SectorID\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Size"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorID"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Size")); err != nil {
if _, err := io.WriteString(w, string("SectorID")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorID)); err != nil {
return err
}
@ -293,8 +295,8 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.SectorID (abi.SectorNumber) (uint64)
case "SectorID":
// t.Size (abi.UnpaddedPieceSize) (uint64)
case "Size":
{
@ -305,7 +307,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.SectorID = abi.SectorNumber(extra)
t.Size = abi.UnpaddedPieceSize(extra)
}
// t.Offset (abi.PaddedPieceSize) (uint64)
@ -323,8 +325,8 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
t.Offset = abi.PaddedPieceSize(extra)
}
// t.Size (abi.UnpaddedPieceSize) (uint64)
case "Size":
// t.SectorID (abi.SectorNumber) (uint64)
case "SectorID":
{
@ -335,7 +337,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.Size = abi.UnpaddedPieceSize(extra)
t.SectorID = abi.SectorNumber(extra)
}
@ -474,6 +476,28 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
if len("Epoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Epoch\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Epoch")); err != nil {
return err
}
if t.Epoch >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
return err
}
}
// t.Value (abi.SealRandomness) (slice)
if len("Value") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Value\" was too long")
@ -497,28 +521,6 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
if _, err := cw.Write(t.Value[:]); err != nil {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
if len("Epoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Epoch\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Epoch")); err != nil {
return err
}
if t.Epoch >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
return err
}
}
return nil
}
@ -560,7 +562,33 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.Value (abi.SealRandomness) (slice)
// t.Epoch (abi.ChainEpoch) (int64)
case "Epoch":
{
maj, extra, err := cr.ReadHeader()
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.Epoch = abi.ChainEpoch(extraI)
}
// t.Value (abi.SealRandomness) (slice)
case "Value":
maj, extra, err = cr.ReadHeader()
@ -582,32 +610,6 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) {
if _, err := io.ReadFull(cr, t.Value[:]); err != nil {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
case "Epoch":
{
maj, extra, err := cr.ReadHeader()
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.Epoch = abi.ChainEpoch(extraI)
}
default:
// Field doesn't exist on this type, so ignore it
@ -629,6 +631,28 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
if len("Epoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Epoch\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Epoch")); err != nil {
return err
}
if t.Epoch >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
return err
}
}
// t.Value (abi.InteractiveSealRandomness) (slice)
if len("Value") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Value\" was too long")
@ -652,28 +676,6 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
if _, err := cw.Write(t.Value[:]); err != nil {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
if len("Epoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Epoch\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Epoch")); err != nil {
return err
}
if t.Epoch >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
return err
}
}
return nil
}
@ -715,7 +717,33 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.Value (abi.InteractiveSealRandomness) (slice)
// t.Epoch (abi.ChainEpoch) (int64)
case "Epoch":
{
maj, extra, err := cr.ReadHeader()
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.Epoch = abi.ChainEpoch(extraI)
}
// t.Value (abi.InteractiveSealRandomness) (slice)
case "Value":
maj, extra, err = cr.ReadHeader()
@ -737,32 +765,6 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) {
if _, err := io.ReadFull(cr, t.Value[:]); err != nil {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
case "Epoch":
{
maj, extra, err := cr.ReadHeader()
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.Epoch = abi.ChainEpoch(extraI)
}
default:
// Field doesn't exist on this type, so ignore it
@ -784,6 +786,22 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.DealID (abi.DealID) (uint64)
if len("DealID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"DealID\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealID"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("DealID")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.DealID)); err != nil {
return err
}
// t.PublishCid (cid.Cid) (struct)
if len("PublishCid") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"PublishCid\" was too long")
@ -806,22 +824,6 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
}
}
// t.DealID (abi.DealID) (uint64)
if len("DealID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"DealID\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealID"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("DealID")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.DealID)); err != nil {
return err
}
// t.DealProposal (market.DealProposal) (struct)
if len("DealProposal") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"DealProposal\" was too long")
@ -910,7 +912,22 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.PublishCid (cid.Cid) (struct)
// t.DealID (abi.DealID) (uint64)
case "DealID":
{
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.DealID = abi.DealID(extra)
}
// t.PublishCid (cid.Cid) (struct)
case "PublishCid":
{
@ -932,21 +949,6 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) {
t.PublishCid = &c
}
}
// t.DealID (abi.DealID) (uint64)
case "DealID":
{
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.DealID = abi.DealID(extra)
}
// t.DealProposal (market.DealProposal) (struct)
case "DealProposal":
@ -1140,28 +1142,6 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error {
return err
}
// t.StartEpoch (abi.ChainEpoch) (int64)
if len("StartEpoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"StartEpoch\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartEpoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("StartEpoch")); err != nil {
return err
}
if t.StartEpoch >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartEpoch)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartEpoch-1)); err != nil {
return err
}
}
// t.EndEpoch (abi.ChainEpoch) (int64)
if len("EndEpoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"EndEpoch\" was too long")
@ -1183,6 +1163,28 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error {
return err
}
}
// t.StartEpoch (abi.ChainEpoch) (int64)
if len("StartEpoch") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"StartEpoch\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartEpoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("StartEpoch")); err != nil {
return err
}
if t.StartEpoch >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartEpoch)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartEpoch-1)); err != nil {
return err
}
}
return nil
}
@ -1224,33 +1226,7 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.StartEpoch (abi.ChainEpoch) (int64)
case "StartEpoch":
{
maj, extra, err := cr.ReadHeader()
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.StartEpoch = abi.ChainEpoch(extraI)
}
// t.EndEpoch (abi.ChainEpoch) (int64)
// t.EndEpoch (abi.ChainEpoch) (int64)
case "EndEpoch":
{
maj, extra, err := cr.ReadHeader()
@ -1267,7 +1243,7 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -1276,6 +1252,32 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) {
t.EndEpoch = abi.ChainEpoch(extraI)
}
// t.StartEpoch (abi.ChainEpoch) (int64)
case "StartEpoch":
{
maj, extra, err := cr.ReadHeader()
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.StartEpoch = abi.ChainEpoch(extraI)
}
default:
// Field doesn't exist on this type, so ignore it

View File

@ -27,7 +27,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/filestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-jsonrpc/auth"

View File

@ -21,7 +21,7 @@ import (
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
retrievalmarket "github.com/filecoin-project/go-fil-markets/retrievalmarket"
jsonrpc "github.com/filecoin-project/go-jsonrpc"
auth "github.com/filecoin-project/go-jsonrpc/auth"

View File

@ -18,7 +18,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
@ -953,7 +953,7 @@ type StorageMinerMethods struct {
MarketListIncompleteDeals func(p0 context.Context) ([]storagemarket.MinerDeal, error) `perm:"read"`
MarketListRetrievalDeals func(p0 context.Context) ([]retrievalmarket.ProviderDealState, error) `perm:"read"`
MarketListRetrievalDeals func(p0 context.Context) ([]struct{}, error) `perm:"read"`
MarketPendingDeals func(p0 context.Context) (PendingDealInfo, error) `perm:"write"`
@ -5684,15 +5684,15 @@ func (s *StorageMinerStub) MarketListIncompleteDeals(p0 context.Context) ([]stor
return *new([]storagemarket.MinerDeal), ErrNotSupported
}
func (s *StorageMinerStruct) MarketListRetrievalDeals(p0 context.Context) ([]retrievalmarket.ProviderDealState, error) {
func (s *StorageMinerStruct) MarketListRetrievalDeals(p0 context.Context) ([]struct{}, error) {
if s.Internal.MarketListRetrievalDeals == nil {
return *new([]retrievalmarket.ProviderDealState), ErrNotSupported
return *new([]struct{}), ErrNotSupported
}
return s.Internal.MarketListRetrievalDeals(p0)
}
func (s *StorageMinerStub) MarketListRetrievalDeals(p0 context.Context) ([]retrievalmarket.ProviderDealState, error) {
return *new([]retrievalmarket.ProviderDealState), ErrNotSupported
func (s *StorageMinerStub) MarketListRetrievalDeals(p0 context.Context) ([]struct{}, error) {
return *new([]struct{}), ErrNotSupported
}
func (s *StorageMinerStruct) MarketPendingDeals(p0 context.Context) (PendingDealInfo, error) {

View File

@ -8,13 +8,15 @@ import (
"github.com/google/uuid"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-graphsync"
"github.com/ipld/go-ipld-prime"
"github.com/ipld/go-ipld-prime/codec/dagjson"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr"
"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
@ -110,16 +112,12 @@ func NewDataTransferChannel(hostID peer.ID, channelState datatransfer.ChannelSta
IsSender: channelState.Sender() == hostID,
Message: channelState.Message(),
}
stringer, ok := channelState.Voucher().(fmt.Stringer)
if ok {
channel.Voucher = stringer.String()
voucher := channelState.Voucher()
voucherJSON, err := ipld.Encode(voucher.Voucher, dagjson.Encode)
if err != nil {
channel.Voucher = fmt.Errorf("Voucher Serialization: %w", err).Error()
} else {
voucherJSON, err := json.Marshal(channelState.Voucher())
if err != nil {
channel.Voucher = fmt.Errorf("Voucher Serialization: %w", err).Error()
} else {
channel.Voucher = string(voucherJSON)
}
channel.Voucher = string(voucherJSON)
}
if channel.IsSender {
channel.IsInitiator = !channelState.IsPull()

View File

@ -10,7 +10,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"

View File

@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"

View File

@ -20,7 +20,7 @@ import (
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
retrievalmarket "github.com/filecoin-project/go-fil-markets/retrievalmarket"
storagemarket "github.com/filecoin-project/go-fil-markets/storagemarket"
auth "github.com/filecoin-project/go-jsonrpc/auth"

Binary file not shown.

View File

@ -8,14 +8,14 @@ import (
dchain "github.com/drand/drand/chain"
dclient "github.com/drand/drand/client"
hclient "github.com/drand/drand/client/http"
"github.com/drand/drand/common/scheme"
dlog "github.com/drand/drand/log"
gclient "github.com/drand/drand/lp2p/client"
"github.com/drand/kyber"
kzap "github.com/go-kit/kit/log/zap"
lru "github.com/hashicorp/golang-lru/v2"
logging "github.com/ipfs/go-log/v2"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"go.uber.org/zap/zapcore"
"go.uber.org/zap"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi"
@ -69,6 +69,18 @@ type DrandHTTPClient interface {
SetUserAgent(string)
}
type logger struct {
*zap.SugaredLogger
}
func (l *logger) With(args ...interface{}) dlog.Logger {
return &logger{l.SugaredLogger.With(args...)}
}
func (l *logger) Named(s string) dlog.Logger {
return &logger{l.SugaredLogger.Named(s)}
}
func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes.DrandConfig) (*DrandBeacon, error) {
if genesisTs == 0 {
panic("what are you doing this cant be zero")
@ -79,9 +91,6 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes
return nil, xerrors.Errorf("unable to unmarshal drand chain info: %w", err)
}
dlogger := dlog.NewKitLoggerFrom(kzap.NewZapSugarLogger(
log.SugaredLogger.Desugar(), zapcore.InfoLevel))
var clients []dclient.Client
for _, url := range config.Servers {
hc, err := hclient.NewWithInfo(url, drandChain, nil)
@ -96,7 +105,7 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes
opts := []dclient.Option{
dclient.WithChainInfo(drandChain),
dclient.WithCacheSize(1024),
dclient.WithLogger(dlogger),
dclient.WithLogger(&logger{&log.SugaredLogger}),
}
if ps != nil {
@ -190,7 +199,7 @@ func (db *DrandBeacon) VerifyEntry(curr types.BeaconEntry, prev types.BeaconEntr
Round: curr.Round,
Signature: curr.Data,
}
err := dchain.VerifyBeacon(db.pubkey, b)
err := dchain.NewVerifier(scheme.GetSchemeFromEnv()).VerifyBeacon(*b, db.pubkey)
if err == nil {
db.cacheValue(curr)
}

View File

@ -3,6 +3,7 @@
package drand
import (
"context"
"os"
"testing"
@ -20,11 +21,11 @@ func TestPrintGroupInfo(t *testing.T) {
c, err := hclient.New(server, nil, nil)
assert.NoError(t, err)
cg := c.(interface {
FetchChainInfo(groupHash []byte) (*dchain.Info, error)
FetchChainInfo(ctx context.Context, groupHash []byte) (*dchain.Info, error)
})
chain, err := cg.FetchChainInfo(nil)
chain, err := cg.FetchChainInfo(context.Background(), nil)
assert.NoError(t, err)
err = chain.ToJSON(os.Stdout)
err = chain.ToJSON(os.Stdout, nil)
assert.NoError(t, err)
}

View File

@ -12,6 +12,7 @@ import (
"github.com/ipfs/go-cid"
blocks "github.com/ipfs/go-libipfs/blocks"
logging "github.com/ipfs/go-log/v2"
"github.com/ipni/storetheindex/announce/message"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/connmgr"
"github.com/libp2p/go-libp2p/core/peer"
@ -20,7 +21,6 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-legs/dtsync"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain"
@ -495,7 +495,7 @@ func (v *IndexerMessageValidator) Validate(ctx context.Context, pid peer.ID, msg
return pubsub.ValidationIgnore
}
idxrMsg := dtsync.Message{}
idxrMsg := message.Message{}
err := idxrMsg.UnmarshalCBOR(bytes.NewBuffer(msg.Data))
if err != nil {
log.Errorw("Could not decode indexer pubsub message", "err", err)

View File

@ -9,12 +9,12 @@ import (
"github.com/golang/mock/gomock"
"github.com/ipfs/go-cid"
blocks "github.com/ipfs/go-libipfs/blocks"
"github.com/ipni/storetheindex/announce/message"
pubsub "github.com/libp2p/go-libp2p-pubsub"
pb "github.com/libp2p/go-libp2p-pubsub/pb"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-legs/dtsync"
"github.com/filecoin-project/lotus/api/mocks"
"github.com/filecoin-project/lotus/chain/types"
@ -105,7 +105,7 @@ func TestIndexerMessageValidator_Validate(t *testing.T) {
mc := gomock.NewController(t)
node := mocks.NewMockFullNode(mc)
subject := NewIndexerMessageValidator(peer.ID(tc.selfPID), node, node)
message := dtsync.Message{
message := message.Message{
Cid: validCid,
Addrs: nil,
ExtraData: tc.extraData,

View File

@ -340,7 +340,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -618,7 +618,7 @@ func (t *ElectionProof) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -828,7 +828,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -1591,7 +1591,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -2202,7 +2202,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -2227,7 +2227,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -2252,7 +2252,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -2277,7 +2277,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -2534,7 +2534,7 @@ func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:

View File

@ -31,7 +31,7 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"

View File

@ -150,11 +150,6 @@ var infoAllCmd = &cli.Command{
}
}
fmt.Println("\n#: Retrieval Deals")
if err := retrievalDealsListCmd.Action(cctx); err != nil {
fmt.Println("ERROR: ", err)
}
fmt.Println("\n#: Data Transfers")
{
fs := &flag.FlagSet{}

View File

@ -24,7 +24,7 @@ import (
"golang.org/x/xerrors"
cborutil "github.com/filecoin-project/go-cbor-util"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"

View File

@ -3,13 +3,11 @@ package main
import (
"fmt"
"os"
"sort"
"text/tabwriter"
"github.com/docker/go-units"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types"
@ -21,7 +19,6 @@ var retrievalDealsCmd = &cli.Command{
Usage: "Manage retrieval deals and related configuration",
Subcommands: []*cli.Command{
retrievalDealSelectionCmd,
retrievalDealsListCmd,
retrievalSetAskCmd,
retrievalGetAskCmd,
},
@ -124,48 +121,6 @@ var retrievalDealSelectionRejectCmd = &cli.Command{
},
}
var retrievalDealsListCmd = &cli.Command{
Name: "list",
Usage: "List all active retrieval deals for this miner",
Action: func(cctx *cli.Context) error {
api, closer, err := lcli.GetMarketsAPI(cctx)
if err != nil {
return err
}
defer closer()
deals, err := api.MarketListRetrievalDeals(lcli.DaemonContext(cctx))
if err != nil {
return err
}
sort.Slice(deals, func(i, j int) bool {
return deals[i].ID < deals[j].ID
})
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "Receiver\tDealID\tPayload\tState\tPricePerByte\tBytesSent\tMessage\n")
for _, deal := range deals {
payloadCid := deal.PayloadCID.String()
_, _ = fmt.Fprintf(w,
"%s\t%d\t%s\t%s\t%s\t%d\t%s\n",
deal.Receiver.String(),
deal.ID,
"..."+payloadCid[len(payloadCid)-8:],
retrievalmarket.DealStatuses[deal.Status],
deal.PricePerByte.String(),
deal.TotalSent,
deal.Message,
)
}
return w.Flush()
},
}
var retrievalSetAskCmd = &cli.Command{
Name: "set-ask",
Usage: "Configure the provider's retrieval ask",

View File

@ -223,7 +223,7 @@ func (t *CallerValidationArgs) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -712,7 +712,7 @@ func (t *SendReturn) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -812,7 +812,7 @@ func (t *MutateStateArgs) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -907,7 +907,7 @@ func (t *AbortWithArgs) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -1064,7 +1064,7 @@ func (t *InspectRuntimeReturn) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:

View File

@ -1506,6 +1506,7 @@ Response:
```
### MarketListRetrievalDeals
MarketListRetrievalDeals is deprecated, returns empty list
Perms: read
@ -1515,48 +1516,7 @@ Inputs: `null`
Response:
```json
[
{
"PayloadCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"ID": 5,
"Selector": {
"Raw": "Ynl0ZSBhcnJheQ=="
},
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PricePerByte": "0",
"PaymentInterval": 42,
"PaymentIntervalIncrease": 42,
"UnsealPrice": "0",
"StoreID": 42,
"ChannelID": {
"Initiator": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"Responder": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"ID": 3
},
"PieceInfo": {
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Deals": [
{
"DealID": 5432,
"SectorID": 9,
"Offset": 1032,
"Length": 1032
}
]
},
"Status": 0,
"Receiver": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"TotalSent": 42,
"FundsReceived": "0",
"Message": "string value",
"CurrentInterval": 42,
"LegacyProtocol": true
}
{}
]
```

View File

@ -839,7 +839,6 @@ USAGE:
COMMANDS:
selection Configure acceptance criteria for retrieval deal proposals
list List all active retrieval deals for this miner
set-ask Configure the provider's retrieval ask
get-ask Get the provider's current retrieval ask configured by the provider in the ask-store using the set-ask CLI command
help, h Shows a list of commands or help for one command
@ -908,19 +907,6 @@ OPTIONS:
```
### lotus-miner retrieval-deals list
```
NAME:
lotus-miner retrieval-deals list - List all active retrieval deals for this miner
USAGE:
lotus-miner retrieval-deals list [command options] [arguments...]
OPTIONS:
--help, -h show help (default: false)
```
### lotus-miner retrieval-deals set-ask
```
NAME:

172
go.mod
View File

@ -14,14 +14,14 @@ require (
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/alecthomas/jsonschema v0.0.0-20200530073317-71f438968921
github.com/buger/goterm v1.0.3
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/chzyer/readline v1.5.0
github.com/containerd/cgroups v1.0.4
github.com/coreos/go-systemd/v22 v22.4.0
github.com/coreos/go-systemd/v22 v22.5.0
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e
github.com/dgraph-io/badger/v2 v2.2007.3
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/docker/go-units v0.5.0
github.com/drand/drand v1.3.0
github.com/drand/kyber v1.1.7
github.com/drand/drand v1.4.9
github.com/drand/kyber v1.1.15
github.com/dustin/go-humanize v1.0.0
github.com/elastic/go-elasticsearch/v7 v7.14.0
github.com/elastic/go-sysinfo v1.7.0
@ -36,16 +36,15 @@ require (
github.com/filecoin-project/go-cbor-util v0.0.1
github.com/filecoin-project/go-commp-utils v0.1.3
github.com/filecoin-project/go-crypto v0.0.1
github.com/filecoin-project/go-data-transfer v1.15.2
github.com/filecoin-project/go-data-transfer/v2 v2.0.0-rc4
github.com/filecoin-project/go-fil-commcid v0.1.0
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
github.com/filecoin-project/go-fil-markets v1.26.0
github.com/filecoin-project/go-fil-markets v1.27.0-rc1
github.com/filecoin-project/go-jsonrpc v0.2.2
github.com/filecoin-project/go-legs v0.4.4
github.com/filecoin-project/go-padreader v0.0.1
github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.10.0
github.com/filecoin-project/go-statemachine v1.0.2
github.com/filecoin-project/go-statemachine v1.0.3
github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/go-storedcounter v0.1.0
github.com/filecoin-project/pubsub v1.0.0
@ -60,7 +59,6 @@ require (
github.com/filecoin-project/test-vectors/schema v0.0.5
github.com/gbrlsnchs/jwt/v3 v3.0.1
github.com/gdamore/tcell/v2 v2.2.0
github.com/go-kit/kit v0.12.0
github.com/go-openapi/spec v0.19.11
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
@ -69,62 +67,63 @@ require (
github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e
github.com/hashicorp/go-hclog v1.3.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru/v2 v2.0.2
github.com/hashicorp/raft v1.1.1
github.com/hashicorp/raft v1.3.10
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea
github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
github.com/ipfs/bbloom v0.0.4
github.com/ipfs/go-blockservice v0.4.0
github.com/ipfs/go-blockservice v0.5.0
github.com/ipfs/go-cid v0.3.2
github.com/ipfs/go-cidutil v0.1.0
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ds-badger2 v0.1.2
github.com/ipfs/go-ds-badger2 v0.1.3
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/ipfs/go-ds-measure v0.2.0
github.com/ipfs/go-fs-lock v0.0.7
github.com/ipfs/go-graphsync v0.13.2
github.com/ipfs/go-graphsync v0.14.3
github.com/ipfs/go-ipfs-blockstore v1.2.0
github.com/ipfs/go-ipfs-blocksutil v0.0.1
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-ds-help v1.1.0
github.com/ipfs/go-ipfs-exchange-interface v0.2.0
github.com/ipfs/go-ipfs-exchange-offline v0.3.0
github.com/ipfs/go-ipfs-files v0.1.1
github.com/ipfs/go-ipfs-http-client v0.4.0
github.com/ipfs/go-ipfs-http-client v0.5.0
github.com/ipfs/go-ipfs-routing v0.3.0
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-cbor v0.0.6
github.com/ipfs/go-ipld-format v0.4.0
github.com/ipfs/go-libipfs v0.4.1
github.com/ipfs/go-libipfs v0.5.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-merkledag v0.8.1
github.com/ipfs/go-merkledag v0.9.0
github.com/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-metrics-prometheus v0.0.2
github.com/ipfs/go-unixfs v0.4.0
github.com/ipfs/go-unixfsnode v1.4.0
github.com/ipfs/interface-go-ipfs-core v0.7.0
github.com/ipld/go-car v0.4.0
github.com/ipld/go-car/v2 v2.5.0
github.com/ipfs/go-unixfs v0.4.3
github.com/ipfs/go-unixfsnode v1.5.2
github.com/ipfs/interface-go-ipfs-core v0.11.1
github.com/ipld/go-car v0.5.0
github.com/ipld/go-car/v2 v2.7.0
github.com/ipld/go-codec-dagpb v1.5.0
github.com/ipld/go-ipld-prime v0.20.0
github.com/ipld/go-ipld-selector-text-lite v0.0.1
github.com/ipni/index-provider v0.10.0
github.com/ipni/index-provider v0.11.0
github.com/ipni/storetheindex v0.5.10
github.com/kelseyhightower/envconfig v1.4.0
github.com/koalacxr/quantile v0.0.1
github.com/libp2p/go-buffer-pool v0.1.0
github.com/libp2p/go-libp2p v0.23.4
github.com/libp2p/go-libp2p v0.26.2
github.com/libp2p/go-libp2p-consensus v0.0.1
github.com/libp2p/go-libp2p-gorpc v0.4.0
github.com/libp2p/go-libp2p-kad-dht v0.18.0
github.com/libp2p/go-libp2p-pubsub v0.8.2
github.com/libp2p/go-libp2p-raft v0.1.8
github.com/libp2p/go-libp2p-gorpc v0.5.0
github.com/libp2p/go-libp2p-kad-dht v0.21.0
github.com/libp2p/go-libp2p-pubsub v0.9.2
github.com/libp2p/go-libp2p-raft v0.4.0
github.com/libp2p/go-libp2p-record v0.2.0
github.com/libp2p/go-libp2p-routing-helpers v0.2.3
github.com/libp2p/go-libp2p-routing-helpers v0.4.0
github.com/libp2p/go-maddr-filter v0.1.0
github.com/libp2p/go-msgio v0.2.0
github.com/mattn/go-isatty v0.0.16
github.com/libp2p/go-msgio v0.3.0
github.com/mattn/go-isatty v0.0.17
github.com/mattn/go-sqlite3 v1.14.16
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/mitchellh/go-homedir v1.1.0
@ -133,37 +132,37 @@ require (
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/multiformats/go-multibase v0.1.1
github.com/multiformats/go-multihash v0.2.1
github.com/multiformats/go-varint v0.0.6
github.com/multiformats/go-varint v0.0.7
github.com/open-rpc/meta-schema v0.0.0-20201029221707-1b72ef2ea333
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e
github.com/prometheus/client_golang v1.13.0
github.com/polydawn/refmt v0.89.0
github.com/prometheus/client_golang v1.14.0
github.com/raulk/clock v1.1.0
github.com/raulk/go-watchdog v1.3.0
github.com/stretchr/testify v1.8.1
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/urfave/cli/v2 v2.16.3
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
github.com/whyrusleeping/cbor-gen v0.0.0-20221021053955-c138aae13722
github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa
github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/xeipuuv/gojsonschema v1.2.0
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542
go.opencensus.io v0.23.0
go.opentelemetry.io/otel v1.11.1
go.opencensus.io v0.24.0
go.opentelemetry.io/otel v1.12.0
go.opentelemetry.io/otel/bridge/opencensus v0.33.0
go.opentelemetry.io/otel/exporters/jaeger v1.2.0
go.opentelemetry.io/otel/sdk v1.11.1
go.uber.org/atomic v1.10.0
go.uber.org/fx v1.15.0
go.uber.org/multierr v1.8.0
go.uber.org/zap v1.23.0
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5
golang.org/x/sync v0.0.0-20220907140024-f12130a52804
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8
go.uber.org/fx v1.18.2
go.uber.org/multierr v1.9.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.5.0
golang.org/x/exp v0.0.0-20230129154200-a960b3787bd2
golang.org/x/net v0.7.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.5.0
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9
golang.org/x/tools v0.1.12
golang.org/x/tools v0.3.0
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
gopkg.in/cheggaaa/pb.v1 v1.0.28
gotest.tools v2.2.0+incompatible
@ -174,7 +173,6 @@ require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/Stebalien/go-bitfield v0.0.1 // indirect
github.com/akavel/rsrc v0.8.0 // indirect
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
github.com/armon/go-metrics v0.3.9 // indirect
@ -183,7 +181,7 @@ require (
github.com/bep/debounce v1.2.1 // indirect
github.com/boltdb/bolt v1.3.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cilium/ebpf v0.4.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
@ -193,8 +191,8 @@ require (
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/drand/kyber-bls12381 v0.2.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/drand/kyber-bls12381 v0.2.3 // indirect
github.com/elastic/go-windows v1.0.0 // indirect
github.com/etclabscore/go-jsonschema-walk v0.0.6 // indirect
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0 // indirect
@ -206,9 +204,8 @@ require (
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 // indirect
github.com/flynn/noise v1.0.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/go-kit/log v0.2.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.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
@ -225,20 +222,20 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1 // indirect
github.com/google/pprof v0.0.0-20221203041831-ce31453925ec // indirect
github.com/hannahhoward/cbor-gen-for v0.0.0-20230214144701-5d17c9d5243c // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v0.16.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/golang-lru v0.6.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/iancoleman/orderedmap v0.1.0 // indirect
github.com/ipfs/go-bitfield v1.0.0 // indirect
github.com/ipfs/go-bitfield v1.1.0 // indirect
github.com/ipfs/go-block-format v0.1.1 // indirect
github.com/ipfs/go-filestore v1.2.0 // indirect
github.com/ipfs/go-ipfs-cmds v0.7.0 // indirect
github.com/ipfs/go-ipfs-config v0.18.0 // indirect
github.com/ipfs/go-ipfs-cmds v0.8.2 // indirect
github.com/ipfs/go-ipfs-delay v0.0.1 // indirect
github.com/ipfs/go-ipfs-files v0.3.0 // indirect
github.com/ipfs/go-ipfs-posinfo v0.0.1 // indirect
github.com/ipfs/go-ipfs-pq v0.0.3 // indirect
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
@ -248,7 +245,6 @@ require (
github.com/ipfs/go-peertaskqueue v0.8.1 // indirect
github.com/ipfs/go-verifcid v0.0.2 // indirect
github.com/ipld/go-ipld-adl-hamt v0.0.0-20220616142416-9004dbd839e0 // indirect
github.com/ipni/storetheindex v0.5.3-0.20221203123030-16745cb63f15 // indirect
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c // indirect
@ -256,78 +252,68 @@ require (
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jessevdk/go-flags v1.4.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/kilic/bls12-381 v0.0.0-20200820230200-6b2c19996391 // indirect
github.com/klauspost/compress v1.15.10 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/klauspost/compress v1.15.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
github.com/koron/go-ssdp v0.0.3 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
github.com/libp2p/go-libp2p-connmgr v0.4.0 // indirect
github.com/libp2p/go-libp2p-core v0.20.1 // indirect
github.com/libp2p/go-libp2p-gostream v0.5.0 // indirect
github.com/libp2p/go-libp2p-gostream v0.6.0 // indirect
github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect
github.com/libp2p/go-libp2p-noise v0.5.0 // indirect
github.com/libp2p/go-libp2p-peerstore v0.8.0 // indirect
github.com/libp2p/go-libp2p-tls v0.5.0 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-netroute v0.2.0 // indirect
github.com/libp2p/go-openssl v0.1.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-reuseport v0.2.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.0 // indirect
github.com/lucas-clemente/quic-go v0.29.1 // indirect
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
github.com/magefile/mage v1.9.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.50 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multicodec v0.8.0 // indirect
github.com/multiformats/go-multistream v0.3.3 // indirect
github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/nikkolasg/hexjson v0.1.0 // indirect
github.com/nkovacs/streamquote v1.0.0 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/ginkgo/v2 v2.5.1 // indirect
github.com/opencontainers/runtime-spec v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.2.1 // indirect
github.com/quic-go/qtls-go1-20 v0.1.1 // indirect
github.com/quic-go/quic-go v0.33.0 // indirect
github.com/quic-go/webtransport-go v0.5.2 // indirect
github.com/rivo/uniseg v0.1.0 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shirou/gopsutil v2.18.12+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/twmb/murmur3 v1.1.6 // indirect
github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.0.1 // indirect
github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
@ -335,20 +321,20 @@ require (
github.com/zondax/ledger-go v0.12.1 // indirect
go.opentelemetry.io/otel/metric v0.33.0 // indirect
go.opentelemetry.io/otel/sdk/metric v0.33.0 // indirect
go.opentelemetry.io/otel/trace v1.11.1 // indirect
go.uber.org/dig v1.12.0 // indirect
go.opentelemetry.io/otel/trace v1.12.0 // indirect
go.uber.org/dig v1.15.0 // indirect
go4.org v0.0.0-20200411211856-f5505b9728dd // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
lukechampine.com/blake3 v1.1.7 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi

702
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ import (
provider "github.com/ipni/index-provider"
"github.com/stretchr/testify/require"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/shared_testutil"
"github.com/filecoin-project/go-state-types/abi"

View File

@ -10,8 +10,8 @@ import (
"time"
"github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
ipld "github.com/ipfs/go-ipld-format"
"github.com/ipfs/go-libipfs/files"
dag "github.com/ipfs/go-merkledag"
dstest "github.com/ipfs/go-merkledag/test"
unixfile "github.com/ipfs/go-unixfs/file"

View File

@ -17,8 +17,8 @@ import (
bstore "github.com/ipfs/go-ipfs-blockstore"
chunk "github.com/ipfs/go-ipfs-chunker"
offline "github.com/ipfs/go-ipfs-exchange-offline"
files "github.com/ipfs/go-ipfs-files"
ipldformat "github.com/ipfs/go-ipld-format"
"github.com/ipfs/go-libipfs/files"
"github.com/ipfs/go-merkledag"
"github.com/ipfs/go-unixfs/importer/balanced"
ihelper "github.com/ipfs/go-unixfs/importer/helpers"

View File

@ -21,7 +21,7 @@ func TestNetConn(t *testing.T) {
firstNode, secondNode, _, _ := kit.EnsembleTwoOne(t)
//stm: @NETWORK_COMMON_ID_001
// stm: @NETWORK_COMMON_ID_001
secondNodeID, err := secondNode.ID(ctx)
require.NoError(t, err)
@ -31,21 +31,21 @@ func TestNetConn(t *testing.T) {
t.Errorf("node should be not connected to peers. %s", err.Error())
}
//stm: @NETWORK_COMMON_ADDRS_LISTEN_001
// stm: @NETWORK_COMMON_ADDRS_LISTEN_001
addrInfo, err := secondNode.NetAddrsListen(ctx)
require.NoError(t, err)
//stm: @NETWORK_COMMON_CONNECT_001
// stm: @NETWORK_COMMON_CONNECT_001
err = firstNode.NetConnect(ctx, addrInfo)
if err != nil {
t.Errorf("nodes failed to connect. %s", err.Error())
}
//stm: @NETWORK_COMMON_PEER_INFO_001
// stm: @NETWORK_COMMON_PEER_INFO_001
netPeerInfo, err := firstNode.NetPeerInfo(ctx, secondNodeID)
require.NoError(t, err)
//stm: @NETWORK_COMMON_AGENT_VERSION_001
// stm: @NETWORK_COMMON_AGENT_VERSION_001
agent, err := firstNode.NetAgentVersion(ctx, secondNodeID)
require.NoError(t, err)
@ -53,7 +53,7 @@ func TestNetConn(t *testing.T) {
t.Errorf("agents not matching. %s", err.Error())
}
//stm: @NETWORK_COMMON_FIND_PEER_001
// stm: @NETWORK_COMMON_FIND_PEER_001
secondNodePeer, err := firstNode.NetFindPeer(ctx, secondNodeID)
require.NoError(t, err)
@ -67,12 +67,12 @@ func TestNetConn(t *testing.T) {
t.Errorf("peer does not have connected state")
}
//stm: @NETWORK_COMMON_PEERS_001
// stm: @NETWORK_COMMON_PEERS_001
addrs, err := firstNode.NetPeers(ctx)
require.NoError(t, err)
require.NotEqual(t, 0, len(addrs))
//stm: @NETWORK_COMMON_DISCONNECT_001
// stm: @NETWORK_COMMON_DISCONNECT_001
err = firstNode.NetDisconnect(ctx, secondNodeID)
if err != nil {
t.Errorf("nodes failed to disconnect. %s", err.Error())
@ -84,7 +84,7 @@ func TestNetConn(t *testing.T) {
t.Errorf("peer should have disconnected")
}
//stm: @NETWORK_COMMON_PEERS_001
// stm: @NETWORK_COMMON_PEERS_001
addrs, err = firstNode.NetPeers(ctx)
require.NoError(t, err)
@ -120,13 +120,13 @@ func TestNetStat(t *testing.T) {
}
}
//stm: @NETWORK_COMMON_STAT_001
// stm: @NETWORK_COMMON_STAT_001
t.Run("all", withScope(t, "all"))
//stm: @NETWORK_COMMON_STAT_002
// stm: @NETWORK_COMMON_STAT_002
t.Run("system", withScope(t, "system"))
//stm: @NETWORK_COMMON_STAT_003
// stm: @NETWORK_COMMON_STAT_003
t.Run("transient", withScope(t, "transient"))
//stm: @NETWORK_COMMON_STAT_004
// stm: @NETWORK_COMMON_STAT_004
t.Run("peer", withScope(t, fmt.Sprintf("peer:%s", sId)))
}
@ -145,11 +145,11 @@ func TestNetLimit(t *testing.T) {
}
}
//stm: @NETWORK_COMMON_LIMIT_001
// stm: @NETWORK_COMMON_LIMIT_001
t.Run("system", withScope(t, "system"))
//stm: @NETWORK_COMMON_LIMIT_002
// stm: @NETWORK_COMMON_LIMIT_002
t.Run("transient", withScope(t, "transient"))
//stm: @NETWORK_COMMON_LIMIT_003
// stm: @NETWORK_COMMON_LIMIT_003
t.Run("peer", withScope(t, fmt.Sprintf("peer:%s", sId)))
}
@ -158,7 +158,7 @@ func TestNetBlockPeer(t *testing.T) {
firstNode, secondNode, _, _ := kit.EnsembleTwoOne(t)
//stm: @NETWORK_COMMON_ID_001
// stm: @NETWORK_COMMON_ID_001
firstAddrInfo, _ := firstNode.NetAddrsListen(ctx)
firstNodeID, err := firstNode.ID(ctx)
require.NoError(t, err)
@ -170,11 +170,11 @@ func TestNetBlockPeer(t *testing.T) {
require.NoError(t, err, "failed to determine connectedness")
require.NotEqual(t, connectedness, network.Connected, "shouldn't already be connected")
//stm: @NETWORK_COMMON_BLOCK_ADD_001
// stm: @NETWORK_COMMON_BLOCK_ADD_001
err = firstNode.NetBlockAdd(ctx, api.NetBlockList{Peers: []peer.ID{secondNodeID}})
require.NoError(t, err)
//stm: @NETWORK_COMMON_BLOCK_LIST_001
// stm: @NETWORK_COMMON_BLOCK_LIST_001
list, err := firstNode.NetBlockList(ctx)
require.NoError(t, err)
@ -182,16 +182,22 @@ func TestNetBlockPeer(t *testing.T) {
t.Errorf("blocked peer not in blocked peer list")
}
require.Error(t, secondNode.NetConnect(ctx, firstAddrInfo), "shouldn't be able to connect to second node")
connectedness, err = secondNode.NetConnectedness(ctx, firstAddrInfo.ID)
err = secondNode.NetConnect(ctx, firstAddrInfo)
// With early muxer selection, we'll only learn that the handshake failed
// when we do something with the connection, for example when we open a stream.
if err == nil {
_, err = secondNode.NetPing(context.Background(), firstAddrInfo.ID)
}
require.Error(t, err, "shouldn't be able to connect to second node")
connectedness, err = firstNode.NetConnectedness(ctx, secondNodeID)
require.NoError(t, err, "failed to determine connectedness")
require.NotEqual(t, connectedness, network.Connected)
//stm: @NETWORK_COMMON_BLOCK_REMOVE_001
// stm: @NETWORK_COMMON_BLOCK_REMOVE_001
err = firstNode.NetBlockRemove(ctx, api.NetBlockList{Peers: []peer.ID{secondNodeID}})
require.NoError(t, err)
//stm: @NETWORK_COMMON_BLOCK_LIST_001
// stm: @NETWORK_COMMON_BLOCK_LIST_001
list, err = firstNode.NetBlockList(ctx)
require.NoError(t, err)
@ -210,7 +216,7 @@ func TestNetBlockIPAddr(t *testing.T) {
firstNode, secondNode, _, _ := kit.EnsembleTwoOne(t)
//stm: @NETWORK_COMMON_ADDRS_LISTEN_001
// stm: @NETWORK_COMMON_ADDRS_LISTEN_001
firstAddrInfo, _ := firstNode.NetAddrsListen(ctx)
secondAddrInfo, _ := secondNode.NetAddrsListen(ctx)
@ -229,11 +235,11 @@ func TestNetBlockIPAddr(t *testing.T) {
require.NoError(t, err, "failed to determine connectedness")
require.NotEqual(t, connectedness, network.Connected, "shouldn't already be connected")
//stm: @NETWORK_COMMON_BLOCK_ADD_001
// stm: @NETWORK_COMMON_BLOCK_ADD_001
require.NoError(t, firstNode.NetBlockAdd(ctx, api.NetBlockList{
IPAddrs: secondNodeIPs}), "failed to add blocked IPs")
//stm: @NETWORK_COMMON_BLOCK_LIST_001
// stm: @NETWORK_COMMON_BLOCK_LIST_001
list, err := firstNode.NetBlockList(ctx)
require.NoError(t, err)
@ -255,11 +261,11 @@ func TestNetBlockIPAddr(t *testing.T) {
require.NoError(t, err, "failed to determine connectedness")
require.NotEqual(t, connectedness, network.Connected)
//stm: @NETWORK_COMMON_BLOCK_REMOVE_001
// stm: @NETWORK_COMMON_BLOCK_REMOVE_001
err = firstNode.NetBlockRemove(ctx, api.NetBlockList{IPAddrs: secondNodeIPs})
require.NoError(t, err)
//stm: @NETWORK_COMMON_BLOCK_LIST_001
// stm: @NETWORK_COMMON_BLOCK_LIST_001
list, err = firstNode.NetBlockList(ctx)
require.NoError(t, err)
@ -274,7 +280,7 @@ func TestNetBlockIPAddr(t *testing.T) {
}
func getConnState(ctx context.Context, t *testing.T, node *kit.TestFullNode, peer peer.ID) network.Connectedness {
//stm: @NETWORK_COMMON_CONNECTEDNESS_001
// stm: @NETWORK_COMMON_CONNECTEDNESS_001
connState, err := node.NetConnectedness(ctx, peer)
require.NoError(t, err)

View File

@ -8,6 +8,7 @@ import (
"path/filepath"
"time"
"github.com/hashicorp/go-hclog"
hraft "github.com/hashicorp/raft"
raftboltdb "github.com/hashicorp/raft-boltdb"
"github.com/ipfs/go-log/v2"
@ -156,7 +157,7 @@ func (rw *raftWrapper) makeStores() error {
snapstore, err := hraft.NewFileSnapshotStoreWithLogger(
df,
RaftMaxSnapshots,
zap.NewStdLog(log.Logger("raft-snapshot").SugaredLogger.Desugar()),
hclog.FromStandardLogger(zap.NewStdLog(log.Logger("raft-snapshot").SugaredLogger.Desugar()), hclog.DefaultOptions),
)
if err != nil {
return err

View File

@ -13,8 +13,8 @@ import (
bstore "github.com/ipfs/go-ipfs-blockstore"
chunker "github.com/ipfs/go-ipfs-chunker"
offline "github.com/ipfs/go-ipfs-exchange-offline"
files "github.com/ipfs/go-ipfs-files"
ipld "github.com/ipfs/go-ipld-format"
"github.com/ipfs/go-libipfs/files"
"github.com/ipfs/go-merkledag"
"github.com/ipfs/go-unixfs/importer/balanced"
ihelper "github.com/ipfs/go-unixfs/importer/helpers"

View File

@ -13,7 +13,7 @@ import (
"github.com/ipfs/go-blockservice"
"github.com/ipfs/go-cid"
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"
carv2 "github.com/ipld/go-car/v2"
@ -25,7 +25,7 @@ import (
// This test uses a full "dense" CARv2, and not a filestore (positional mapping).
func TestRoundtripUnixFS_Dense(t *testing.T) {
//stm: @CLIENT_DATA_IMPORT_002
// stm: @CLIENT_DATA_IMPORT_002
ctx := context.Background()
inputPath, inputContents := genInputFile(t)
@ -74,7 +74,7 @@ func TestRoundtripUnixFS_Dense(t *testing.T) {
}
func TestRoundtripUnixFS_Filestore(t *testing.T) {
//stm: @CLIENT_DATA_IMPORT_001
// stm: @CLIENT_DATA_IMPORT_001
ctx := context.Background()
inputPath, inputContents := genInputFile(t)

View File

@ -3,7 +3,7 @@ package marketevents
import (
logging "github.com/ipfs/go-log/v2"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"

View File

@ -140,7 +140,7 @@ func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -250,7 +250,7 @@ func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -275,7 +275,7 @@ func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:

View File

@ -17,8 +17,8 @@ import (
"github.com/ipfs/go-cid"
bstore "github.com/ipfs/go-ipfs-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline"
files "github.com/ipfs/go-ipfs-files"
format "github.com/ipfs/go-ipld-format"
"github.com/ipfs/go-libipfs/files"
logging "github.com/ipfs/go-log/v2"
"github.com/ipfs/go-merkledag"
unixfile "github.com/ipfs/go-unixfs/file"
@ -44,7 +44,7 @@ import (
"github.com/filecoin-project/go-address"
cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/go-commp-utils/writer"
datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
"github.com/filecoin-project/go-fil-markets/discovery"
rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
@ -1302,8 +1302,8 @@ func (a *API) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Addre
return nil, err
}
for _, s := range ps {
if strings.HasPrefix(s, dealProtoPrefix) {
res.DealProtocols = append(res.DealProtocols, s)
if strings.HasPrefix(string(s), dealProtoPrefix) {
res.DealProtocols = append(res.DealProtocols, string(s))
}
}
sort.Strings(res.DealProtocols)

View File

@ -16,7 +16,7 @@ import (
dssync "github.com/ipfs/go-datastore/sync"
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"
@ -32,7 +32,7 @@ import (
var testdata embed.FS
func TestImportLocal(t *testing.T) {
//stm: @CLIENT_STORAGE_DEALS_IMPORT_LOCAL_001, @CLIENT_RETRIEVAL_FIND_001
// stm: @CLIENT_STORAGE_DEALS_IMPORT_LOCAL_001, @CLIENT_RETRIEVAL_FIND_001
ds := dssync.MutexWrap(datastore.NewMapDatastore())
dir := t.TempDir()
im := imports.NewManager(ds, dir)
@ -46,7 +46,7 @@ func TestImportLocal(t *testing.T) {
b, err := testdata.ReadFile("testdata/payload.txt")
require.NoError(t, err)
//stm: @CLIENT_STORAGE_DEALS_LIST_IMPORTS_001
// stm: @CLIENT_STORAGE_DEALS_LIST_IMPORTS_001
root, err := a.ClientImportLocal(ctx, bytes.NewReader(b))
require.NoError(t, err)
require.NotEqual(t, cid.Undef, root)
@ -59,7 +59,7 @@ func TestImportLocal(t *testing.T) {
require.Equal(t, root, *it.Root)
require.True(t, strings.HasPrefix(it.CARPath, dir))
//stm: @CLIENT_DATA_HAS_LOCAL_001
// stm: @CLIENT_DATA_HAS_LOCAL_001
local, err := a.ClientHasLocal(ctx, root)
require.NoError(t, err)
require.True(t, local)

View File

@ -91,8 +91,12 @@ func (a *NetAPI) NetPeerInfo(_ context.Context, p peer.ID) (*api.ExtendedPeerInf
protocols, err := a.Host.Peerstore().GetProtocols(p)
if err == nil {
sort.Strings(protocols)
info.Protocols = protocols
protocolStrings := make([]string, 0, len(protocols))
for _, protocol := range protocols {
protocolStrings = append(protocolStrings, string(protocol))
}
sort.Strings(protocolStrings)
info.Protocols = protocolStrings
}
if cm := a.Host.ConnManager().GetTagInfo(p); cm != nil {

View File

@ -25,8 +25,8 @@ import (
"github.com/filecoin-project/dagstore/shard"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
gst "github.com/filecoin-project/go-data-transfer/transport/graphsync"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
gst "github.com/filecoin-project/go-data-transfer/v2/transport/graphsync"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
@ -539,20 +539,8 @@ func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]*api.MarketDe
return sm.listDeals(ctx)
}
func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) {
var out []retrievalmarket.ProviderDealState
deals := sm.RetrievalProvider.ListDeals()
for _, deal := range deals {
if deal.ChannelID != nil {
if deal.ChannelID.Initiator == "" || deal.ChannelID.Responder == "" {
deal.ChannelID = nil // don't try to push unparsable peer IDs over jsonrpc
}
}
out = append(out, deal)
}
return out, nil
func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]struct{}, error) {
return []struct{}{}, nil
}
func (sm *StorageMinerAPI) MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) {

View File

@ -13,10 +13,10 @@ import (
"go.uber.org/fx"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-data-transfer/channelmonitor"
dtimpl "github.com/filecoin-project/go-data-transfer/impl"
dtnet "github.com/filecoin-project/go-data-transfer/network"
dtgstransport "github.com/filecoin-project/go-data-transfer/transport/graphsync"
"github.com/filecoin-project/go-data-transfer/v2/channelmonitor"
dtimpl "github.com/filecoin-project/go-data-transfer/v2/impl"
dtnet "github.com/filecoin-project/go-data-transfer/v2/network"
dtgstransport "github.com/filecoin-project/go-data-transfer/v2/transport/graphsync"
"github.com/filecoin-project/go-fil-markets/discovery"
discoveryimpl "github.com/filecoin-project/go-fil-markets/discovery/impl"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
@ -24,7 +24,6 @@ import (
rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
"github.com/filecoin-project/go-fil-markets/storagemarket"
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation"
smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network"
"github.com/filecoin-project/go-state-types/abi"
@ -95,15 +94,6 @@ func ClientBlockstore() dtypes.ClientBlockstore {
return blockstore.WrapIDStore(blockstore.FromDatastore(datastore.NewMapDatastore()))
}
// RegisterClientValidator is an initialization hook that registers the client
// request validator with the data transfer module as the validator for
// StorageDataTransferVoucher types
func RegisterClientValidator(crv dtypes.ClientRequestValidator, dtm dtypes.ClientDataTransfer) {
if err := dtm.RegisterVoucherType(&requestvalidation.StorageDataTransferVoucher{}, (*requestvalidation.UnifiedRequestValidator)(crv)); err != nil {
panic(err)
}
}
// NewClientGraphsyncDataTransfer returns a data transfer manager that just
// uses the clients's Client DAG service for transfers
func NewClientGraphsyncDataTransfer(lc fx.Lifecycle, h host.Host, gs dtypes.Graphsync, ds dtypes.MetadataDS, r repo.LockedRepo) (dtypes.ClientDataTransfer, error) {

View File

@ -6,8 +6,8 @@ import (
"github.com/ipfs/go-graphsync"
exchange "github.com/ipfs/go-ipfs-exchange-interface"
datatransfer "github.com/filecoin-project/go-data-transfer"
dtnet "github.com/filecoin-project/go-data-transfer/network"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"
dtnet "github.com/filecoin-project/go-data-transfer/v2/network"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation"
"github.com/filecoin-project/go-statestore"

View File

@ -7,6 +7,7 @@ import (
"math/bits"
"os"
"path/filepath"
"sync"
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p"
@ -14,10 +15,9 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager"
"github.com/libp2p/go-libp2p/p2p/host/resource-manager/obs"
rcmgrObs "github.com/libp2p/go-libp2p/p2p/host/resource-manager/obs"
"github.com/prometheus/client_golang/prometheus"
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
"go.uber.org/fx"
@ -25,6 +25,8 @@ import (
"github.com/filecoin-project/lotus/node/repo"
)
var rcmgrMetricsOnce sync.Once
func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo) (network.ResourceManager, error) {
return func(lc fx.Lifecycle, repo repo.LockedRepo) (network.ResourceManager, error) {
isFullNode := repo.RepoType().Type() == "FullNode"
@ -32,7 +34,7 @@ func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo)
if (isFullNode && envvar == "0") || // only set NullResourceManager if envvar is explicitly "0"
(!isFullNode && envvar != "1") { // set NullResourceManager *unless* envvar is explicitly "1"
log.Info("libp2p resource manager is disabled")
return network.NullResourceManager, nil
return &network.NullResourceManager{}, nil
}
log.Info("libp2p resource manager is enabled")
@ -52,37 +54,41 @@ func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo)
// For every extra 1GB of memory we have available, increase our limit by 1GiB
defaultLimits.SystemLimitIncrease.Memory = 1 << 30
defaultLimitConfig := defaultLimits.AutoScale()
if defaultLimitConfig.System.Memory > 4<<30 {
changes := rcmgr.PartialLimitConfig{}
if defaultLimitConfig.ToPartialLimitConfig().System.Memory > 4<<30 {
// Cap our memory limit
defaultLimitConfig.System.Memory = 4 << 30
changes.System.Memory = 4 << 30
}
maxconns := int(connMgrHi)
if 2*maxconns > defaultLimitConfig.System.ConnsInbound {
if rcmgr.LimitVal(2*maxconns) > defaultLimitConfig.ToPartialLimitConfig().System.ConnsInbound {
// adjust conns to 2x to allow for two conns per peer (TCP+QUIC)
defaultLimitConfig.System.ConnsInbound = logScale(2 * maxconns)
defaultLimitConfig.System.ConnsOutbound = logScale(2 * maxconns)
defaultLimitConfig.System.Conns = logScale(4 * maxconns)
changes.System.ConnsInbound = rcmgr.LimitVal(logScale(2 * maxconns))
changes.System.ConnsOutbound = rcmgr.LimitVal(logScale(2 * maxconns))
changes.System.Conns = rcmgr.LimitVal(logScale(4 * maxconns))
defaultLimitConfig.System.StreamsInbound = logScale(16 * maxconns)
defaultLimitConfig.System.StreamsOutbound = logScale(64 * maxconns)
defaultLimitConfig.System.Streams = logScale(64 * maxconns)
changes.System.StreamsInbound = rcmgr.LimitVal(logScale(16 * maxconns))
changes.System.StreamsOutbound = rcmgr.LimitVal(logScale(64 * maxconns))
changes.System.Streams = rcmgr.LimitVal(logScale(64 * maxconns))
if 2*maxconns > defaultLimitConfig.System.FD {
defaultLimitConfig.System.FD = logScale(2 * maxconns)
if rcmgr.LimitVal(2*maxconns) > defaultLimitConfig.ToPartialLimitConfig().System.FD {
changes.System.FD = rcmgr.LimitVal(logScale(2 * maxconns))
}
defaultLimitConfig.ServiceDefault.StreamsInbound = logScale(8 * maxconns)
defaultLimitConfig.ServiceDefault.StreamsOutbound = logScale(32 * maxconns)
defaultLimitConfig.ServiceDefault.Streams = logScale(32 * maxconns)
changes.ServiceDefault.StreamsInbound = rcmgr.LimitVal(logScale(8 * maxconns))
changes.ServiceDefault.StreamsOutbound = rcmgr.LimitVal(logScale(32 * maxconns))
changes.ServiceDefault.Streams = rcmgr.LimitVal(logScale(32 * maxconns))
defaultLimitConfig.ProtocolDefault.StreamsInbound = logScale(8 * maxconns)
defaultLimitConfig.ProtocolDefault.StreamsOutbound = logScale(32 * maxconns)
defaultLimitConfig.ProtocolDefault.Streams = logScale(32 * maxconns)
changes.ProtocolDefault.StreamsInbound = rcmgr.LimitVal(logScale(8 * maxconns))
changes.ProtocolDefault.StreamsOutbound = rcmgr.LimitVal(logScale(32 * maxconns))
changes.ProtocolDefault.Streams = rcmgr.LimitVal(logScale(32 * maxconns))
log.Info("adjusted default resource manager limits")
}
changedLimitConfig := changes.Build(defaultLimitConfig)
// initialize
var limiter rcmgr.Limiter
var opts []rcmgr.Option
@ -95,13 +101,13 @@ func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo)
switch {
case err == nil:
defer limitsIn.Close() //nolint:errcheck
limiter, err = rcmgr.NewLimiterFromJSON(limitsIn, defaultLimitConfig)
limiter, err = rcmgr.NewLimiterFromJSON(limitsIn, changedLimitConfig)
if err != nil {
return nil, fmt.Errorf("error parsing limit file: %w", err)
}
case errors.Is(err, os.ErrNotExist):
limiter = rcmgr.NewFixedLimiter(defaultLimitConfig)
limiter = rcmgr.NewFixedLimiter(changedLimitConfig)
default:
return nil, err
@ -111,10 +117,10 @@ func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo)
if err != nil {
return nil, fmt.Errorf("error creating resource manager stats reporter: %w", err)
}
err = view.Register(obs.DefaultViews...)
if err != nil {
return nil, fmt.Errorf("error registering rcmgr metrics: %w", err)
}
rcmgrMetricsOnce.Do(func() {
rcmgrObs.MustRegisterWith(prometheus.DefaultRegisterer)
})
// Metrics
opts = append(opts, rcmgr.WithMetrics(rcmgrMetrics{}), rcmgr.WithTraceReporter(str))

View File

@ -12,6 +12,7 @@ import (
"github.com/libp2p/go-libp2p/core/event"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
"go.uber.org/fx"
"golang.org/x/xerrors"
@ -84,7 +85,7 @@ func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.
return nil
}
func protosContains(protos []string, search string) bool {
func protosContains(protos []protocol.ID, search protocol.ID) bool {
for _, p := range protos {
if p == search {
return true

View File

@ -25,9 +25,9 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
dtimpl "github.com/filecoin-project/go-data-transfer/impl"
dtnet "github.com/filecoin-project/go-data-transfer/network"
dtgstransport "github.com/filecoin-project/go-data-transfer/transport/graphsync"
dtimpl "github.com/filecoin-project/go-data-transfer/v2/impl"
dtnet "github.com/filecoin-project/go-data-transfer/v2/network"
dtgstransport "github.com/filecoin-project/go-data-transfer/v2/transport/graphsync"
piecefilestore "github.com/filecoin-project/go-fil-markets/filestore"
piecestoreimpl "github.com/filecoin-project/go-fil-markets/piecestore/impl"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"

View File

@ -41,10 +41,15 @@ func IndexProvider(cfg config.IndexProviderConfig) func(params IdxProv, marketHo
}
ipds := namespace.Wrap(args.Datastore, datastore.NewKey("/index-provider"))
addrs := marketHost.Addrs()
addrsString := make([]string, 0, len(addrs))
for _, addr := range addrs {
addrsString = append(addrsString, addr.String())
}
var opts = []engine.Option{
engine.WithDatastore(ipds),
engine.WithHost(marketHost),
engine.WithRetrievalAddrs(marketHost.Addrs()...),
engine.WithRetrievalAddrs(addrsString...),
engine.WithEntriesCacheCapacity(cfg.EntriesCacheCapacity),
engine.WithChainedEntries(cfg.EntriesChunkSize),
engine.WithTopicName(topicName),

View File

@ -33,22 +33,6 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.Voucher (paych.SignedVoucher) (struct)
if len("Voucher") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Voucher\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Voucher"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Voucher")); err != nil {
return err
}
if err := t.Voucher.MarshalCBOR(cw); err != nil {
return err
}
// t.Proof ([]uint8) (slice)
if len("Proof") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Proof\" was too long")
@ -73,6 +57,22 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.Voucher (paych.SignedVoucher) (struct)
if len("Voucher") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Voucher\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Voucher"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Voucher")); err != nil {
return err
}
if err := t.Voucher.MarshalCBOR(cw); err != nil {
return err
}
// t.Submitted (bool) (bool)
if len("Submitted") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Submitted\" was too long")
@ -129,27 +129,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.Voucher (paych.SignedVoucher) (struct)
case "Voucher":
{
b, err := cr.ReadByte()
if err != nil {
return err
}
if b != cbg.CborNull[0] {
if err := cr.UnreadByte(); err != nil {
return err
}
t.Voucher = new(paych.SignedVoucher)
if err := t.Voucher.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Voucher pointer: %w", err)
}
}
}
// t.Proof ([]uint8) (slice)
// t.Proof ([]uint8) (slice)
case "Proof":
maj, extra, err = cr.ReadHeader()
@ -171,6 +151,26 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) {
if _, err := io.ReadFull(cr, t.Proof[:]); err != nil {
return err
}
// t.Voucher (paych.SignedVoucher) (struct)
case "Voucher":
{
b, err := cr.ReadByte()
if err != nil {
return err
}
if b != cbg.CborNull[0] {
if err := cr.UnreadByte(); err != nil {
return err
}
t.Voucher = new(paych.SignedVoucher)
if err := t.Voucher.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Voucher pointer: %w", err)
}
}
}
// t.Submitted (bool) (bool)
case "Submitted":
@ -210,26 +210,35 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.ChannelID (string) (string)
if len("ChannelID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"ChannelID\" was too long")
// t.Amount (big.Int) (struct)
if len("Amount") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Amount\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Amount"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("ChannelID")); err != nil {
if _, err := io.WriteString(w, string("Amount")); err != nil {
return err
}
if len(t.ChannelID) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.ChannelID was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil {
if err := t.Amount.MarshalCBOR(cw); err != nil {
return err
}
if _, err := io.WriteString(w, string(t.ChannelID)); err != nil {
// t.Target (address.Address) (struct)
if len("Target") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Target\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Target"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Target")); err != nil {
return err
}
if err := t.Target.MarshalCBOR(cw); err != nil {
return err
}
@ -265,35 +274,35 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.Target (address.Address) (struct)
if len("Target") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Target\" was too long")
// t.NextLane (uint64) (uint64)
if len("NextLane") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"NextLane\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Target"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("NextLane"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Target")); err != nil {
if _, err := io.WriteString(w, string("NextLane")); err != nil {
return err
}
if err := t.Target.MarshalCBOR(cw); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.NextLane)); err != nil {
return err
}
// t.Direction (uint64) (uint64)
if len("Direction") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Direction\" was too long")
// t.Settling (bool) (bool)
if len("Settling") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Settling\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Direction"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Settling"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Direction")); err != nil {
if _, err := io.WriteString(w, string("Settling")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Direction)); err != nil {
if err := cbg.WriteBool(w, t.Settling); err != nil {
return err
}
@ -322,35 +331,102 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
}
}
// t.NextLane (uint64) (uint64)
if len("NextLane") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"NextLane\" was too long")
// t.ChannelID (string) (string)
if len("ChannelID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"ChannelID\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("NextLane"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("NextLane")); err != nil {
if _, err := io.WriteString(w, string("ChannelID")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.NextLane)); err != nil {
if len(t.ChannelID) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.ChannelID was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil {
return err
}
if _, err := io.WriteString(w, string(t.ChannelID)); err != nil {
return err
}
// t.Amount (big.Int) (struct)
if len("Amount") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Amount\" was too long")
// t.CreateMsg (cid.Cid) (struct)
if len("CreateMsg") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"CreateMsg\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Amount"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CreateMsg"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Amount")); err != nil {
if _, err := io.WriteString(w, string("CreateMsg")); err != nil {
return err
}
if err := t.Amount.MarshalCBOR(cw); err != nil {
if t.CreateMsg == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
if err := cbg.WriteCid(cw, *t.CreateMsg); err != nil {
return xerrors.Errorf("failed to write cid field t.CreateMsg: %w", err)
}
}
// t.Direction (uint64) (uint64)
if len("Direction") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Direction\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Direction"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Direction")); err != nil {
return err
}
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Direction)); err != nil {
return err
}
// t.AddFundsMsg (cid.Cid) (struct)
if len("AddFundsMsg") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"AddFundsMsg\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("AddFundsMsg"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("AddFundsMsg")); err != nil {
return err
}
if t.AddFundsMsg == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
if err := cbg.WriteCid(cw, *t.AddFundsMsg); err != nil {
return xerrors.Errorf("failed to write cid field t.AddFundsMsg: %w", err)
}
}
// t.PendingAmount (big.Int) (struct)
if len("PendingAmount") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"PendingAmount\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PendingAmount"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("PendingAmount")); err != nil {
return err
}
if err := t.PendingAmount.MarshalCBOR(cw); err != nil {
return err
}
@ -385,82 +461,6 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := t.PendingAvailableAmount.MarshalCBOR(cw); err != nil {
return err
}
// t.PendingAmount (big.Int) (struct)
if len("PendingAmount") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"PendingAmount\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PendingAmount"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("PendingAmount")); err != nil {
return err
}
if err := t.PendingAmount.MarshalCBOR(cw); err != nil {
return err
}
// t.CreateMsg (cid.Cid) (struct)
if len("CreateMsg") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"CreateMsg\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CreateMsg"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("CreateMsg")); err != nil {
return err
}
if t.CreateMsg == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
if err := cbg.WriteCid(cw, *t.CreateMsg); err != nil {
return xerrors.Errorf("failed to write cid field t.CreateMsg: %w", err)
}
}
// t.AddFundsMsg (cid.Cid) (struct)
if len("AddFundsMsg") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"AddFundsMsg\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("AddFundsMsg"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("AddFundsMsg")); err != nil {
return err
}
if t.AddFundsMsg == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
if err := cbg.WriteCid(cw, *t.AddFundsMsg); err != nil {
return xerrors.Errorf("failed to write cid field t.AddFundsMsg: %w", err)
}
}
// t.Settling (bool) (bool)
if len("Settling") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Settling\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Settling"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Settling")); err != nil {
return err
}
if err := cbg.WriteBool(w, t.Settling); err != nil {
return err
}
return nil
}
@ -502,16 +502,25 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.ChannelID (string) (string)
case "ChannelID":
// t.Amount (big.Int) (struct)
case "Amount":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
if err := t.Amount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Amount: %w", err)
}
}
// t.Target (address.Address) (struct)
case "Target":
{
if err := t.Target.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Target: %w", err)
}
t.ChannelID = string(sval)
}
// t.Channel (address.Address) (struct)
case "Channel":
@ -543,18 +552,8 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
}
}
// t.Target (address.Address) (struct)
case "Target":
{
if err := t.Target.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Target: %w", err)
}
}
// t.Direction (uint64) (uint64)
case "Direction":
// t.NextLane (uint64) (uint64)
case "NextLane":
{
@ -565,9 +564,27 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.Direction = uint64(extra)
t.NextLane = uint64(extra)
}
// t.Settling (bool) (bool)
case "Settling":
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
}
switch extra {
case 20:
t.Settling = false
case 21:
t.Settling = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
// t.Vouchers ([]*paychmgr.VoucherInfo) (slice)
case "Vouchers":
@ -598,60 +615,16 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
t.Vouchers[i] = &v
}
// t.NextLane (uint64) (uint64)
case "NextLane":
// t.ChannelID (string) (string)
case "ChannelID":
{
maj, extra, err = cr.ReadHeader()
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.NextLane = uint64(extra)
}
// t.Amount (big.Int) (struct)
case "Amount":
{
if err := t.Amount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Amount: %w", err)
}
}
// t.AvailableAmount (big.Int) (struct)
case "AvailableAmount":
{
if err := t.AvailableAmount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.AvailableAmount: %w", err)
}
}
// t.PendingAvailableAmount (big.Int) (struct)
case "PendingAvailableAmount":
{
if err := t.PendingAvailableAmount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.PendingAvailableAmount: %w", err)
}
}
// t.PendingAmount (big.Int) (struct)
case "PendingAmount":
{
if err := t.PendingAmount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.PendingAmount: %w", err)
}
t.ChannelID = string(sval)
}
// t.CreateMsg (cid.Cid) (struct)
case "CreateMsg":
@ -675,6 +648,21 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
t.CreateMsg = &c
}
}
// t.Direction (uint64) (uint64)
case "Direction":
{
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.Direction = uint64(extra)
}
// t.AddFundsMsg (cid.Cid) (struct)
case "AddFundsMsg":
@ -699,23 +687,35 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
}
}
// t.Settling (bool) (bool)
case "Settling":
// t.PendingAmount (big.Int) (struct)
case "PendingAmount":
{
if err := t.PendingAmount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.PendingAmount: %w", err)
}
maj, extra, err = cr.ReadHeader()
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
// t.AvailableAmount (big.Int) (struct)
case "AvailableAmount":
{
if err := t.AvailableAmount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.AvailableAmount: %w", err)
}
}
switch extra {
case 20:
t.Settling = false
case 21:
t.Settling = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
// t.PendingAvailableAmount (big.Int) (struct)
case "PendingAvailableAmount":
{
if err := t.PendingAvailableAmount.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.PendingAvailableAmount: %w", err)
}
}
default:
@ -738,26 +738,26 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.ChannelID (string) (string)
if len("ChannelID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"ChannelID\" was too long")
// t.Err (string) (string)
if len("Err") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Err\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Err"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("ChannelID")); err != nil {
if _, err := io.WriteString(w, string("Err")); err != nil {
return err
}
if len(t.ChannelID) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.ChannelID was too long")
if len(t.Err) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.Err was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Err))); err != nil {
return err
}
if _, err := io.WriteString(w, string(t.ChannelID)); err != nil {
if _, err := io.WriteString(w, string(t.Err)); err != nil {
return err
}
@ -793,26 +793,26 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error {
return err
}
// t.Err (string) (string)
if len("Err") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Err\" was too long")
// t.ChannelID (string) (string)
if len("ChannelID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"ChannelID\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Err"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Err")); err != nil {
if _, err := io.WriteString(w, string("ChannelID")); err != nil {
return err
}
if len(t.Err) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.Err was too long")
if len(t.ChannelID) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.ChannelID was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Err))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil {
return err
}
if _, err := io.WriteString(w, string(t.Err)); err != nil {
if _, err := io.WriteString(w, string(t.ChannelID)); err != nil {
return err
}
return nil
@ -856,8 +856,8 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.ChannelID (string) (string)
case "ChannelID":
// t.Err (string) (string)
case "Err":
{
sval, err := cbg.ReadString(cr)
@ -865,7 +865,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) {
return err
}
t.ChannelID = string(sval)
t.Err = string(sval)
}
// t.MsgCid (cid.Cid) (struct)
case "MsgCid":
@ -898,8 +898,8 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
// t.Err (string) (string)
case "Err":
// t.ChannelID (string) (string)
case "ChannelID":
{
sval, err := cbg.ReadString(cr)
@ -907,7 +907,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) {
return err
}
t.Err = string(sval)
t.ChannelID = string(sval)
}
default:

File diff suppressed because it is too large Load Diff

View File

@ -48,29 +48,6 @@ func (t *Call) MarshalCBOR(w io.Writer) error {
return err
}
// t.RetType (sealer.ReturnType) (string)
if len("RetType") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"RetType\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RetType"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("RetType")); err != nil {
return err
}
if len(t.RetType) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.RetType was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RetType))); err != nil {
return err
}
if _, err := io.WriteString(w, string(t.RetType)); err != nil {
return err
}
// t.State (sealer.CallState) (uint64)
if len("State") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"State\" was too long")
@ -102,6 +79,29 @@ func (t *Call) MarshalCBOR(w io.Writer) error {
if err := t.Result.MarshalCBOR(cw); err != nil {
return err
}
// t.RetType (sealer.ReturnType) (string)
if len("RetType") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"RetType\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RetType"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("RetType")); err != nil {
return err
}
if len(t.RetType) > cbg.MaxLength {
return xerrors.Errorf("Value in field t.RetType was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RetType))); err != nil {
return err
}
if _, err := io.WriteString(w, string(t.RetType)); err != nil {
return err
}
return nil
}
@ -153,17 +153,6 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) {
}
}
// t.RetType (sealer.ReturnType) (string)
case "RetType":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.RetType = ReturnType(sval)
}
// t.State (sealer.CallState) (uint64)
case "State":
@ -199,6 +188,17 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) {
}
}
// t.RetType (sealer.ReturnType) (string)
case "RetType":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.RetType = ReturnType(sval)
}
default:
// Field doesn't exist on this type, so ignore it
@ -259,20 +259,26 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error {
return err
}
// t.WorkerCall (storiface.CallID) (struct)
if len("WorkerCall") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"WorkerCall\" was too long")
// t.StartTime (int64) (int64)
if len("StartTime") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"StartTime\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WorkerCall"))); err != nil {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartTime"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("WorkerCall")); err != nil {
if _, err := io.WriteString(w, string("StartTime")); err != nil {
return err
}
if err := t.WorkerCall.MarshalCBOR(cw); err != nil {
return err
if t.StartTime >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartTime)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartTime-1)); err != nil {
return err
}
}
// t.WorkError (string) (string)
@ -298,6 +304,22 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error {
return err
}
// t.WorkerCall (storiface.CallID) (struct)
if len("WorkerCall") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"WorkerCall\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WorkerCall"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("WorkerCall")); err != nil {
return err
}
if err := t.WorkerCall.MarshalCBOR(cw); err != nil {
return err
}
// t.WorkerHostname (string) (string)
if len("WorkerHostname") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"WorkerHostname\" was too long")
@ -320,28 +342,6 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error {
if _, err := io.WriteString(w, string(t.WorkerHostname)); err != nil {
return err
}
// t.StartTime (int64) (int64)
if len("StartTime") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"StartTime\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartTime"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("StartTime")); err != nil {
return err
}
if t.StartTime >= 0 {
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartTime)); err != nil {
return err
}
} else {
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartTime-1)); err != nil {
return err
}
}
return nil
}
@ -404,38 +404,6 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) {
t.Status = WorkStatus(sval)
}
// t.WorkerCall (storiface.CallID) (struct)
case "WorkerCall":
{
if err := t.WorkerCall.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.WorkerCall: %w", err)
}
}
// t.WorkError (string) (string)
case "WorkError":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.WorkError = string(sval)
}
// t.WorkerHostname (string) (string)
case "WorkerHostname":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.WorkerHostname = string(sval)
}
// t.StartTime (int64) (int64)
case "StartTime":
{
@ -453,7 +421,7 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) {
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
return fmt.Errorf("int64 negative overflow")
}
extraI = -1 - extraI
default:
@ -462,6 +430,38 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) {
t.StartTime = int64(extraI)
}
// t.WorkError (string) (string)
case "WorkError":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.WorkError = string(sval)
}
// t.WorkerCall (storiface.CallID) (struct)
case "WorkerCall":
{
if err := t.WorkerCall.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.WorkerCall: %w", err)
}
}
// t.WorkerHostname (string) (string)
case "WorkerHostname":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.WorkerHostname = string(sval)
}
default:
// Field doesn't exist on this type, so ignore it

View File

@ -30,22 +30,6 @@ func (t *CallID) MarshalCBOR(w io.Writer) error {
return err
}
// t.Sector (abi.SectorID) (struct)
if len("Sector") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Sector\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Sector"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Sector")); err != nil {
return err
}
if err := t.Sector.MarshalCBOR(cw); err != nil {
return err
}
// t.ID (uuid.UUID) (array)
if len("ID") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"ID\" was too long")
@ -69,6 +53,22 @@ func (t *CallID) MarshalCBOR(w io.Writer) error {
if _, err := cw.Write(t.ID[:]); err != nil {
return err
}
// t.Sector (abi.SectorID) (struct)
if len("Sector") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Sector\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Sector"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Sector")); err != nil {
return err
}
if err := t.Sector.MarshalCBOR(cw); err != nil {
return err
}
return nil
}
@ -110,17 +110,7 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.Sector (abi.SectorID) (struct)
case "Sector":
{
if err := t.Sector.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Sector: %w", err)
}
}
// t.ID (uuid.UUID) (array)
// t.ID (uuid.UUID) (array)
case "ID":
maj, extra, err = cr.ReadHeader()
@ -144,6 +134,16 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) {
if _, err := io.ReadFull(cr, t.ID[:]); err != nil {
return err
}
// t.Sector (abi.SectorID) (struct)
case "Sector":
{
if err := t.Sector.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.Sector: %w", err)
}
}
default:
// Field doesn't exist on this type, so ignore it
@ -294,22 +294,6 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error {
return err
}
// t.Local (bool) (bool)
if len("Local") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Local\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Local"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Local")); err != nil {
return err
}
if err := cbg.WriteBool(w, t.Local); err != nil {
return err
}
// t.URL (string) (string)
if len("URL") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"URL\" was too long")
@ -333,6 +317,22 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error {
return err
}
// t.Local (bool) (bool)
if len("Local") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Local\" was too long")
}
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Local"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Local")); err != nil {
return err
}
if err := cbg.WriteBool(w, t.Local); err != nil {
return err
}
// t.Headers ([]storiface.SecDataHttpHeader) (slice)
if len("Headers") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Headers\" was too long")
@ -398,7 +398,18 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) {
}
switch name {
// t.Local (bool) (bool)
// t.URL (string) (string)
case "URL":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.URL = string(sval)
}
// t.Local (bool) (bool)
case "Local":
maj, extra, err = cr.ReadHeader()
@ -416,17 +427,6 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) {
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
// t.URL (string) (string)
case "URL":
{
sval, err := cbg.ReadString(cr)
if err != nil {
return err
}
t.URL = string(sval)
}
// t.Headers ([]storiface.SecDataHttpHeader) (slice)
case "Headers":