From 8f5c0c60f511501c4dfa80e8a1ac850a0fee0752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Jul 2021 18:00:54 +0200 Subject: [PATCH 1/6] Config for deal publishing control addresses --- api/api_storage.go | 8 +++++--- cmd/lotus-storage-miner/actor.go | 14 ++++++++++++++ node/config/def.go | 13 ++++++++----- node/modules/storageminer.go | 9 +++++++++ storage/addresses.go | 3 +++ 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/api/api_storage.go b/api/api_storage.go index 0ccfbd88f6f..6afa86e6983 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -280,14 +280,16 @@ const ( PreCommitAddr AddrUse = iota CommitAddr PoStAddr + DealPublishAddr TerminateSectorsAddr ) type AddressConfig struct { - PreCommitControl []address.Address - CommitControl []address.Address - TerminateControl []address.Address + PreCommitControl []address.Address + CommitControl []address.Address + TerminateControl []address.Address + DealPublishControl []address.Address DisableOwnerFallback bool DisableWorkerFallback bool diff --git a/cmd/lotus-storage-miner/actor.go b/cmd/lotus-storage-miner/actor.go index 7e428d0e4af..3af589ea542 100644 --- a/cmd/lotus-storage-miner/actor.go +++ b/cmd/lotus-storage-miner/actor.go @@ -435,6 +435,7 @@ var actorControlList = &cli.Command{ commit := map[address.Address]struct{}{} precommit := map[address.Address]struct{}{} terminate := map[address.Address]struct{}{} + dealPublish := map[address.Address]struct{}{} post := map[address.Address]struct{}{} for _, ca := range mi.ControlAddresses { @@ -471,6 +472,16 @@ var actorControlList = &cli.Command{ terminate[ca] = struct{}{} } + for _, ca := range ac.DealPublishControl { + ca, err := api.StateLookupID(ctx, ca, types.EmptyTSK) + if err != nil { + return err + } + + delete(post, ca) + dealPublish[ca] = struct{}{} + } + printKey := func(name string, a address.Address) { b, err := api.WalletBalance(ctx, a) if err != nil { @@ -515,6 +526,9 @@ var actorControlList = &cli.Command{ if _, ok := terminate[a]; ok { uses = append(uses, color.YellowString("terminate")) } + if _, ok := dealPublish[a]; ok { + uses = append(uses, color.MagentaString("deals")) + } tw.Write(map[string]interface{}{ "name": name, diff --git a/node/config/def.go b/node/config/def.go index 240fadbd93f..f9a479d75d8 100644 --- a/node/config/def.go +++ b/node/config/def.go @@ -182,9 +182,10 @@ type MinerFeeConfig struct { } type MinerAddressConfig struct { - PreCommitControl []string - CommitControl []string - TerminateControl []string + PreCommitControl []string + CommitControl []string + TerminateControl []string + DealPublishControl []string // DisableOwnerFallback disables usage of the owner address for messages // sent automatically @@ -404,8 +405,10 @@ func DefaultStorageMiner() *StorageMiner { }, Addresses: MinerAddressConfig{ - PreCommitControl: []string{}, - CommitControl: []string{}, + PreCommitControl: []string{}, + CommitControl: []string{}, + TerminateControl: []string{}, + DealPublishControl: []string{}, }, } cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http" diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 8508850d3e9..0f281327e16 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -188,6 +188,15 @@ func AddressSelector(addrConf *config.MinerAddressConfig) func() (*storage.Addre as.TerminateControl = append(as.TerminateControl, addr) } + for _, s := range addrConf.DealPublishControl { + addr, err := address.NewFromString(s) + if err != nil { + return nil, xerrors.Errorf("parsing deal publishing control address: %w", err) + } + + as.DealPublishControl = append(as.DealPublishControl, addr) + } + return as, nil } } diff --git a/storage/addresses.go b/storage/addresses.go index a8e5e7101e2..2efec8ce09c 100644 --- a/storage/addresses.go +++ b/storage/addresses.go @@ -32,6 +32,8 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi m addrs = append(addrs, as.CommitControl...) case api.TerminateSectorsAddr: addrs = append(addrs, as.TerminateControl...) + case api.DealPublishAddr: + addrs = append(addrs, as.DealPublishControl...) default: defaultCtl := map[address.Address]struct{}{} for _, a := range mi.ControlAddresses { @@ -43,6 +45,7 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi m configCtl := append([]address.Address{}, as.PreCommitControl...) configCtl = append(configCtl, as.CommitControl...) configCtl = append(configCtl, as.TerminateControl...) + configCtl = append(configCtl, as.DealPublishControl...) for _, addr := range configCtl { if addr.Protocol() != address.ID { From ee97aa0a8a974dbea09b025aec1b8d56a7d40d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Jul 2021 19:12:03 +0200 Subject: [PATCH 2/6] dealpublisher: Use address selector --- api/api_storage.go | 2 +- itests/deals_publish_test.go | 36 +++++++++++++--- itests/kit/control.go | 43 ++++++++++++++++++++ itests/kit/funds.go | 9 +++- markets/storageadapter/dealpublisher.go | 34 +++++++++++----- markets/storageadapter/dealpublisher_test.go | 20 ++++++++- storage/addresses.go | 7 ++++ 7 files changed, 130 insertions(+), 21 deletions(-) create mode 100644 itests/kit/control.go diff --git a/api/api_storage.go b/api/api_storage.go index 6afa86e6983..f76b0a8b0cf 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -279,8 +279,8 @@ type AddrUse int const ( PreCommitAddr AddrUse = iota CommitAddr - PoStAddr DealPublishAddr + PoStAddr TerminateSectorsAddr ) diff --git a/itests/deals_publish_test.go b/itests/deals_publish_test.go index 16f84038bbb..ab0e20f669f 100644 --- a/itests/deals_publish_test.go +++ b/itests/deals_publish_test.go @@ -11,9 +11,13 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/node" + "github.com/filecoin-project/lotus/node/config" + "github.com/filecoin-project/lotus/node/modules" + "github.com/filecoin-project/lotus/storage" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" "github.com/stretchr/testify/require" ) @@ -28,16 +32,34 @@ func TestPublishDealsBatching(t *testing.T) { kit.QuietMiningLogs() - opts := node.Override(new(*storageadapter.DealPublisher), - storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{ - Period: publishPeriod, - MaxDealsPerMsg: maxDealsPerMsg, - }), + publisherKey, err := wallet.GenerateKey(types.KTSecp256k1) + require.NoError(t, err) + + opts := node.Options( + node.Override(new(*storageadapter.DealPublisher), + storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{ + Period: publishPeriod, + MaxDealsPerMsg: maxDealsPerMsg, + }), + ), + node.Override(new(*storage.AddressSelector), modules.AddressSelector(&config.MinerAddressConfig{ + DealPublishControl: []string{ + publisherKey.Address.String(), + }, + DisableOwnerFallback: true, + DisableWorkerFallback: true, + })), + kit.LatestActorsAt(-1), ) - client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ConstructorOpts(opts)) + client, miner, ens := kit.EnsembleMinimal(t, kit.Account(publisherKey, types.FromFil(10)), kit.MockProofs(), kit.ConstructorOpts(opts)) ens.InterconnectAll().BeginMining(10 * time.Millisecond) + _, err = client.WalletImport(ctx, &publisherKey.KeyInfo) + require.NoError(t, err) + + kit.SetControlAddresses(t, client, miner, publisherKey.Address) + dh := kit.NewDealHarness(t, client, miner) // Starts a deal and waits until it's published @@ -93,6 +115,8 @@ func TestPublishDealsBatching(t *testing.T) { require.NoError(t, err) require.Len(t, pubDealsParams.Deals, int(maxDealsPerMsg)) } + + require.Equal(t, publisherKey.Address.String(), msg.From.String()) } require.Equal(t, 1, count) diff --git a/itests/kit/control.go b/itests/kit/control.go new file mode 100644 index 00000000000..0528c4c8993 --- /dev/null +++ b/itests/kit/control.go @@ -0,0 +1,43 @@ +package kit + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + addr "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/big" + miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" + + "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/lotus/chain/actors/builtin/miner" + "github.com/filecoin-project/lotus/chain/types" +) + +func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs ...addr.Address) { + ctx := context.TODO() + + mi, err := client.StateMinerInfo(ctx, w.ActorAddr, types.EmptyTSK) + require.NoError(t, err) + + cwp := &miner2.ChangeWorkerAddressParams{ + NewWorker: mi.Worker, + NewControlAddrs: addrs, + } + + sp, err := actors.SerializeParams(cwp) + require.NoError(t, err) + + smsg, err := client.MpoolPushMessage(ctx, &types.Message{ + From: mi.Owner, + To: w.ActorAddr, + Method: miner.Methods.ChangeWorkerAddress, + + Value: big.Zero(), + Params: sp, + }, nil) + require.NoError(t, err) + + WaitMsg(ctx, t, client, smsg.Cid()) +} diff --git a/itests/kit/funds.go b/itests/kit/funds.go index 417cf9ce1b1..1d023b6abaa 100644 --- a/itests/kit/funds.go +++ b/itests/kit/funds.go @@ -2,6 +2,7 @@ package kit import ( "context" + "github.com/ipfs/go-cid" "testing" "github.com/filecoin-project/go-state-types/abi" @@ -27,8 +28,12 @@ func SendFunds(ctx context.Context, t *testing.T, sender *TestFullNode, recipien sm, err := sender.MpoolPushMessage(ctx, msg, nil) require.NoError(t, err) - res, err := sender.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true) + WaitMsg(ctx, t, sender, sm.Cid()) +} + +func WaitMsg(ctx context.Context, t *testing.T, node *TestFullNode, msg cid.Cid) { + res, err := node.StateWaitMsg(ctx, msg, 3, api.LookbackNoLimit, true) require.NoError(t, err) - require.EqualValues(t, 0, res.Receipt.ExitCode, "did not successfully send funds") + require.EqualValues(t, 0, res.Receipt.ExitCode, "message did not successfully execute") } diff --git a/markets/storageadapter/dealpublisher.go b/markets/storageadapter/dealpublisher.go index 157c85ed76f..9f7ba162953 100644 --- a/markets/storageadapter/dealpublisher.go +++ b/markets/storageadapter/dealpublisher.go @@ -7,27 +7,33 @@ import ( "sync" "time" + "github.com/ipfs/go-cid" "go.uber.org/fx" + "golang.org/x/xerrors" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/node/config" + "github.com/filecoin-project/go-state-types/big" + market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/chain/actors" "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" - market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" - "github.com/ipfs/go-cid" - "golang.org/x/xerrors" + "github.com/filecoin-project/lotus/node/config" + "github.com/filecoin-project/lotus/storage" ) type dealPublisherAPI interface { ChainHead(context.Context) (*types.TipSet, error) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) + + WalletBalance(context.Context, address.Address) (types.BigInt, error) + WalletHas(context.Context, address.Address) (bool, error) + StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error) + StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) } // DealPublisher batches deal publishing so that many deals can be included in @@ -40,6 +46,7 @@ type dealPublisherAPI interface { // publish message with all deals in the queue. type DealPublisher struct { api dealPublisherAPI + as *storage.AddressSelector ctx context.Context Shutdown context.CancelFunc @@ -87,14 +94,14 @@ type PublishMsgConfig struct { func NewDealPublisher( feeConfig *config.MinerFeeConfig, publishMsgCfg PublishMsgConfig, -) func(lc fx.Lifecycle, full api.FullNode) *DealPublisher { - return func(lc fx.Lifecycle, full api.FullNode) *DealPublisher { +) func(lc fx.Lifecycle, full api.FullNode, as *storage.AddressSelector) *DealPublisher { + return func(lc fx.Lifecycle, full api.FullNode, as *storage.AddressSelector) *DealPublisher { maxFee := abi.NewTokenAmount(0) if feeConfig != nil { maxFee = abi.TokenAmount(feeConfig.MaxPublishDealsFee) } publishSpec := &api.MessageSendSpec{MaxFee: maxFee} - dp := newDealPublisher(full, publishMsgCfg, publishSpec) + dp := newDealPublisher(full, as, publishMsgCfg, publishSpec) lc.Append(fx.Hook{ OnStop: func(ctx context.Context) error { dp.Shutdown() @@ -107,12 +114,14 @@ func NewDealPublisher( func newDealPublisher( dpapi dealPublisherAPI, + as *storage.AddressSelector, publishMsgCfg PublishMsgConfig, publishSpec *api.MessageSendSpec, ) *DealPublisher { ctx, cancel := context.WithCancel(context.Background()) return &DealPublisher{ api: dpapi, + as: as, ctx: ctx, Shutdown: cancel, maxDealsPerPublishMsg: publishMsgCfg.MaxDealsPerMsg, @@ -345,9 +354,14 @@ func (p *DealPublisher) publishDealProposals(deals []market2.ClientDealProposal) return cid.Undef, xerrors.Errorf("serializing PublishStorageDeals params failed: %w", err) } + addr, _, err := p.as.AddressFor(p.ctx, p.api, mi, api.DealPublishAddr, big.Zero(), big.Zero()) + if err != nil { + return cid.Undef, xerrors.Errorf("selecting address for publishing deals: %w", err) + } + smsg, err := p.api.MpoolPushMessage(p.ctx, &types.Message{ To: market.Address, - From: mi.Worker, + From: addr, Value: types.NewInt(0), Method: market.Methods.PublishStorageDeals, Params: params, diff --git a/markets/storageadapter/dealpublisher_test.go b/markets/storageadapter/dealpublisher_test.go index 746c67d0ef9..3f27425aef8 100644 --- a/markets/storageadapter/dealpublisher_test.go +++ b/markets/storageadapter/dealpublisher_test.go @@ -94,7 +94,7 @@ func TestDealPublisher(t *testing.T) { dpapi := newDPAPI(t) // Create a deal publisher - dp := newDealPublisher(dpapi, PublishMsgConfig{ + dp := newDealPublisher(dpapi, nil, PublishMsgConfig{ Period: tc.publishPeriod, MaxDealsPerMsg: tc.maxDealsPerMsg, }, &api.MessageSendSpec{MaxFee: abi.NewTokenAmount(1)}) @@ -134,7 +134,7 @@ func TestForcePublish(t *testing.T) { // Create a deal publisher start := time.Now() publishPeriod := time.Hour - dp := newDealPublisher(dpapi, PublishMsgConfig{ + dp := newDealPublisher(dpapi, nil, PublishMsgConfig{ Period: publishPeriod, MaxDealsPerMsg: 10, }, &api.MessageSendSpec{MaxFee: abi.NewTokenAmount(1)}) @@ -320,6 +320,22 @@ func (d *dpAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spec * return &types.SignedMessage{Message: *msg}, nil } +func (d *dpAPI) WalletBalance(ctx context.Context, a address.Address) (types.BigInt, error) { + panic("don't call me") +} + +func (d *dpAPI) WalletHas(ctx context.Context, a address.Address) (bool, error) { + panic("don't call me") +} + +func (d *dpAPI) StateAccountKey(ctx context.Context, a address.Address, key types.TipSetKey) (address.Address, error) { + panic("don't call me") +} + +func (d *dpAPI) StateLookupID(ctx context.Context, a address.Address, key types.TipSetKey) (address.Address, error) { + panic("don't call me") +} + func getClientActor(t *testing.T) address.Address { return tutils.NewActorAddr(t, "client") } diff --git a/storage/addresses.go b/storage/addresses.go index 2efec8ce09c..f8f06ed9813 100644 --- a/storage/addresses.go +++ b/storage/addresses.go @@ -5,6 +5,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -24,6 +25,12 @@ type AddressSelector struct { } func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi miner.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) { + if as == nil { + // should only happen in some tests + log.Warnw("smart address selection disabled, using worker address") + return mi.Worker, big.Zero(), nil + } + var addrs []address.Address switch use { case api.PreCommitAddr: From 2dc27d6ab45ae6cb0a32ac448a648ce2c19ef5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Jul 2021 19:35:27 +0200 Subject: [PATCH 3/6] itests: Fix deal provider collateral flakiness --- build/openrpc/miner.json.gz | Bin 8102 -> 8114 bytes chain/actors/policy/policy.go | 24 +++++++++++++++++++++++ chain/actors/policy/policy.go.template | 11 +++++++++++ documentation/en/api-v0-methods-miner.md | 1 + itests/ccupgrade_test.go | 10 +++++++--- itests/kit/funds.go | 5 +++-- itests/kit/init.go | 3 +++ 7 files changed, 49 insertions(+), 5 deletions(-) diff --git a/build/openrpc/miner.json.gz b/build/openrpc/miner.json.gz index cc9a8948a2e85881f60d7ba36719fe394826a91d..f7ad7b9c0a1c4ff98eaef18e96997eb9f7781735 100644 GIT binary patch literal 8114 zcmV;jA5GvNiwFP!00000|LlEhbKADI_Fv)f{cw_utmqb7*3ACk*h%WvZgecWIlGCc zg-A%kHc4=kkYm^5|NagDUPV9zFH&TMZKsJyU;zZyde#LCz>|($=y!Ytv zx&v%l^&_&NfsxZbF$nffOw)tDueWp)`i6&G!pZ#o_uq5;&6zD7Lwn_GZzcqLU=A;l z1HB3HmIisPB?-K8JDPzV0v|~Gl>hl!dj#aqZ>+RIS z)3-M83H06q7rk{o{P6hK96Iee{(l#}qs~x&er~O2t5fXE(7ZBpaWY~SOBE@?U=h)c zu-W*gqWJ#vd1yeA%+o8;E7+bODXKv4`&|5SEgh6a}f=Oi}v^ z&Jpb&G{<;C#vaDAmge@fueUxY8%*&Pq|f^rMc>!jD;v09xKFkTc6VW13y z-_NaJ6jjPT3v?@+!E5%k0D%NHCgzAM=)zOf&rA`O5v4hy)Ds;DEt~R)y+$lEyBb@H|OH>_08n3_a~>n-HiWwe=_;-*ZAc67Y#c1$it3JQSKgih+6iV4~a&w=3^Ub zE+C7R1{{;M_06G;(PxQHeqTUGGk|5$7E_;zeAWZxus%{oW_7IpFkXq1Pe-ua7ibLbnCeO2mlxS}xLLPV;Kf?XkRla&BiARbiDPWX(xhhGtUY=T^+;G%(IO3EOZk&7QF>AYC zmJ-vgiLIo>8`jzqYpEFOe{6)YL{w{HD+%d_skXyZ$Lp;0bKAupIRgZgXQ7yeEHGmr zvwez878h3v(q!pwCGH*cGk=*<7-vq?Iz^`DQHJoLLwpTrKD1^Byv!6ib3RZG2~#Sd zsiBBkTRSHj^0gWEY-noJM-6Cy@SMq(2DDRbLPLA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=4ub&mejTlz1= zqyDfjh)4B}EW1XHWJGzyFczRDD%5+hm<=Az1;OrNOSch@{aQ`7h~{T!jJ|Y$C$<(H za)bK0dAs>>Au~VeGveBSv9$>(JfO&iS;rF!At`Z&;=Z|*vYQVDHclv@Rn!fyucB{O zL77)n(>FmITTnQez06TKvO4uCoF|><*d@?ZKz2(%pJU>}E9jA>Ys929_T)*wg!Xvx z=ph4G`lxp_7#kf_v!~Wr5*wRnO zH=aH^9JKUL{BK`%@M(Obb^HAz{gw&O2MnfGBq*2AzVV=Wi7;15!B6nOe|~b7BGlve z`jr3HN1f*!Ra7LY&!?$$NNv#htQ5bnvzhsS{tVTo8dv8vtI@>kB16KbPGvwo`6bo! z5fi+o6he%%nqmdPvUO?6I8!QiAmr(7F2(Gsis5&J-ah~T00030{{WAiT>Fdx00Y|9 AwEzGB diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index c159dc98f22..426ea9300b6 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -196,6 +196,30 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab } } +func SetProviderCollateralSupplyTarget(num, denom big.Int) { + + market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{ + Numerator: num, + Denominator: denom, + } + + market3.ProviderCollateralSupplyTarget = builtin3.BigFrac{ + Numerator: num, + Denominator: denom, + } + + market4.ProviderCollateralSupplyTarget = builtin4.BigFrac{ + Numerator: num, + Denominator: denom, + } + + market5.ProviderCollateralSupplyTarget = builtin5.BigFrac{ + Numerator: num, + Denominator: denom, + } + +} + func DealProviderCollateralBounds( size abi.PaddedPieceSize, verified bool, rawBytePower, qaPower, baselinePower abi.StoragePower, diff --git a/chain/actors/policy/policy.go.template b/chain/actors/policy/policy.go.template index 17b3eb0ff70..84ba4b91473 100644 --- a/chain/actors/policy/policy.go.template +++ b/chain/actors/policy/policy.go.template @@ -132,6 +132,17 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab } } +func SetProviderCollateralSupplyTarget(num, denom big.Int) { +{{range .versions}} + {{if (ge . 2)}} + market{{.}}.ProviderCollateralSupplyTarget = builtin{{.}}.BigFrac{ + Numerator: num, + Denominator: denom, + } + {{end}} +{{end}} +} + func DealProviderCollateralBounds( size abi.PaddedPieceSize, verified bool, rawBytePower, qaPower, baselinePower abi.StoragePower, diff --git a/documentation/en/api-v0-methods-miner.md b/documentation/en/api-v0-methods-miner.md index 496f63a0851..51a08c4f169 100644 --- a/documentation/en/api-v0-methods-miner.md +++ b/documentation/en/api-v0-methods-miner.md @@ -227,6 +227,7 @@ Response: "PreCommitControl": null, "CommitControl": null, "TerminateControl": null, + "DealPublishControl": null, "DisableOwnerFallback": true, "DisableWorkerFallback": true } diff --git a/itests/ccupgrade_test.go b/itests/ccupgrade_test.go index eac2523bf6e..e94a2144187 100644 --- a/itests/ccupgrade_test.go +++ b/itests/ccupgrade_test.go @@ -73,9 +73,13 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) { { exp, err := client.StateSectorExpiration(ctx, maddr, CC, types.EmptyTSK) - require.NoError(t, err) - require.NotNil(t, exp) - require.Greater(t, 50000, int(exp.OnTime)) + if err != nil { + require.Contains(t, err.Error(), "failed to find sector 3") // already cleaned up + } else { + require.NoError(t, err) + require.NotNil(t, exp) + require.Greater(t, 50000, int(exp.OnTime)) + } } { exp, err := client.StateSectorExpiration(ctx, maddr, Upgraded, types.EmptyTSK) diff --git a/itests/kit/funds.go b/itests/kit/funds.go index 1d023b6abaa..100e77183f7 100644 --- a/itests/kit/funds.go +++ b/itests/kit/funds.go @@ -2,12 +2,13 @@ package kit import ( "context" - "github.com/ipfs/go-cid" "testing" - "github.com/filecoin-project/go-state-types/abi" "github.com/stretchr/testify/require" + "github.com/filecoin-project/go-state-types/abi" + "github.com/ipfs/go-cid" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" diff --git a/itests/kit/init.go b/itests/kit/init.go index 8df4922b864..dc8463cb4e4 100644 --- a/itests/kit/init.go +++ b/itests/kit/init.go @@ -5,6 +5,7 @@ import ( "os" "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors/policy" logging "github.com/ipfs/go-log/v2" @@ -13,6 +14,8 @@ import ( func init() { _ = logging.SetLogLevel("*", "INFO") + policy.SetProviderCollateralSupplyTarget(big.Zero(), big.NewInt(1)) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) From d0e87a74875eb266f35e03a38e62d8dce9537a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Jul 2021 20:01:40 +0200 Subject: [PATCH 4/6] dealpublisher: Fix provider address checks --- itests/deals_publish_test.go | 3 +-- markets/storageadapter/client.go | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/itests/deals_publish_test.go b/itests/deals_publish_test.go index ab0e20f669f..296152e3400 100644 --- a/itests/deals_publish_test.go +++ b/itests/deals_publish_test.go @@ -114,9 +114,8 @@ func TestPublishDealsBatching(t *testing.T) { err = pubDealsParams.UnmarshalCBOR(bytes.NewReader(msg.Params)) require.NoError(t, err) require.Len(t, pubDealsParams.Deals, int(maxDealsPerMsg)) + require.Equal(t, publisherKey.Address.String(), msg.From.String()) } - - require.Equal(t, publisherKey.Address.String(), msg.From.String()) } require.Equal(t, 1, count) diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 9357cc271d9..80ead2be3b4 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -160,8 +160,16 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor return 0, xerrors.Errorf("failed to resolve from msg ID addr: %w", err) } - if fromid != mi.Worker { - return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s", pubmsg.From, deal.Proposal.Provider) + var pubOk bool + pubAddrs := append([]address.Address{mi.Worker, mi.Owner}, mi.ControlAddresses...) + for _, a := range pubAddrs { + if fromid == a { + pubOk = true + break + } + } + if !pubOk { + return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s,%+v", pubmsg.From, deal.Proposal.Provider, pubAddrs) } if pubmsg.To != miner2.StorageMarketActorAddr { From 9bdea91a70d72ff4e051be98ed5639289fdf81f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Jul 2021 21:37:32 +0200 Subject: [PATCH 5/6] itests: Some kit cleanup --- itests/deals_publish_test.go | 2 +- itests/kit/control.go | 17 ++++++++--------- itests/kit/funds.go | 10 +++++----- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/itests/deals_publish_test.go b/itests/deals_publish_test.go index 296152e3400..2fb4f50f9bd 100644 --- a/itests/deals_publish_test.go +++ b/itests/deals_publish_test.go @@ -58,7 +58,7 @@ func TestPublishDealsBatching(t *testing.T) { _, err = client.WalletImport(ctx, &publisherKey.KeyInfo) require.NoError(t, err) - kit.SetControlAddresses(t, client, miner, publisherKey.Address) + miner.SetControlAddresses(publisherKey.Address) dh := kit.NewDealHarness(t, client, miner) diff --git a/itests/kit/control.go b/itests/kit/control.go index 0528c4c8993..73ac39b7a14 100644 --- a/itests/kit/control.go +++ b/itests/kit/control.go @@ -2,7 +2,6 @@ package kit import ( "context" - "testing" "github.com/stretchr/testify/require" @@ -15,11 +14,11 @@ import ( "github.com/filecoin-project/lotus/chain/types" ) -func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs ...addr.Address) { +func (tm *TestMiner) SetControlAddresses(addrs ...addr.Address) { ctx := context.TODO() - mi, err := client.StateMinerInfo(ctx, w.ActorAddr, types.EmptyTSK) - require.NoError(t, err) + mi, err := tm.FullNode.StateMinerInfo(ctx, tm.ActorAddr, types.EmptyTSK) + require.NoError(tm.t, err) cwp := &miner2.ChangeWorkerAddressParams{ NewWorker: mi.Worker, @@ -27,17 +26,17 @@ func SetControlAddresses(t *testing.T, client *TestFullNode, w *TestMiner, addrs } sp, err := actors.SerializeParams(cwp) - require.NoError(t, err) + require.NoError(tm.t, err) - smsg, err := client.MpoolPushMessage(ctx, &types.Message{ + smsg, err := tm.FullNode.MpoolPushMessage(ctx, &types.Message{ From: mi.Owner, - To: w.ActorAddr, + To: tm.ActorAddr, Method: miner.Methods.ChangeWorkerAddress, Value: big.Zero(), Params: sp, }, nil) - require.NoError(t, err) + require.NoError(tm.t, err) - WaitMsg(ctx, t, client, smsg.Cid()) + tm.FullNode.WaitMsg(ctx, smsg.Cid()) } diff --git a/itests/kit/funds.go b/itests/kit/funds.go index 100e77183f7..e49c708ea9b 100644 --- a/itests/kit/funds.go +++ b/itests/kit/funds.go @@ -29,12 +29,12 @@ func SendFunds(ctx context.Context, t *testing.T, sender *TestFullNode, recipien sm, err := sender.MpoolPushMessage(ctx, msg, nil) require.NoError(t, err) - WaitMsg(ctx, t, sender, sm.Cid()) + sender.WaitMsg(ctx, sm.Cid()) } -func WaitMsg(ctx context.Context, t *testing.T, node *TestFullNode, msg cid.Cid) { - res, err := node.StateWaitMsg(ctx, msg, 3, api.LookbackNoLimit, true) - require.NoError(t, err) +func (f *TestFullNode) WaitMsg(ctx context.Context, msg cid.Cid) { + res, err := f.StateWaitMsg(ctx, msg, 3, api.LookbackNoLimit, true) + require.NoError(f.t, err) - require.EqualValues(t, 0, res.Receipt.ExitCode, "message did not successfully execute") + require.EqualValues(f.t, 0, res.Receipt.ExitCode, "message did not successfully execute") } From 79b0bfb2720d36f17edb62df04249e8bf5059660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 8 Jul 2021 18:54:56 +0200 Subject: [PATCH 6/6] policy: Add a docstring to SetProviderCollateralSupplyTarget --- chain/actors/policy/policy.go | 3 +++ chain/actors/policy/policy.go.template | 3 +++ 2 files changed, 6 insertions(+) diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index 426ea9300b6..c06c85d380c 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -196,6 +196,9 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab } } +// SetProviderCollateralSupplyTarget sets the percentage of normalized circulating +// supply that must be covered by provider collateral in a deal. This should +// only be used for testing. func SetProviderCollateralSupplyTarget(num, denom big.Int) { market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{ diff --git a/chain/actors/policy/policy.go.template b/chain/actors/policy/policy.go.template index 84ba4b91473..3257feffd41 100644 --- a/chain/actors/policy/policy.go.template +++ b/chain/actors/policy/policy.go.template @@ -132,6 +132,9 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab } } +// SetProviderCollateralSupplyTarget sets the percentage of normalized circulating +// supply that must be covered by provider collateral in a deal. This should +// only be used for testing. func SetProviderCollateralSupplyTarget(num, denom big.Int) { {{range .versions}} {{if (ge . 2)}}