Skip to content

Commit

Permalink
more inline template (#4691)
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode authored Jan 10, 2022
1 parent 70c69a2 commit 72ee5c6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
1 change: 0 additions & 1 deletion pkg/chain/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
exported5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/exported"
exported6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/exported"
exported7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/exported"

/* inline-gen end */

"github.com/filecoin-project/venus/venus-shared/actors/builtin"
Expand Down
14 changes: 14 additions & 0 deletions pkg/vm/vmcontext/runtime_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ import (
"github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/rt"

/* inline-gen template
{{range .actorVersions}}
rt{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/runtime"{{end}}
/* inline-gen start */

rt0 "github.com/filecoin-project/specs-actors/actors/runtime"
rt2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
rt3 "github.com/filecoin-project/specs-actors/v3/actors/runtime"
rt4 "github.com/filecoin-project/specs-actors/v4/actors/runtime"
rt5 "github.com/filecoin-project/specs-actors/v5/actors/runtime"
rt6 "github.com/filecoin-project/specs-actors/v6/actors/runtime"
rt7 "github.com/filecoin-project/specs-actors/v7/actors/runtime"
/* inline-gen end */

"github.com/filecoin-project/venus/pkg/vm/gas"
"github.com/filecoin-project/venus/pkg/vm/runtime"
Expand All @@ -45,6 +52,11 @@ func init() {

var actorLog = logging.Logger("vm.actors")

/* inline-gen template
{{range .actorVersions}}
var _ rt{{.}}.Runtime = (*runtimeAdapter)(nil){{end}}
/* inline-gen start */

var _ rt0.Runtime = (*runtimeAdapter)(nil)
var _ rt2.Runtime = (*runtimeAdapter)(nil)
var _ rt3.Runtime = (*runtimeAdapter)(nil)
Expand All @@ -53,6 +65,8 @@ var _ rt5.Runtime = (*runtimeAdapter)(nil)
var _ rt6.Runtime = (*runtimeAdapter)(nil)
var _ rt7.Runtime = (*runtimeAdapter)(nil)

/* inline-gen end */

type runtimeAdapter struct {
ctx *invocationContext
syscalls
Expand Down
28 changes: 27 additions & 1 deletion pkg/vm/vmcontext/syscalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
rt7 "github.com/filecoin-project/specs-actors/v7/actors/runtime"
proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
"github.com/ipfs/go-cid"

/* inline-gen template
{{range .actorVersions}}
rt{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/runtime"{{end}}
/* inline-gen start */

rt0 "github.com/filecoin-project/specs-actors/actors/runtime"
rt2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
rt3 "github.com/filecoin-project/specs-actors/v3/actors/runtime"
rt4 "github.com/filecoin-project/specs-actors/v4/actors/runtime"
rt5 "github.com/filecoin-project/specs-actors/v5/actors/runtime"
rt6 "github.com/filecoin-project/specs-actors/v6/actors/runtime"
rt7 "github.com/filecoin-project/specs-actors/v7/actors/runtime"
/* inline-gen end */

"github.com/filecoin-project/venus/pkg/crypto"
vmState "github.com/filecoin-project/venus/pkg/state/tree"
"github.com/filecoin-project/venus/pkg/vm/gas"
Expand Down Expand Up @@ -51,8 +64,21 @@ type syscalls struct {
stateView SyscallsStateView
}

/* inline-gen template
{{range .actorVersions}}
var _ rt{{.}}.Syscalls = (*syscalls)(nil){{end}}
/* inline-gen start */

var _ rt0.Syscalls = (*syscalls)(nil)
var _ rt2.Syscalls = (*syscalls)(nil)
var _ rt3.Syscalls = (*syscalls)(nil)
var _ rt4.Syscalls = (*syscalls)(nil)
var _ rt5.Syscalls = (*syscalls)(nil)
var _ rt6.Syscalls = (*syscalls)(nil)
var _ rt7.Syscalls = (*syscalls)(nil)

/* inline-gen end */

func (sys syscalls) VerifySignature(signature crypto.Signature, signer address.Address, plaintext []byte) error {
charge, err := sys.pricelist.OnVerifySignature(signature.Type, len(plaintext))
if err != nil {
Expand Down

0 comments on commit 72ee5c6

Please sign in to comment.