ChainSafe / fil-actor-states

State handling crates for the Filecoin Actors
Apache License 2.0
3 stars 2 forks source link

Add verify_deals_for_activation method in market state #290

Closed sudo-shashank closed 4 months ago

sudo-shashank commented 4 months ago

Summary of changes Changes introduced in this pull request:

ref go impl

// Validates a collection of deal dealProposals for activation, and returns their combined weight,
// split into regular deal weight and verified deal weight.
func ValidateDealsForActivation(
    st *State, store adt.Store, dealIDs []abi.DealID, minerAddr addr.Address, sectorExpiry, currEpoch abi.ChainEpoch,
) (big.Int, big.Int, uint64, error) {
    proposals, err := AsDealProposalArray(store, st.Proposals)
    if err != nil {
        return big.Int{}, big.Int{}, 0, xerrors.Errorf("failed to load dealProposals: %w", err)
    }

    return validateAndComputeDealWeight(proposals, dealIDs, minerAddr, sectorExpiry, currEpoch)
}

Reference issue to close (if applicable)

Closes

Other information and links