Merge pull request #6923 from filecoin-project/frrist/better-state-tree-errors

polish(errors): better state tree errors
This commit is contained in:
Steven Allen 2021-07-28 18:35:57 -07:00 committed by GitHub
commit 6ffcf611a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -273,7 +273,7 @@ func LoadStateTree(cst cbor.IpldStore, c cid.Cid) (*StateTree, error) {
} }
if err != nil { if err != nil {
log.Errorf("failed to load state tree: %s", err) log.Errorf("failed to load state tree: %s", err)
return nil, xerrors.Errorf("failed to load state tree: %w", err) return nil, xerrors.Errorf("failed to load state tree %s: %w", c, err)
} }
s := &StateTree{ s := &StateTree{

View File

@ -221,7 +221,7 @@ func (sm *StateManager) ResolveToKeyAddress(ctx context.Context, addr address.Ad
// First try to resolve the actor in the parent state, so we don't have to compute anything. // First try to resolve the actor in the parent state, so we don't have to compute anything.
tree, err := state.LoadStateTree(cst, ts.ParentState()) tree, err := state.LoadStateTree(cst, ts.ParentState())
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("failed to load parent state tree: %w", err) return address.Undef, xerrors.Errorf("failed to load parent state tree at tipset %s: %w", ts.Parents(), err)
} }
resolved, err := vm.ResolveToKeyAddr(tree, cst, addr) resolved, err := vm.ResolveToKeyAddr(tree, cst, addr)
@ -232,12 +232,12 @@ func (sm *StateManager) ResolveToKeyAddress(ctx context.Context, addr address.Ad
// If that fails, compute the tip-set and try again. // If that fails, compute the tip-set and try again.
st, _, err := sm.TipSetState(ctx, ts) st, _, err := sm.TipSetState(ctx, ts)
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("resolve address failed to get tipset state: %w", err) return address.Undef, xerrors.Errorf("resolve address failed to get tipset %s state: %w", ts, err)
} }
tree, err = state.LoadStateTree(cst, st) tree, err = state.LoadStateTree(cst, st)
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("failed to load state tree") return address.Undef, xerrors.Errorf("failed to load state tree at tipset %s: %w", ts, err)
} }
return vm.ResolveToKeyAddr(tree, cst, addr) return vm.ResolveToKeyAddr(tree, cst, addr)

View File

@ -110,7 +110,7 @@ func (cs *ChainStore) BlockMsgsForTipset(ts *types.TipSet) ([]BlockMessages, err
cst := cbor.NewCborStore(cs.stateBlockstore) cst := cbor.NewCborStore(cs.stateBlockstore)
st, err := state.LoadStateTree(cst, ts.Blocks()[0].ParentStateRoot) st, err := state.LoadStateTree(cst, ts.Blocks()[0].ParentStateRoot)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to load state tree") return nil, xerrors.Errorf("failed to load state tree at tipset %s: %w", ts, err)
} }
selectMsg := func(m *types.Message) (bool, error) { selectMsg := func(m *types.Message) (bool, error) {