@@ -778,54 +778,58 @@ func CheckPreCommits(st *State, store adt.Store, allocatedSectorsMap map[uint64]
778
778
779
779
// invert pre-commit clean up queue into a lookup by sector number
780
780
cleanUpEpochs := make (map [uint64 ]abi.ChainEpoch )
781
- if cleanUpQ , err := util .LoadBitfieldQueue (store , st .PreCommittedSectorsCleanUp , st .QuantSpecEveryDeadline (), PrecommitCleanUpAmtBitwidth ); err != nil {
782
- acc .Addf ("error loading pre-commit clean up queue: %v" , err )
783
- } else {
784
- err = cleanUpQ .ForEach (func (epoch abi.ChainEpoch , bf bitfield.BitField ) error {
785
- quantized := quant .QuantizeUp (epoch )
786
- acc .Require (quantized == epoch , "precommit expiration %d is not quantized" , epoch )
787
- if err = bf .ForEach (func (secNum uint64 ) error {
788
- cleanUpEpochs [secNum ] = epoch
781
+ if st .PreCommittedSectorsCleanUp != nil {
782
+ if cleanUpQ , err := util .LoadBitfieldQueue (store , * st .PreCommittedSectorsCleanUp , st .QuantSpecEveryDeadline (), PrecommitCleanUpAmtBitwidth ); err != nil {
783
+ acc .Addf ("error loading pre-commit clean up queue: %v" , err )
784
+ } else {
785
+ err = cleanUpQ .ForEach (func (epoch abi.ChainEpoch , bf bitfield.BitField ) error {
786
+ quantized := quant .QuantizeUp (epoch )
787
+ acc .Require (quantized == epoch , "precommit expiration %d is not quantized" , epoch )
788
+ if err = bf .ForEach (func (secNum uint64 ) error {
789
+ cleanUpEpochs [secNum ] = epoch
790
+ return nil
791
+ }); err != nil {
792
+ acc .Addf ("error iteration pre-commit expiration bitfield: %v" , err )
793
+ }
789
794
return nil
790
- }); err != nil {
791
- acc .Addf ("error iteration pre-commit expiration bitfield: %v" , err )
792
- }
793
- return nil
794
- })
795
- acc .RequireNoError (err , "error iterating pre-commit clean up queue" )
795
+ })
796
+ acc .RequireNoError (err , "error iterating pre-commit clean up queue" )
797
+ }
796
798
}
797
799
798
800
precommitTotal := big .Zero ()
799
- if precommitted , err := adt .AsMap (store , st .PreCommittedSectors , builtin .DefaultHamtBitwidth ); err != nil {
800
- acc .Addf ("error loading precommitted sectors: %v" , err )
801
- } else {
802
- var precommit SectorPreCommitOnChainInfo
803
- err = precommitted .ForEach (& precommit , func (key string ) error {
804
- secNum , err := abi .ParseUIntKey (key )
805
- if err != nil {
806
- acc .Addf ("error parsing pre-commit key as uint: %v" , err )
807
- return nil
808
- }
809
-
810
- allocated := false
811
- if allocatedSectorsMap != nil {
812
- allocated = allocatedSectorsMap [secNum ]
813
- } else {
814
- allocated , err = allocatedSectorsBf .IsSet (secNum )
801
+ if st .PreCommittedSectors != nil {
802
+ if precommitted , err := adt .AsMap (store , * st .PreCommittedSectors , builtin .DefaultHamtBitwidth ); err != nil {
803
+ acc .Addf ("error loading precommitted sectors: %v" , err )
804
+ } else {
805
+ var precommit SectorPreCommitOnChainInfo
806
+ err = precommitted .ForEach (& precommit , func (key string ) error {
807
+ secNum , err := abi .ParseUIntKey (key )
815
808
if err != nil {
816
- acc .Addf ("error checking allocated sectors : %v" , err )
809
+ acc .Addf ("error parsing pre-commit key as uint : %v" , err )
817
810
return nil
818
811
}
819
- }
820
- acc .Require (allocated , "pre-committed sector number has not been allocated %d" , secNum )
821
812
822
- _ , found := cleanUpEpochs [secNum ]
823
- acc .Require (found , "no clean up epoch for pre-commit at %d" , precommit .PreCommitEpoch )
813
+ allocated := false
814
+ if allocatedSectorsMap != nil {
815
+ allocated = allocatedSectorsMap [secNum ]
816
+ } else {
817
+ allocated , err = allocatedSectorsBf .IsSet (secNum )
818
+ if err != nil {
819
+ acc .Addf ("error checking allocated sectors: %v" , err )
820
+ return nil
821
+ }
822
+ }
823
+ acc .Require (allocated , "pre-committed sector number has not been allocated %d" , secNum )
824
824
825
- precommitTotal = big .Add (precommitTotal , precommit .PreCommitDeposit )
826
- return nil
827
- })
828
- acc .RequireNoError (err , "error iterating pre-committed sectors" )
825
+ _ , found := cleanUpEpochs [secNum ]
826
+ acc .Require (found , "no clean up epoch for pre-commit at %d" , precommit .PreCommitEpoch )
827
+
828
+ precommitTotal = big .Add (precommitTotal , precommit .PreCommitDeposit )
829
+ return nil
830
+ })
831
+ acc .RequireNoError (err , "error iterating pre-committed sectors" )
832
+ }
829
833
}
830
834
831
835
acc .Require (st .PreCommitDeposits .Equals (precommitTotal ),
0 commit comments