Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predicates: Fast StateGetActor wrapper #4835

Merged
merged 1 commit into from
Nov 12, 2020
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
34 changes: 34 additions & 0 deletions chain/events/state/fastapi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package state

import (
"context"

"github.com/filecoin-project/go-address"

"github.com/filecoin-project/lotus/chain/types"
)

type FastChainApiAPI interface {
ChainAPI

ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
}

type fastAPI struct {
FastChainApiAPI
}

func WrapFastAPI(api FastChainApiAPI) ChainAPI {
return &fastAPI{
api,
}
}

func (a *fastAPI) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
ts, err := a.FastChainApiAPI.ChainGetTipSet(ctx, tsk)
if err != nil {
return nil, err
}

return a.FastChainApiAPI.StateGetActor(ctx, actor, ts.Parents())
}
2 changes: 1 addition & 1 deletion markets/storageadapter/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func NewClientNodeAdapter(stateapi full.StateAPI, chain full.ChainAPI, mpool ful

fundmgr: fundmgr,
ev: events.NewEvents(context.TODO(), capi),
dsMatcher: newDealStateMatcher(state.NewStatePredicates(capi)),
dsMatcher: newDealStateMatcher(state.NewStatePredicates(state.WrapFastAPI(capi))),
}
}

Expand Down
2 changes: 1 addition & 1 deletion markets/storageadapter/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewProviderNodeAdapter(fc *config.MinerFeeConfig) func(dag dtypes.StagingDA
dag: dag,
secb: secb,
ev: events.NewEvents(context.TODO(), full),
dsMatcher: newDealStateMatcher(state.NewStatePredicates(full)),
dsMatcher: newDealStateMatcher(state.NewStatePredicates(state.WrapFastAPI(full))),
}
if fc != nil {
na.publishSpec = &api.MessageSendSpec{MaxFee: abi.TokenAmount(fc.MaxPublishDealsFee)}
Expand Down