Integrate FIP 0027
This commit is contained in:
parent
77613b57a9
commit
339b7db2b7
@ -16,7 +16,7 @@ import (
|
||||
datatransfer "github.com/filecoin-project/go-data-transfer"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
"github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/go-fil-markets/piecestore"
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"sort"
|
||||
|
||||
abi "github.com/filecoin-project/go-state-types/abi"
|
||||
market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
market "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
@ -1,6 +1,8 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -12,6 +14,7 @@ import (
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
market{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/builtin/market"
|
||||
{{range .versions}}
|
||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||
{{end}}
|
||||
@ -128,7 +131,7 @@ type DealProposals interface {
|
||||
decode(*cbg.Deferred) (*DealProposal, error)
|
||||
}
|
||||
|
||||
type PublishStorageDealsParams = market0.PublishStorageDealsParams
|
||||
type PublishStorageDealsParams = market{{.latestVersion}}.PublishStorageDealsParams
|
||||
|
||||
type PublishStorageDealsReturn interface {
|
||||
DealIDs() ([]abi.DealID, error)
|
||||
@ -154,7 +157,7 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
||||
type VerifyDealsForActivationParams = market0.VerifyDealsForActivationParams
|
||||
type WithdrawBalanceParams = market0.WithdrawBalanceParams
|
||||
|
||||
type ClientDealProposal = market0.ClientDealProposal
|
||||
type ClientDealProposal = market{{.latestVersion}}.ClientDealProposal
|
||||
|
||||
type DealState struct {
|
||||
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
|
||||
@ -168,7 +171,7 @@ type DealProposal struct {
|
||||
VerifiedDeal bool
|
||||
Client address.Address
|
||||
Provider address.Address
|
||||
Label string
|
||||
Label market{{.latestVersion}}.DealLabel
|
||||
StartEpoch abi.ChainEpoch
|
||||
EndEpoch abi.ChainEpoch
|
||||
StoragePricePerEpoch abi.TokenAmount
|
||||
@ -227,3 +230,11 @@ func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, ab
|
||||
|
||||
return ef, big.Sub(tf, ef)
|
||||
}
|
||||
|
||||
func labelFromGoString(s string) (market{{.latestVersion}}.DealLabel, error) {
|
||||
if utf8.ValidString(s) {
|
||||
return market{{.latestVersion}}.NewLabelFromString(s)
|
||||
} else {
|
||||
return market{{.latestVersion}}.NewLabelFromBytes([]byte(s))
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -12,6 +14,7 @@ import (
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
@ -295,7 +298,7 @@ type DealProposals interface {
|
||||
decode(*cbg.Deferred) (*DealProposal, error)
|
||||
}
|
||||
|
||||
type PublishStorageDealsParams = market0.PublishStorageDealsParams
|
||||
type PublishStorageDealsParams = market8.PublishStorageDealsParams
|
||||
|
||||
type PublishStorageDealsReturn interface {
|
||||
DealIDs() ([]abi.DealID, error)
|
||||
@ -342,7 +345,7 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
||||
type VerifyDealsForActivationParams = market0.VerifyDealsForActivationParams
|
||||
type WithdrawBalanceParams = market0.WithdrawBalanceParams
|
||||
|
||||
type ClientDealProposal = market0.ClientDealProposal
|
||||
type ClientDealProposal = market8.ClientDealProposal
|
||||
|
||||
type DealState struct {
|
||||
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
|
||||
@ -356,7 +359,7 @@ type DealProposal struct {
|
||||
VerifiedDeal bool
|
||||
Client address.Address
|
||||
Provider address.Address
|
||||
Label string
|
||||
Label market8.DealLabel
|
||||
StartEpoch abi.ChainEpoch
|
||||
EndEpoch abi.ChainEpoch
|
||||
StoragePricePerEpoch abi.TokenAmount
|
||||
@ -415,3 +418,11 @@ func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, ab
|
||||
|
||||
return ef, big.Sub(tf, ef)
|
||||
}
|
||||
|
||||
func labelFromGoString(s string) (market8.DealLabel, error) {
|
||||
if utf8.ValidString(s) {
|
||||
return market8.NewLabelFromString(s)
|
||||
} else {
|
||||
return market8.NewLabelFromBytes([]byte(s))
|
||||
}
|
||||
}
|
||||
|
@ -206,14 +206,24 @@ func (s *dealProposals{{.v}}) Get(dealID abi.DealID) (*DealProposal, bool, error
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV{{.v}}DealProposal(proposal{{.v}})
|
||||
return &proposal, true, nil
|
||||
|
||||
proposal, err := fromV{{.v}}DealProposal(proposal{{.v}})
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals{{.v}}) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp{{.v}} market{{.v}}.DealProposal
|
||||
return s.Array.ForEach(&dp{{.v}}, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV{{.v}}DealProposal(dp{{.v}}))
|
||||
dp, err := fromV{{.v}}DealProposal(dp{{.v}})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -222,8 +232,13 @@ func (s *dealProposals{{.v}}) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp{{.v}}.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV{{.v}}DealProposal(dp{{.v}})
|
||||
return &dp, nil
|
||||
|
||||
dp, err := fromV{{.v}}DealProposal(dp{{.v}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals{{.v}}) array() adt.Array {
|
||||
|
@ -199,14 +199,24 @@ func (s *dealProposals0) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV0DealProposal(proposal0)
|
||||
|
||||
proposal, err := fromV0DealProposal(proposal0)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals0) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp0 market0.DealProposal
|
||||
return s.Array.ForEach(&dp0, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV0DealProposal(dp0))
|
||||
dp, err := fromV0DealProposal(dp0)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -215,7 +225,12 @@ func (s *dealProposals0) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp0.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV0DealProposal(dp0)
|
||||
|
||||
dp, err := fromV0DealProposal(dp0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -199,14 +199,24 @@ func (s *dealProposals2) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV2DealProposal(proposal2)
|
||||
|
||||
proposal, err := fromV2DealProposal(proposal2)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals2) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp2 market2.DealProposal
|
||||
return s.Array.ForEach(&dp2, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV2DealProposal(dp2))
|
||||
dp, err := fromV2DealProposal(dp2)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -215,7 +225,12 @@ func (s *dealProposals2) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp2.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV2DealProposal(dp2)
|
||||
|
||||
dp, err := fromV2DealProposal(dp2)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,24 @@ func (s *dealProposals3) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV3DealProposal(proposal3)
|
||||
|
||||
proposal, err := fromV3DealProposal(proposal3)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals3) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp3 market3.DealProposal
|
||||
return s.Array.ForEach(&dp3, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV3DealProposal(dp3))
|
||||
dp, err := fromV3DealProposal(dp3)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,7 +220,12 @@ func (s *dealProposals3) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp3.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV3DealProposal(dp3)
|
||||
|
||||
dp, err := fromV3DealProposal(dp3)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,24 @@ func (s *dealProposals4) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV4DealProposal(proposal4)
|
||||
|
||||
proposal, err := fromV4DealProposal(proposal4)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals4) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp4 market4.DealProposal
|
||||
return s.Array.ForEach(&dp4, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV4DealProposal(dp4))
|
||||
dp, err := fromV4DealProposal(dp4)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,7 +220,12 @@ func (s *dealProposals4) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp4.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV4DealProposal(dp4)
|
||||
|
||||
dp, err := fromV4DealProposal(dp4)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,24 @@ func (s *dealProposals5) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV5DealProposal(proposal5)
|
||||
|
||||
proposal, err := fromV5DealProposal(proposal5)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals5) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp5 market5.DealProposal
|
||||
return s.Array.ForEach(&dp5, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV5DealProposal(dp5))
|
||||
dp, err := fromV5DealProposal(dp5)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,7 +220,12 @@ func (s *dealProposals5) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp5.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV5DealProposal(dp5)
|
||||
|
||||
dp, err := fromV5DealProposal(dp5)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,24 @@ func (s *dealProposals6) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV6DealProposal(proposal6)
|
||||
|
||||
proposal, err := fromV6DealProposal(proposal6)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals6) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp6 market6.DealProposal
|
||||
return s.Array.ForEach(&dp6, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV6DealProposal(dp6))
|
||||
dp, err := fromV6DealProposal(dp6)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,7 +220,12 @@ func (s *dealProposals6) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp6.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV6DealProposal(dp6)
|
||||
|
||||
dp, err := fromV6DealProposal(dp6)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,24 @@ func (s *dealProposals7) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV7DealProposal(proposal7)
|
||||
|
||||
proposal, err := fromV7DealProposal(proposal7)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals7) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp7 market7.DealProposal
|
||||
return s.Array.ForEach(&dp7, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV7DealProposal(dp7))
|
||||
dp, err := fromV7DealProposal(dp7)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,7 +220,12 @@ func (s *dealProposals7) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp7.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV7DealProposal(dp7)
|
||||
|
||||
dp, err := fromV7DealProposal(dp7)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,24 @@ func (s *dealProposals8) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV8DealProposal(proposal8)
|
||||
|
||||
proposal, err := fromV8DealProposal(proposal8)
|
||||
if err != nil {
|
||||
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *dealProposals8) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp8 market8.DealProposal
|
||||
return s.Array.ForEach(&dp8, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV8DealProposal(dp8))
|
||||
dp, err := fromV8DealProposal(dp8)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding proposal: %w", err)
|
||||
}
|
||||
|
||||
return cb(abi.DealID(idx), dp)
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,7 +220,12 @@ func (s *dealProposals8) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
if err := dp8.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV8DealProposal(dp8)
|
||||
|
||||
dp, err := fromV8DealProposal(dp8)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
@ -36,7 +38,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||
|
||||
@ -391,7 +392,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
|
||||
return mds.Put(ctx, datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size])
|
||||
}
|
||||
|
||||
func findMarketDealID(ctx context.Context, api v1api.FullNode, deal market2.DealProposal) (abi.DealID, error) {
|
||||
func findMarketDealID(ctx context.Context, api v1api.FullNode, deal market8.DealProposal) (abi.DealID, error) {
|
||||
// TODO: find a better way
|
||||
// (this is only used by genesis miners)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
@ -252,12 +252,17 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
|
||||
|
||||
func createDeals(m *genesis.Miner, k *wallet.Key, maddr address.Address, ssize abi.SectorSize) error {
|
||||
for i, sector := range m.Sectors {
|
||||
proposal := &market2.DealProposal{
|
||||
label, err := market8.NewLabelFromString(fmt.Sprintf("%d", i))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("error creating deal label: %w", err)
|
||||
}
|
||||
|
||||
proposal := &market8.DealProposal{
|
||||
PieceCID: sector.CommD,
|
||||
PieceSize: abi.PaddedPieceSize(ssize),
|
||||
Client: k.Address,
|
||||
Provider: maddr,
|
||||
Label: fmt.Sprintf("%d", i),
|
||||
Label: label,
|
||||
StartEpoch: 0,
|
||||
EndEpoch: 9001,
|
||||
StoragePricePerEpoch: big.Zero(),
|
||||
|
@ -707,7 +707,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -1158,7 +1158,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -1300,7 +1300,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -1335,7 +1335,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -1456,7 +1456,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -2711,7 +2711,7 @@ Inputs:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -3079,7 +3079,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
|
@ -5447,7 +5447,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -5525,7 +5525,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
|
@ -5863,7 +5863,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
@ -5941,7 +5941,7 @@ Response:
|
||||
"VerifiedDeal": true,
|
||||
"Client": "f01234",
|
||||
"Provider": "f01234",
|
||||
"Label": "string value",
|
||||
"Label": {},
|
||||
"StartEpoch": 10101,
|
||||
"EndEpoch": 10101,
|
||||
"StoragePricePerEpoch": "0",
|
||||
|
9
extern/storage-sealing/currentdealinfo.go
vendored
9
extern/storage-sealing/currentdealinfo.go
vendored
@ -4,15 +4,16 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
@ -120,7 +121,7 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
|
||||
return dealID, nil, xerrors.Errorf("getting publish deal message %s: %w", publishCid, err)
|
||||
}
|
||||
|
||||
var pubDealsParams market2.PublishStorageDealsParams
|
||||
var pubDealsParams market8.PublishStorageDealsParams
|
||||
if err := pubDealsParams.UnmarshalCBOR(bytes.NewReader(pubmsg.Params)); err != nil {
|
||||
return dealID, nil, xerrors.Errorf("unmarshalling publish deal message params for message %s: %w", publishCid, err)
|
||||
}
|
||||
@ -173,7 +174,7 @@ func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tok Ti
|
||||
return p1.PieceCID.Equals(p2.PieceCID) &&
|
||||
p1.PieceSize == p2.PieceSize &&
|
||||
p1.VerifiedDeal == p2.VerifiedDeal &&
|
||||
p1.Label == p2.Label &&
|
||||
p1.Label.Equals(p2.Label) &&
|
||||
p1.StartEpoch == p2.StartEpoch &&
|
||||
p1.EndEpoch == p2.EndEpoch &&
|
||||
p1.StoragePricePerEpoch.Equals(p2.StoragePricePerEpoch) &&
|
||||
|
25
extern/storage-sealing/currentdealinfo_test.go
vendored
25
extern/storage-sealing/currentdealinfo_test.go
vendored
@ -8,10 +8,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -23,7 +25,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
evtmock "github.com/filecoin-project/lotus/chain/events/state/mock"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -32,6 +33,12 @@ import (
|
||||
var errNotFound = errors.New("could not find")
|
||||
|
||||
func TestGetCurrentDealInfo(t *testing.T) {
|
||||
success, err := market8.NewLabelFromString("success")
|
||||
require.NoError(t, err)
|
||||
|
||||
other, err := market8.NewLabelFromString("other")
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
dummyCid, _ := cid.Parse("bafkqaaa")
|
||||
dummyCid2, _ := cid.Parse("bafkqaab")
|
||||
@ -46,7 +53,7 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
StoragePricePerEpoch: abi.NewTokenAmount(1),
|
||||
ProviderCollateral: abi.NewTokenAmount(1),
|
||||
ClientCollateral: abi.NewTokenAmount(1),
|
||||
Label: "success",
|
||||
Label: success,
|
||||
}
|
||||
otherProposal := market.DealProposal{
|
||||
PieceCID: dummyCid2,
|
||||
@ -56,7 +63,7 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
StoragePricePerEpoch: abi.NewTokenAmount(1),
|
||||
ProviderCollateral: abi.NewTokenAmount(1),
|
||||
ClientCollateral: abi.NewTokenAmount(1),
|
||||
Label: "other",
|
||||
Label: other,
|
||||
}
|
||||
successDeal := &api.MarketDeal{
|
||||
Proposal: proposal,
|
||||
@ -260,11 +267,11 @@ type CurrentDealInfoMockAPI struct {
|
||||
|
||||
func (mapi *CurrentDealInfoMockAPI) ChainGetMessage(ctx context.Context, c cid.Cid) (*types.Message, error) {
|
||||
var dealIDs []abi.DealID
|
||||
var deals []market2.ClientDealProposal
|
||||
var deals []market.ClientDealProposal
|
||||
for k, dl := range mapi.MarketDeals {
|
||||
dealIDs = append(dealIDs, k.DealID)
|
||||
deals = append(deals, market2.ClientDealProposal{
|
||||
Proposal: market2.DealProposal(dl.Proposal),
|
||||
deals = append(deals, market.ClientDealProposal{
|
||||
Proposal: market8.DealProposal(market.DealProposal(dl.Proposal)),
|
||||
ClientSignature: crypto.Signature{
|
||||
Data: []byte("foo bar cat dog"),
|
||||
Type: crypto.SigTypeBLS,
|
||||
@ -275,7 +282,7 @@ func (mapi *CurrentDealInfoMockAPI) ChainGetMessage(ctx context.Context, c cid.C
|
||||
return dealIDs[i] < dealIDs[j]
|
||||
})
|
||||
buf := new(bytes.Buffer)
|
||||
params := market2.PublishStorageDealsParams{Deals: deals}
|
||||
params := market.PublishStorageDealsParams{Deals: deals}
|
||||
err := params.MarshalCBOR(buf)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
5
extern/storage-sealing/types_test.go
vendored
5
extern/storage-sealing/types_test.go
vendored
@ -4,6 +4,8 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@ -11,7 +13,6 @@ import (
|
||||
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
api "github.com/filecoin-project/lotus/api"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
|
||||
)
|
||||
|
||||
@ -29,7 +30,7 @@ func TestSectorInfoSerialization(t *testing.T) {
|
||||
StartEpoch: 0,
|
||||
EndEpoch: 100,
|
||||
},
|
||||
DealProposal: &market2.DealProposal{
|
||||
DealProposal: &market7.DealProposal{
|
||||
PieceCID: dummyCid,
|
||||
PieceSize: 5,
|
||||
Client: tutils.NewActorAddr(t, "client"),
|
||||
|
@ -3,14 +3,12 @@ package genesis
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
)
|
||||
|
||||
type ActorType string
|
||||
@ -24,7 +22,7 @@ type PreSeal struct {
|
||||
CommR cid.Cid
|
||||
CommD cid.Cid
|
||||
SectorID abi.SectorNumber
|
||||
Deal market2.DealProposal
|
||||
Deal market8.DealProposal
|
||||
ProofType abi.RegisteredSealProof
|
||||
}
|
||||
|
||||
|
8
go.mod
8
go.mod
@ -38,16 +38,16 @@ require (
|
||||
github.com/filecoin-project/go-data-transfer v1.15.1
|
||||
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.20.1
|
||||
github.com/filecoin-project/go-fil-markets v1.20.2-0.20220407213005-954803e6a2c8
|
||||
github.com/filecoin-project/go-jsonrpc v0.1.5
|
||||
github.com/filecoin-project/go-legs v0.3.7
|
||||
github.com/filecoin-project/go-legs v0.3.10
|
||||
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.1.3
|
||||
github.com/filecoin-project/go-statemachine v1.0.2
|
||||
github.com/filecoin-project/go-statestore v0.2.0
|
||||
github.com/filecoin-project/go-storedcounter v0.1.0
|
||||
github.com/filecoin-project/index-provider v0.5.0
|
||||
github.com/filecoin-project/index-provider v0.6.1
|
||||
github.com/filecoin-project/specs-actors v0.9.14
|
||||
github.com/filecoin-project/specs-actors/v2 v2.3.6
|
||||
github.com/filecoin-project/specs-actors/v3 v3.1.1
|
||||
@ -56,7 +56,7 @@ require (
|
||||
github.com/filecoin-project/specs-actors/v6 v6.0.1
|
||||
github.com/filecoin-project/specs-actors/v7 v7.0.0
|
||||
github.com/filecoin-project/specs-storage v0.2.2
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220407213329-8b2d3ecf4294
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220407202104-e375a8763a1c
|
||||
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
|
||||
|
31
go.sum
31
go.sum
@ -298,6 +298,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
|
||||
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/filecoin-project/dagstore v0.5.2 h1:Nd6oXdnolbbVhpMpkYT5PJHOjQp4OBSntHpMV5pxj3c=
|
||||
github.com/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0=
|
||||
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
|
||||
@ -335,8 +336,8 @@ github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88Oq
|
||||
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
|
||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
|
||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
|
||||
github.com/filecoin-project/go-fil-markets v1.20.1 h1:DwrFuNIWC0a2c2ESpHtdEMH3QCpR/hoZ5DwjNT+VJ+E=
|
||||
github.com/filecoin-project/go-fil-markets v1.20.1/go.mod h1:QV767KIWHrikVK8R0u2wTc5wkee4gXOf5/AfxDoQckw=
|
||||
github.com/filecoin-project/go-fil-markets v1.20.2-0.20220407213005-954803e6a2c8 h1:JYjWHFOoGUouZE3bu1DvIztkq11Q7S2VrNbcvfU3bOg=
|
||||
github.com/filecoin-project/go-fil-markets v1.20.2-0.20220407213005-954803e6a2c8/go.mod h1:lhA01KAScD9S/N4J5On9Y3vXmqm/r2yWlKrbKRItLGY=
|
||||
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
|
||||
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
|
||||
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
|
||||
@ -344,11 +345,11 @@ github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0/go.mod h1:7aWZdaQ1b16BVoQUYR+
|
||||
github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI=
|
||||
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI=
|
||||
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g=
|
||||
github.com/filecoin-project/go-indexer-core v0.2.8/go.mod h1:IagNfTdFuX4057kla43PjRCn3yBuUiZgIxuA0hTUamY=
|
||||
github.com/filecoin-project/go-indexer-core v0.2.9/go.mod h1:u03I3HB6ZnqCc3cm8Tq+QkTWBbfKOvNxM8K6Ny/IHRw=
|
||||
github.com/filecoin-project/go-jsonrpc v0.1.5 h1:ckxqZ09ivBAVf5CSmxxrqqNHC7PJm3GYGtYKiNQ+vGk=
|
||||
github.com/filecoin-project/go-jsonrpc v0.1.5/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
|
||||
github.com/filecoin-project/go-legs v0.3.7 h1:yfm7fx+iy1nPtgPEQ6kQjvhoJOVbXide50STYdy+yos=
|
||||
github.com/filecoin-project/go-legs v0.3.7/go.mod h1:pgekGm8/gKY5zCtQ/qGAoSjGP92wTLFqpO3GPHeu8YU=
|
||||
github.com/filecoin-project/go-legs v0.3.10 h1:B14z78do63gkxf5Br7rPnxZsZk/m9PR3Mx5aOf2WTIs=
|
||||
github.com/filecoin-project/go-legs v0.3.10/go.mod h1:5psVRe2nRQDa3PDtcd+2Ud4CirxOr2DI5VsDVMq7sIk=
|
||||
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak=
|
||||
github.com/filecoin-project/go-padreader v0.0.1 h1:8h2tVy5HpoNbr2gBRr+WD6zV6VD6XHig+ynSGJg8ZOs=
|
||||
github.com/filecoin-project/go-padreader v0.0.1/go.mod h1:VYVPJqwpsfmtoHnAmPx6MUwmrK6HIcDqZJiuZhtmfLQ=
|
||||
@ -367,13 +368,15 @@ github.com/filecoin-project/go-statemachine v1.0.1/go.mod h1:jZdXXiHa61n4NmgWFG4
|
||||
github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
|
||||
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||
github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd h1:Ykxbz+LvSCUIl2zFaaPGmF8KHXTJu9T/PymgHr7IHjs=
|
||||
github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
|
||||
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
|
||||
github.com/filecoin-project/go-statestore v0.2.0 h1:cRRO0aPLrxKQCZ2UOQbzFGn4WDNdofHZoGPjfNaAo5Q=
|
||||
github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo=
|
||||
github.com/filecoin-project/go-storedcounter v0.1.0 h1:Mui6wSUBC+cQGHbDUBcO7rfh5zQkWJM/CpAZa/uOuus=
|
||||
github.com/filecoin-project/go-storedcounter v0.1.0/go.mod h1:4ceukaXi4vFURIoxYMfKzaRF5Xv/Pinh2oTnoxpv+z8=
|
||||
github.com/filecoin-project/index-provider v0.5.0 h1:k2C1RFvOvxmA2i8bhmkb3b4qun7RDRDzzs/y25/TwQg=
|
||||
github.com/filecoin-project/index-provider v0.5.0/go.mod h1:KHVrP2vU3YuScb+fawObwTFoR882up9U07kk0ZrfP0c=
|
||||
github.com/filecoin-project/index-provider v0.6.1 h1:yVpmtm1ASl2JZMNDC6H2Fe0neYo5akYgaJJB2wlcsMU=
|
||||
github.com/filecoin-project/index-provider v0.6.1/go.mod h1:iAbSQ6sUpKC4GqfUSheGnYwj9d9B+X8pPi4BV1PgwZA=
|
||||
github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
|
||||
github.com/filecoin-project/specs-actors v0.9.14 h1:68PVstg2UB3ZsMLF+DKFTAs/YKsqhKWynkr0IqmVRQY=
|
||||
github.com/filecoin-project/specs-actors v0.9.14/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
|
||||
@ -402,10 +405,12 @@ github.com/filecoin-project/specs-actors/v8 v8.0.0-20220404082322-5f5089f6e8bd h
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220404082322-5f5089f6e8bd/go.mod h1:UYIPg65iPWoFw5NEftREdJwv9b/5yaLKdCgTvNI/2FA=
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220407213329-8b2d3ecf4294 h1:4GF9ZCcMmlZbDlUbBsOzFROM0gPnd9oo7QlYrQo5uvs=
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220407213329-8b2d3ecf4294/go.mod h1:UYIPg65iPWoFw5NEftREdJwv9b/5yaLKdCgTvNI/2FA=
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220407202104-e375a8763a1c h1:WdAk1RfDBOhypv+tFzdonzk3jjQIfk2FJBZdRyFrLN4=
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.0-20220407202104-e375a8763a1c/go.mod h1:UYIPg65iPWoFw5NEftREdJwv9b/5yaLKdCgTvNI/2FA=
|
||||
github.com/filecoin-project/specs-storage v0.2.0 h1:Y4UDv0apRQ3zI2GiPPubi8JblpUZZphEdaJUxCutfyg=
|
||||
github.com/filecoin-project/specs-storage v0.2.0/go.mod h1:Tb88Zq+IBJbvAn3mS89GYj3jdRThBTE/771HCVZdRJU=
|
||||
github.com/filecoin-project/storetheindex v0.3.5 h1:KoS9TvjPm6zIZfUH8atAHJbVHOO7GTP1MdTG+v0eE+Q=
|
||||
github.com/filecoin-project/storetheindex v0.3.5/go.mod h1:0r3d0kSpK63O6AvLr1CjAINLi+nWD49clzcnKV+GLpI=
|
||||
github.com/filecoin-project/storetheindex v0.4.0 h1:MPIDJYBknPbwBcVf+2/WEIK6LKxhZmfQGCrqKmvhFyU=
|
||||
github.com/filecoin-project/storetheindex v0.4.0/go.mod h1:LIwqpXoKeGxOGEjmxPfdYVPQYoZOSI3oXMUd9XTCpjc=
|
||||
github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg=
|
||||
github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
@ -596,6 +601,7 @@ github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
|
||||
@ -942,7 +948,7 @@ github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20211210234204-ce2a1c70cd
|
||||
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20211210234204-ce2a1c70cd73/go.mod h1:2PJ0JgxyB08t0b2WKrcuqI3di0V+5n6RS/LTUJhkoxY=
|
||||
github.com/ipld/go-ipld-selector-text-lite v0.0.1 h1:lNqFsQpBHc3p5xHob2KvEg/iM5dIFn6iw4L/Hh+kS1Y=
|
||||
github.com/ipld/go-ipld-selector-text-lite v0.0.1/go.mod h1:U2CQmFb+uWzfIEF3I1arrDa5rwtj00PrpiwwCO+k1RM=
|
||||
github.com/ipld/go-storethehash v0.0.1/go.mod h1:w8cQfWInks8lvvbQTiKbCPusU9v0sqiViBihTHbavpQ=
|
||||
github.com/ipld/go-storethehash v0.0.2/go.mod h1:w8cQfWInks8lvvbQTiKbCPusU9v0sqiViBihTHbavpQ=
|
||||
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c=
|
||||
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4=
|
||||
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
|
||||
@ -1081,6 +1087,9 @@ github.com/libp2p/go-libp2p v0.18.0-rc1/go.mod h1:RgYlH7IIWHXREimC92bw5Lg1V2R5Xm
|
||||
github.com/libp2p/go-libp2p v0.18.0-rc3/go.mod h1:WYL+Xw1iuwi6rdfzw5VIEpD+HqzYucHZ6fcUuumbI3M=
|
||||
github.com/libp2p/go-libp2p v0.18.1 h1:IK9EOGNO2ZghU4F+dx9c4xfhMNZr45x06CijJaZE/ms=
|
||||
github.com/libp2p/go-libp2p v0.18.1/go.mod h1:ll44MqmrIFKpL3BwCexxzm+7RZ8exEtN96V1rRdMG7Y=
|
||||
github.com/libp2p/go-libp2p v0.18.0-rc5/go.mod h1:aZPS5l84bDvCvP4jkyEUT/J6YOpUq33Fgqrs3K59mpI=
|
||||
github.com/libp2p/go-libp2p v0.18.0-rc6 h1:IR6TVPYGo1wDY0tY61gyPQVxK1koOkXh49ejVfAnH7A=
|
||||
github.com/libp2p/go-libp2p v0.18.0-rc6/go.mod h1:oOUOAlBrm1L0+jxT10h2TMUMTDz6pV3EvmkJ3beDYGQ=
|
||||
github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052/go.mod h1:nRMRTab+kZuk0LnKZpxhOVH/ndsdr2Nr//Zltc/vwgo=
|
||||
github.com/libp2p/go-libp2p-asn-util v0.1.0 h1:rABPCO77SjdbJ/eJ/ynIo8vWICy1VEnL5JAxJbQLo1E=
|
||||
github.com/libp2p/go-libp2p-asn-util v0.1.0/go.mod h1:wu+AnM9Ii2KgO5jMmS1rz9dvzTdj8BXqsPR9HR0XB7I=
|
||||
@ -1277,7 +1286,6 @@ github.com/libp2p/go-libp2p-swarm v0.5.3/go.mod h1:NBn7eNW2lu568L7Ns9wdFrOhgRlkR
|
||||
github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL0L1lXUZ5ot2Fvc=
|
||||
github.com/libp2p/go-libp2p-swarm v0.9.0/go.mod h1:2f8d8uxTJmpeqHF/1ujjdXZp+98nNIbujVOMEZxCbZ8=
|
||||
github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA=
|
||||
github.com/libp2p/go-libp2p-swarm v0.10.1/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs=
|
||||
github.com/libp2p/go-libp2p-swarm v0.10.2 h1:UaXf+CTq6Ns1N2V1EgqJ9Q3xaRsiN7ImVlDMpirMAWw=
|
||||
github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs=
|
||||
github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
|
||||
@ -1957,7 +1965,6 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:f
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20210303213153-67a261a1d291/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20210713220151-be142a5ae1a8/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20220224212727-7a699437a831/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20220302191723-37c43cae8e14 h1:vo2wkP2ceHyGyZwFFtAabpot03EeSxxwAe57pOI9E/4=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20220302191723-37c43cae8e14/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
"github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
)
|
||||
|
||||
func TestShardRegistration(t *testing.T) {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"go.uber.org/fx"
|
||||
@ -269,12 +269,12 @@ func (c *ClientNodeAdapter) DealProviderCollateralBounds(ctx context.Context, si
|
||||
}
|
||||
|
||||
// TODO: Remove dealID parameter, change publishCid to be cid.Cid (instead of pointer)
|
||||
func (c *ClientNodeAdapter) OnDealSectorPreCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, proposal market0.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorPreCommittedCallback) error {
|
||||
func (c *ClientNodeAdapter) OnDealSectorPreCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, proposal market8.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorPreCommittedCallback) error {
|
||||
return c.scMgr.OnDealSectorPreCommitted(ctx, provider, marketactor.DealProposal(proposal), *publishCid, cb)
|
||||
}
|
||||
|
||||
// TODO: Remove dealID parameter, change publishCid to be cid.Cid (instead of pointer)
|
||||
func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, sectorNumber abi.SectorNumber, proposal market0.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorCommittedCallback) error {
|
||||
func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, sectorNumber abi.SectorNumber, proposal market8.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorCommittedCallback) error {
|
||||
return c.scMgr.OnDealSectorCommitted(ctx, provider, sectorNumber, marketactor.DealProposal(proposal), *publishCid, cb)
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ func (c *ClientNodeAdapter) OnDealExpiredOrSlashed(ctx context.Context, dealID a
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Address, proposal market0.DealProposal) (*marketactor.ClientDealProposal, error) {
|
||||
func (c *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Address, proposal market8.DealProposal) (*marketactor.ClientDealProposal, error) {
|
||||
// TODO: output spec signed proposal
|
||||
buf, err := cborutil.Dump(&proposal)
|
||||
if err != nil {
|
||||
|
@ -15,8 +15,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -60,7 +58,7 @@ type DealPublisher struct {
|
||||
publishSpec *api.MessageSendSpec
|
||||
|
||||
lk sync.Mutex
|
||||
pending []*pendingDeal
|
||||
pending []*pendingDeal ``
|
||||
cancelWaitForMoreDeals context.CancelFunc
|
||||
publishPeriodStart time.Time
|
||||
startEpochSealingBuffer abi.ChainEpoch
|
||||
@ -69,7 +67,7 @@ type DealPublisher struct {
|
||||
// A deal that is queued to be published
|
||||
type pendingDeal struct {
|
||||
ctx context.Context
|
||||
deal market2.ClientDealProposal
|
||||
deal market.ClientDealProposal
|
||||
Result chan publishResult
|
||||
}
|
||||
|
||||
@ -79,7 +77,7 @@ type publishResult struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func newPendingDeal(ctx context.Context, deal market2.ClientDealProposal) *pendingDeal {
|
||||
func newPendingDeal(ctx context.Context, deal market.ClientDealProposal) *pendingDeal {
|
||||
return &pendingDeal{
|
||||
ctx: ctx,
|
||||
deal: deal,
|
||||
@ -151,7 +149,7 @@ func (p *DealPublisher) PendingDeals() api.PendingDealInfo {
|
||||
}
|
||||
}
|
||||
|
||||
pending := make([]market2.ClientDealProposal, len(deals))
|
||||
pending := make([]market.ClientDealProposal, len(deals))
|
||||
for i, deal := range deals {
|
||||
pending[i] = deal.deal
|
||||
}
|
||||
@ -173,7 +171,7 @@ func (p *DealPublisher) ForcePublishPendingDeals() {
|
||||
p.publishAllDeals()
|
||||
}
|
||||
|
||||
func (p *DealPublisher) Publish(ctx context.Context, deal market2.ClientDealProposal) (cid.Cid, error) {
|
||||
func (p *DealPublisher) Publish(ctx context.Context, deal market.ClientDealProposal) (cid.Cid, error) {
|
||||
pdeal := newPendingDeal(ctx, deal)
|
||||
|
||||
// Add the deal to the queue
|
||||
@ -297,7 +295,7 @@ func (p *DealPublisher) publishReady(ready []*pendingDeal) {
|
||||
|
||||
// Validate each deal to make sure it can be published
|
||||
validated := make([]*pendingDeal, 0, len(ready))
|
||||
deals := make([]market2.ClientDealProposal, 0, len(ready))
|
||||
deals := make([]market.ClientDealProposal, 0, len(ready))
|
||||
for _, pd := range ready {
|
||||
// Validate the deal
|
||||
if err := p.validateDeal(pd.deal); err != nil {
|
||||
@ -321,7 +319,7 @@ func (p *DealPublisher) publishReady(ready []*pendingDeal) {
|
||||
|
||||
// validateDeal checks that the deal proposal start epoch hasn't already
|
||||
// elapsed
|
||||
func (p *DealPublisher) validateDeal(deal market2.ClientDealProposal) error {
|
||||
func (p *DealPublisher) validateDeal(deal market.ClientDealProposal) error {
|
||||
start := time.Now()
|
||||
|
||||
pcid, err := deal.Proposal.Cid()
|
||||
@ -344,8 +342,8 @@ func (p *DealPublisher) validateDeal(deal market2.ClientDealProposal) error {
|
||||
return xerrors.Errorf("getting provider info: %w", err)
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&market2.PublishStorageDealsParams{
|
||||
Deals: []market0.ClientDealProposal{deal},
|
||||
params, err := actors.SerializeParams(&market.PublishStorageDealsParams{
|
||||
Deals: []market.ClientDealProposal{deal},
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("serializing PublishStorageDeals params failed: %w", err)
|
||||
@ -377,7 +375,7 @@ func (p *DealPublisher) validateDeal(deal market2.ClientDealProposal) error {
|
||||
}
|
||||
|
||||
// Sends the publish message
|
||||
func (p *DealPublisher) publishDealProposals(deals []market2.ClientDealProposal) (cid.Cid, error) {
|
||||
func (p *DealPublisher) publishDealProposals(deals []market.ClientDealProposal) (cid.Cid, error) {
|
||||
if len(deals) == 0 {
|
||||
return cid.Undef, nil
|
||||
}
|
||||
@ -400,7 +398,7 @@ func (p *DealPublisher) publishDealProposals(deals []market2.ClientDealProposal)
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&market2.PublishStorageDealsParams{
|
||||
params, err := actors.SerializeParams(&market.PublishStorageDealsParams{
|
||||
Deals: deals,
|
||||
})
|
||||
|
||||
@ -427,7 +425,7 @@ func (p *DealPublisher) publishDealProposals(deals []market2.ClientDealProposal)
|
||||
return smsg.Cid(), nil
|
||||
}
|
||||
|
||||
func pieceCids(deals []market2.ClientDealProposal) string {
|
||||
func pieceCids(deals []market.ClientDealProposal) string {
|
||||
cids := make([]string, 0, len(deals))
|
||||
for _, dl := range deals {
|
||||
cids = append(cids, dl.Proposal.PieceCID.String())
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/raulk/clock"
|
||||
"golang.org/x/xerrors"
|
||||
@ -25,7 +27,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
)
|
||||
|
||||
func TestDealPublisher(t *testing.T) {
|
||||
@ -250,7 +251,7 @@ func publishDeal(t *testing.T, dp *DealPublisher, invalid int, ctxCancelled bool
|
||||
startEpoch = abi.ChainEpoch(5)
|
||||
}
|
||||
deal := market.ClientDealProposal{
|
||||
Proposal: market0.DealProposal{
|
||||
Proposal: market8.DealProposal{
|
||||
PieceCID: generateCids(1)[0],
|
||||
Client: getClientActor(t),
|
||||
Provider: getProviderActor(t),
|
||||
@ -297,7 +298,7 @@ func checkPublishedDeals(t *testing.T, dpapi *dpAPI, dealsToPublish []market.Cli
|
||||
require.Equal(t, market.Methods.PublishStorageDeals, msg.Method)
|
||||
|
||||
// Check that the expected number of deals was included in the message
|
||||
var params market2.PublishStorageDealsParams
|
||||
var params market.PublishStorageDealsParams
|
||||
err := params.UnmarshalCBOR(bytes.NewReader(msg.Params))
|
||||
require.NoError(t, err)
|
||||
require.Len(t, params.Deals, expectedDealsInMsg)
|
||||
@ -335,7 +336,7 @@ func matchPieceCids(sent []market.ClientDealProposal, exp []market.ClientDealPro
|
||||
return true
|
||||
}
|
||||
|
||||
func dealPieceCids(deals []market2.ClientDealProposal) []cid.Cid {
|
||||
func dealPieceCids(deals []market.ClientDealProposal) []cid.Cid {
|
||||
cids := make([]cid.Cid, 0, len(deals))
|
||||
for _, dl := range deals {
|
||||
cids = append(cids, dl.Proposal.PieceCID)
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
|
||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
@ -31,6 +33,9 @@ import (
|
||||
)
|
||||
|
||||
func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
label, err := market7.NewDealLabelFromString("success")
|
||||
require.NoError(t, err)
|
||||
|
||||
provider := address.TestAddress
|
||||
ctx := context.Background()
|
||||
publishCid := generateCids(1)[0]
|
||||
@ -46,7 +51,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
StoragePricePerEpoch: abi.NewTokenAmount(1),
|
||||
ProviderCollateral: abi.NewTokenAmount(1),
|
||||
ClientCollateral: abi.NewTokenAmount(1),
|
||||
Label: "success",
|
||||
Label: label,
|
||||
}
|
||||
unfinishedDeal := &api.MarketDeal{
|
||||
Proposal: proposal,
|
||||
@ -252,6 +257,9 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOnDealSectorCommitted(t *testing.T) {
|
||||
label, err := market7.NewDealLabelFromString("success")
|
||||
require.NoError(t, err)
|
||||
|
||||
provider := address.TestAddress
|
||||
publishCid := generateCids(1)[0]
|
||||
pieceCid := generateCids(1)[0]
|
||||
@ -265,7 +273,7 @@ func TestOnDealSectorCommitted(t *testing.T) {
|
||||
StoragePricePerEpoch: abi.NewTokenAmount(1),
|
||||
ProviderCollateral: abi.NewTokenAmount(1),
|
||||
ClientCollateral: abi.NewTokenAmount(1),
|
||||
Label: "success",
|
||||
Label: label,
|
||||
}
|
||||
unfinishedDeal := &api.MarketDeal{
|
||||
Proposal: proposal,
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"go.uber.org/fx"
|
||||
@ -17,7 +19,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
@ -284,12 +285,12 @@ func (n *ProviderNodeAdapter) DealProviderCollateralBounds(ctx context.Context,
|
||||
}
|
||||
|
||||
// TODO: Remove dealID parameter, change publishCid to be cid.Cid (instead of pointer)
|
||||
func (n *ProviderNodeAdapter) OnDealSectorPreCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, proposal market2.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorPreCommittedCallback) error {
|
||||
func (n *ProviderNodeAdapter) OnDealSectorPreCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, proposal market8.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorPreCommittedCallback) error {
|
||||
return n.scMgr.OnDealSectorPreCommitted(ctx, provider, market.DealProposal(proposal), *publishCid, cb)
|
||||
}
|
||||
|
||||
// TODO: Remove dealID parameter, change publishCid to be cid.Cid (instead of pointer)
|
||||
func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, sectorNumber abi.SectorNumber, proposal market2.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorCommittedCallback) error {
|
||||
func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, sectorNumber abi.SectorNumber, proposal market8.DealProposal, publishCid *cid.Cid, cb storagemarket.DealSectorCommittedCallback) error {
|
||||
return n.scMgr.OnDealSectorCommitted(ctx, provider, sectorNumber, market.DealProposal(proposal), *publishCid, cb)
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ func (n *ProviderNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid,
|
||||
return cb(receipt.Receipt.ExitCode, receipt.Receipt.Return, receipt.Message, nil)
|
||||
}
|
||||
|
||||
func (n *ProviderNodeAdapter) WaitForPublishDeals(ctx context.Context, publishCid cid.Cid, proposal market2.DealProposal) (*storagemarket.PublishDealsWaitResult, error) {
|
||||
func (n *ProviderNodeAdapter) WaitForPublishDeals(ctx context.Context, publishCid cid.Cid, proposal market8.DealProposal) (*storagemarket.PublishDealsWaitResult, error) {
|
||||
// Wait for deal to be published (plus additional time for confidence)
|
||||
receipt, err := n.StateWaitMsg(ctx, publishCid, 2*build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
||||
|
||||
bstore "github.com/ipfs/go-ipfs-blockstore"
|
||||
format "github.com/ipfs/go-ipld-format"
|
||||
unixfile "github.com/ipfs/go-unixfs/file"
|
||||
@ -60,7 +62,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/markets/storageadapter"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/node/repo/imports"
|
||||
@ -233,12 +234,17 @@ func (a *API) dealStarter(ctx context.Context, params *api.StartDealParams, isSt
|
||||
// stateless flow from here to the end
|
||||
//
|
||||
|
||||
dealProposal := &market.DealProposal{
|
||||
label, err := market8.NewLabelFromString(params.Data.Root.Encode(multibase.MustNewEncoder('u')))
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to encode label: %w", err)
|
||||
}
|
||||
|
||||
dealProposal := &market8.DealProposal{
|
||||
PieceCID: *params.Data.PieceCid,
|
||||
PieceSize: params.Data.PieceSize.Padded(),
|
||||
Client: walletKey,
|
||||
Provider: params.Miner,
|
||||
Label: params.Data.Root.Encode(multibase.MustNewEncoder('u')),
|
||||
Label: label,
|
||||
StartEpoch: dealStart,
|
||||
EndEpoch: calcDealExpiration(params.MinBlocksDuration, md, dealStart),
|
||||
StoragePricePerEpoch: big.Zero(),
|
||||
@ -265,7 +271,7 @@ func (a *API) dealStarter(ctx context.Context, params *api.StartDealParams, isSt
|
||||
return nil, xerrors.Errorf("failed to sign proposal : %w", err)
|
||||
}
|
||||
|
||||
dealProposalSigned := &market.ClientDealProposal{
|
||||
dealProposalSigned := &market8.ClientDealProposal{
|
||||
Proposal: *dealProposal,
|
||||
ClientSignature: *dealProposalSig,
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/mock"
|
||||
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
@ -39,6 +39,11 @@ func PreSeal(spt abi.RegisteredSealProof, maddr address.Address, sectors int) (*
|
||||
}
|
||||
|
||||
for i := range genm.Sectors {
|
||||
label, err := market7.NewDealLabelFromString(fmt.Sprintf("%d", i))
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("failed to create label: %w", err)
|
||||
}
|
||||
|
||||
preseal := &genesis.PreSeal{}
|
||||
|
||||
preseal.ProofType = spt
|
||||
@ -47,12 +52,12 @@ func PreSeal(spt abi.RegisteredSealProof, maddr address.Address, sectors int) (*
|
||||
r := mock.CommDR(d)
|
||||
preseal.CommR, _ = commcid.ReplicaCommitmentV1ToCID(r[:])
|
||||
preseal.SectorID = abi.SectorNumber(i + 1)
|
||||
preseal.Deal = market2.DealProposal{
|
||||
preseal.Deal = market7.DealProposal{
|
||||
PieceCID: preseal.CommD,
|
||||
PieceSize: abi.PaddedPieceSize(ssize),
|
||||
Client: k.Address,
|
||||
Provider: maddr,
|
||||
Label: fmt.Sprintf("%d", i),
|
||||
Label: label,
|
||||
StartEpoch: 1,
|
||||
EndEpoch: 10000,
|
||||
StoragePricePerEpoch: big.Zero(),
|
||||
|
Loading…
Reference in New Issue
Block a user