Merge remote-tracking branch 'origin/testnet/3' into feat/4stage-seal
This commit is contained in:
commit
f54a555aa8
@ -136,7 +136,7 @@ type FullNode interface {
|
|||||||
|
|
||||||
MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
|
MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
|
||||||
|
|
||||||
MarketEnsureAvailable(context.Context, address.Address, types.BigInt) error
|
MarketEnsureAvailable(context.Context, address.Address, address.Address, types.BigInt) error
|
||||||
// MarketFreeBalance
|
// MarketFreeBalance
|
||||||
|
|
||||||
PaychGet(ctx context.Context, from, to address.Address, ensureFunds types.BigInt) (*ChannelInfo, error)
|
PaychGet(ctx context.Context, from, to address.Address, ensureFunds types.BigInt) (*ChannelInfo, error)
|
||||||
|
@ -132,7 +132,7 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
MsigGetAvailableBalance func(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
MsigGetAvailableBalance func(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
||||||
|
|
||||||
MarketEnsureAvailable func(context.Context, address.Address, types.BigInt) error `perm:"sign"`
|
MarketEnsureAvailable func(context.Context, address.Address, address.Address, types.BigInt) error `perm:"sign"`
|
||||||
|
|
||||||
PaychGet func(ctx context.Context, from, to address.Address, ensureFunds types.BigInt) (*api.ChannelInfo, error) `perm:"sign"`
|
PaychGet func(ctx context.Context, from, to address.Address, ensureFunds types.BigInt) (*api.ChannelInfo, error) `perm:"sign"`
|
||||||
PaychList func(context.Context) ([]address.Address, error) `perm:"read"`
|
PaychList func(context.Context) ([]address.Address, error) `perm:"read"`
|
||||||
@ -519,8 +519,8 @@ func (c *FullNodeStruct) MsigGetAvailableBalance(ctx context.Context, a address.
|
|||||||
return c.Internal.MsigGetAvailableBalance(ctx, a, tsk)
|
return c.Internal.MsigGetAvailableBalance(ctx, a, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) MarketEnsureAvailable(ctx context.Context, addr address.Address, amt types.BigInt) error {
|
func (c *FullNodeStruct) MarketEnsureAvailable(ctx context.Context, addr, wallet address.Address, amt types.BigInt) error {
|
||||||
return c.Internal.MarketEnsureAvailable(ctx, addr, amt)
|
return c.Internal.MarketEnsureAvailable(ctx, addr, wallet, amt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychGet(ctx context.Context, from, to address.Address, ensureFunds types.BigInt) (*api.ChannelInfo, error) {
|
func (c *FullNodeStruct) PaychGet(ctx context.Context, from, to address.Address, ensureFunds types.BigInt) (*api.ChannelInfo, error) {
|
||||||
|
@ -130,7 +130,7 @@ func (e *calledEvents) checkNewCalls(ts *types.TipSet) {
|
|||||||
for _, matchFn := range matchFns {
|
for _, matchFn := range matchFns {
|
||||||
ok, err := matchFn(msg)
|
ok, err := matchFn(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("event matcher failed: %s", err)
|
log.Errorf("event matcher failed: %s", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
matched = ok
|
matched = ok
|
||||||
|
@ -574,9 +574,13 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
|
|||||||
|
|
||||||
var sinfos []abi.SectorInfo
|
var sinfos []abi.SectorInfo
|
||||||
for _, s := range pset {
|
for _, s := range pset {
|
||||||
|
if s.Info.Info.RegisteredProof == 0 {
|
||||||
|
return nil, xerrors.Errorf("sector %d in proving set had registered type of zero", s.ID)
|
||||||
|
}
|
||||||
sinfos = append(sinfos, abi.SectorInfo{
|
sinfos = append(sinfos, abi.SectorInfo{
|
||||||
SectorNumber: s.ID,
|
SectorNumber: s.ID,
|
||||||
SealedCID: s.Info.Info.SealedCID,
|
SealedCID: s.Info.Info.SealedCID,
|
||||||
|
RegisteredProof: s.Info.Info.RegisteredProof,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +201,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
{
|
{
|
||||||
newSectorInfo := &miner.SectorOnChainInfo{
|
newSectorInfo := &miner.SectorOnChainInfo{
|
||||||
Info: miner.SectorPreCommitInfo{
|
Info: miner.SectorPreCommitInfo{
|
||||||
|
RegisteredProof: preseal.ProofType,
|
||||||
SectorNumber: preseal.SectorID,
|
SectorNumber: preseal.SectorID,
|
||||||
SealedCID: preseal.CommR,
|
SealedCID: preseal.CommR,
|
||||||
SealRandEpoch: 0,
|
SealRandEpoch: 0,
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
logging "github.com/ipfs/go-log"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
@ -14,6 +15,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/node/impl/full"
|
"github.com/filecoin-project/lotus/node/impl/full"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var log = logging.Logger("market_adapter")
|
||||||
|
|
||||||
type FundMgr struct {
|
type FundMgr struct {
|
||||||
sm *stmgr.StateManager
|
sm *stmgr.StateManager
|
||||||
mpool full.MpoolAPI
|
mpool full.MpoolAPI
|
||||||
@ -31,7 +34,7 @@ func NewFundMgr(sm *stmgr.StateManager, mpool full.MpoolAPI) *FundMgr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr address.Address, amt types.BigInt) error {
|
func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Address, amt types.BigInt) error {
|
||||||
fm.lk.Lock()
|
fm.lk.Lock()
|
||||||
avail, ok := fm.available[addr]
|
avail, ok := fm.available[addr]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -64,7 +67,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr address.Address, am
|
|||||||
|
|
||||||
smsg, err := fm.mpool.MpoolPushMessage(ctx, &types.Message{
|
smsg, err := fm.mpool.MpoolPushMessage(ctx, &types.Message{
|
||||||
To: builtin.StorageMarketActorAddr,
|
To: builtin.StorageMarketActorAddr,
|
||||||
From: addr,
|
From: wallet,
|
||||||
Value: toAdd,
|
Value: toAdd,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1000000),
|
GasLimit: types.NewInt(1000000),
|
||||||
@ -77,7 +80,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr address.Address, am
|
|||||||
|
|
||||||
_, r, err := fm.sm.WaitForMessage(ctx, smsg.Cid())
|
_, r, err := fm.sm.WaitForMessage(ctx, smsg.Cid())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return xerrors.Errorf("failed waiting for market AddBalance message: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.ExitCode != 0 {
|
if r.ExitCode != 0 {
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||||
"github.com/filecoin-project/specs-actors/actors/runtime"
|
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -57,7 +58,7 @@ func (tas *testActorState) UnmarshalCBOR(r io.Reader) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if t != cbg.MajUnsignedInt {
|
if t != cbg.MajUnsignedInt {
|
||||||
return fmt.Errorf("wrong type in test actor state")
|
return fmt.Errorf("wrong type in test actor state (got %d)", t)
|
||||||
}
|
}
|
||||||
tas.HasUpgraded = v
|
tas.HasUpgraded = v
|
||||||
return nil
|
return nil
|
||||||
@ -70,38 +71,29 @@ func (ta *testActor) Exports() []interface{} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ta *testActor) Constructor(act *types.Actor, vmctx types.VMContext, params *struct{}) ([]byte, aerrors.ActorError) {
|
func (ta *testActor) Constructor(rt runtime.Runtime, params *adt.EmptyValue) *adt.EmptyValue {
|
||||||
c, err := vmctx.Storage().Put(&testActorState{11})
|
|
||||||
if err != nil {
|
rt.State().Create(&testActorState{11})
|
||||||
return nil, err
|
fmt.Println("NEW ACTOR ADDRESS IS: ", rt.Message().Receiver())
|
||||||
}
|
|
||||||
empty, err := vmctx.Storage().Put(&adt.EmptyValue{})
|
return &adt.EmptyValue{}
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("NEW ACTOR ADDRESS IS: ", vmctx.Message().To.String())
|
func (ta *testActor) TestMethod(rt runtime.Runtime, params *adt.EmptyValue) *adt.EmptyValue {
|
||||||
|
|
||||||
return nil, vmctx.Storage().Commit(empty, c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ta *testActor) TestMethod(act *types.Actor, vmctx types.VMContext, params *struct{}) ([]byte, aerrors.ActorError) {
|
|
||||||
var st testActorState
|
var st testActorState
|
||||||
if err := vmctx.Storage().Get(vmctx.Storage().GetHead(), &st); err != nil {
|
rt.State().Readonly(&st)
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if vmctx.BlockHeight() > testForkHeight {
|
if rt.CurrEpoch() > testForkHeight {
|
||||||
if st.HasUpgraded != 55 {
|
if st.HasUpgraded != 55 {
|
||||||
return nil, aerrors.Fatal("fork updating applied in wrong order")
|
panic(aerrors.Fatal("fork updating applied in wrong order"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if st.HasUpgraded != 11 {
|
if st.HasUpgraded != 11 {
|
||||||
return nil, aerrors.Fatal("fork updating happened too early")
|
panic(aerrors.Fatal("fork updating happened too early"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return &adt.EmptyValue{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestForkHeightTriggers(t *testing.T) {
|
func TestForkHeightTriggers(t *testing.T) {
|
||||||
@ -125,7 +117,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// predicting the address here... may break if other assumptions change
|
// predicting the address here... may break if other assumptions change
|
||||||
taddr, err := address.NewIDAddress(1000)
|
taddr, err := address.NewIDAddress(1002)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -144,7 +136,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
|
|
||||||
var tas testActorState
|
var tas testActorState
|
||||||
if err := cst.Get(ctx, act.Head, &tas); err != nil {
|
if err := cst.Get(ctx, act.Head, &tas); err != nil {
|
||||||
return cid.Undef, err
|
return cid.Undef, xerrors.Errorf("in fork handler, failed to run get: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tas.HasUpgraded = 55
|
tas.HasUpgraded = 55
|
||||||
|
@ -5,11 +5,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
|
||||||
"github.com/minio/blake2b-simd"
|
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
"github.com/minio/blake2b-simd"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/runtime"
|
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||||
@ -890,12 +891,12 @@ func (cs *ChainStore) TryFillTipSet(ts *types.TipSet) (*FullTipSet, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func drawRandomness(t *types.Ticket, pers crypto.DomainSeparationTag, round int64, entropy []byte) ([]byte, error) {
|
func drawRandomness(t *types.Ticket, pers crypto.DomainSeparationTag, round int64, entropy []byte) ([]byte, error) {
|
||||||
// TODO: Make this spec compliant
|
|
||||||
h := blake2b.New256()
|
h := blake2b.New256()
|
||||||
if err := binary.Write(h, binary.BigEndian, int64(pers)); err != nil {
|
if err := binary.Write(h, binary.BigEndian, int64(pers)); err != nil {
|
||||||
return nil, xerrors.Errorf("deriving randomness: %w", err)
|
return nil, xerrors.Errorf("deriving randomness: %w", err)
|
||||||
}
|
}
|
||||||
h.Write(t.VRFProof)
|
VRFDigest := blake2b.Sum256(t.VRFProof)
|
||||||
|
h.Write(VRFDigest[:])
|
||||||
if err := binary.Write(h, binary.BigEndian, round); err != nil {
|
if err := binary.Write(h, binary.BigEndian, round); err != nil {
|
||||||
return nil, xerrors.Errorf("deriving randomness: %w", err)
|
return nil, xerrors.Errorf("deriving randomness: %w", err)
|
||||||
}
|
}
|
||||||
@ -909,9 +910,11 @@ func (cs *ChainStore) GetRandomness(ctx context.Context, blks []cid.Cid, pers cr
|
|||||||
defer span.End()
|
defer span.End()
|
||||||
span.AddAttributes(trace.Int64Attribute("round", round))
|
span.AddAttributes(trace.Int64Attribute("round", round))
|
||||||
|
|
||||||
|
/*
|
||||||
defer func() {
|
defer func() {
|
||||||
log.Infof("getRand %v %d %d %x -> %x", blks, pers, round, entropy, out)
|
log.Infof("getRand %v %d %d %x -> %x", blks, pers, round, entropy, out)
|
||||||
}()
|
}()
|
||||||
|
*/
|
||||||
|
|
||||||
for {
|
for {
|
||||||
nts, err := cs.LoadTipSet(types.NewTipSetKey(blks...))
|
nts, err := cs.LoadTipSet(types.NewTipSetKey(blks...))
|
||||||
@ -921,25 +924,12 @@ func (cs *ChainStore) GetRandomness(ctx context.Context, blks []cid.Cid, pers cr
|
|||||||
|
|
||||||
mtb := nts.MinTicketBlock()
|
mtb := nts.MinTicketBlock()
|
||||||
|
|
||||||
if int64(nts.Height()) <= round {
|
// if at (or just past -- for null epochs) appropriate epoch
|
||||||
|
// or at genesis (works for negative epochs)
|
||||||
|
if int64(nts.Height()) <= round || mtb.Height == 0 {
|
||||||
return drawRandomness(nts.MinTicketBlock().Ticket, pers, round, entropy)
|
return drawRandomness(nts.MinTicketBlock().Ticket, pers, round, entropy)
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case for lookback behind genesis block
|
|
||||||
// TODO(spec): this is not in the spec, need to sync that
|
|
||||||
if mtb.Height == 0 {
|
|
||||||
|
|
||||||
// round is negative
|
|
||||||
thash, err := drawRandomness(mtb.Ticket, pers, round*-1, entropy)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// for negative lookbacks, just use the hash of the positive tickethash value
|
|
||||||
h := blake2b.Sum256(thash)
|
|
||||||
return h[:], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
blks = mtb.Parents
|
blks = mtb.Parents
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
|
"github.com/minio/blake2b-simd"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
@ -170,7 +171,9 @@ func (ts *TipSet) Equals(ots *TipSet) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Ticket) Less(o *Ticket) bool {
|
func (t *Ticket) Less(o *Ticket) bool {
|
||||||
return bytes.Compare(t.VRFProof, o.VRFProof) < 0
|
tDigest := blake2b.Sum256(t.VRFProof)
|
||||||
|
oDigest := blake2b.Sum256(o.VRFProof)
|
||||||
|
return bytes.Compare(tDigest[:], oDigest[:]) < 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *TipSet) MinTicket() *Ticket {
|
func (ts *TipSet) MinTicket() *Ticket {
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
@ -89,17 +88,7 @@ type Invokee interface {
|
|||||||
var tVMContext = reflect.TypeOf((*types.VMContext)(nil)).Elem()
|
var tVMContext = reflect.TypeOf((*types.VMContext)(nil)).Elem()
|
||||||
var tAError = reflect.TypeOf((*aerrors.ActorError)(nil)).Elem()
|
var tAError = reflect.TypeOf((*aerrors.ActorError)(nil)).Elem()
|
||||||
|
|
||||||
func (i *invoker) transform(instance Invokee) (nativeCode, error) {
|
func (*invoker) transform(instance Invokee) (nativeCode, error) {
|
||||||
itype := reflect.TypeOf(instance)
|
|
||||||
if strings.Contains(itype.PkgPath(), "github.com/filecoin-project/specs-actors/") {
|
|
||||||
return i.transformSpec(instance)
|
|
||||||
} else {
|
|
||||||
return i.transformLotus(instance)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*invoker) transformSpec(instance Invokee) (nativeCode, error) {
|
|
||||||
itype := reflect.TypeOf(instance)
|
itype := reflect.TypeOf(instance)
|
||||||
exports := instance.Exports()
|
exports := instance.Exports()
|
||||||
for i, m := range exports {
|
for i, m := range exports {
|
||||||
@ -178,81 +167,6 @@ func (*invoker) transformSpec(instance Invokee) (nativeCode, error) {
|
|||||||
return code, nil
|
return code, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*invoker) transformLotus(instance Invokee) (nativeCode, error) {
|
|
||||||
itype := reflect.TypeOf(instance)
|
|
||||||
exports := instance.Exports()
|
|
||||||
for i, m := range exports {
|
|
||||||
i := i
|
|
||||||
newErr := func(format string, args ...interface{}) error {
|
|
||||||
str := fmt.Sprintf(format, args...)
|
|
||||||
return fmt.Errorf("transform(%s) export(%d): %s", itype.Name(), i, str)
|
|
||||||
}
|
|
||||||
if m == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
meth := reflect.ValueOf(m)
|
|
||||||
t := meth.Type()
|
|
||||||
if t.Kind() != reflect.Func {
|
|
||||||
return nil, newErr("is not a function")
|
|
||||||
}
|
|
||||||
if t.NumIn() != 3 {
|
|
||||||
return nil, newErr("wrong number of inputs should be: " +
|
|
||||||
"*types.Actor, *VMContext, <type of parameter>")
|
|
||||||
}
|
|
||||||
if t.In(0) != reflect.TypeOf(&types.Actor{}) {
|
|
||||||
return nil, newErr("first arguemnt should be *types.Actor")
|
|
||||||
}
|
|
||||||
if t.In(1) != tVMContext {
|
|
||||||
return nil, newErr("second argument should be types.VMContext")
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.In(2).Kind() != reflect.Ptr {
|
|
||||||
return nil, newErr("parameter has to be a pointer to parameter, is: %s",
|
|
||||||
t.In(2).Kind())
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.NumOut() != 2 {
|
|
||||||
return nil, newErr("wrong number of outputs should be: " +
|
|
||||||
"(InvokeRet, error)")
|
|
||||||
}
|
|
||||||
if t.Out(0) != reflect.TypeOf([]byte{}) {
|
|
||||||
return nil, newErr("first output should be slice of bytes")
|
|
||||||
}
|
|
||||||
if !t.Out(1).Implements(tAError) {
|
|
||||||
return nil, newErr("second output should be ActorError type")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
code := make(nativeCode, len(exports))
|
|
||||||
for id, m := range exports {
|
|
||||||
meth := reflect.ValueOf(m)
|
|
||||||
code[id] = reflect.MakeFunc(reflect.TypeOf((invokeFunc)(nil)),
|
|
||||||
func(in []reflect.Value) []reflect.Value {
|
|
||||||
paramT := meth.Type().In(2).Elem()
|
|
||||||
param := reflect.New(paramT)
|
|
||||||
|
|
||||||
inBytes := in[2].Interface().([]byte)
|
|
||||||
if len(inBytes) > 0 {
|
|
||||||
if err := DecodeParams(inBytes, param.Interface()); err != nil {
|
|
||||||
aerr := aerrors.Absorb(err, 1, "failed to decode parameters")
|
|
||||||
return []reflect.Value{
|
|
||||||
reflect.ValueOf([]byte{}),
|
|
||||||
// Below is a hack, fixed in Go 1.13
|
|
||||||
// https://git.io/fjXU6
|
|
||||||
reflect.ValueOf(&aerr).Elem(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return meth.Call([]reflect.Value{
|
|
||||||
in[0], in[1], param,
|
|
||||||
})
|
|
||||||
}).Interface().(invokeFunc)
|
|
||||||
|
|
||||||
}
|
|
||||||
return code, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func DecodeParams(b []byte, out interface{}) error {
|
func DecodeParams(b []byte, out interface{}) error {
|
||||||
um, ok := out.(cbg.CBORUnmarshaler)
|
um, ok := out.(cbg.CBORUnmarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -257,6 +257,7 @@ func (rs *runtimeShim) Send(to address.Address, method abi.MethodNum, m vmr.CBOR
|
|||||||
if err.IsFatal() {
|
if err.IsFatal() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
log.Warnf("vmctx send failed: to: %s, method: %d: ret: %d, err: %s", to, method, ret, err)
|
||||||
return nil, exitcode.ExitCode(err.RetCode())
|
return nil, exitcode.ExitCode(err.RetCode())
|
||||||
}
|
}
|
||||||
return &dumbWrapperType{ret}, 0
|
return &dumbWrapperType{ret}, 0
|
||||||
|
@ -76,7 +76,6 @@ func (ss *syscallShim) VerifyConsensusFault(a, b []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ss *syscallShim) VerifyPoSt(proof abi.PoStVerifyInfo) error {
|
func (ss *syscallShim) VerifyPoSt(proof abi.PoStVerifyInfo) error {
|
||||||
//VerifyFallbackPost(ctx context.Context, sectorSize abi.SectorSize, sectorInfo SortedPublicSectorInfo, challengeSeed []byte, proof []byte, candidates []EPostCandidate, proverID address.Address, faults uint64) (bool, error)
|
|
||||||
ok, err := ss.verifier.VerifyFallbackPost(context.TODO(), proof)
|
ok, err := ss.verifier.VerifyFallbackPost(context.TODO(), proof)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -105,9 +104,6 @@ func (ss *syscallShim) VerifySeal(info abi.SealVerifyInfo) error {
|
|||||||
//_, span := trace.StartSpan(ctx, "ValidatePoRep")
|
//_, span := trace.StartSpan(ctx, "ValidatePoRep")
|
||||||
//defer span.End()
|
//defer span.End()
|
||||||
|
|
||||||
commD := cidToCommD(info.UnsealedCID)
|
|
||||||
commR := cidToCommR(info.OnChain.SealedCID)
|
|
||||||
|
|
||||||
miner, err := address.NewIDAddress(uint64(info.Miner))
|
miner, err := address.NewIDAddress(uint64(info.Miner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("weirdly failed to construct address: %w", err)
|
return xerrors.Errorf("weirdly failed to construct address: %w", err)
|
||||||
@ -117,7 +113,7 @@ func (ss *syscallShim) VerifySeal(info abi.SealVerifyInfo) error {
|
|||||||
proof := []byte(info.OnChain.Proof)
|
proof := []byte(info.OnChain.Proof)
|
||||||
seed := []byte(info.InteractiveRandomness)
|
seed := []byte(info.InteractiveRandomness)
|
||||||
|
|
||||||
log.Infof("Verif r:%x; d:%x; m:%s; t:%x; s:%x; N:%d; p:%x", commR, commD, miner, ticket, seed, info.SectorID.Number, proof)
|
log.Infof("Verif r:%x; d:%x; m:%s; t:%x; s:%x; N:%d; p:%x", info.OnChain.SealedCID, info.UnsealedCID, miner, ticket, seed, info.SectorID.Number, proof)
|
||||||
|
|
||||||
//func(ctx context.Context, maddr address.Address, ssize abi.SectorSize, commD, commR, ticket, proof, seed []byte, sectorID abi.SectorNumber)
|
//func(ctx context.Context, maddr address.Address, ssize abi.SectorSize, commD, commR, ticket, proof, seed []byte, sectorID abi.SectorNumber)
|
||||||
ok, err := ss.verifier.VerifySeal(info)
|
ok, err := ss.verifier.VerifySeal(info)
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
block "github.com/ipfs/go-block-format"
|
block "github.com/ipfs/go-block-format"
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
hamt "github.com/ipfs/go-hamt-ipld"
|
hamt "github.com/ipfs/go-hamt-ipld"
|
||||||
|
@ -227,7 +227,7 @@ func main() {
|
|||||||
|
|
||||||
seed := lapi.SealSeed{
|
seed := lapi.SealSeed{
|
||||||
Epoch: 101,
|
Epoch: 101,
|
||||||
Value: []byte{1, 2, 3, 4, 5},
|
Value: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 255},
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Generating PoRep for sector (1)")
|
log.Info("Generating PoRep for sector (1)")
|
||||||
|
@ -555,7 +555,7 @@ create temp table c (like blocks_challenges excluding constraints) on commit dro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt2, err := tx.Prepare(`copy b (cid, parentWeight, parentStateRoot, height, miner, "timestamp", vrfproof, tickets, eprof, prand, ep0partial, ep0sector, ep0challangei) from stdin`)
|
stmt2, err := tx.Prepare(`copy b (cid, parentWeight, parentStateRoot, height, miner, "timestamp", vrfproof, tickets, prand, ep0partial, ep0sector, ep0challangei) from stdin`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ create temp table c (like blocks_challenges excluding constraints) on commit dro
|
|||||||
bh.Timestamp,
|
bh.Timestamp,
|
||||||
bh.Ticket.VRFProof,
|
bh.Ticket.VRFProof,
|
||||||
l,
|
l,
|
||||||
bh.EPostProof.Proof,
|
//bh.EPostProof.Proof,
|
||||||
bh.EPostProof.PostRand,
|
bh.EPostProof.PostRand,
|
||||||
bh.EPostProof.Candidates[0].Partial,
|
bh.EPostProof.Candidates[0].Partial,
|
||||||
bh.EPostProof.Candidates[0].SectorID,
|
bh.EPostProof.Candidates[0].SectorID,
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
|
|
||||||
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
||||||
@ -119,7 +120,7 @@ var preSealCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rp, err := registeredProofFromSsize(c.Uint64("sector-size"))
|
rp, _, err := lapi.ProofTypeFromSectorSize(abi.SectorSize(c.Uint64("sector-size")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -221,20 +222,15 @@ var aggregateSectorDirsCmd = &cli.Command{
|
|||||||
|
|
||||||
ssize := abi.SectorSize(cctx.Uint64("sector-size"))
|
ssize := abi.SectorSize(cctx.Uint64("sector-size"))
|
||||||
|
|
||||||
rp, err := registeredProofFromSsize(cctx.Uint64("sector-size"))
|
ppt, spt, err := lapi.ProofTypeFromSectorSize(abi.SectorSize(cctx.Uint64("sector-size")))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
sp, err := rp.RegisteredSealProof()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
agsb, err := sectorbuilder.New(§orbuilder.Config{
|
agsb, err := sectorbuilder.New(§orbuilder.Config{
|
||||||
Miner: maddr,
|
Miner: maddr,
|
||||||
SealProofType: sp,
|
SealProofType: spt,
|
||||||
PoStProofType: rp,
|
PoStProofType: ppt,
|
||||||
Paths: sectorbuilder.SimplePath(destdir),
|
Paths: sectorbuilder.SimplePath(destdir),
|
||||||
WorkerThreads: 2,
|
WorkerThreads: 2,
|
||||||
}, namespace.Wrap(agmds, datastore.NewKey("/sectorbuilder")))
|
}, namespace.Wrap(agmds, datastore.NewKey("/sectorbuilder")))
|
||||||
@ -295,8 +291,8 @@ var aggregateSectorDirsCmd = &cli.Command{
|
|||||||
|
|
||||||
sb, err := sectorbuilder.New(§orbuilder.Config{
|
sb, err := sectorbuilder.New(§orbuilder.Config{
|
||||||
Miner: maddr,
|
Miner: maddr,
|
||||||
SealProofType: sp,
|
SealProofType: spt,
|
||||||
PoStProofType: rp,
|
PoStProofType: ppt,
|
||||||
Paths: sectorbuilder.SimplePath(dir),
|
Paths: sectorbuilder.SimplePath(dir),
|
||||||
WorkerThreads: 2,
|
WorkerThreads: 2,
|
||||||
}, namespace.Wrap(mds, datastore.NewKey("/sectorbuilder")))
|
}, namespace.Wrap(mds, datastore.NewKey("/sectorbuilder")))
|
||||||
@ -336,19 +332,3 @@ func mergeGenMiners(a, b genesis.Miner) genesis.Miner {
|
|||||||
Sectors: append(a.Sectors, b.Sectors...),
|
Sectors: append(a.Sectors, b.Sectors...),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func registeredProofFromSsize(ssize uint64) (abi.RegisteredProof, error) {
|
|
||||||
// TODO: this should be provided to us by something lower down...
|
|
||||||
switch ssize {
|
|
||||||
case 2 << 10:
|
|
||||||
return abi.RegisteredProof_StackedDRG2KiBPoSt, nil
|
|
||||||
case 32 << 30:
|
|
||||||
return abi.RegisteredProof_StackedDRG32GiBPoSt, nil
|
|
||||||
case 8 << 20:
|
|
||||||
return abi.RegisteredProof_StackedDRG8MiBPoSt, nil
|
|
||||||
case 512 << 20:
|
|
||||||
return abi.RegisteredProof_StackedDRG512MiBPoSt, nil
|
|
||||||
default:
|
|
||||||
return 0, fmt.Errorf("unsupported sector size: %d", ssize)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -104,6 +104,7 @@ func PreSeal(maddr address.Address, pt abi.RegisteredProof, offset abi.SectorNum
|
|||||||
CommR: scid,
|
CommR: scid,
|
||||||
CommD: ucid,
|
CommD: ucid,
|
||||||
SectorID: sid,
|
SectorID: sid,
|
||||||
|
ProofType: pt,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ type PreSeal struct {
|
|||||||
CommD cid.Cid
|
CommD cid.Cid
|
||||||
SectorID abi.SectorNumber
|
SectorID abi.SectorNumber
|
||||||
Deal market.DealProposal
|
Deal market.DealProposal
|
||||||
|
ProofType abi.RegisteredProof
|
||||||
}
|
}
|
||||||
|
|
||||||
type Miner struct {
|
type Miner struct {
|
||||||
|
4
go.mod
4
go.mod
@ -18,12 +18,12 @@ require (
|
|||||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
|
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
|
||||||
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200227194154-8ef88c730c81
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200228192824-ee51014cc8c6
|
||||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6
|
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663
|
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200228064721-be233370d8e9
|
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200228064721-be233370d8e9
|
||||||
github.com/filecoin-project/go-statestore v0.1.0
|
github.com/filecoin-project/go-statestore v0.1.0
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226233922-9ed222007d11
|
github.com/filecoin-project/specs-actors v0.0.0-20200229011003-1d726e3afd04
|
||||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||||
github.com/google/uuid v1.1.1
|
github.com/google/uuid v1.1.1
|
||||||
|
34
go.sum
34
go.sum
@ -94,13 +94,11 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
|
|||||||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
|
||||||
github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY=
|
github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY=
|
||||||
github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8=
|
github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8=
|
||||||
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
|
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
|
||||||
github.com/filecoin-project/chain-validation v0.0.3 h1:luT/8kJ0WdMIqQ9Bm31W4JkuYCW0wUb26AvnD4WK59M=
|
github.com/filecoin-project/chain-validation v0.0.3 h1:luT/8kJ0WdMIqQ9Bm31W4JkuYCW0wUb26AvnD4WK59M=
|
||||||
github.com/filecoin-project/chain-validation v0.0.3/go.mod h1:NCEGFjcWRjb8akWFSOXvU6n2efkWIqAeOKU6o5WBGQw=
|
github.com/filecoin-project/chain-validation v0.0.3/go.mod h1:NCEGFjcWRjb8akWFSOXvU6n2efkWIqAeOKU6o5WBGQw=
|
||||||
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5 h1:/MmWluswvDIbuPvBct4q6HeQgVm62O2DzWYTB38kt4A=
|
|
||||||
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be h1:TooKBwR/g8jG0hZ3lqe9S5sy2vTUcLOZLlz3M5wGn2E=
|
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be h1:TooKBwR/g8jG0hZ3lqe9S5sy2vTUcLOZLlz3M5wGn2E=
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
||||||
@ -114,23 +112,12 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
|||||||
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww=
|
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww=
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5 h1:yvQJCW9mmi9zy+51xA01Ea2X7/dL7r8eKDPuGUjRmbo=
|
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5 h1:yvQJCW9mmi9zy+51xA01Ea2X7/dL7r8eKDPuGUjRmbo=
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5/go.mod h1:JbkIgFF/Z9BDlvrJO1FuKkaWsH673/UdFaiVS6uIHlA=
|
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5/go.mod h1:JbkIgFF/Z9BDlvrJO1FuKkaWsH673/UdFaiVS6uIHlA=
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200223154807-f7afd8e927f9 h1:uFS5r3K3AgIuR7cGBYY8k+vgwn/UXhin9NR2yCXVe7o=
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200228192824-ee51014cc8c6 h1:xYldVV9fZ+nsykQnEVMwcLU+6R5EshzmOWcyQDpludc=
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200223154807-f7afd8e927f9/go.mod h1:ftsiBbjLjNLAZ52FVDigkdCp73ltdcvAzAXav6drSLA=
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200228192824-ee51014cc8c6/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts=
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200227185910-091d5f0ab546 h1:wIrzVUX4TZ56WMbTpl9cNr/XRyTfI9RTc3GfFxUtznA=
|
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200227185910-091d5f0ab546/go.mod h1:f272JjgKXzn2OxdlmVhq6CjvlX5FfV743TvWLirsDpk=
|
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200227194154-8ef88c730c81 h1:3jFhWp4lC7irXg/d4Q4p3FQtw0m8hne+9GHveViCM04=
|
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200227194154-8ef88c730c81/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts=
|
|
||||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs=
|
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs=
|
||||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.mod h1:0HgYnrkeSU4lu1p+LEOeDpFsNBssa0OGGriWdA4hvaE=
|
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.mod h1:0HgYnrkeSU4lu1p+LEOeDpFsNBssa0OGGriWdA4hvaE=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.1 h1:gV7bs5YaqlgpGFMiLxInGK2L1FyCXUE0rimz4L7ghoE=
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 h1:eYxi6vI5CyeXD15X1bB3bledDXbqKxqf0wQzTLgwYwA=
|
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 h1:eYxi6vI5CyeXD15X1bB3bledDXbqKxqf0wQzTLgwYwA=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
|
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b h1:ds4TQay8wuV+2ucC6ENAeSYQDdl9CWYXnX0gvxzGKHg=
|
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b/go.mod h1:qsuPYsbKTHH2phNk81aUF9VJIilUxFrnxxnryJh4FOM=
|
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200224193134-7d37ec0f7723 h1:06DgVyH7jjafVa01EuVltEvJ7J7Q5A3/XEOLhmdDFOc=
|
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200224193134-7d37ec0f7723/go.mod h1:u8n91UJUua9zEiyAPw8wRAgUEoyTH8BBM9LWJ5WuxOM=
|
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200226210935-4739f8749f56 h1:CqldkHf9HtAsewneyOZdi19Btc6kEvktVVeZsP9N7NQ=
|
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200226210935-4739f8749f56 h1:CqldkHf9HtAsewneyOZdi19Btc6kEvktVVeZsP9N7NQ=
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200226210935-4739f8749f56/go.mod h1:tzTc9BxxSbjlIzhFwm5h9oBkXKkRuLxeiWspntwnKyw=
|
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200226210935-4739f8749f56/go.mod h1:tzTc9BxxSbjlIzhFwm5h9oBkXKkRuLxeiWspntwnKyw=
|
||||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200227214127-332d57b390aa h1:EVToQ5L+49psMvYP5ICsOcFRua79oDMyYQAeEqxkzwU=
|
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200227214127-332d57b390aa h1:EVToQ5L+49psMvYP5ICsOcFRua79oDMyYQAeEqxkzwU=
|
||||||
@ -143,22 +130,11 @@ github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 h
|
|||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
||||||
github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIiWBRilQjQ+5IiwdQ=
|
github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIiWBRilQjQ+5IiwdQ=
|
||||||
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
|
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf h1:fbxBG12yrxilPFV1EG2lYqpUyAlRZWkvtqjk2svSeXY=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200213011857-91a589664341/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200220011005-b2a2fbf40362/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200223194852-39976038b18d h1:vukVHqbLQnXc+ZfhK+Cor3kaQx9SQbSZISqSeGjhYcE=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200223194852-39976038b18d/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226200336-94c9b92b2775/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
github.com/filecoin-project/specs-actors v0.0.0-20200226200336-94c9b92b2775/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226204010-2ecdc6712206 h1:n63pVgoasZ8lzmC+Vx3/argZ5x9Vw+fPj/f24zsCAPE=
|
github.com/filecoin-project/specs-actors v0.0.0-20200228215954-2c5be7cfad99/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226204010-2ecdc6712206/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
github.com/filecoin-project/specs-actors v0.0.0-20200229011003-1d726e3afd04 h1:O343OeQLkLWLj5ZqQ5nhevAGBTeB5LioiA53ddScqdY=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226222440-f5d1be727992 h1:T4BLV7JBn+0xxSzWlmMwU4tCGp2QkqcE+xXwNO0ufBo=
|
github.com/filecoin-project/specs-actors v0.0.0-20200229011003-1d726e3afd04/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226222915-a3b194d36c61 h1:W5/1uYhny36b2x6Ce8awB3tF40z0Lmw7qluukRiVaVM=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226222915-a3b194d36c61/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226232338-edd04eb6eda5 h1:B1JCug32caW45wn0X0oifwhFdveLRoi0wrVkKlf7hMs=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226232338-edd04eb6eda5/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226233922-9ed222007d11 h1:IJJmTpNWYSdPPyMGP7ET3JE04jjZl7AzGiLTDcJOL04=
|
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200226233922-9ed222007d11/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
|
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
|
||||||
|
@ -3,9 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
|
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -14,6 +11,10 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
|
||||||
|
"github.com/filecoin-project/lotus/genesis"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ func (api *api) Spawn() (nodeInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sbroot := filepath.Join(dir, "preseal")
|
sbroot := filepath.Join(dir, "preseal")
|
||||||
genm, ki, err := seed.PreSeal(genMiner, build.SectorSizes[0], 0, 2, sbroot, []byte("8"), nil)
|
genm, ki, err := seed.PreSeal(genMiner, abi.RegisteredProof_StackedDRG2KiBSeal, 0, 2, sbroot, []byte("8"), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nodeInfo{}, xerrors.Errorf("preseal failed: %w", err)
|
return nodeInfo{}, xerrors.Errorf("preseal failed: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -145,8 +145,8 @@ func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) EnsureFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error {
|
func (n *ClientNodeAdapter) EnsureFunds(ctx context.Context, addr, wallet address.Address, amount abi.TokenAmount) error {
|
||||||
return n.fm.EnsureAvailable(ctx, addr, amount)
|
return n.fm.EnsureAvailable(ctx, addr, wallet, amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
||||||
@ -234,7 +234,7 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
|
|||||||
return false, false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
return false, false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if sd.Proposal.StartEpoch > 0 {
|
if sd.State.SectorStartEpoch > 0 {
|
||||||
cb(nil)
|
cb(nil)
|
||||||
return true, false, nil
|
return true, false, nil
|
||||||
}
|
}
|
||||||
@ -259,7 +259,7 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
|
|||||||
return false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
return false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if sd.Proposal.StartEpoch == 0 {
|
if sd.State.SectorStartEpoch < 1 {
|
||||||
return false, xerrors.Errorf("deal wasn't active: deal=%d, parentState=%s, h=%d", dealId, ts.ParentState(), ts.Height())
|
return false, xerrors.Errorf("deal wasn't active: deal=%d, parentState=%s, h=%d", dealId, ts.ParentState(), ts.Height())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,31 +276,49 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sectorNumber abi.SectorNumber
|
||||||
|
var sectorFound bool
|
||||||
matchEvent := func(msg *types.Message) (bool, error) {
|
matchEvent := func(msg *types.Message) (bool, error) {
|
||||||
if msg.To != provider {
|
if msg.To != provider {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Method != builtin.MethodsMiner.ProveCommitSector {
|
switch msg.Method {
|
||||||
|
case builtin.MethodsMiner.PreCommitSector:
|
||||||
|
var params miner.SectorPreCommitInfo
|
||||||
|
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
|
||||||
|
return false, xerrors.Errorf("unmarshal pre commit: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, did := range params.DealIDs {
|
||||||
|
if did == abi.DealID(dealId) {
|
||||||
|
sectorNumber = params.SectorNumber
|
||||||
|
sectorFound = true
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false, nil
|
||||||
|
case builtin.MethodsMiner.ProveCommitSector:
|
||||||
|
var params miner.ProveCommitSectorParams
|
||||||
|
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
|
||||||
|
return false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !sectorFound {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var params miner.SectorPreCommitInfo
|
if params.SectorNumber != sectorNumber {
|
||||||
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
|
return false, nil
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var found bool
|
return true, nil
|
||||||
for _, dealID := range params.DealIDs {
|
default:
|
||||||
if uint64(dealID) == dealId {
|
return false, nil
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return found, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := c.ev.Called(checkFunc, called, revert, 3, build.SealRandomnessLookbackLimit, matchEvent); err != nil {
|
if err := c.ev.Called(checkFunc, called, revert, 3, build.SealRandomnessLookbackLimit, matchEvent); err != nil {
|
||||||
return xerrors.Errorf("failed to set up called handler: %w", err)
|
return xerrors.Errorf("failed to set up called handler: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,8 @@ func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Addr
|
|||||||
return localSignature, nil
|
return localSignature, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr address.Address, amt abi.TokenAmount) error {
|
func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr, wallet address.Address, amt abi.TokenAmount) error {
|
||||||
return n.MarketEnsureAvailable(ctx, addr, amt)
|
return n.MarketEnsureAvailable(ctx, addr, wallet, amt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) MostRecentStateId(ctx context.Context) (storagemarket.StateKey, error) {
|
func (n *ProviderNodeAdapter) MostRecentStateId(ctx context.Context) (storagemarket.StateKey, error) {
|
||||||
@ -269,29 +269,49 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sectorNumber abi.SectorNumber
|
||||||
|
var sectorFound bool
|
||||||
|
|
||||||
matchEvent := func(msg *types.Message) (bool, error) {
|
matchEvent := func(msg *types.Message) (bool, error) {
|
||||||
if msg.To != provider {
|
if msg.To != provider {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Method != builtin.MethodsMiner.ProveCommitSector {
|
switch msg.Method {
|
||||||
|
case builtin.MethodsMiner.PreCommitSector:
|
||||||
|
var params miner.SectorPreCommitInfo
|
||||||
|
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
|
||||||
|
return false, xerrors.Errorf("unmarshal pre commit: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, did := range params.DealIDs {
|
||||||
|
if did == abi.DealID(dealID) {
|
||||||
|
sectorNumber = params.SectorNumber
|
||||||
|
sectorFound = true
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false, nil
|
||||||
|
case builtin.MethodsMiner.ProveCommitSector:
|
||||||
|
var params miner.ProveCommitSectorParams
|
||||||
|
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
|
||||||
|
return false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !sectorFound {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var params miner.SectorPreCommitInfo
|
if params.SectorNumber != sectorNumber {
|
||||||
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
|
return false, nil
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var found bool
|
return true, nil
|
||||||
for _, did := range params.DealIDs {
|
default:
|
||||||
if did == abi.DealID(dealID) {
|
return false, nil
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return found, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := n.ev.Called(checkFunc, called, revert, 3, build.SealRandomnessLookbackLimit, matchEvent); err != nil {
|
if err := n.ev.Called(checkFunc, called, revert, 3, build.SealRandomnessLookbackLimit, matchEvent); err != nil {
|
||||||
|
@ -300,6 +300,10 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
|
|||||||
order.MinerPeerID = pid
|
order.MinerPeerID = pid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if order.Size == 0 {
|
||||||
|
return xerrors.Errorf("cannot make retrieval deal for zero bytes")
|
||||||
|
}
|
||||||
|
|
||||||
retrievalResult := make(chan error, 1)
|
retrievalResult := make(chan error, 1)
|
||||||
|
|
||||||
unsubscribe := a.Retrieval.SubscribeToEvents(func(event retrievalmarket.ClientEvent, state retrievalmarket.ClientDealState) {
|
unsubscribe := a.Retrieval.SubscribeToEvents(func(event retrievalmarket.ClientEvent, state retrievalmarket.ClientDealState) {
|
||||||
@ -313,10 +317,12 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ppb := types.BigDiv(order.Total, types.NewInt(order.Size))
|
||||||
|
|
||||||
a.Retrieval.Retrieve(
|
a.Retrieval.Retrieve(
|
||||||
ctx,
|
ctx,
|
||||||
order.Root,
|
order.Root,
|
||||||
retrievalmarket.NewParamsV0(types.BigDiv(order.Total, types.NewInt(order.Size)), order.PaymentInterval, order.PaymentIntervalIncrease),
|
retrievalmarket.NewParamsV0(ppb, order.PaymentInterval, order.PaymentIntervalIncrease),
|
||||||
order.Total,
|
order.Total,
|
||||||
order.MinerPeerID,
|
order.MinerPeerID,
|
||||||
order.Client,
|
order.Client,
|
||||||
|
@ -16,6 +16,6 @@ type MarketAPI struct {
|
|||||||
FMgr *market.FundMgr
|
FMgr *market.FundMgr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *MarketAPI) MarketEnsureAvailable(ctx context.Context, addr address.Address, amt types.BigInt) error {
|
func (a *MarketAPI) MarketEnsureAvailable(ctx context.Context, addr, wallet address.Address, amt types.BigInt) error {
|
||||||
return a.FMgr.EnsureAvailable(ctx, addr, amt)
|
return a.FMgr.EnsureAvailable(ctx, addr, wallet, amt)
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ func (epp *SectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi []abi.S
|
|||||||
|
|
||||||
cds, err := epp.sb.GenerateEPostCandidates(ssi, rand, faults)
|
cds, err := epp.sb.GenerateEPostCandidates(ssi, rand, faults)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, xerrors.Errorf("failed to generate candidates: %w", err)
|
||||||
}
|
}
|
||||||
log.Infof("Generate candidates took %s", time.Since(start))
|
log.Infof("Generate candidates took %s", time.Since(start))
|
||||||
return cds, nil
|
return cds, nil
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/wallet"
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
"github.com/filecoin-project/lotus/genesis"
|
||||||
@ -29,9 +30,15 @@ func PreSeal(ssize abi.SectorSize, maddr address.Address, sectors int) (*genesis
|
|||||||
Sectors: make([]*genesis.PreSeal, sectors),
|
Sectors: make([]*genesis.PreSeal, sectors),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, st, err := api.ProofTypeFromSectorSize(ssize)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
for i := range genm.Sectors {
|
for i := range genm.Sectors {
|
||||||
preseal := &genesis.PreSeal{}
|
preseal := &genesis.PreSeal{}
|
||||||
|
|
||||||
|
preseal.ProofType = st
|
||||||
preseal.CommD = zerocomm.ForSize(abi.PaddedPieceSize(ssize).Unpadded())
|
preseal.CommD = zerocomm.ForSize(abi.PaddedPieceSize(ssize).Unpadded())
|
||||||
d, _ := commcid.CIDToPieceCommitmentV1(preseal.CommD)
|
d, _ := commcid.CIDToPieceCommitmentV1(preseal.CommD)
|
||||||
r := commDR(d)
|
r := commDR(d)
|
||||||
|
@ -47,12 +47,14 @@ func (evt SectorForceState) applyGlobal(state *SectorInfo) bool {
|
|||||||
|
|
||||||
type SectorStart struct {
|
type SectorStart struct {
|
||||||
id abi.SectorNumber
|
id abi.SectorNumber
|
||||||
|
sectorType abi.RegisteredProof
|
||||||
pieces []Piece
|
pieces []Piece
|
||||||
}
|
}
|
||||||
|
|
||||||
func (evt SectorStart) apply(state *SectorInfo) {
|
func (evt SectorStart) apply(state *SectorInfo) {
|
||||||
state.SectorID = evt.id
|
state.SectorID = evt.id
|
||||||
state.Pieces = evt.pieces
|
state.Pieces = evt.pieces
|
||||||
|
state.SectorType = evt.sectorType
|
||||||
}
|
}
|
||||||
|
|
||||||
type SectorPacked struct{ pieces []Piece }
|
type SectorPacked struct{ pieces []Piece }
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/lib/nullreader"
|
"github.com/filecoin-project/lotus/lib/nullreader"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -48,6 +49,12 @@ func (m *Sealing) PledgeSector() error {
|
|||||||
|
|
||||||
size := abi.PaddedPieceSize(m.sb.SectorSize()).Unpadded()
|
size := abi.PaddedPieceSize(m.sb.SectorSize()).Unpadded()
|
||||||
|
|
||||||
|
rt, _, err := api.ProofTypeFromSectorSize(m.sb.SectorSize())
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
sid, err := m.sb.AcquireSectorNumber()
|
sid, err := m.sb.AcquireSectorNumber()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("%+v", err)
|
log.Errorf("%+v", err)
|
||||||
@ -60,7 +67,7 @@ func (m *Sealing) PledgeSector() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := m.newSector(sid, pieces); err != nil {
|
if err := m.newSector(sid, rt, pieces); err != nil {
|
||||||
log.Errorf("%+v", err)
|
log.Errorf("%+v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,12 @@ func (m *Sealing) SealPiece(ctx context.Context, size abi.UnpaddedPieceSize, r i
|
|||||||
return xerrors.Errorf("adding piece to sector: %w", err)
|
return xerrors.Errorf("adding piece to sector: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.newSector(sectorID, []Piece{
|
_, rt, err := api.ProofTypeFromSectorSize(m.sb.SectorSize())
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("bad sector size: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return m.newSector(sectorID, rt, []Piece{
|
||||||
{
|
{
|
||||||
DealID: &dealID,
|
DealID: &dealID,
|
||||||
|
|
||||||
@ -131,10 +136,11 @@ func (m *Sealing) SealPiece(ctx context.Context, size abi.UnpaddedPieceSize, r i
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Sealing) newSector(sid abi.SectorNumber, pieces []Piece) error {
|
func (m *Sealing) newSector(sid abi.SectorNumber, rt abi.RegisteredProof, pieces []Piece) error {
|
||||||
log.Infof("Start sealing %d", sid)
|
log.Infof("Start sealing %d", sid)
|
||||||
return m.sectors.Send(uint64(sid), SectorStart{
|
return m.sectors.Send(uint64(sid), SectorStart{
|
||||||
id: sid,
|
id: sid,
|
||||||
pieces: pieces,
|
pieces: pieces,
|
||||||
|
sectorType: rt,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
|||||||
params := &miner.SectorPreCommitInfo{
|
params := &miner.SectorPreCommitInfo{
|
||||||
Expiration: 10000000, // TODO: implement
|
Expiration: 10000000, // TODO: implement
|
||||||
SectorNumber: sector.SectorID,
|
SectorNumber: sector.SectorID,
|
||||||
RegisteredProof: abi.RegisteredProof_StackedDRG32GiBSeal,
|
RegisteredProof: sector.SectorType,
|
||||||
|
|
||||||
SealedCID: *sector.CommR,
|
SealedCID: *sector.CommR,
|
||||||
SealRandEpoch: sector.Ticket.Epoch,
|
SealRandEpoch: sector.Ticket.Epoch,
|
||||||
|
Loading…
Reference in New Issue
Block a user