github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/builtin/verifreg/verified_registry_state.go (about) 1 package verifreg 2 3 import ( 4 addr "github.com/filecoin-project/go-address" 5 "github.com/filecoin-project/go-state-types/abi" 6 cid "github.com/ipfs/go-cid" 7 "golang.org/x/xerrors" 8 9 "github.com/filecoin-project/specs-actors/v4/actors/builtin" 10 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" 11 ) 12 13 // DataCap is an integer number of bytes. 14 // We can introduce policy changes and replace this in the future. 15 type DataCap = abi.StoragePower 16 17 type State struct { 18 // Root key holder multisig. 19 // Authorize and remove verifiers. 20 RootKey addr.Address 21 22 // Verifiers authorize VerifiedClients. 23 // Verifiers delegate their DataCap. 24 Verifiers cid.Cid // HAMT[addr.Address]DataCap 25 26 // VerifiedClients can add VerifiedClientData, up to DataCap. 27 VerifiedClients cid.Cid // HAMT[addr.Address]DataCap 28 } 29 30 var MinVerifiedDealSize = abi.NewStoragePower(1 << 20) 31 32 // rootKeyAddress comes from genesis. 33 func ConstructState(store adt.Store, rootKeyAddress addr.Address) (*State, error) { 34 emptyMapCid, err := adt.StoreEmptyMap(store, builtin.DefaultHamtBitwidth) 35 if err != nil { 36 return nil, xerrors.Errorf("failed to create empty map: %w", err) 37 } 38 39 return &State{ 40 RootKey: rootKeyAddress, 41 Verifiers: emptyMapCid, 42 VerifiedClients: emptyMapCid, 43 }, nil 44 }