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

Feat: add type SignedStorageAsk into venus-shared/在venus-shared中添加SignedStorageAsk类型定义. #5280

Merged
merged 4 commits into from
Sep 9, 2022
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
1 change: 1 addition & 0 deletions venus-devtool/cborgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func main() {
market.RetrievalAsk{},
market.ProviderDealState{},
market.TimeStamp{},
market.SignedStorageAsk{},
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions venus-shared/api/market/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type IMarket interface {
MarketGetDealUpdates(ctx context.Context) (<-chan market.MinerDeal, error) //perm:read
MarketListIncompleteDeals(ctx context.Context, mAddr address.Address) ([]market.MinerDeal, error) //perm:read
MarketSetAsk(ctx context.Context, mAddr address.Address, price types.BigInt, verifiedPrice types.BigInt, duration abi.ChainEpoch, minPieceSize abi.PaddedPieceSize, maxPieceSize abi.PaddedPieceSize) error //perm:admin
MarketGetAsk(ctx context.Context, mAddr address.Address) (*storagemarket.SignedStorageAsk, error) //perm:read
MarketListAsk(ctx context.Context) ([]*storagemarket.SignedStorageAsk, error) //perm:read
MarketGetAsk(ctx context.Context, mAddr address.Address) (*market.SignedStorageAsk, error) //perm:read
MarketListAsk(ctx context.Context) ([]*market.SignedStorageAsk, error) //perm:read
MarketSetRetrievalAsk(ctx context.Context, mAddr address.Address, rask *retrievalmarket.Ask) error //perm:admin
MarketGetRetrievalAsk(ctx context.Context, mAddr address.Address) (*retrievalmarket.Ask, error) //perm:read
MarketListRetrievalAsk(ctx context.Context) ([]*market.RetrievalAsk, error) //perm:read
Expand Down
8 changes: 6 additions & 2 deletions venus-shared/api/market/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,9 @@ Response:
"Signature": {
"Type": 2,
"Data": "Ynl0ZSBhcnJheQ=="
}
},
"CreatedAt": 42,
"UpdatedAt": 42
}
```

Expand Down Expand Up @@ -1141,7 +1143,9 @@ Response:
"Signature": {
"Type": 2,
"Data": "Ynl0ZSBhcnJheQ=="
}
},
"CreatedAt": 42,
"UpdatedAt": 42
}
]
```
Expand Down
9 changes: 4 additions & 5 deletions venus-shared/api/market/mock/mock_imarket.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions venus-shared/api/market/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions venus-shared/types/market/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions venus-shared/types/market/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto"
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
"github.com/ipfs/go-cid"

Expand Down Expand Up @@ -137,3 +138,20 @@ type StorageStatus struct {
Available int64
Reserved int64
}

type SignedStorageAsk struct {
Ask *storagemarket.StorageAsk
Signature *crypto.Signature
TimeStamp
}

func (sa *SignedStorageAsk) ToChainAsk() *storagemarket.SignedStorageAsk {
return &storagemarket.SignedStorageAsk{
Ask: sa.Ask,
Signature: sa.Signature,
}
}

func FromChainAsk(s *storagemarket.SignedStorageAsk) *SignedStorageAsk {
return &SignedStorageAsk{Ask: s.Ask, Signature: s.Signature}
}