Skip to content

Commit

Permalink
fix: add missing field to v12 market state (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek authored Sep 4, 2023
1 parent c6bbd0f commit e82e922
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
22 changes: 20 additions & 2 deletions builtin/v12/market/cbor_gen.go

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

13 changes: 13 additions & 0 deletions builtin/v12/market/market_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ type State struct {

// Verified registry allocation IDs for deals that are not yet activated.
PendingDealAllocationIds cid.Cid // HAMT[DealID]AllocationID

/// Maps providers to their sector IDs to deal IDs.
/// This supports finding affected deals when a sector is terminated early
/// or has data replaced.
/// Grouping by provider limits the cost of operations in the expected use case
/// of multiple sectors all belonging to the same provider.
/// HAMT[Address]HAMT[SectorNumber]SectorDealIDs
ProviderSectors cid.Cid
}

func ConstructState(store adt.Store) (*State, error) {
Expand Down Expand Up @@ -83,6 +91,10 @@ func ConstructState(store adt.Store) (*State, error) {
if err != nil {
return nil, xerrors.Errorf("failed to create empty map: %w", err)
}
emptyProviderSectorsMap, err := adt.StoreEmptyMap(store, builtin.DefaultHamtBitwidth)
if err != nil {
return nil, xerrors.Errorf("failed to create empty map: %w", err)
}

return &State{
Proposals: emptyProposalsArrayCid,
Expand All @@ -94,6 +106,7 @@ func ConstructState(store adt.Store) (*State, error) {
DealOpsByEpoch: emptyDealOpsHamtCid,
LastCron: abi.ChainEpoch(-1),
PendingDealAllocationIds: emptyPendingDealAllocationMapCid,
ProviderSectors: emptyProviderSectorsMap,

TotalClientLockedCollateral: abi.NewTokenAmount(0),
TotalProviderLockedCollateral: abi.NewTokenAmount(0),
Expand Down

0 comments on commit e82e922

Please sign in to comment.