filecoin-project / specs-actors

DEPRECATED Specification of builtin actors, in the form of executable code.
Other
86 stars 102 forks source link

optimize compute RecordSkippedFaults #1270

Open zgfzgf opened 4 years ago

zgfzgf commented 4 years ago

Comparing the following code, we can draw a conclusion L860 add newFaults, err = bitfield.SubtractBitField(newFaults, retractedRecoveries) so much the better https://github.com/filecoin-project/specs-actors/blob/903e84f2245c703829b21171356a7fc9d9d7bba3/actors/builtin/miner/partition_state.go#L856-L870 https://github.com/filecoin-project/specs-actors/blob/903e84f2245c703829b21171356a7fc9d9d7bba3/actors/builtin/miner/partition_state.go#L241-L251

zgfzgf commented 4 years ago

now: newFaults=skipped - skipped∩Terminated - skipped∩Faults add: newFaults_add=skipped - skipped∩Terminated - skipped∩Faults - skipped∩Recoveries ∵ Recoveries ⊆Faults ∴ newFaults == newFaults_add This makes the code safer and more understandable

anorth commented 4 years ago

I'm not sure I follow what you're proposing, but because Recoveries is a subset of Faults, subtracting it in newFaults_add makes no difference.

ZenGround0 commented 4 years ago

@zgfzgf does this explanation resolve the issue: https://github.com/filecoin-project/specs-actors/pull/1271#discussion_r509461995 ?

zgfzgf commented 4 years ago

hi,@ZenGround0 At first, I thought it was an error. After looking at the code carefully, I found that it was not an error However, comparing the references in the two places, it is found that they are not the same. In order to maintain consistency, this issue is submitted Now I think we should change this place or another place. What do you think?