Synthetic PoRep provider interface solution

This commit is contained in:
Andrew Jackson (Ajax) 2023-06-09 13:07:14 -05:00 committed by Łukasz Magiera
parent 7f306a5b02
commit 8281b26f94

View File

@ -23,6 +23,7 @@ import (
"github.com/filecoin-project/lotus/api/v1api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types"
@ -169,6 +170,28 @@ func (n *ProviderNodeAdapter) GetMinerWorkerAddress(ctx context.Context, maddr a
return mi.Worker, nil
}
func (n *ProviderNodeAdapter) GetProofType(ctx context.Context, maddr address.Address, tok shared.TipSetToken) (abi.RegisteredSealProof, error) {
tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil {
return 0, err
}
mi, err := n.StateMinerInfo(ctx, maddr, tsk)
if err != nil {
return 0, err
}
nver, err := n.StateNetworkVersion(ctx, tsk)
if err != nil {
return 0, err
}
// false because this variance is not consumed.
const configWantSynthetic = false
return miner.PreferredSealProofTypeFromWindowPoStType(nver, mi.WindowPoStProofType, configWantSynthetic)
}
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*crypto.Signature, error) {
signer, err := n.StateAccountKey(ctx, signer, types.EmptyTSK)
if err != nil {