Skip to content

Commit

Permalink
Merge pull request #5722 from filecoin-project/feat/transport-code
Browse files Browse the repository at this point in the history
Feat/transport code
  • Loading branch information
diwufeiwen authored Feb 15, 2023
2 parents 1e8f438 + a3cf5f5 commit 8fc932e
Show file tree
Hide file tree
Showing 46 changed files with 1,129 additions and 674 deletions.
2 changes: 1 addition & 1 deletion app/submodule/chain/chain_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewChainSubmodule(ctx context.Context,
}
faultChecker := consensusfault.NewFaultChecker(chainStore, fork)
syscalls := vmsupport.NewSyscalls(faultChecker, config.Verifier())
processor := consensus.NewDefaultProcessor(syscalls, circulatiingSupplyCalculator)
processor := consensus.NewDefaultProcessor(syscalls, circulatiingSupplyCalculator, chainStore, config.Repo().Config().NetworkParams)

waiter := chain.NewWaiter(chainStore, messageStore, config.Repo().Datastore(), cbor.NewCborStore(config.Repo().Datastore()))

Expand Down
25 changes: 12 additions & 13 deletions app/submodule/chain/chaininfo_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/pkg/constants"
"github.com/filecoin-project/venus/pkg/fork"
"github.com/filecoin-project/venus/pkg/statemanger"
"github.com/filecoin-project/venus/venus-shared/actors"
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
Expand Down Expand Up @@ -769,25 +770,23 @@ func (cia *chainInfoAPI) StateActorManifestCID(ctx context.Context, nv network.V
// message is not applied on-top-of the messages in the passed-in
// tipset.
func (cia *chainInfoAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*types.InvocResult, error) {
start := time.Now()
ts, err := cia.chain.ChainReader.GetTipSet(ctx, tsk)
if err != nil {
return nil, fmt.Errorf("loading tipset %s: %v", tsk, err)
}
ret, err := cia.chain.Stmgr.Call(ctx, msg, ts)
if err != nil {
return nil, err
var res *types.InvocResult
for {
res, err = cia.chain.Stmgr.Call(ctx, msg, ts)
if err != fork.ErrExpensiveFork {
break
}
ts, err = cia.chain.ChainReader.GetTipSet(ctx, ts.Parents())
if err != nil {
return nil, fmt.Errorf("getting parent tipset: %w", err)
}
}
duration := time.Since(start)

mcid := msg.Cid()
return &types.InvocResult{
MsgCid: mcid,
Msg: msg,
MsgRct: &ret.Receipt,
ExecutionTrace: types.ExecutionTrace{},
Duration: duration,
}, nil
return res, nil
}

// StateReplay replays a given message, assuming it was included in a block in the specified tipset.
Expand Down
1 change: 1 addition & 0 deletions app/submodule/chain/miner_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (msa *minerStateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr ad
// StateSectorGetInfo returns the on-chain info for the specified miner's sector. Returns null in case the sector info isn't found
// NOTE: returned info.Expiration may not be accurate in some cases, use StateSectorExpiration to get accurate
// expiration epoch
// return nil if sector not found
func (msa *minerStateAPI) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*types.SectorOnChainInfo, error) {
_, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion app/submodule/eth/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/ipfs/go-cid"

"github.com/filecoin-project/go-jsonrpc"
v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
"github.com/filecoin-project/venus/venus-shared/types"
)
Expand Down Expand Up @@ -78,7 +79,7 @@ func (e *ethAPIDummy) EthGetBalance(ctx context.Context, address types.EthAddres
return types.EthBigIntZero, ErrModuleDisabled
}

func (e *ethAPIDummy) EthFeeHistory(ctx context.Context, blkCount types.EthUint64, newestBlk string, rewardPercentiles []float64) (types.EthFeeHistory, error) {
func (e *ethAPIDummy) EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (types.EthFeeHistory, error) {
return types.EthFeeHistory{}, ErrModuleDisabled
}

Expand Down
Loading

0 comments on commit 8fc932e

Please sign in to comment.