Skip to content

Commit

Permalink
fix: vet actors shims
Browse files Browse the repository at this point in the history
1. Check error in EraseAllUnproven
2. Avoid dead code.
  • Loading branch information
Stebalien committed Aug 6, 2021
1 parent f7e2885 commit 5a321f9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
5 changes: 4 additions & 1 deletion chain/actors/builtin/miner/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,15 @@ func (s *state{{.v}}) EraseAllUnproven() error {

return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}

return s.State.SaveDeadlines(s.store, dls)
{{else}}
// field doesn't exist until v2
return nil
{{end}}
return nil
}

func (d *deadline{{.v}}) LoadPartition(idx uint64) (Partition, error) {
Expand Down
2 changes: 1 addition & 1 deletion chain/actors/builtin/miner/v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreC
func (s *state0) EraseAllUnproven() error {

// field doesn't exist until v2

return nil

}

func (d *deadline0) LoadPartition(idx uint64) (Partition, error) {
Expand Down
4 changes: 3 additions & 1 deletion chain/actors/builtin/miner/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,12 @@ func (s *state2) EraseAllUnproven() error {

return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}

return s.State.SaveDeadlines(s.store, dls)

return nil
}

func (d *deadline2) LoadPartition(idx uint64) (Partition, error) {
Expand Down
4 changes: 3 additions & 1 deletion chain/actors/builtin/miner/v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,12 @@ func (s *state3) EraseAllUnproven() error {

return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}

return s.State.SaveDeadlines(s.store, dls)

return nil
}

func (d *deadline3) LoadPartition(idx uint64) (Partition, error) {
Expand Down
4 changes: 3 additions & 1 deletion chain/actors/builtin/miner/v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,12 @@ func (s *state4) EraseAllUnproven() error {

return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}

return s.State.SaveDeadlines(s.store, dls)

return nil
}

func (d *deadline4) LoadPartition(idx uint64) (Partition, error) {
Expand Down
4 changes: 3 additions & 1 deletion chain/actors/builtin/miner/v5.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,12 @@ func (s *state5) EraseAllUnproven() error {

return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}

return s.State.SaveDeadlines(s.store, dls)

return nil
}

func (d *deadline5) LoadPartition(idx uint64) (Partition, error) {
Expand Down

0 comments on commit 5a321f9

Please sign in to comment.