Skip to content

Commit

Permalink
Merge pull request #6279 from filecoin-project/feat/builtin-actor-events
Browse files Browse the repository at this point in the history
feat: events: Add APIs to consume smart contract and built-in actor events
  • Loading branch information
LinZexiao authored Mar 7, 2024
2 parents 9ad1edd + 99532c5 commit 9c713ca
Show file tree
Hide file tree
Showing 30 changed files with 2,605 additions and 197 deletions.
6 changes: 6 additions & 0 deletions app/node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/libp2p/go-libp2p"
"github.com/pkg/errors"

"github.com/filecoin-project/venus/app/submodule/actorevent"
"github.com/filecoin-project/venus/app/submodule/blockstore"
"github.com/filecoin-project/venus/app/submodule/chain"
"github.com/filecoin-project/venus/app/submodule/common"
Expand Down Expand Up @@ -171,6 +172,10 @@ func (b *Builder) build(ctx context.Context) (*Node, error) {
return nil, err
}

if nd.actorEvent, err = actorevent.NewActorEventSubModule(ctx, b.repo.Config(), nd.chain, nd.eth); err != nil {
return nil, err
}

apiBuilder := NewBuilder()
apiBuilder.NameSpace("Filecoin")

Expand All @@ -188,6 +193,7 @@ func (b *Builder) build(ctx context.Context) (*Node, error) {
nd.market,
nd.common,
nd.eth,
nd.actorEvent,
)

if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion app/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/awnumar/memguard"
"github.com/etherlabsio/healthcheck/v2"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/venus/app/submodule/actorevent"
"github.com/filecoin-project/venus/app/submodule/blockstore"
chain2 "github.com/filecoin-project/venus/app/submodule/chain"
"github.com/filecoin-project/venus/app/submodule/common"
Expand Down Expand Up @@ -100,7 +101,8 @@ type Node struct {

common *common.CommonModule

eth *eth.EthSubModule
eth *eth.EthSubModule
actorEvent *actorevent.ActorEventSubModule

//
// Jsonrpc
Expand Down
4 changes: 3 additions & 1 deletion app/node/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"reflect"

"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/venus/app/submodule/actorevent"
"github.com/filecoin-project/venus/app/submodule/eth"
v0api "github.com/filecoin-project/venus/venus-shared/api/chain/v0"
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
Expand Down Expand Up @@ -40,14 +41,15 @@ func (builder *RPCBuilder) AddServices(services ...RPCService) error {
}

var ethSubModuleTyp = reflect.TypeOf(&eth.EthSubModule{}).Elem()
var actorEventSubModuleTyp = reflect.TypeOf(&actorevent.ActorEventSubModule{}).Elem()

func skipV0API(in interface{}) bool {
inT := reflect.TypeOf(in)
if inT.Kind() == reflect.Pointer {
inT = inT.Elem()
}

return inT.AssignableTo(ethSubModuleTyp)
return inT.AssignableTo(ethSubModuleTyp) || inT.AssignableTo(actorEventSubModuleTyp)
}

func (builder *RPCBuilder) AddV0API(service RPCService) error {
Expand Down
Loading

0 comments on commit 9c713ca

Please sign in to comment.