Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Remove pointer from PreCommitSectorBatchParams #1425

Merged
merged 1 commit into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions actors/builtin/miner/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions actors/builtin/miner/miner_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,13 @@ type PreCommitSectorParams = miner0.SectorPreCommitInfo
// This method may be deprecated and removed in the future.
func (a Actor) PreCommitSector(rt Runtime, params *PreCommitSectorParams) *abi.EmptyValue {
// This is a direct method call to self, not a message send.
batchParams := &PreCommitSectorBatchParams{Sectors: []*miner0.SectorPreCommitInfo{params}}
batchParams := &PreCommitSectorBatchParams{Sectors: []miner0.SectorPreCommitInfo{*params}}
a.PreCommitSectorBatch(rt, batchParams)
return nil
}

type PreCommitSectorBatchParams struct {
Sectors []*miner0.SectorPreCommitInfo
Sectors []miner0.SectorPreCommitInfo
}

// Pledges the miner to seal and commit some new sectors.
Expand Down Expand Up @@ -782,7 +782,7 @@ func (a Actor) PreCommitSectorBatch(rt Runtime, params *PreCommitSectorBatchPara
}

if precommit.ReplaceCapacity {
validateReplaceSector(rt, &st, store, precommit)
validateReplaceSector(rt, &st, store, &precommit)
}

// Estimate the sector weight using the current epoch as an estimate for activation,
Expand All @@ -794,7 +794,7 @@ func (a Actor) PreCommitSectorBatch(rt Runtime, params *PreCommitSectorBatchPara

// Build on-chain record.
chainInfos[i] = &SectorPreCommitOnChainInfo{
Info: SectorPreCommitInfo(*precommit),
Info: SectorPreCommitInfo(precommit),
PreCommitDeposit: depositReq,
PreCommitEpoch: currEpoch,
DealWeight: dealWeight.DealWeight,
Expand Down
28 changes: 14 additions & 14 deletions actors/builtin/miner/miner_commitment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ func TestPreCommitBatch(t *testing.T) {
proveCommitEpoch := precommitEpoch + miner.PreCommitChallengeDelay + 1
dealLifespan := sectorExpiration - proveCommitEpoch

sectors := make([]*miner0.SectorPreCommitInfo, batchSize)
sectors := make([]miner0.SectorPreCommitInfo, batchSize)
conf := preCommitBatchConf{
sectorWeights: make([]market.SectorWeights, batchSize),
firstForMiner: true,
Expand All @@ -519,7 +519,7 @@ func TestPreCommitBatch(t *testing.T) {
if len(test.deals) > i {
deals = test.deals[i]
}
sectors[i] = actor.makePreCommit(sectorNos[i], precommitEpoch-1, sectorExpiration, deals.IDs)
sectors[i] = *actor.makePreCommit(sectorNos[i], precommitEpoch-1, sectorExpiration, deals.IDs)

dealSpace := deals.size + deals.verifiedSize
dealWeight := big.Mul(big.NewIntUnsigned(deals.size), big.NewInt(int64(dealLifespan)))
Expand Down Expand Up @@ -592,10 +592,10 @@ func TestPreCommitBatch(t *testing.T) {
dlInfo := actor.deadline(rt)

sectorExpiration := dlInfo.PeriodEnd() + defaultSectorExpiration*miner.WPoStProvingPeriod
sectors := []*miner0.SectorPreCommitInfo{
actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
actor.makePreCommit(101, precommitEpoch-1, sectorExpiration, nil),
actor.makePreCommit(102, precommitEpoch-1, rt.Epoch(), nil), // Expires too soon
sectors := []miner0.SectorPreCommitInfo{
*actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
*actor.makePreCommit(101, precommitEpoch-1, sectorExpiration, nil),
*actor.makePreCommit(102, precommitEpoch-1, rt.Epoch(), nil), // Expires too soon
}

rt.ExpectAbortContainsMessage(exitcode.ErrIllegalArgument, "sector expiration", func() {
Expand All @@ -614,10 +614,10 @@ func TestPreCommitBatch(t *testing.T) {
dlInfo := actor.deadline(rt)

sectorExpiration := dlInfo.PeriodEnd() + defaultSectorExpiration*miner.WPoStProvingPeriod
sectors := []*miner0.SectorPreCommitInfo{
actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
actor.makePreCommit(101, precommitEpoch-1, sectorExpiration, nil),
actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
sectors := []miner0.SectorPreCommitInfo{
*actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
*actor.makePreCommit(101, precommitEpoch-1, sectorExpiration, nil),
*actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
}
rt.ExpectAbortContainsMessage(exitcode.ErrIllegalArgument, "duplicate sector number 100", func() {
actor.preCommitSectorBatch(rt, &miner.PreCommitSectorBatchParams{Sectors: sectors}, preCommitBatchConf{firstForMiner: true})
Expand Down Expand Up @@ -751,10 +751,10 @@ func TestProveCommit(t *testing.T) {

sectorExpiration := dlInfo.PeriodEnd() + defaultSectorExpiration*miner.WPoStProvingPeriod

sectors := []*miner0.SectorPreCommitInfo{
actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
actor.makePreCommit(101, precommitEpoch-1, sectorExpiration, []abi.DealID{1}), // 1 * 32GiB verified deal
actor.makePreCommit(102, precommitEpoch-1, sectorExpiration, []abi.DealID{2, 3}), // 2 * 16GiB verified deals
sectors := []miner0.SectorPreCommitInfo{
*actor.makePreCommit(100, precommitEpoch-1, sectorExpiration, nil),
*actor.makePreCommit(101, precommitEpoch-1, sectorExpiration, []abi.DealID{1}), // 1 * 32GiB verified deal
*actor.makePreCommit(102, precommitEpoch-1, sectorExpiration, []abi.DealID{2, 3}), // 2 * 16GiB verified deals
}

dealSpace := uint64(32 << 30)
Expand Down