9e03fcab83
* Initial work supporting DDO pieces in lotus-miner * sealing: Update pipeline input to operate on UniversalPiece * sealing: Update pipeline checks/sealing states to operate on UniversalPiece * sealing: Make pipeline build with UniversalPiece * move PieceDealInfo out of api * make gen * make sealing pipeline unit tests pass * fix itest ensemble build * don't panic in SectorsStatus with deals * stop linter from complaining about checkPieces * fix sector import tests * mod tidy * sealing: Add logic for (pre)committing DDO sectors * sealing: state-types with method defs * DDO non-snap pipeline works(?), DDO Itests * DDO support in snapdeals pipeline * make gen * update actor bundles * update the gst market fix * fix: chain: use PreCommitSectorsBatch2 when setting up genesis * some bug fixes * integration working changes * update actor bundles * Make TestOnboardRawPieceSnap pass * Appease the linter * Make deadlines test pass with v12 actors * Update go-state-types, abstract market DealState * make gen * mod tidy, lint fixes * Fix some more tests * Bump version in master Bump version in master * Make gen Make gen * fix sender * fix: lotus-provider: Fix winning PoSt * fix: sql Scan cannot write to an object * Actually show miner-addrs in info-log Actually show miner-addrs in lotus-provider info-log * [WIP] feat: Add nv22 skeleton Addition of Network Version 22 skeleton * update FFI * ddo is now nv22 * make gen * temp actor bundle with ddo * use working go-state-types * gst with v13 market migration * update bundle, builtin.MethodsMiner.ProveCommitSectors2 -> 3 * actually working v13 migration, v13 migration itest * Address review * sealing: Correct DDO snap pledge math * itests: Mixed ddo itest * pipeline: Fix sectorWeight * sealing: convert market deals into PAMs in mixed sectors * sealing: make market to ddo conversion work * fix lint * update gst * Update actors and GST to lastest integ branch * commit batcher: Update ProveCommitSectors3Params builder logic * make gen * use builtin-actors master * ddo: address review * itests: Add commd assertions to ddo tests * make gen * gst with fixed types * config knobs for RequireActivationSuccess * storage: Drop obsolete flaky tasts --------- Co-authored-by: Jennifer Wang <jiayingw703@gmail.com> Co-authored-by: Aayush <arajasek94@gmail.com> Co-authored-by: Shrenuj Bansal <shrenuj.bansal@protocol.ai> Co-authored-by: Phi <orjan.roren@gmail.com> Co-authored-by: Andrew Jackson (Ajax) <snadrus@gmail.com> Co-authored-by: TippyFlits <james.bluett@protocol.ai>
94 lines
2.3 KiB
Go
94 lines
2.3 KiB
Go
package market
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
cbg "github.com/whyrusleeping/cbor-gen"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
|
)
|
|
|
|
func DiffDealProposals(pre, cur DealProposals) (*DealProposalChanges, error) {
|
|
results := new(DealProposalChanges)
|
|
if err := adt.DiffAdtArray(pre.array(), cur.array(), &marketProposalsDiffer{results, pre, cur}); err != nil {
|
|
return nil, fmt.Errorf("diffing deal states: %w", err)
|
|
}
|
|
return results, nil
|
|
}
|
|
|
|
type marketProposalsDiffer struct {
|
|
Results *DealProposalChanges
|
|
pre, cur DealProposals
|
|
}
|
|
|
|
func (d *marketProposalsDiffer) Add(key uint64, val *cbg.Deferred) error {
|
|
dp, err := d.cur.decode(val)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
d.Results.Added = append(d.Results.Added, ProposalIDState{abi.DealID(key), *dp})
|
|
return nil
|
|
}
|
|
|
|
func (d *marketProposalsDiffer) Modify(key uint64, from, to *cbg.Deferred) error {
|
|
// short circuit, DealProposals are static
|
|
return nil
|
|
}
|
|
|
|
func (d *marketProposalsDiffer) Remove(key uint64, val *cbg.Deferred) error {
|
|
dp, err := d.pre.decode(val)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
d.Results.Removed = append(d.Results.Removed, ProposalIDState{abi.DealID(key), *dp})
|
|
return nil
|
|
}
|
|
|
|
func DiffDealStates(pre, cur DealStates) (*DealStateChanges, error) {
|
|
results := new(DealStateChanges)
|
|
if err := adt.DiffAdtArray(pre.array(), cur.array(), &marketStatesDiffer{results, pre, cur}); err != nil {
|
|
return nil, fmt.Errorf("diffing deal states: %w", err)
|
|
}
|
|
return results, nil
|
|
}
|
|
|
|
type marketStatesDiffer struct {
|
|
Results *DealStateChanges
|
|
pre, cur DealStates
|
|
}
|
|
|
|
func (d *marketStatesDiffer) Add(key uint64, val *cbg.Deferred) error {
|
|
ds, err := d.cur.decode(val)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
d.Results.Added = append(d.Results.Added, DealIDState{abi.DealID(key), ds})
|
|
return nil
|
|
}
|
|
|
|
func (d *marketStatesDiffer) Modify(key uint64, from, to *cbg.Deferred) error {
|
|
dsFrom, err := d.pre.decode(from)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
dsTo, err := d.cur.decode(to)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !dsFrom.Equals(dsTo) {
|
|
d.Results.Modified = append(d.Results.Modified, DealStateChange{abi.DealID(key), dsFrom, dsTo})
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (d *marketStatesDiffer) Remove(key uint64, val *cbg.Deferred) error {
|
|
ds, err := d.pre.decode(val)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
d.Results.Removed = append(d.Results.Removed, DealIDState{abi.DealID(key), ds})
|
|
return nil
|
|
}
|