Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions chain/actors/adt/adt.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package adt
import (
"bytes"
"crypto/sha256"
"fmt"

builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/ipfs/go-cid"
sha256simd "github.com/minio/sha256-simd"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor"
Expand Down Expand Up @@ -116,7 +117,7 @@ func MapOptsForActorCode(c cid.Cid) (*MapOpts, error) {
}, nil
}

return nil, xerrors.Errorf("actor code unknown or doesn't have Map: %s", c)
return nil, fmt.Errorf("actor code unknown or doesn't have Map: %s", c)
}

type MapHashFunc func([]byte) []byte
Expand Down
10 changes: 6 additions & 4 deletions chain/actors/aerrors/error_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package aerrors_test

import (
"fmt"
"testing"

"github.com/filecoin-project/go-state-types/exitcode"
"golang.org/x/xerrors"

. "github.com/filecoin-project/lily/chain/actors/aerrors"

"github.com/stretchr/testify/assert"
"golang.org/x/xerrors"
)

func TestFatalError(t *testing.T) {
e1 := xerrors.New("out of disk space")
e2 := xerrors.Errorf("could not put node: %w", e1)
e3 := xerrors.Errorf("could not save head: %w", e2)
e2 := fmt.Errorf("could not put node: %w", e1)
e3 := fmt.Errorf("could not save head: %w", e2)
ae := Escalate(e3, "failed to save the head")
aw1 := Wrap(ae, "saving head of new miner actor")
aw2 := Absorb(aw1, 1, "try to absorb fatal error")
Expand All @@ -25,7 +27,7 @@ func TestFatalError(t *testing.T) {
}
func TestAbsorbeError(t *testing.T) {
e1 := xerrors.New("EOF")
e2 := xerrors.Errorf("could not decode: %w", e1)
e2 := fmt.Errorf("could not decode: %w", e1)
ae := Absorb(e2, 35, "failed to decode CBOR")
aw1 := Wrap(ae, "saving head of new miner actor")
aw2 := Wrap(aw1, "initializing actor")
Expand Down
2 changes: 1 addition & 1 deletion chain/actors/aerrors/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func HandleExternalError(err error, msg string) ActorError {
}
}

if xerrors.Is(err, &cbor.SerializationError{}) {
if errors.Is(err, &cbor.SerializationError{}) {
return &actorError{
fatal: false,
retCode: 253,
Expand Down
12 changes: 5 additions & 7 deletions chain/actors/agen/generator/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"os"
"path/filepath"
"text/template"

"golang.org/x/xerrors"
)

var latestVersion = 7
Expand Down Expand Up @@ -69,7 +67,7 @@ func generateAdapters() error {
{
af, err := ioutil.ReadFile(filepath.Join(actDir, "actor.go.template"))
if err != nil {
return xerrors.Errorf("loading actor template: %w", err)
return fmt.Errorf("loading actor template: %w", err)
}

tpl := template.Must(template.New("").Funcs(template.FuncMap{
Expand Down Expand Up @@ -102,7 +100,7 @@ func generateState(actDir string) error {
return nil // skip
}

return xerrors.Errorf("loading state adapter template: %w", err)
return fmt.Errorf("loading state adapter template: %w", err)
}

for _, version := range versions {
Expand Down Expand Up @@ -134,7 +132,7 @@ func generateMessages(actDir string) error {
return nil // skip
}

return xerrors.Errorf("loading message adapter template: %w", err)
return fmt.Errorf("loading message adapter template: %w", err)
}

for _, version := range versions {
Expand Down Expand Up @@ -166,7 +164,7 @@ func generatePolicy() error {
return nil // skip
}

return xerrors.Errorf("loading policy template file: %w", err)
return fmt.Errorf("loading policy template file: %w", err)
}

tpl := template.Must(template.New("").Funcs(template.FuncMap{
Expand Down Expand Up @@ -197,7 +195,7 @@ func generateBuiltin() error {
return nil // skip
}

return xerrors.Errorf("loading builtin template file: %w", err)
return fmt.Errorf("loading builtin template file: %w", err)
}

tpl := template.Must(template.New("").Funcs(template.FuncMap{
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/account/account.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chain/actors/builtin/account/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package account

import (
"golang.org/x/xerrors"
"fmt"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/cbor"
Expand Down Expand Up @@ -40,7 +40,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return load{{.}}(store, act.Head)
{{end}}
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
return nil, fmt.Errorf("unknown actor code %s", act.Code)
}

type State interface {
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/builtin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chain/actors/builtin/builtin.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package builtin

import (
"strings"
"fmt"

"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"

{{range .versions}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
Expand Down Expand Up @@ -78,7 +78,7 @@ func RegisterActorState(code cid.Cid, loader ActorStateLoader) {
func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
loader, found := ActorStateLoaders[act.Code]
if !found {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
return nil, fmt.Errorf("unknown actor code %s", act.Code)
}
return loader(store, act.Head)
}
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/init/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package init

import (
"golang.org/x/xerrors"
"fmt"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
Expand Down Expand Up @@ -45,7 +45,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return load{{.}}(store, act.Head)
{{end}}
}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
return nil, fmt.Errorf("unknown actor code %s", act.Code)
}

type State interface {
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/init/init.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/init/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
package init

import (
"fmt"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"

"github.com/filecoin-project/lotus/node/modules/dtypes"

Expand Down Expand Up @@ -77,12 +77,12 @@ func (s *state{{.v}}) Remove(addrs ...address.Address) (err error) {
}
for _, addr := range addrs {
if err = m.Delete(abi.AddrKey(addr)); err != nil {
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
return fmt.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
}
}
amr, err := m.Root()
if err != nil {
return xerrors.Errorf("failed to get address map root: %w", err)
return fmt.Errorf("failed to get address map root: %w", err)
}
s.State.AddressMap = amr
return nil
Expand Down
6 changes: 3 additions & 3 deletions chain/actors/builtin/init/v0.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/init/v2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/init/v3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/init/v4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading