Skip to content

Commit

Permalink
Feat/replace common type (#4636)
Browse files Browse the repository at this point in the history
* more type and function

* replace type
  • Loading branch information
simlecode authored Dec 22, 2021
1 parent e1d2584 commit bc4f8bc
Show file tree
Hide file tree
Showing 262 changed files with 2,307 additions and 1,611 deletions.
2 changes: 1 addition & 1 deletion app/client/apiface/blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/ipfs/go-cid"

"github.com/filecoin-project/venus/app/submodule/apitypes"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
)

type IBlockStore interface {
Expand Down
8 changes: 4 additions & 4 deletions app/client/apiface/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/pkg/types"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/miner"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"

"github.com/filecoin-project/go-state-types/big"
acrypto "github.com/filecoin-project/go-state-types/crypto"
Expand Down Expand Up @@ -70,7 +70,7 @@ type IChainInfo interface {
// Rule[perm:read]
ChainGetBlock(ctx context.Context, id cid.Cid) (*types.BlockHeader, error)
// Rule[perm:read]
ChainGetMessage(ctx context.Context, msgID cid.Cid) (*types.UnsignedMessage, error)
ChainGetMessage(ctx context.Context, msgID cid.Cid) (*types.Message, error)
// Rule[perm:read]
ChainGetBlockMessages(ctx context.Context, bid cid.Cid) (*apitypes.BlockMessages, error)
// Rule[perm:read]
Expand Down Expand Up @@ -189,7 +189,7 @@ type IMinerState interface {
// Rule[perm:read]
StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error)
// Rule[perm:read]
StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]types.MarketDeal, error)
StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]apitypes.MarketDeal, error)
// Rule[perm:read]
StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*miner.SectorOnChainInfo, error)
// Rule[perm:read]
Expand Down
4 changes: 2 additions & 2 deletions app/client/apiface/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package apiface
import (
"context"

"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/types"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
)

type IMarket interface {
Expand Down
4 changes: 2 additions & 2 deletions app/client/apiface/mining.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/types"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
)

type IMining interface {
Expand Down
25 changes: 12 additions & 13 deletions app/client/apiface/mpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package apiface
import (
"context"

"github.com/filecoin-project/venus/app/submodule/apitypes"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/venus/pkg/messagepool"
"github.com/filecoin-project/venus/pkg/types"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
"github.com/filecoin-project/venus/venus-shared/messagepool"
"github.com/ipfs/go-cid"
)

Expand Down Expand Up @@ -36,34 +35,34 @@ type IMessagePool interface {
// Rule[perm:write]
MpoolPushUntrusted(ctx context.Context, smsg *types.SignedMessage) (cid.Cid, error)
// Rule[perm:sign]
MpoolPushMessage(ctx context.Context, msg *types.UnsignedMessage, spec *types.MessageSendSpec) (*types.SignedMessage, error)
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *apitypes.MessageSendSpec) (*types.SignedMessage, error)
// Rule[perm:write]
MpoolBatchPush(ctx context.Context, smsgs []*types.SignedMessage) ([]cid.Cid, error)
// Rule[perm:write]
MpoolBatchPushUntrusted(ctx context.Context, smsgs []*types.SignedMessage) ([]cid.Cid, error)
// Rule[perm:sign]
MpoolBatchPushMessage(ctx context.Context, msgs []*types.UnsignedMessage, spec *types.MessageSendSpec) ([]*types.SignedMessage, error)
MpoolBatchPushMessage(ctx context.Context, msgs []*types.Message, spec *apitypes.MessageSendSpec) ([]*types.SignedMessage, error)
// Rule[perm:read]
MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error)
// Rule[perm:read]
MpoolSub(ctx context.Context) (<-chan messagepool.MpoolUpdate, error)
// Rule[perm:read]
GasEstimateMessageGas(ctx context.Context, msg *types.UnsignedMessage, spec *types.MessageSendSpec, tsk types.TipSetKey) (*types.UnsignedMessage, error)
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *apitypes.MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
// Rule[perm:read]
GasBatchEstimateMessageGas(ctx context.Context, estimateMessages []*types.EstimateMessage, fromNonce uint64, tsk types.TipSetKey) ([]*types.EstimateResult, error)
GasBatchEstimateMessageGas(ctx context.Context, estimateMessages []*apitypes.EstimateMessage, fromNonce uint64, tsk types.TipSetKey) ([]*apitypes.EstimateResult, error)
// Rule[perm:read]
GasEstimateFeeCap(ctx context.Context, msg *types.UnsignedMessage, maxqueueblks int64, tsk types.TipSetKey) (big.Int, error)
GasEstimateFeeCap(ctx context.Context, msg *types.Message, maxqueueblks int64, tsk types.TipSetKey) (big.Int, error)
// Rule[perm:read]
GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (big.Int, error)
// Rule[perm:read]
GasEstimateGasLimit(ctx context.Context, msgIn *types.UnsignedMessage, tsk types.TipSetKey) (int64, error)
GasEstimateGasLimit(ctx context.Context, msgIn *types.Message, tsk types.TipSetKey) (int64, error)
// MpoolCheckMessages performs logical checks on a batch of messages
// Rule[perm:read]
MpoolCheckMessages(ctx context.Context, protos []*apitypes.MessagePrototype) ([][]apitypes.MessageCheckStatus, error)
MpoolCheckMessages(ctx context.Context, protos []*messagepool.MessagePrototype) ([][]messagepool.MessageCheckStatus, error)
// MpoolCheckPendingMessages performs logical checks for all pending messages from a given address
// Rule[perm:read]
MpoolCheckPendingMessages(ctx context.Context, addr address.Address) ([][]apitypes.MessageCheckStatus, error)
MpoolCheckPendingMessages(ctx context.Context, addr address.Address) ([][]messagepool.MessageCheckStatus, error)
// MpoolCheckReplaceMessages performs logical checks on pending messages with replacement
// Rule[perm:read]
MpoolCheckReplaceMessages(ctx context.Context, msg []*types.Message) ([][]apitypes.MessageCheckStatus, error)
MpoolCheckReplaceMessages(ctx context.Context, msg []*types.Message) ([][]messagepool.MessageCheckStatus, error)
}
28 changes: 14 additions & 14 deletions app/client/apiface/multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ import (

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/types"
types "github.com/filecoin-project/venus/venus-shared/chain"
"github.com/filecoin-project/venus/venus-shared/messagepool"
)

type IMultiSig interface {
// Rule[perm:sign]
MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (*apitypes.MessagePrototype, error)
MsigCreate(ctx context.Context, req uint64, addrs []address.Address, duration abi.ChainEpoch, val types.BigInt, src address.Address, gp types.BigInt) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*apitypes.MessagePrototype, error)
MsigPropose(ctx context.Context, msig address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigAddPropose(ctx context.Context, msig address.Address, src address.Address, newAdd address.Address, inc bool) (*apitypes.MessagePrototype, error)
MsigAddPropose(ctx context.Context, msig address.Address, src address.Address, newAdd address.Address, inc bool) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (*apitypes.MessagePrototype, error)
MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (*apitypes.MessagePrototype, error)
MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (*apitypes.MessagePrototype, error)
MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (*apitypes.MessagePrototype, error)
MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (*apitypes.MessagePrototype, error)
MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (*apitypes.MessagePrototype, error)
MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigApproveTxnHash(ctx context.Context, msig address.Address, txID uint64, proposer address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*apitypes.MessagePrototype, error)
MsigApproveTxnHash(ctx context.Context, msig address.Address, txID uint64, proposer address.Address, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigCancel(ctx context.Context, msig address.Address, txID uint64, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*apitypes.MessagePrototype, error)
MsigCancel(ctx context.Context, msig address.Address, txID uint64, to address.Address, amt types.BigInt, src address.Address, method uint64, params []byte) (*messagepool.MessagePrototype, error)
// Rule[perm:sign]
MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (*apitypes.MessagePrototype, error)
MsigRemoveSigner(ctx context.Context, msig address.Address, proposer address.Address, toRemove address.Address, decrease bool) (*messagepool.MessagePrototype, error)
// Rule[perm:read]
MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)
}
6 changes: 3 additions & 3 deletions app/client/apiface/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package apiface
import (
"context"

"github.com/filecoin-project/venus/app/submodule/apitypes"

"github.com/filecoin-project/venus/pkg/net"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr"

"github.com/filecoin-project/venus/pkg/net"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
)

type INetwork interface {
Expand Down
14 changes: 6 additions & 8 deletions app/client/apiface/paych.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package apiface
import (
"context"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/paychmgr"
"github.com/filecoin-project/venus/pkg/types"

"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/venus/pkg/paychmgr"
paychtypes "github.com/filecoin-project/venus/venus-shared/paych"
)

type IPaychan interface {
Expand All @@ -20,7 +18,7 @@ type IPaychan interface {
// @to: the payment channel recipient
// @amt: the deposits funds in the payment channel
// Rule[perm:sign]
PaychGet(ctx context.Context, from, to address.Address, amt big.Int) (*apitypes.ChannelInfo, error)
PaychGet(ctx context.Context, from, to address.Address, amt big.Int) (*paychtypes.ChannelInfo, error)
// PaychAvailableFunds get the status of an outbound payment channel
// @pch: payment channel address
// Rule[perm:sign]
Expand All @@ -44,14 +42,14 @@ type IPaychan interface {
// @to: the payment channel recipient
// @vouchers: the outstanding (non-redeemed) vouchers
// Rule[perm:sign]
PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []apitypes.VoucherSpec) (*apitypes.PaymentInfo, error)
PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []paychtypes.VoucherSpec) (*paychtypes.PaymentInfo, error)
// PaychList list the addresses of all channels that have been created
// Rule[perm:read]
PaychList(ctx context.Context) ([]address.Address, error)
// PaychStatus get the payment channel status
// @pch: payment channel address
// Rule[perm:read]
PaychStatus(ctx context.Context, pch address.Address) (*types.PaychStatus, error)
PaychStatus(ctx context.Context, pch address.Address) (*paychtypes.Status, error)
// PaychSettle update payment channel status to settle
// After a settlement period (currently 12 hours) either party to the payment channel can call collect on chain
// @pch: payment channel address
Expand Down
6 changes: 3 additions & 3 deletions app/client/apiface/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"

"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/venus/app/submodule/apitypes"
syncTypes "github.com/filecoin-project/venus/pkg/chainsync/types"
"github.com/filecoin-project/venus/pkg/types"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
)

type ISyncer interface {
Expand All @@ -23,7 +23,7 @@ type ISyncer interface {
// Rule[perm:write]
SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) error
// Rule[perm:read]
StateCall(ctx context.Context, msg *types.UnsignedMessage, tsk types.TipSetKey) (*types.InvocResult, error)
StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*apitypes.InvocResult, error)
// Rule[perm:read]
SyncState(ctx context.Context) (*apitypes.SyncState, error)
}
2 changes: 1 addition & 1 deletion app/client/apiface/v0api/blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/ipfs/go-cid"

"github.com/filecoin-project/venus/app/submodule/apitypes"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
)

type IBlockStore interface {
Expand Down
16 changes: 8 additions & 8 deletions app/client/apiface/v0api/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/pkg/types"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/miner"

"github.com/filecoin-project/go-state-types/big"
acrypto "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/miner"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
)

type IChain interface {
Expand Down Expand Up @@ -64,7 +64,7 @@ type IChainInfo interface {
// Rule[perm:read]
ChainGetBlock(ctx context.Context, id cid.Cid) (*types.BlockHeader, error)
// Rule[perm:read]
ChainGetMessage(ctx context.Context, msgID cid.Cid) (*types.UnsignedMessage, error)
ChainGetMessage(ctx context.Context, msgID cid.Cid) (*types.Message, error)
// Rule[perm:read]
ChainGetBlockMessages(ctx context.Context, bid cid.Cid) (*apitypes.BlockMessages, error)
// Rule[perm:read]
Expand Down Expand Up @@ -155,7 +155,7 @@ type IMinerState interface {
// Rule[perm:read]
StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error)
// Rule[perm:read]
StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]types.MarketDeal, error)
StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]apitypes.MarketDeal, error)
// Rule[perm:read]
StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*miner.SectorOnChainInfo, error)
// Rule[perm:read]
Expand Down
4 changes: 2 additions & 2 deletions app/client/apiface/v0api/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package v0api
import (
"context"

"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/types"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
)

type IMarket interface {
Expand Down
4 changes: 2 additions & 2 deletions app/client/apiface/v0api/mining.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/venus/app/submodule/apitypes"
"github.com/filecoin-project/venus/pkg/types"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
types "github.com/filecoin-project/venus/venus-shared/chain"
)

type IMining interface {
Expand Down
Loading

0 comments on commit bc4f8bc

Please sign in to comment.