From 5a321f970e814c9fdd287d36101a1995946d8160 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 6 Aug 2021 14:56:29 -0700 Subject: [PATCH] fix: vet actors shims 1. Check error in EraseAllUnproven 2. Avoid dead code. --- chain/actors/builtin/miner/state.go.template | 5 ++++- chain/actors/builtin/miner/v0.go | 2 +- chain/actors/builtin/miner/v2.go | 4 +++- chain/actors/builtin/miner/v3.go | 4 +++- chain/actors/builtin/miner/v4.go | 4 +++- chain/actors/builtin/miner/v5.go | 4 +++- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/chain/actors/builtin/miner/state.go.template b/chain/actors/builtin/miner/state.go.template index 09c1202d95e..b63a73a2c24 100644 --- a/chain/actors/builtin/miner/state.go.template +++ b/chain/actors/builtin/miner/state.go.template @@ -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) { diff --git a/chain/actors/builtin/miner/v0.go b/chain/actors/builtin/miner/v0.go index cd922645ea4..422afec8adf 100644 --- a/chain/actors/builtin/miner/v0.go +++ b/chain/actors/builtin/miner/v0.go @@ -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) { diff --git a/chain/actors/builtin/miner/v2.go b/chain/actors/builtin/miner/v2.go index 5de653fe4e2..81b32abb754 100644 --- a/chain/actors/builtin/miner/v2.go +++ b/chain/actors/builtin/miner/v2.go @@ -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) { diff --git a/chain/actors/builtin/miner/v3.go b/chain/actors/builtin/miner/v3.go index 1819428a6d3..8ac77915a90 100644 --- a/chain/actors/builtin/miner/v3.go +++ b/chain/actors/builtin/miner/v3.go @@ -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) { diff --git a/chain/actors/builtin/miner/v4.go b/chain/actors/builtin/miner/v4.go index 5a3a75053c3..5f442962f0e 100644 --- a/chain/actors/builtin/miner/v4.go +++ b/chain/actors/builtin/miner/v4.go @@ -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) { diff --git a/chain/actors/builtin/miner/v5.go b/chain/actors/builtin/miner/v5.go index 82e98c2ef06..a3e03a7d4f4 100644 --- a/chain/actors/builtin/miner/v5.go +++ b/chain/actors/builtin/miner/v5.go @@ -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) {