Skip to content

Commit 762fecc

Browse files
authored
refactor: rename PledgeCollateral to DealCollateral (#563)
1 parent e3d45e3 commit 762fecc

File tree

9 files changed

+37
-25
lines changed

9 files changed

+37
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ boostd --vv init \
142142
--api-sealer=`lotus-miner auth api-info --perm=admin` \
143143
--api-sector-index=`lotus-miner auth api-info --perm=admin` \
144144
--wallet-publish-storage-deals=`lotus wallet new bls` \
145-
--wallet-collateral-pledge=`lotus wallet new bls` \
145+
--wallet-deal-collateral=`lotus wallet new bls` \
146146
--max-staging-deals-bytes=50000000000
147147
```
148148

cmd/boostd/init.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ var initCmd = &cli.Command{
5858
Required: true,
5959
},
6060
&cli.StringFlag{
61-
Name: "wallet-collateral-pledge",
62-
Usage: "wallet to be used for pledging collateral",
61+
Name: "wallet-deal-collateral",
62+
Usage: "wallet to be used for deal collateral",
6363
Required: true,
6464
},
6565
&cli.Int64Flag{
@@ -138,8 +138,8 @@ var migrateFlags = []cli.Flag{
138138
Required: true,
139139
},
140140
&cli.StringFlag{
141-
Name: "wallet-collateral-pledge",
142-
Usage: "wallet to be used for pledging collateral",
141+
Name: "wallet-deal-collateral",
142+
Usage: "wallet to be used for deal collateral",
143143
Required: true,
144144
},
145145
&cli.Int64Flag{
@@ -531,13 +531,13 @@ func initBoost(ctx context.Context, cctx *cli.Context, marketsRepo lotus_repo.Lo
531531
return nil, fmt.Errorf("failed to parse wallet-publish-storage-deals: %s; err: %w", cctx.String("wallet-publish-storage-deals"), err)
532532
}
533533

534-
walletCP, err := address.NewFromString(cctx.String("wallet-collateral-pledge"))
534+
walletCP, err := address.NewFromString(cctx.String("wallet-deal-collateral"))
535535
if err != nil {
536-
return nil, fmt.Errorf("failed to parse wallet-collateral-pledge: %s; err: %w", cctx.String("wallet-collateral-pledge"), err)
536+
return nil, fmt.Errorf("failed to parse wallet-deal-collateral: %s; err: %w", cctx.String("wallet-deal-collateral"), err)
537537
}
538538

539539
if walletPSD.String() == walletCP.String() {
540-
return nil, fmt.Errorf("wallets for PublishStorageDeals and pledging collateral must be different")
540+
return nil, fmt.Errorf("wallets for PublishStorageDeals and deal collateral must be different")
541541
}
542542

543543
if cctx.Int64("max-staging-deals-bytes") <= 0 {
@@ -659,7 +659,7 @@ func setMinerApiConfig(cctx *cli.Context, rcfg *config.Boost, dialCheck bool) er
659659
func setCommonConfig(cctx *cli.Context, rcfg *config.Boost, bp *boostParams) {
660660
rcfg.Dealmaking.MaxStagingDealsBytes = cctx.Int64("max-staging-deals-bytes")
661661
rcfg.Wallets.Miner = bp.minerActor.String()
662-
rcfg.Wallets.PledgeCollateral = bp.walletCP.String()
662+
rcfg.Wallets.DealCollateral = bp.walletCP.String()
663663
rcfg.Wallets.PublishStorageDeals = bp.walletPSD.String()
664664
}
665665

documentation/devnet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ boostd -vv init \
112112
--api-sealer=$MINER_API_INFO \
113113
--api-sector-index=$MINER_API_INFO \
114114
--wallet-publish-storage-deals=$PUBMSG_WALLET \
115-
--wallet-collateral-pledge=$COLLAT_WALLET \
115+
--wallet-deal-collateral=$COLLAT_WALLET \
116116
--max-staging-deals-bytes=2000000000
117117
```
118118

fundmanager/fundmanager.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Config struct {
3131
// The address of the storage miner, used as the target address when
3232
// moving funds to escrow
3333
StorageMiner address.Address
34-
// Wallet used as source of pledge collateral when moving funds to
34+
// Wallet used as source of deal collateral when moving funds to
3535
// escrow
3636
CollatWallet address.Address
3737
// Wallet used to send the publish message (and pay gas fees)
@@ -192,7 +192,7 @@ func (m *FundManager) persistTagged(ctx context.Context, dealUuid uuid.UUID, dea
192192
return nil
193193
}
194194

195-
// MoveFundsToEscrow moves funds from the pledge collateral wallet into escrow with
195+
// MoveFundsToEscrow moves funds from the deal collateral wallet into escrow with
196196
// the storage market actor
197197
func (m *FundManager) MoveFundsToEscrow(ctx context.Context, amt abi.TokenAmount) (cid.Cid, error) {
198198
msgCid, err := m.api.MarketAddBalance(ctx, m.cfg.CollatWallet, m.cfg.StorageMiner, amt)
@@ -214,13 +214,13 @@ func (m *FundManager) BalanceMarket(ctx context.Context) (storagemarket.Balance,
214214
return toSharedBalance(bal), nil
215215
}
216216

217-
// BalancePledgeCollateral returns the amount of funds in the wallet used for
218-
// pledging collateral for deal making
219-
func (m *FundManager) BalancePledgeCollateral(ctx context.Context) (abi.TokenAmount, error) {
217+
// BalanceDealCollateral returns the amount of funds in the wallet used for
218+
// collateral for deal making
219+
func (m *FundManager) BalanceDealCollateral(ctx context.Context) (abi.TokenAmount, error) {
220220
return m.api.WalletBalance(ctx, m.cfg.CollatWallet)
221221
}
222222

223-
func (m *FundManager) AddressPledgeCollateral() address.Address {
223+
func (m *FundManager) AddressDealCollateral() address.Address {
224224
return m.cfg.CollatWallet
225225
}
226226

gql/resolver_funds.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func (r *resolver) Funds(ctx context.Context) (*funds, error) {
4444
return nil, fmt.Errorf("getting publish message balance: %w", err)
4545
}
4646

47-
balCollateral, err := r.fundMgr.BalancePledgeCollateral(ctx)
47+
balCollateral, err := r.fundMgr.BalanceDealCollateral(ctx)
4848
if err != nil {
49-
return nil, fmt.Errorf("getting pledge collateral balance: %w", err)
49+
return nil, fmt.Errorf("getting deal collateral balance: %w", err)
5050
}
5151

5252
return &funds{
@@ -56,7 +56,7 @@ func (r *resolver) Funds(ctx context.Context) (*funds, error) {
5656
Locked: gqltypes.BigInt{Int: balMkt.Locked},
5757
},
5858
Collateral: fundsWallet{
59-
Address: r.fundMgr.AddressPledgeCollateral().String(),
59+
Address: r.fundMgr.AddressDealCollateral().String(),
6060
Balance: gqltypes.BigInt{Int: balCollateral},
6161
},
6262
PubMsg: fundsWallet{

gql/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ type RootMutation {
365365
"""Publish all pending deals now"""
366366
dealPublishNow: Boolean!
367367

368-
"""Top-up the available pledge collateral in escrow for deal publishing"""
368+
"""Top-up the available deal collateral in escrow for deal publishing"""
369369
fundsMoveToEscrow(amount: BigInt!): Boolean!
370370

371371
"""Update the Storage Ask (price of doing a storage deal)"""

node/builder.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,13 @@ func ConfigBoost(c interface{}) Option {
409409
return Error(errors.New("retrieval pricing policy must be either default or external"))
410410
}
411411

412-
walletPledgeCollat, err := address.NewFromString(cfg.Wallets.PledgeCollateral)
412+
collatWalletStr := cfg.Wallets.DealCollateral
413+
if collatWalletStr == "" && cfg.Wallets.PledgeCollateral != "" { // nolint:staticcheck
414+
collatWalletStr = cfg.Wallets.PledgeCollateral // nolint:staticcheck
415+
}
416+
walletDealCollat, err := address.NewFromString(collatWalletStr)
413417
if err != nil {
414-
return Error(fmt.Errorf("failed to parse cfg.Wallets.PledgeCollateral: %s; err: %w", cfg.Wallets.PledgeCollateral, err))
418+
return Error(fmt.Errorf("failed to parse deal collateral wallet: '%s'; err: %w", collatWalletStr, err))
415419
}
416420
walletPSD, err := address.NewFromString(cfg.Wallets.PublishStorageDeals)
417421
if err != nil {
@@ -441,7 +445,7 @@ func ConfigBoost(c interface{}) Option {
441445

442446
Override(new(*fundmanager.FundManager), fundmanager.New(fundmanager.Config{
443447
StorageMiner: walletMiner,
444-
CollatWallet: walletPledgeCollat,
448+
CollatWallet: walletDealCollat,
445449
PubMsgWallet: walletPSD,
446450
PubMsgBalMin: abi.TokenAmount(cfg.Dealmaking.PublishMsgMaxFee),
447451
})),

node/config/doc_gen.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/config/types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ type WalletsConfig struct {
5858
// The wallet used to send PublishStorageDeals messages.
5959
// Must be a control or worker address of the miner.
6060
PublishStorageDeals string
61-
// The wallet used as the source for pledge collateral
61+
// The wallet used as the source for storage deal collateral
62+
DealCollateral string
63+
// Deprecated: Renamed to DealCollateral
6264
PledgeCollateral string
6365
}
6466

0 commit comments

Comments
 (0)