Skip to content

Commit

Permalink
use the shared API (#4639)
Browse files Browse the repository at this point in the history
* use the shared API
  • Loading branch information
simlecode authored Dec 24, 2021
1 parent c6c0a39 commit 3b23ec7
Show file tree
Hide file tree
Showing 107 changed files with 485 additions and 780 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ jobs:
cmd: "lint"
- go_build:
cmd: "build"
- go_build:
cmd: "gen-api"
- check_file_change
#- go_build:
# cmd: "gen-api"
#- check_file_change
# place the filecoin binary in PATH for IPTB
- go_build:
cmd: "install"
Expand Down
9 changes: 4 additions & 5 deletions app/client/apiface/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ 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/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"
Expand Down Expand Up @@ -86,7 +85,7 @@ type IChainInfo interface {
// Rule[perm:read]
StateVerifierStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
// Rule[perm:read]
ChainNotify(ctx context.Context) <-chan []*chain.HeadChange
ChainNotify(ctx context.Context) <-chan []*apitypes.HeadChange
// Rule[perm:read]
GetFullBlock(ctx context.Context, id cid.Cid) (*types.FullBlock, error)
// Rule[perm:read]
Expand All @@ -96,7 +95,7 @@ type IChainInfo interface {
// Rule[perm:read]
GetEntry(ctx context.Context, height abi.ChainEpoch, round uint64) (*types.BeaconEntry, error)
// Rule[perm:read]
MessageWait(ctx context.Context, msgCid cid.Cid, confidence, lookback abi.ChainEpoch) (*chain.ChainMessage, error)
MessageWait(ctx context.Context, msgCid cid.Cid, confidence, lookback abi.ChainEpoch) (*apitypes.ChainMessage, error)
// Rule[perm:read]
ProtocolParameters(ctx context.Context) (*apitypes.ProtocolParams, error)
// Rule[perm:read]
Expand Down Expand Up @@ -148,7 +147,7 @@ type IChainInfo interface {
// Rule[perm:read]
ChainExport(context.Context, abi.ChainEpoch, bool, types.TipSetKey) (<-chan []byte, error)
// Rule[perm:read]
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*chain.HeadChange, error)
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*apitypes.HeadChange, error)
}

type IMinerState interface {
Expand Down Expand Up @@ -185,7 +184,7 @@ type IMinerState interface {
// Rule[perm:read]
StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error)
// Rule[perm:read]
StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (chain.CirculatingSupply, error)
StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error)
// Rule[perm:read]
StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error)
// Rule[perm:read]
Expand Down
2 changes: 1 addition & 1 deletion app/client/apiface/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"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"
"github.com/filecoin-project/venus/venus-shared/libp2p/net"
)

type INetwork interface {
Expand Down
8 changes: 4 additions & 4 deletions app/client/apiface/paych.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/venus/pkg/paychmgr"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
paychtypes "github.com/filecoin-project/venus/venus-shared/paych"
)

Expand All @@ -22,12 +22,12 @@ type IPaychan interface {
// PaychAvailableFunds get the status of an outbound payment channel
// @pch: payment channel address
// Rule[perm:sign]
PaychAvailableFunds(ctx context.Context, ch address.Address) (*paychmgr.ChannelAvailableFunds, error)
PaychAvailableFunds(ctx context.Context, ch address.Address) (*apitypes.ChannelAvailableFunds, error)
// PaychAvailableFundsByFromTo get the status of an outbound payment channel
// @from: the payment channel sender
// @to: he payment channel recipient
// Rule[perm:sign]
PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*paychmgr.ChannelAvailableFunds, error)
PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*apitypes.ChannelAvailableFunds, error)
// PaychGetWaitReady waits until the create channel / add funds message with the sentinel
// @sentinel: given message CID arrives.
// @ch: the returned channel address can safely be used against the Manager methods.
Expand Down Expand Up @@ -87,7 +87,7 @@ type IPaychan interface {
// If there are insufficient funds in the channel to create the voucher,
// returns a nil voucher and the shortfall.
// Rule[perm:sign]
PaychVoucherCreate(ctx context.Context, pch address.Address, amt big.Int, lane uint64) (*paychmgr.VoucherCreateResult, error)
PaychVoucherCreate(ctx context.Context, pch address.Address, amt big.Int, lane uint64) (*paychtypes.VoucherCreateResult, error)
// PaychVoucherList list vouchers in payment channel
// @pch: payment channel address
// Rule[perm:write]
Expand Down
9 changes: 4 additions & 5 deletions app/client/apiface/v0api/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"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"
Expand Down Expand Up @@ -80,7 +79,7 @@ type IChainInfo interface {
// Rule[perm:read]
StateVerifierStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
// Rule[perm:read]
ChainNotify(ctx context.Context) <-chan []*chain.HeadChange
ChainNotify(ctx context.Context) <-chan []*apitypes.HeadChange
// Rule[perm:read]
GetFullBlock(ctx context.Context, id cid.Cid) (*types.FullBlock, error)
// Rule[perm:read]
Expand All @@ -90,7 +89,7 @@ type IChainInfo interface {
// Rule[perm:read]
GetEntry(ctx context.Context, height abi.ChainEpoch, round uint64) (*types.BeaconEntry, error)
// Rule[perm:read]
MessageWait(ctx context.Context, msgCid cid.Cid, confidence, lookback abi.ChainEpoch) (*chain.ChainMessage, error)
MessageWait(ctx context.Context, msgCid cid.Cid, confidence, lookback abi.ChainEpoch) (*apitypes.ChainMessage, error)
// Rule[perm:read]
ProtocolParameters(ctx context.Context) (*apitypes.ProtocolParams, error)
// Rule[perm:read]
Expand All @@ -114,7 +113,7 @@ type IChainInfo interface {
// Rule[perm:read]
ChainExport(context.Context, abi.ChainEpoch, bool, types.TipSetKey) (<-chan []byte, error)
// Rule[perm:read]
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*chain.HeadChange, error)
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*apitypes.HeadChange, error)
}

type IMinerState interface {
Expand Down Expand Up @@ -151,7 +150,7 @@ type IMinerState interface {
// Rule[perm:read]
StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error)
// Rule[perm:read]
StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (chain.CirculatingSupply, error)
StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error)
// Rule[perm:read]
StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error)
// Rule[perm:read]
Expand Down
3 changes: 1 addition & 2 deletions app/client/apiface/v0api/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import (
"context"

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

"github.com/filecoin-project/venus/pkg/net"
"github.com/filecoin-project/venus/venus-shared/libp2p/net"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/peer"
Expand Down
8 changes: 4 additions & 4 deletions app/client/apiface/v0api/paych.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/venus/pkg/paychmgr"
apitypes "github.com/filecoin-project/venus/venus-shared/api/chain"
paychtypes "github.com/filecoin-project/venus/venus-shared/paych"
)

Expand All @@ -22,12 +22,12 @@ type IPaychan interface {
// PaychAvailableFunds get the status of an outbound payment channel
// @pch: payment channel address
// Rule[perm:sign]
PaychAvailableFunds(ctx context.Context, ch address.Address) (*paychmgr.ChannelAvailableFunds, error)
PaychAvailableFunds(ctx context.Context, ch address.Address) (*apitypes.ChannelAvailableFunds, error)
// PaychAvailableFundsByFromTo get the status of an outbound payment channel
// @from: the payment channel sender
// @to: he payment channel recipient
// Rule[perm:sign]
PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*paychmgr.ChannelAvailableFunds, error)
PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*apitypes.ChannelAvailableFunds, error)
// PaychGetWaitReady waits until the create channel / add funds message with the sentinel
// @sentinel: given message CID arrives.
// @ch: the returned channel address can safely be used against the Manager methods.
Expand Down Expand Up @@ -87,7 +87,7 @@ type IPaychan interface {
// If there are insufficient funds in the channel to create the voucher,
// returns a nil voucher and the shortfall.
// Rule[perm:sign]
PaychVoucherCreate(ctx context.Context, pch address.Address, amt big.Int, lane uint64) (*paychmgr.VoucherCreateResult, error)
PaychVoucherCreate(ctx context.Context, pch address.Address, amt big.Int, lane uint64) (*paychtypes.VoucherCreateResult, error)
// PaychVoucherList list vouchers in payment channel
// @pch: payment channel address
// Rule[perm:write]
Expand Down
Loading

0 comments on commit 3b23ec7

Please sign in to comment.