Merge remote-tracking branch 'origin/testnet/3' into feat/new-workers

This commit is contained in:
Łukasz Magiera 2020-03-19 03:28:55 +01:00
commit 1ed7779701
55 changed files with 439 additions and 288 deletions

View File

@ -1 +1 @@
/dns4/t01000.miner.interoptnet.kittyhawk.wtf/tcp/1347/p2p/12D3KooWK7jRsuaw43bF7FWPdJNUD9wMK1dReGDSusnyTuP45UGi /dns4/t01000.miner.interopnet.kittyhawk.wtf/tcp/1347/p2p/12D3KooWA9Y7wdECo7S77anUXAAqDA799EWoyF69Qfypjbm5koes

Binary file not shown.

View File

@ -4,10 +4,14 @@ package build
import ( 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/builtin/power"
) )
func init() { func init() {
InsecurePoStValidation = true InsecurePoStValidation = true
power.ConsensusMinerMinPower = big.NewInt(2048)
} }
var SectorSizes = []abi.SectorSize{2048} var SectorSizes = []abi.SectorSize{2048}

View File

@ -416,7 +416,7 @@ func getRandomMessages(cg *ChainGen) ([]*types.SignedMessage, error) {
Method: 0, Method: 0,
GasLimit: types.NewInt(10000), GasLimit: 10000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -36,7 +36,7 @@ func doExecValue(ctx context.Context, vm *vm.VM, to, from address.Address, value
From: from, From: from,
Method: method, Method: method,
Params: params, Params: params,
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
Value: value, Value: value,
Nonce: act.Nonce, Nonce: act.Nonce,

View File

@ -70,7 +70,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add
From: wallet, From: wallet,
Value: toAdd, Value: toAdd,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
Method: builtin.MethodsMarket.AddBalance, Method: builtin.MethodsMarket.AddBalance,
Params: params, Params: params,
}) })

View File

@ -45,6 +45,8 @@ var (
ErrNotEnoughFunds = errors.New("not enough funds to execute transaction") ErrNotEnoughFunds = errors.New("not enough funds to execute transaction")
ErrInvalidToAddr = errors.New("message had invalid to address") ErrInvalidToAddr = errors.New("message had invalid to address")
ErrBroadcastAnyway = errors.New("broadcasting message despite validation fail")
) )
const ( const (
@ -313,7 +315,7 @@ func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error
snonce, err := mp.getStateNonce(m.Message.From, curTs) snonce, err := mp.getStateNonce(m.Message.From, curTs)
if err != nil { if err != nil {
return xerrors.Errorf("failed to look up actor state nonce: %w", err) return xerrors.Errorf("failed to look up actor state nonce: %s: %w", err, ErrBroadcastAnyway)
} }
if snonce > m.Message.Nonce { if snonce > m.Message.Nonce {
@ -322,7 +324,7 @@ func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error
balance, err := mp.getStateBalance(m.Message.From, curTs) balance, err := mp.getStateBalance(m.Message.From, curTs)
if err != nil { if err != nil {
return xerrors.Errorf("failed to check sender balance: %w", err) return xerrors.Errorf("failed to check sender balance: %s: %w", err, ErrBroadcastAnyway)
} }
if balance.LessThan(m.Message.RequiredFunds()) { if balance.LessThan(m.Message.RequiredFunds()) {

View File

@ -26,8 +26,8 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate
return nil, xerrors.Errorf("failed to set up vm: %w", err) return nil, xerrors.Errorf("failed to set up vm: %w", err)
} }
if msg.GasLimit == types.EmptyInt { if msg.GasLimit == 0 {
msg.GasLimit = types.NewInt(10000000000) msg.GasLimit = 10000000000
} }
if msg.GasPrice == types.EmptyInt { if msg.GasPrice == types.EmptyInt {
msg.GasPrice = types.NewInt(0) msg.GasPrice = types.NewInt(0)
@ -38,7 +38,7 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate
if span.IsRecordingEvents() { if span.IsRecordingEvents() {
span.AddAttributes( span.AddAttributes(
trace.Int64Attribute("gas_limit", int64(msg.GasLimit.Uint64())), trace.Int64Attribute("gas_limit", msg.GasLimit),
trace.Int64Attribute("gas_price", int64(msg.GasPrice.Uint64())), trace.Int64Attribute("gas_price", int64(msg.GasPrice.Uint64())),
trace.StringAttribute("value", msg.Value.String()), trace.StringAttribute("value", msg.Value.String()),
) )

View File

@ -181,7 +181,7 @@ func TestForkHeightTriggers(t *testing.T) {
To: builtin.InitActorAddr, To: builtin.InitActorAddr,
Method: builtin.MethodsInit.Exec, Method: builtin.MethodsInit.Exec,
Params: enc, Params: enc,
GasLimit: types.NewInt(10000), GasLimit: 10000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }
sig, err := cg.Wallet().Sign(ctx, cg.Banker(), m.Cid().Bytes()) sig, err := cg.Wallet().Sign(ctx, cg.Banker(), m.Cid().Bytes())
@ -208,7 +208,7 @@ func TestForkHeightTriggers(t *testing.T) {
Method: 2, Method: 2,
Params: nil, Params: nil,
Nonce: nonce, Nonce: nonce,
GasLimit: types.NewInt(10000), GasLimit: 10000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }
nonce++ nonce++

View File

@ -228,7 +228,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B
Nonce: sysAct.Nonce, Nonce: sysAct.Nonce,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1 << 30), GasLimit: 1 << 30,
Method: builtin.MethodsReward.AwardBlockReward, Method: builtin.MethodsReward.AwardBlockReward,
Params: params, Params: params,
} }
@ -260,7 +260,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B
Nonce: ca.Nonce, Nonce: ca.Nonce,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1 << 30), // Make super sure this is never too little GasLimit: 1 << 30, // Make super sure this is never too little
Method: builtin.MethodsCron.EpochTick, Method: builtin.MethodsCron.EpochTick,
Params: nil, Params: nil,
} }

View File

@ -77,8 +77,8 @@ func (cs *ChainStore) call(ctx context.Context, msg *types.Message, ts *types.Ti
return nil, xerrors.Errorf("failed to set up vm: %w", err) return nil, xerrors.Errorf("failed to set up vm: %w", err)
} }
if msg.GasLimit == types.EmptyInt { if msg.GasLimit == 0 {
msg.GasLimit = types.NewInt(10000000000) msg.GasLimit = 10000000000
} }
if msg.GasPrice == types.EmptyInt { if msg.GasPrice == types.EmptyInt {
msg.GasPrice = types.NewInt(0) msg.GasPrice = types.NewInt(0)

View File

@ -2,6 +2,7 @@ package sub
import ( import (
"context" "context"
"golang.org/x/xerrors"
"time" "time"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
@ -181,13 +182,13 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs
} }
if err := mv.mpool.Add(m); err != nil { if err := mv.mpool.Add(m); err != nil {
log.Warnf("failed to add message from network to message pool (From: %s, To: %s, Nonce: %d, Value: %s): %s", m.Message.From, m.Message.To, m.Message.Nonce, types.FIL(m.Message.Value), err) log.Debugf("failed to add message from network to message pool (From: %s, To: %s, Nonce: %d, Value: %s): %s", m.Message.From, m.Message.To, m.Message.Nonce, types.FIL(m.Message.Value), err)
ctx, _ = tag.New( ctx, _ = tag.New(
ctx, ctx,
tag.Insert(metrics.FailureType, "add"), tag.Insert(metrics.FailureType, "add"),
) )
stats.Record(ctx, metrics.MessageValidationFailure.M(1)) stats.Record(ctx, metrics.MessageValidationFailure.M(1))
return false return xerrors.Is(err, messagepool.ErrBroadcastAnyway)
} }
stats.Record(ctx, metrics.MessageValidationSuccess.M(1)) stats.Record(ctx, metrics.MessageValidationSuccess.M(1))
return true return true

View File

@ -656,9 +656,15 @@ func (t *Message) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.GasLimit (big.Int) (struct) // t.GasLimit (int64) (int64)
if err := t.GasLimit.MarshalCBOR(w); err != nil { if t.GasLimit >= 0 {
return err if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.GasLimit))); err != nil {
return err
}
} else {
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajNegativeInt, uint64(-t.GasLimit)-1)); err != nil {
return err
}
} }
// t.Method (abi.MethodNum) (uint64) // t.Method (abi.MethodNum) (uint64)
@ -746,14 +752,30 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.GasLimit (big.Int) (struct) // t.GasLimit (int64) (int64)
{ {
maj, extra, err := cbg.CborReadHeader(br)
if err := t.GasLimit.UnmarshalCBOR(br); err != nil { var extraI int64
if err != nil {
return err return err
} }
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.GasLimit = int64(extraI)
} }
// t.Method (abi.MethodNum) (uint64) // t.Method (abi.MethodNum) (uint64)
@ -1043,9 +1065,15 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.GasUsed (big.Int) (struct) // t.GasUsed (int64) (int64)
if err := t.GasUsed.MarshalCBOR(w); err != nil { if t.GasUsed >= 0 {
return err if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.GasUsed))); err != nil {
return err
}
} else {
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajNegativeInt, uint64(-t.GasUsed)-1)); err != nil {
return err
}
} }
return nil return nil
} }
@ -1107,14 +1135,30 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error {
if _, err := io.ReadFull(br, t.Return); err != nil { if _, err := io.ReadFull(br, t.Return); err != nil {
return err return err
} }
// t.GasUsed (big.Int) (struct) // t.GasUsed (int64) (int64)
{ {
maj, extra, err := cbg.CborReadHeader(br)
if err := t.GasUsed.UnmarshalCBOR(br); err != nil { var extraI int64
if err != nil {
return err return err
} }
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.GasUsed = int64(extraI)
} }
return nil return nil
} }

View File

@ -21,7 +21,7 @@ type Message struct {
Value BigInt Value BigInt
GasPrice BigInt GasPrice BigInt
GasLimit BigInt GasLimit int64
Method abi.MethodNum Method abi.MethodNum
Params []byte Params []byte
@ -87,7 +87,7 @@ func (m *Message) Cid() cid.Cid {
func (m *Message) RequiredFunds() BigInt { func (m *Message) RequiredFunds() BigInt {
return BigAdd( return BigAdd(
m.Value, m.Value,
BigMul(m.GasPrice, m.GasLimit), BigMul(m.GasPrice, NewInt(uint64(m.GasLimit))),
) )
} }

View File

@ -9,9 +9,9 @@ import (
type MessageReceipt struct { type MessageReceipt struct {
ExitCode exitcode.ExitCode ExitCode exitcode.ExitCode
Return []byte Return []byte
GasUsed BigInt GasUsed int64
} }
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool { func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && BigCmp(mr.GasUsed, o.GasUsed) == 0 return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed
} }

View File

@ -27,7 +27,7 @@ func MkMessage(from, to address.Address, nonce uint64, w *wallet.Wallet) *types.
From: from, From: from,
Value: types.NewInt(1), Value: types.NewInt(1),
Nonce: nonce, Nonce: nonce,
GasLimit: types.NewInt(1), GasLimit: 1,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -27,7 +27,7 @@ func BenchmarkSerializeMessage(b *testing.B) {
Nonce: 197, Nonce: 197,
Method: 1231254, Method: 1231254,
Params: []byte("some bytes, idk. probably at least ten of them"), Params: []byte("some bytes, idk. probably at least ten of them"),
GasLimit: NewInt(126723), GasLimit: 126723,
GasPrice: NewInt(1776234), GasPrice: NewInt(1776234),
} }

View File

@ -19,7 +19,7 @@ func TestSignedMessageJsonRoundtrip(t *testing.T) {
Method: 1235126, Method: 1235126,
Value: types.NewInt(123123), Value: types.NewInt(123123),
GasPrice: types.NewInt(1234), GasPrice: types.NewInt(1234),
GasLimit: types.NewInt(9992969384), GasLimit: 9992969384,
Nonce: 123123, Nonce: 123123,
}, },
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"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/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode" "github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
@ -53,7 +54,7 @@ func (a *Applier) ApplyMessage(eCtx *vtypes.ExecutionContext, state vstate.VMWra
mr := vtypes.MessageReceipt{ mr := vtypes.MessageReceipt{
ExitCode: exitcode.ExitCode(ret.ExitCode), ExitCode: exitcode.ExitCode(ret.ExitCode),
ReturnValue: ret.Return, ReturnValue: ret.Return,
GasUsed: ret.GasUsed, GasUsed: big.NewInt(ret.GasUsed),
} }
return mr, nil return mr, nil
@ -91,7 +92,7 @@ func (a *Applier) ApplyTipSetMessages(state vstate.VMWrapper, blocks []vtypes.Bl
ExitCode: exitcode.ExitCode(ret.ExitCode), ExitCode: exitcode.ExitCode(ret.ExitCode),
ReturnValue: ret.Return, ReturnValue: ret.Return,
GasUsed: ret.GasUsed, GasUsed: big.NewInt(ret.GasUsed),
}) })
return nil return nil
}) })
@ -130,7 +131,7 @@ func toLotusMsg(msg *vtypes.Message) *types.Message {
Value: types.BigInt{Int: msg.Value.Int}, Value: types.BigInt{Int: msg.Value.Int},
GasPrice: types.BigInt{Int: msg.GasPrice.Int}, GasPrice: types.BigInt{Int: msg.GasPrice.Int},
GasLimit: types.NewInt(uint64(msg.GasLimit)), GasLimit: msg.GasLimit,
Params: msg.Params, Params: msg.Params,
} }

View File

@ -41,7 +41,7 @@ func (f *Factories) NewRandomnessSource() vstate.RandomnessSource {
func (f *Factories) NewValidationConfig() vstate.ValidationConfig { func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
trackGas := false trackGas := false
checkExit := true checkExit := true
checkRet := false // TODO enable return value checking once https://github.com/filecoin-project/specs-actors/pull/230 lands checkRet := true
// ignore gas and return value assertions // ignore gas and return value assertions
return NewConfig(trackGas, checkExit, checkRet) return NewConfig(trackGas, checkExit, checkRet)
} }

View File

@ -34,15 +34,18 @@ type Runtime struct {
height abi.ChainEpoch height abi.ChainEpoch
cst cbor.IpldStore cst cbor.IpldStore
gasAvailable types.BigInt gasAvailable int64
gasUsed types.BigInt gasUsed int64
sys runtime.Syscalls sys runtime.Syscalls
// address that started invoke chain // address that started invoke chain
origin address.Address origin address.Address
originNonce uint64
internalExecutions []*ExecutionResult internalExecutions []*ExecutionResult
// the first internal call has a value of 1 for this field
internalCallCounter int64
} }
func (rs *Runtime) ResolveAddress(address address.Address) (ret address.Address, ok bool) { func (rs *Runtime) ResolveAddress(address address.Address) (ret address.Address, ok bool) {
@ -158,19 +161,14 @@ func (rs *Runtime) Store() vmr.Store {
func (rt *Runtime) NewActorAddress() address.Address { func (rt *Runtime) NewActorAddress() address.Address {
var b bytes.Buffer var b bytes.Buffer
if err := rt.Message().Caller().MarshalCBOR(&b); err != nil { // todo: spec says cbor; why not just bytes? if err := rt.origin.MarshalCBOR(&b); err != nil { // todo: spec says cbor; why not just bytes?
rt.Abortf(exitcode.ErrSerialization, "writing caller address into a buffer: %v", err) rt.Abortf(exitcode.ErrSerialization, "writing caller address into a buffer: %v", err)
} }
act, err := rt.state.GetActor(rt.origin) if err := binary.Write(&b, binary.BigEndian, rt.originNonce); err != nil {
if err != nil {
rt.Abortf(exitcode.SysErrInternal, "getting top level actor: %v", err)
}
if err := binary.Write(&b, binary.BigEndian, act.Nonce); err != nil {
rt.Abortf(exitcode.ErrSerialization, "writing nonce address into a buffer: %v", err) rt.Abortf(exitcode.ErrSerialization, "writing nonce address into a buffer: %v", err)
} }
if err := binary.Write(&b, binary.BigEndian, uint64(0)); err != nil { // TODO: expose on vm if err := binary.Write(&b, binary.BigEndian, rt.internalCallCounter); err != nil { // TODO: expose on vm
rt.Abortf(exitcode.ErrSerialization, "writing callSeqNum address into a buffer: %v", err) rt.Abortf(exitcode.ErrSerialization, "writing callSeqNum address into a buffer: %v", err)
} }
addr, err := address.NewActorAddress(b.Bytes()) addr, err := address.NewActorAddress(b.Bytes())
@ -317,32 +315,34 @@ func (rt *Runtime) internalSend(to address.Address, method abi.MethodNum, value
} }
defer st.ClearSnapshot() defer st.ClearSnapshot()
ret, err, subrt := rt.vm.send(ctx, msg, rt, 0) ret, errSend, subrt := rt.vm.send(ctx, msg, rt, 0)
if err != nil { if errSend != nil {
if err := st.Revert(); err != nil { if errRevert := st.Revert(); errRevert != nil {
return nil, aerrors.Escalate(err, "failed to revert state tree after failed subcall") return nil, aerrors.Escalate(errRevert, "failed to revert state tree after failed subcall")
} }
} }
mr := types.MessageReceipt{ mr := types.MessageReceipt{
ExitCode: exitcode.ExitCode(aerrors.RetCode(err)), ExitCode: exitcode.ExitCode(aerrors.RetCode(errSend)),
Return: ret, Return: ret,
GasUsed: types.EmptyInt, GasUsed: 0,
} }
var es = ""
if err != nil {
es = err.Error()
}
er := ExecutionResult{ er := ExecutionResult{
Msg: msg, Msg: msg,
MsgRct: &mr, MsgRct: &mr,
Error: es,
Subcalls: subrt.internalExecutions,
} }
if errSend != nil {
er.Error = errSend.Error()
}
if subrt != nil {
er.Subcalls = subrt.internalExecutions
rt.internalCallCounter = subrt.internalCallCounter
}
rt.internalExecutions = append(rt.internalExecutions, &er) rt.internalExecutions = append(rt.internalExecutions, &er)
return ret, err return ret, errSend
} }
func (rs *Runtime) State() vmr.StateHandle { func (rs *Runtime) State() vmr.StateHandle {
@ -421,10 +421,9 @@ func (rt *Runtime) stateCommit(oldh, newh cid.Cid) aerrors.ActorError {
return nil return nil
} }
func (rt *Runtime) ChargeGas(amount uint64) { func (rt *Runtime) ChargeGas(toUse int64) {
toUse := types.NewInt(amount) rt.gasUsed = rt.gasUsed + toUse
rt.gasUsed = types.BigAdd(rt.gasUsed, toUse) if rt.gasUsed > rt.gasAvailable {
if rt.gasUsed.GreaterThan(rt.gasAvailable) { rt.Abortf(exitcode.SysErrOutOfGas, "not enough gas: used=%d, available=%d", rt.gasUsed, rt.gasAvailable)
rt.Abortf(exitcode.SysErrOutOfGas, "not enough gas: used=%s, available=%s", rt.gasUsed, rt.gasAvailable)
} }
} }

View File

@ -91,7 +91,7 @@ func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Ad
var _ cbor.IpldBlockstore = (*gasChargingBlocks)(nil) var _ cbor.IpldBlockstore = (*gasChargingBlocks)(nil)
type gasChargingBlocks struct { type gasChargingBlocks struct {
chargeGas func(uint64) chargeGas func(int64)
under cbor.IpldBlockstore under cbor.IpldBlockstore
} }
@ -101,13 +101,13 @@ func (bs *gasChargingBlocks) Get(c cid.Cid) (block.Block, error) {
if err != nil { if err != nil {
return nil, aerrors.Escalate(err, "failed to get block from blockstore") return nil, aerrors.Escalate(err, "failed to get block from blockstore")
} }
bs.chargeGas(uint64(len(blk.RawData())) * gasGetPerByte) bs.chargeGas(int64(len(blk.RawData())) * gasGetPerByte)
return blk, nil return blk, nil
} }
func (bs *gasChargingBlocks) Put(blk block.Block) error { func (bs *gasChargingBlocks) Put(blk block.Block) error {
bs.chargeGas(gasPutObj + uint64(len(blk.RawData()))*gasPutPerByte) bs.chargeGas(gasPutObj + int64(len(blk.RawData()))*gasPutPerByte)
if err := bs.under.Put(blk); err != nil { if err := bs.under.Put(blk); err != nil {
return aerrors.Escalate(err, "failed to write data to disk") return aerrors.Escalate(err, "failed to write data to disk")
@ -115,18 +115,20 @@ func (bs *gasChargingBlocks) Put(blk block.Block) error {
return nil return nil
} }
func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin address.Address, usedGas types.BigInt) *Runtime { func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin address.Address, originNonce uint64, usedGas int64, icc int64) *Runtime {
rt := &Runtime{ rt := &Runtime{
ctx: ctx, ctx: ctx,
vm: vm, vm: vm,
state: vm.cstate, state: vm.cstate,
msg: msg, msg: msg,
origin: origin, origin: origin,
height: vm.blockHeight, originNonce: originNonce,
sys: vm.Syscalls, height: vm.blockHeight,
sys: vm.Syscalls,
gasUsed: usedGas, gasUsed: usedGas,
gasAvailable: msg.GasLimit, gasAvailable: msg.GasLimit,
internalCallCounter: icc,
} }
rt.cst = &cbor.BasicIpldStore{ rt.cst = &cbor.BasicIpldStore{
Blocks: &gasChargingBlocks{rt.ChargeGas, vm.cst.Blocks}, Blocks: &gasChargingBlocks{rt.ChargeGas, vm.cst.Blocks},
@ -182,7 +184,7 @@ type ApplyRet struct {
} }
func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime, func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
gasCharge uint64) ([]byte, aerrors.ActorError, *Runtime) { gasCharge int64) ([]byte, aerrors.ActorError, *Runtime) {
st := vm.cstate st := vm.cstate
@ -204,13 +206,17 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
} }
} }
gasUsed := types.NewInt(gasCharge) gasUsed := gasCharge
origin := msg.From origin := msg.From
on := msg.Nonce
var icc int64 = 0
if parent != nil { if parent != nil {
gasUsed = types.BigAdd(parent.gasUsed, gasUsed) gasUsed = parent.gasUsed + gasUsed
origin = parent.origin origin = parent.origin
on = parent.originNonce
icc = parent.internalCallCounter + 1
} }
rt := vm.makeRuntime(ctx, msg, origin, gasUsed) rt := vm.makeRuntime(ctx, msg, origin, on, gasUsed, icc)
if parent != nil { if parent != nil {
defer func() { defer func() {
parent.gasUsed = rt.gasUsed parent.gasUsed = rt.gasUsed
@ -234,8 +240,11 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
} }
func checkMessage(msg *types.Message) error { func checkMessage(msg *types.Message) error {
if msg.GasLimit == types.EmptyInt { if msg.GasLimit == 0 {
return xerrors.Errorf("message gas no gas limit set") return xerrors.Errorf("message has no gas limit set")
}
if msg.GasLimit < 0 {
return xerrors.Errorf("message has negative gas limit")
} }
if msg.GasPrice == types.EmptyInt { if msg.GasPrice == types.EmptyInt {
@ -268,8 +277,8 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
if err != nil { if err != nil {
return nil, xerrors.Errorf("could not serialize message: %w", err) return nil, xerrors.Errorf("could not serialize message: %w", err)
} }
msgGasCost := uint64(len(serMsg)) * gasPerMessageByte msgGasCost := int64(len(serMsg)) * gasPerMessageByte
if msgGasCost > msg.GasLimit.Uint64() { if msgGasCost > msg.GasLimit {
return &ApplyRet{ return &ApplyRet{
MessageReceipt: types.MessageReceipt{ MessageReceipt: types.MessageReceipt{
ExitCode: exitcode.SysErrOutOfGas, ExitCode: exitcode.SysErrOutOfGas,
@ -306,7 +315,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
}, nil }, nil
} }
gascost := types.BigMul(msg.GasLimit, msg.GasPrice) gascost := types.BigMul(types.NewInt(uint64(msg.GasLimit)), msg.GasPrice)
totalCost := types.BigAdd(gascost, msg.Value) totalCost := types.BigAdd(gascost, msg.Value)
if fromActor.Balance.LessThan(totalCost) { if fromActor.Balance.LessThan(totalCost) {
return &ApplyRet{ return &ApplyRet{
@ -334,7 +343,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
} }
var errcode uint8 var errcode uint8
var gasUsed types.BigInt var gasUsed int64
if errcode = aerrors.RetCode(actorErr); errcode != 0 { if errcode = aerrors.RetCode(actorErr); errcode != 0 {
gasUsed = msg.GasLimit gasUsed = msg.GasLimit
@ -345,7 +354,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
} else { } else {
gasUsed = rt.gasUsed gasUsed = rt.gasUsed
// refund unused gas // refund unused gas
refund := types.BigMul(types.BigSub(msg.GasLimit, gasUsed), msg.GasPrice) refund := types.BigMul(types.NewInt(uint64(msg.GasLimit-gasUsed)), msg.GasPrice)
if err := Transfer(gasHolder, fromActor, refund); err != nil { if err := Transfer(gasHolder, fromActor, refund); err != nil {
return nil, xerrors.Errorf("failed to refund gas") return nil, xerrors.Errorf("failed to refund gas")
} }
@ -356,7 +365,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
return nil, xerrors.Errorf("getting burnt funds actor failed: %w", err) return nil, xerrors.Errorf("getting burnt funds actor failed: %w", err)
} }
gasReward := types.BigMul(msg.GasPrice, gasUsed) gasReward := types.BigMul(msg.GasPrice, types.NewInt(uint64(gasUsed)))
if err := Transfer(gasHolder, rwAct, gasReward); err != nil { if err := Transfer(gasHolder, rwAct, gasReward); err != nil {
return nil, xerrors.Errorf("failed to give miner gas reward: %w", err) return nil, xerrors.Errorf("failed to give miner gas reward: %w", err)
} }

View File

@ -796,7 +796,7 @@ var slashConsensusFault = &cli.Command{
From: def, From: def,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
GasLimit: types.NewInt(10000000), GasLimit: 10000000,
Method: builtin.MethodsPower.ReportConsensusFault, Method: builtin.MethodsPower.ReportConsensusFault,
Params: params, Params: params,
} }

View File

@ -123,7 +123,7 @@ var msigCreateCmd = &cli.Command{
Method: builtin.MethodsInit.Exec, Method: builtin.MethodsInit.Exec,
Params: enc, Params: enc,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
Value: types.BigInt(filval), Value: types.BigInt(filval),
} }
@ -353,7 +353,7 @@ var msigProposeCmd = &cli.Command{
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin.MethodsMultisig.Propose, Method: builtin.MethodsMultisig.Propose,
Params: enc, Params: enc,
GasLimit: types.NewInt(100000), GasLimit: 100000,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }
@ -439,7 +439,7 @@ var msigApproveCmd = &cli.Command{
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin.MethodsMultisig.Approve, Method: builtin.MethodsMultisig.Approve,
Params: enc, Params: enc,
GasLimit: types.NewInt(100000), GasLimit: 100000,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }

View File

@ -62,7 +62,7 @@ var sendCmd = &cli.Command{
From: fromAddr, From: fromAddr,
To: toAddr, To: toAddr,
Value: types.BigInt(val), Value: types.BigInt(val),
GasLimit: types.NewInt(1000), GasLimit: 1000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -349,7 +349,7 @@ var stateReplaySetCmd = &cli.Command{
fmt.Println("Replay receipt:") fmt.Println("Replay receipt:")
fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode) fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode)
fmt.Printf("Return: %x\n", res.MsgRct.Return) fmt.Printf("Return: %x\n", res.MsgRct.Return)
fmt.Printf("Gas Used: %s\n", res.MsgRct.GasUsed) fmt.Printf("Gas Used: %d\n", res.MsgRct.GasUsed)
if res.MsgRct.ExitCode != 0 { if res.MsgRct.ExitCode != 0 {
fmt.Printf("Error message: %q\n", res.Error) fmt.Printf("Error message: %q\n", res.Error)
} }
@ -849,7 +849,7 @@ var stateWaitMsgCmd = &cli.Command{
fmt.Printf("message was executed in tipset: %s", mw.TipSet.Cids()) fmt.Printf("message was executed in tipset: %s", mw.TipSet.Cids())
fmt.Printf("Exit Code: %d", mw.Receipt.ExitCode) fmt.Printf("Exit Code: %d", mw.Receipt.ExitCode)
fmt.Printf("Gas Used: %s", mw.Receipt.GasUsed) fmt.Printf("Gas Used: %d", mw.Receipt.GasUsed)
fmt.Printf("Return: %x", mw.Receipt.Return) fmt.Printf("Return: %x", mw.Receipt.Return)
return nil return nil
}, },
@ -928,7 +928,7 @@ var stateCallCmd = &cli.Command{
From: froma, From: froma,
To: toa, To: toa,
Value: types.BigInt(value), Value: types.BigInt(value),
GasLimit: types.NewInt(10000000000), GasLimit: 10000000000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
Method: abi.MethodNum(method), Method: abi.MethodNum(method),
Params: params, Params: params,

View File

@ -3,11 +3,12 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/filecoin-project/specs-actors/actors/crypto"
"math/rand" "math/rand"
"os" "os"
"time" "time"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -76,7 +77,7 @@ func sendSmallFundsTxs(ctx context.Context, api api.FullNode, from address.Addre
From: from, From: from,
To: sendSet[rand.Intn(20)], To: sendSet[rand.Intn(20)],
Value: types.NewInt(1), Value: types.NewInt(1),
GasLimit: types.NewInt(100000), GasLimit: 100000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -662,7 +662,7 @@ create temp table msgs (like messages excluding constraints) on commit drop;
m.Nonce, m.Nonce,
m.Value.String(), m.Value.String(),
m.GasPrice.String(), m.GasPrice.String(),
m.GasLimit.String(), m.GasLimit,
m.Method, m.Method,
m.Params, m.Params,
); err != nil { ); err != nil {
@ -706,7 +706,7 @@ create temp table recs (like receipts excluding constraints) on commit drop;
c.state.String(), c.state.String(),
c.idx, c.idx,
m.ExitCode, m.ExitCode,
m.GasUsed.String(), m.GasUsed,
m.Return, m.Return,
); err != nil { ); err != nil {
return err return err

View File

@ -279,7 +279,7 @@ type Message struct {
Value sbig Value sbig
GasPrice sbig GasPrice sbig
GasLimit sbig GasLimit int64
Method abi.MethodNum Method abi.MethodNum
Params []byte Params []byte
@ -324,7 +324,7 @@ func (h *handler) messages(filter string, args ...interface{}) (out []types.Mess
Nonce: r.Nonce, Nonce: r.Nonce,
Value: types.BigInt(r.Value), Value: types.BigInt(r.Value),
GasPrice: types.BigInt(r.GasPrice), GasPrice: types.BigInt(r.GasPrice),
GasLimit: types.BigInt(r.GasLimit), GasLimit: r.GasLimit,
Method: r.Method, Method: r.Method,
Params: r.Params, Params: r.Params,
} }

View File

@ -190,7 +190,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) {
To: to, To: to,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000), GasLimit: 1000,
}) })
if err != nil { if err != nil {
w.WriteHeader(400) w.WriteHeader(400)
@ -256,7 +256,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
To: owner, To: owner,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000), GasLimit: 1000,
}) })
if err != nil { if err != nil {
w.WriteHeader(400) w.WriteHeader(400)
@ -285,7 +285,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
Method: builtin.MethodsPower.CreateMiner, Method: builtin.MethodsPower.CreateMiner,
Params: params, Params: params,
GasLimit: types.NewInt(10000000), GasLimit: 10000000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -89,7 +89,7 @@ var noncefix = &cli.Command{
From: addr, From: addr,
To: addr, To: addr,
Value: types.NewInt(1), Value: types.NewInt(1),
GasLimit: types.NewInt(1000), GasLimit: 1000,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
Nonce: i, Nonce: i,
} }

View File

@ -505,7 +505,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(100000000), GasLimit: 100000000,
} }
smsg, err := api.MpoolPushMessage(ctx, msg) smsg, err := api.MpoolPushMessage(ctx, msg)
@ -576,7 +576,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
Method: builtin.MethodsPower.CreateMiner, Method: builtin.MethodsPower.CreateMiner,
Params: params, Params: params,
GasLimit: types.NewInt(10000000), GasLimit: 10000000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -46,8 +46,9 @@ var dealsCmd = &cli.Command{
} }
var dealsImportDataCmd = &cli.Command{ var dealsImportDataCmd = &cli.Command{
Name: "import-data", Name: "import-data",
Usage: "Manually import data for a deal", Usage: "Manually import data for a deal",
ArgsUsage: "<proposal CID> <file>",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, closer, err := lcli.GetStorageMinerAPI(cctx) api, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil { if err != nil {

View File

@ -100,7 +100,7 @@ var rewardsRedeemCmd = &cli.Command{
Nonce: workerNonce, Nonce: workerNonce,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
GasLimit: types.NewInt(100000), GasLimit: 100000,
Method: builtin.MethodsReward.WithdrawReward, Method: builtin.MethodsReward.WithdrawReward,
Params: params, Params: params,
}) })

7
go.mod
View File

@ -11,7 +11,7 @@ require (
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/coreos/go-systemd/v22 v22.0.0 github.com/coreos/go-systemd/v22 v22.0.0
github.com/docker/go-units v0.4.0 github.com/docker/go-units v0.4.0
github.com/filecoin-project/chain-validation v0.0.6-0.20200311235406-31f0d58e13e4 github.com/filecoin-project/chain-validation v0.0.6-0.20200318065243-0ccb5ec3afc5
github.com/filecoin-project/filecoin-ffi v0.0.0-20200304181354-4446ff8a1bb9 github.com/filecoin-project/filecoin-ffi v0.0.0-20200304181354-4446ff8a1bb9
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e
@ -19,13 +19,13 @@ 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-20200304003055-d449a980d4bd github.com/filecoin-project/go-fil-markets v0.0.0-20200318012938-6403a5bda668
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.20200317221918-42574fc2aab9 github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200317221918-42574fc2aab9
github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9
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-20200311215506-e95895452888 github.com/filecoin-project/specs-actors v0.0.0-20200312030511-3f5510bf6130
github.com/filecoin-project/specs-storage v0.0.0-20200317133846-063ba163b217 github.com/filecoin-project/specs-storage v0.0.0-20200317133846-063ba163b217
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
@ -60,6 +60,7 @@ require (
github.com/ipfs/go-merkledag v0.2.4 github.com/ipfs/go-merkledag v0.2.4
github.com/ipfs/go-path v0.0.7 github.com/ipfs/go-path v0.0.7
github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb
github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785
github.com/lib/pq v1.2.0 github.com/lib/pq v1.2.0
github.com/libp2p/go-libp2p v0.5.2 github.com/libp2p/go-libp2p v0.5.2
github.com/libp2p/go-libp2p-circuit v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.4

26
go.sum
View File

@ -98,9 +98,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
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.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/filecoin-project/chain-validation v0.0.6-0.20200318065243-0ccb5ec3afc5 h1:cr9+8iX+u9fDV53MWqqZw820EyeWVX+h/HCz56JUWb0=
github.com/filecoin-project/chain-validation v0.0.6-0.20200311235406-31f0d58e13e4 h1:chsO3yHq03hxr5MtB8XTIbTAyu1S6mx9lt2M+0JOhto= github.com/filecoin-project/chain-validation v0.0.6-0.20200318065243-0ccb5ec3afc5/go.mod h1:7HoEkq8OWN3vGcCZ4SRGxAPeL/mLckS+PNV3F0XmrCs=
github.com/filecoin-project/chain-validation v0.0.6-0.20200311235406-31f0d58e13e4/go.mod h1:7HoEkq8OWN3vGcCZ4SRGxAPeL/mLckS+PNV3F0XmrCs=
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5 h1:/MmWluswvDIbuPvBct4q6HeQgVm62O2DzWYTB38kt4A= 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=
@ -117,13 +116,13 @@ 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-20200304003055-d449a980d4bd h1:tLOl4GWJKQjpjqvSYSW0FoIjhoAzJSEoRibqkVFlaCE= github.com/filecoin-project/go-fil-markets v0.0.0-20200318012938-6403a5bda668 h1:856ZUIBb2K8+C5nepxi4FQ/yeTSWdr4mWbjs1JbByGU=
github.com/filecoin-project/go-fil-markets v0.0.0-20200304003055-d449a980d4bd/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts= github.com/filecoin-project/go-fil-markets v0.0.0-20200318012938-6403a5bda668/go.mod h1:7EGCMycMpwICVzckXUfNL44HfIxG7pwoAVeOuZFGX/4=
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.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.20200226210935-4739f8749f56/go.mod h1:tzTc9BxxSbjlIzhFwm5h9oBkXKkRuLxeiWspntwnKyw= github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200311224656-7d83652bdbed/go.mod h1:xAd/X905Ncgj8kkHsP2pmQUf6MQT2qJTDcOEfkwCjYc=
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2 h1:4RjDynwobd/UYlZUprRg/GMEsMP6fAfVRTXgFs4XNfo= github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2 h1:4RjDynwobd/UYlZUprRg/GMEsMP6fAfVRTXgFs4XNfo=
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2/go.mod h1:NcE+iL0bbYnamGmYQgCPVGbSaf8VF2/CLra/61B3I3I= github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2/go.mod h1:NcE+iL0bbYnamGmYQgCPVGbSaf8VF2/CLra/61B3I3I=
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200317165603-bd9e7cb04d81 h1:W5yekTpVTUiB86rSDiZo6rTI3lrLKrsrdY0tx/IqgJA= github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200317165603-bd9e7cb04d81 h1:W5yekTpVTUiB86rSDiZo6rTI3lrLKrsrdY0tx/IqgJA=
@ -140,6 +139,8 @@ github.com/filecoin-project/specs-actors v0.0.0-20200302223606-0eaf97b10aaf/go.m
github.com/filecoin-project/specs-actors v0.0.0-20200306000749-99e98e61e2a0/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU= github.com/filecoin-project/specs-actors v0.0.0-20200306000749-99e98e61e2a0/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888 h1:VCrkpFmZuQRyHrUpFTS3K/09cCQDMi/ZJUQ6c4zr1g4= github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888 h1:VCrkpFmZuQRyHrUpFTS3K/09cCQDMi/ZJUQ6c4zr1g4=
github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888/go.mod h1:5WngRgTN5Eo4+0SjCBqLzEr2l6Mj45DrP2606gBhqI0= github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888/go.mod h1:5WngRgTN5Eo4+0SjCBqLzEr2l6Mj45DrP2606gBhqI0=
github.com/filecoin-project/specs-actors v0.0.0-20200312030511-3f5510bf6130 h1:atiWEDtI/gzSm89fL+NyneLN3eHfBd1QPgOZyXPjA5M=
github.com/filecoin-project/specs-actors v0.0.0-20200312030511-3f5510bf6130/go.mod h1:5WngRgTN5Eo4+0SjCBqLzEr2l6Mj45DrP2606gBhqI0=
github.com/filecoin-project/specs-storage v0.0.0-20200303233430-1a5a408f7513 h1:okBx3lPomwDxlPmRvyP078BwivDfdxNUlpCDhDD0ia8= github.com/filecoin-project/specs-storage v0.0.0-20200303233430-1a5a408f7513 h1:okBx3lPomwDxlPmRvyP078BwivDfdxNUlpCDhDD0ia8=
github.com/filecoin-project/specs-storage v0.0.0-20200303233430-1a5a408f7513/go.mod h1:sC2Ck2l1G8hXI5Do/3sp0yxbMRMnukbFwP9KF1CRFLw= github.com/filecoin-project/specs-storage v0.0.0-20200303233430-1a5a408f7513/go.mod h1:sC2Ck2l1G8hXI5Do/3sp0yxbMRMnukbFwP9KF1CRFLw=
github.com/filecoin-project/specs-storage v0.0.0-20200317133846-063ba163b217 h1:doPA79fSLg5TnY2rJhXs5dIZHP3IoCcIiCLKFGfgrY8= github.com/filecoin-project/specs-storage v0.0.0-20200317133846-063ba163b217 h1:doPA79fSLg5TnY2rJhXs5dIZHP3IoCcIiCLKFGfgrY8=
@ -198,7 +199,6 @@ github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvK
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824/go.mod h1:OiEWyHgK+CWrmOlVquHaIK1vhpUJydC9m0Je6mhaiNE=
github.com/hannahhoward/cbor-gen-for v0.0.0-20191216214420-3e450425c40c/go.mod h1:WVPCl0HO/0RAL5+vBH2GMxBomlxBF70MAS78+Lu1//k= github.com/hannahhoward/cbor-gen-for v0.0.0-20191216214420-3e450425c40c/go.mod h1:WVPCl0HO/0RAL5+vBH2GMxBomlxBF70MAS78+Lu1//k=
github.com/hannahhoward/cbor-gen-for v0.0.0-20191218204337-9ab7b1bcc099 h1:vQqOW42RRM5LoM/1K5dK940VipLqpH8lEVGrMz+mNjU= github.com/hannahhoward/cbor-gen-for v0.0.0-20191218204337-9ab7b1bcc099 h1:vQqOW42RRM5LoM/1K5dK940VipLqpH8lEVGrMz+mNjU=
github.com/hannahhoward/cbor-gen-for v0.0.0-20191218204337-9ab7b1bcc099/go.mod h1:WVPCl0HO/0RAL5+vBH2GMxBomlxBF70MAS78+Lu1//k= github.com/hannahhoward/cbor-gen-for v0.0.0-20191218204337-9ab7b1bcc099/go.mod h1:WVPCl0HO/0RAL5+vBH2GMxBomlxBF70MAS78+Lu1//k=
@ -214,7 +214,6 @@ github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uG
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag=
github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo=
github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
@ -237,7 +236,6 @@ github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbR
github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M=
github.com/ipfs/go-blockservice v0.1.3-0.20190908200855-f22eea50656c h1:lN5IQA07VtLiTLAp/Scezp1ljFhXErC6yq4O1cu+yJ0= github.com/ipfs/go-blockservice v0.1.3-0.20190908200855-f22eea50656c h1:lN5IQA07VtLiTLAp/Scezp1ljFhXErC6yq4O1cu+yJ0=
github.com/ipfs/go-blockservice v0.1.3-0.20190908200855-f22eea50656c/go.mod h1:t+411r7psEUhLueM8C7aPA7cxCclv4O3VsUVxt9kz2I= github.com/ipfs/go-blockservice v0.1.3-0.20190908200855-f22eea50656c/go.mod h1:t+411r7psEUhLueM8C7aPA7cxCclv4O3VsUVxt9kz2I=
github.com/ipfs/go-car v0.0.3-0.20200131220434-3f68f6ebd093/go.mod h1:rEkw0S1sHd5kHL3rUSGEhwNanYqTwwNhjtpp0rwjrr4=
github.com/ipfs/go-car v0.0.3-0.20200304012825-b6769248bfef h1:Zn2PZSkX8Go+SZpQmjVKNrkcgbNuIxUC/3MOQRDTIVw= github.com/ipfs/go-car v0.0.3-0.20200304012825-b6769248bfef h1:Zn2PZSkX8Go+SZpQmjVKNrkcgbNuIxUC/3MOQRDTIVw=
github.com/ipfs/go-car v0.0.3-0.20200304012825-b6769248bfef/go.mod h1:7BMxYRi5cbR/GJ1A8mYSHvMLXLkHgYdrJ6VlNGobd0o= github.com/ipfs/go-car v0.0.3-0.20200304012825-b6769248bfef/go.mod h1:7BMxYRi5cbR/GJ1A8mYSHvMLXLkHgYdrJ6VlNGobd0o=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
@ -296,7 +294,6 @@ github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAz
github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-files v0.0.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE= github.com/ipfs/go-ipfs-files v0.0.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE=
github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-flags v0.0.1/go.mod h1:RnXBb9WV53GSfTrSDVK61NLTFKvWc60n+K9EgCDh+rA=
github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs=
github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A=
github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU=
@ -341,13 +338,14 @@ github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb h1:tmWYgjltxwM7PD
github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k= github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k=
github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E=
github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
github.com/ipld/go-car v0.0.5-0.20200316204026-3e2cf7af0fab h1:+3Y6Jb3IBmG3t6e3r6TItnuciOaMOuGW7QIVEUa5vy4=
github.com/ipld/go-car v0.0.5-0.20200316204026-3e2cf7af0fab/go.mod h1:yR5AsJ38xTwwgwGpbh60ICtdLPp5lGfuH28PAAzaEhM=
github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785 h1:fASnkvtR+SmB2y453RxmDD3Uvd4LonVUgFGk9JoDaZs= github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785 h1:fASnkvtR+SmB2y453RxmDD3Uvd4LonVUgFGk9JoDaZs=
github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w=
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43rAdyGA+yRQuy6ju0ucZkWpYc1F2CTQtZTVW/4= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43rAdyGA+yRQuy6ju0ucZkWpYc1F2CTQtZTVW/4=
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU=
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c= github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c=
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4= github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4=
github.com/jackpal/gateway v1.0.4/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc=
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA=
@ -521,7 +519,6 @@ github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eq
github.com/libp2p/go-libp2p-tls v0.1.0 h1:o4bjjAdnUjNgJoPoDd0wUaZH7K+EenlNWJpgyXB3ulA= github.com/libp2p/go-libp2p-tls v0.1.0 h1:o4bjjAdnUjNgJoPoDd0wUaZH7K+EenlNWJpgyXB3ulA=
github.com/libp2p/go-libp2p-tls v0.1.0/go.mod h1:VZdoSWQDeNpIIAFJFv+6uqTqpnIIDHcqZQSTC/A1TT0= github.com/libp2p/go-libp2p-tls v0.1.0/go.mod h1:VZdoSWQDeNpIIAFJFv+6uqTqpnIIDHcqZQSTC/A1TT0=
github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk=
github.com/libp2p/go-libp2p-transport v0.0.4/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A=
github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A=
github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc= github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc=
github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw=
@ -777,9 +774,6 @@ github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE= github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE=
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8=
github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible/go.mod h1:34LEDbeKFZInPUrAG+bjuJmUXONGdEFW7XL0SpTY1y4=
github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible/go.mod h1:dRWHHvc4HDQSHh9gbKEBbUZ+f2Q8iZTPG3UOGYODxSQ=
github.com/whyrusleeping/go-smux-yamux v2.0.8+incompatible/go.mod h1:6qHUzBXUbB9MXmw3AUdB52L8sEb/hScCqOdW2kj/wuI=
github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA=
github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA=
github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
@ -790,7 +784,6 @@ github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d h1:wnjWu1N8UT
github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A= github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A=
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow=
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg=
github.com/whyrusleeping/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@ -845,7 +838,6 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=

View File

@ -230,10 +230,17 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer
} }
} }
} }
var kind reflect.Kind
var res interface{}
var nonZero bool
if handler.valOut != -1 { if handler.valOut != -1 {
resp.Result = callResult[handler.valOut].Interface() res = callResult[handler.valOut].Interface()
kind = callResult[handler.valOut].Kind()
nonZero = !callResult[handler.valOut].IsZero()
} }
if resp.Result != nil && reflect.TypeOf(resp.Result).Kind() == reflect.Chan {
if res != nil && kind == reflect.Chan {
// Channel responses are sent from channel control goroutine. // Channel responses are sent from channel control goroutine.
// Sending responses here could cause deadlocks on writeLk, or allow // Sending responses here could cause deadlocks on writeLk, or allow
// sending channel messages before this rpc call returns // sending channel messages before this rpc call returns
@ -250,6 +257,12 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer
Code: 1, Code: 1,
Message: err.(error).Error(), Message: err.(error).Error(),
} }
} else if resp.Error == nil {
// check error as JSON-RPC spec prohibits error and value at the same time
resp.Result = res
}
if resp.Error != nil && nonZero {
log.Errorw("error and res returned", "request", req, "r.err", resp.Error, "res", res)
} }
w(func(w io.Writer) { w(func(w io.Writer) {

View File

@ -19,6 +19,10 @@ func (p *param) UnmarshalJSON(raw []byte) error {
} }
func (p *param) MarshalJSON() ([]byte, error) { func (p *param) MarshalJSON() ([]byte, error) {
if p.v.Kind() == reflect.Invalid {
return p.data, nil
}
return json.Marshal(p.v.Interface()) return json.Marshal(p.v.Interface())
} }

View File

@ -5,26 +5,33 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
payapi "github.com/filecoin-project/lotus/node/impl/paych" "github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/lotus/paychmgr"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/paych" "github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/lotus/node/impl/full"
payapi "github.com/filecoin-project/lotus/node/impl/paych"
"github.com/filecoin-project/lotus/paychmgr"
) )
type retrievalClientNode struct { type retrievalClientNode struct {
pmgr *paychmgr.Manager chainapi full.ChainAPI
payapi payapi.PaychAPI pmgr *paychmgr.Manager
payapi payapi.PaychAPI
} }
// NewRetrievalClientNode returns a new node adapter for a retrieval client that talks to the // NewRetrievalClientNode returns a new node adapter for a retrieval client that talks to the
// Lotus Node // Lotus Node
func NewRetrievalClientNode(pmgr *paychmgr.Manager, payapi payapi.PaychAPI) retrievalmarket.RetrievalClientNode { func NewRetrievalClientNode(pmgr *paychmgr.Manager, payapi payapi.PaychAPI, chainapi full.ChainAPI) retrievalmarket.RetrievalClientNode {
return &retrievalClientNode{pmgr: pmgr, payapi: payapi} return &retrievalClientNode{pmgr: pmgr, payapi: payapi, chainapi: chainapi}
} }
// GetOrCreatePaymentChannel sets up a new payment channel if one does not exist // GetOrCreatePaymentChannel sets up a new payment channel if one does not exist
// between a client and a miner and insures the client has the given amount of funds available in the channel // between a client and a miner and ensures the client has the given amount of
func (rcn *retrievalClientNode) GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, minerAddress address.Address, clientFundsAvailable abi.TokenAmount) (address.Address, error) { // funds available in the channel.
func (rcn *retrievalClientNode) GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, minerAddress address.Address, clientFundsAvailable abi.TokenAmount, tok shared.TipSetToken) (address.Address, error) {
// TODO: respect the provided TipSetToken (a serialized TipSetKey) when
// querying the chain
paych, _, err := rcn.pmgr.GetPaych(ctx, clientAddress, minerAddress, clientFundsAvailable) paych, _, err := rcn.pmgr.GetPaych(ctx, clientAddress, minerAddress, clientFundsAvailable)
return paych, err return paych, err
} }
@ -39,10 +46,21 @@ func (rcn *retrievalClientNode) AllocateLane(paymentChannel address.Address) (ui
// CreatePaymentVoucher creates a new payment voucher in the given lane for a // CreatePaymentVoucher creates a new payment voucher in the given lane for a
// given payment channel so that all the payment vouchers in the lane add up // given payment channel so that all the payment vouchers in the lane add up
// to the given amount (so the payment voucher will be for the difference) // to the given amount (so the payment voucher will be for the difference)
func (rcn *retrievalClientNode) CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane uint64) (*paych.SignedVoucher, error) { func (rcn *retrievalClientNode) CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane uint64, tok shared.TipSetToken) (*paych.SignedVoucher, error) {
// TODO: respect the provided TipSetToken (a serialized TipSetKey) when
// querying the chain
voucher, err := rcn.payapi.PaychVoucherCreate(ctx, paymentChannel, amount, lane) voucher, err := rcn.payapi.PaychVoucherCreate(ctx, paymentChannel, amount, lane)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return voucher, nil return voucher, nil
} }
func (rcn *retrievalClientNode) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error) {
head, err := rcn.chainapi.ChainHead(ctx)
if err != nil {
return nil, 0, err
}
return head.Key().Bytes(), head.Height(), nil
}

View File

@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-sectorbuilder" "github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/paych" "github.com/filecoin-project/specs-actors/actors/builtin/paych"
@ -28,8 +29,13 @@ func NewRetrievalProviderNode(miner *storage.Miner, sealer sealmgr.Manager, full
return &retrievalProviderNode{miner, sealer, full} return &retrievalProviderNode{miner, sealer, full}
} }
func (rpn *retrievalProviderNode) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) { func (rpn *retrievalProviderNode) GetMinerWorkerAddress(ctx context.Context, miner address.Address, tok shared.TipSetToken) (address.Address, error) {
addr, err := rpn.full.StateMinerWorker(ctx, miner, types.EmptyTSK) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil {
return address.Undef, err
}
addr, err := rpn.full.StateMinerWorker(ctx, miner, tsk)
return addr, err return addr, err
} }
@ -51,7 +57,18 @@ func (rpn *retrievalProviderNode) UnsealSector(ctx context.Context, sectorID uin
return rpn.sealer.ReadPieceFromSealedSector(ctx, sid, sectorbuilder.UnpaddedByteIndex(offset), abi.UnpaddedPieceSize(length), si.Ticket.Value, *si.CommD) return rpn.sealer.ReadPieceFromSealedSector(ctx, sid, sectorbuilder.UnpaddedByteIndex(offset), abi.UnpaddedPieceSize(length), si.Ticket.Value, *si.CommD)
} }
func (rpn *retrievalProviderNode) SavePaymentVoucher(ctx context.Context, paymentChannel address.Address, voucher *paych.SignedVoucher, proof []byte, expectedAmount abi.TokenAmount) (abi.TokenAmount, error) { func (rpn *retrievalProviderNode) SavePaymentVoucher(ctx context.Context, paymentChannel address.Address, voucher *paych.SignedVoucher, proof []byte, expectedAmount abi.TokenAmount, tok shared.TipSetToken) (abi.TokenAmount, error) {
// TODO: respect the provided TipSetToken (a serialized TipSetKey) when
// querying the chain
added, err := rpn.full.PaychVoucherAdd(ctx, paymentChannel, voucher, proof, expectedAmount) added, err := rpn.full.PaychVoucherAdd(ctx, paymentChannel, voucher, proof, expectedAmount)
return added, err return added, err
} }
func (rpn *retrievalProviderNode) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error) {
head, err := rpn.full.ChainHead(ctx)
if err != nil {
return nil, 0, err
}
return head.Key().Bytes(), head.Height(), nil
}

View File

@ -6,16 +6,17 @@ import (
"bytes" "bytes"
"context" "context"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
samarket "github.com/filecoin-project/specs-actors/actors/builtin/market" samarket "github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/specs-actors/actors/crypto"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
@ -115,10 +116,6 @@ func (n *ClientNodeAdapter) ListClientDeals(ctx context.Context, addr address.Ad
return out, nil return out, nil
} }
func (n *ClientNodeAdapter) MostRecentStateId(ctx context.Context) (storagemarket.StateKey, error) {
return n.ChainHead(ctx)
}
// Adds funds with the StorageMinerActor for a storage participant. Used by both providers and clients. // Adds funds with the StorageMinerActor for a storage participant. Used by both providers and clients.
func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error { func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error {
// (Provider Node API) // (Provider Node API)
@ -127,7 +124,7 @@ func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address,
From: addr, From: addr,
Value: amount, Value: amount,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
Method: builtin.MethodsMarket.AddBalance, Method: builtin.MethodsMarket.AddBalance,
}) })
if err != nil { if err != nil {
@ -161,7 +158,7 @@ func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address
// ValidatePublishedDeal validates that the provided deal has appeared on chain and references the same ClientDeal // ValidatePublishedDeal validates that the provided deal has appeared on chain and references the same ClientDeal
// returns the Deal id if there is no error // returns the Deal id if there is no error
func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal storagemarket.ClientDeal) (uint64, error) { func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal storagemarket.ClientDeal) (abi.DealID, error) {
log.Infow("DEAL ACCEPTED!") log.Infow("DEAL ACCEPTED!")
pubmsg, err := c.cs.GetMessage(*deal.PublishMessage) pubmsg, err := c.cs.GetMessage(*deal.PublishMessage)
@ -223,12 +220,12 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
return 0, err return 0, err
} }
return uint64(res.IDs[dealIdx]), nil return res.IDs[dealIdx], nil
} }
func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealId uint64, cb storagemarket.DealSectorCommittedCallback) error { func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealId abi.DealID, cb storagemarket.DealSectorCommittedCallback) error {
checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) { checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) {
sd, err := stmgr.GetStorageDeal(ctx, c.StateManager, abi.DealID(dealId), ts) sd, err := stmgr.GetStorageDeal(ctx, c.StateManager, dealId, ts)
if err != nil { if err != nil {
// TODO: This may be fine for some errors // TODO: This may be fine for some errors
@ -367,4 +364,13 @@ func (n *ClientNodeAdapter) ValidateAskSignature(ask *storagemarket.SignedStorag
} }
func (n *ClientNodeAdapter) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error) {
head, err := n.ChainHead(ctx)
if err != nil {
return nil, 0, err
}
return head.Key().Bytes(), head.Height(), nil
}
var _ storagemarket.StorageClientNode = &ClientNodeAdapter{} var _ storagemarket.StorageClientNode = &ClientNodeAdapter{}

View File

@ -7,17 +7,19 @@ import (
"context" "context"
"io" "io"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"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"
@ -51,7 +53,7 @@ func NewProviderNodeAdapter(dag dtypes.StagingDAG, secb *sectorblocks.SectorBloc
} }
} }
func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemarket.MinerDeal) (storagemarket.DealID, cid.Cid, error) { func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemarket.MinerDeal) (abi.DealID, cid.Cid, error) {
log.Info("publishing deal") log.Info("publishing deal")
worker, err := n.StateMinerWorker(ctx, deal.Proposal.Provider, types.EmptyTSK) worker, err := n.StateMinerWorker(ctx, deal.Proposal.Provider, types.EmptyTSK)
@ -73,7 +75,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
From: worker, From: worker,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
Method: builtin.MethodsMarket.PublishStorageDeals, Method: builtin.MethodsMarket.PublishStorageDeals,
Params: params, Params: params,
}) })
@ -96,11 +98,11 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
} }
// TODO: bad types here // TODO: bad types here
return storagemarket.DealID(resp.IDs[0]), smsg.Cid(), nil return resp.IDs[0], smsg.Cid(), nil
} }
func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagemarket.MinerDeal, pieceSize abi.UnpaddedPieceSize, pieceData io.Reader) error { func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagemarket.MinerDeal, pieceSize abi.UnpaddedPieceSize, pieceData io.Reader) error {
_, err := n.secb.AddPiece(ctx, abi.UnpaddedPieceSize(pieceSize), pieceData, abi.DealID(deal.DealID)) _, err := n.secb.AddPiece(ctx, abi.UnpaddedPieceSize(pieceSize), pieceData, deal.DealID)
if err != nil { if err != nil {
return xerrors.Errorf("AddPiece failed: %s", err) return xerrors.Errorf("AddPiece failed: %s", err)
} }
@ -132,9 +134,13 @@ func (n *ProviderNodeAdapter) ListProviderDeals(ctx context.Context, addr addres
return out, nil return out, nil
} }
func (n *ProviderNodeAdapter) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) { func (n *ProviderNodeAdapter) GetMinerWorkerAddress(ctx context.Context, miner address.Address, tok shared.TipSetToken) (address.Address, error) {
addr, err := n.StateMinerWorker(ctx, miner, types.EmptyTSK) tsk, err := types.TipSetKeyFromBytes(tok)
return addr, err if err != nil {
return address.Undef, err
}
return n.StateMinerWorker(ctx, miner, tsk)
} }
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*crypto.Signature, error) { func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*crypto.Signature, error) {
@ -149,10 +155,6 @@ func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr, wallet addr
return n.MarketEnsureAvailable(ctx, addr, wallet, amt) return n.MarketEnsureAvailable(ctx, addr, wallet, amt)
} }
func (n *ProviderNodeAdapter) MostRecentStateId(ctx context.Context) (storagemarket.StateKey, error) {
return n.ChainHead(ctx)
}
// Adds funds with the StorageMinerActor for a storage participant. Used by both providers and clients. // Adds funds with the StorageMinerActor for a storage participant. Used by both providers and clients.
func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error { func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error {
// (Provider Node API) // (Provider Node API)
@ -161,7 +163,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
From: addr, From: addr,
Value: amount, Value: amount,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
Method: builtin.MethodsMarket.AddBalance, Method: builtin.MethodsMarket.AddBalance,
}) })
if err != nil { if err != nil {
@ -189,9 +191,8 @@ func (n *ProviderNodeAdapter) GetBalance(ctx context.Context, addr address.Addre
return utils.ToSharedBalance(bal), nil return utils.ToSharedBalance(bal), nil
} }
func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context, dealID uint64) (sectorID uint64, offset uint64, length uint64, err error) { func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context, dealID abi.DealID) (sectorID uint64, offset uint64, length uint64, err error) {
refs, err := n.secb.GetRefs(dealID)
refs, err := n.secb.GetRefs(abi.DealID(dealID))
if err != nil { if err != nil {
return 0, 0, 0, err return 0, 0, 0, err
} }
@ -219,9 +220,9 @@ func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context
return uint64(best.SectorID), best.Offset, uint64(best.Size), nil return uint64(best.SectorID), best.Offset, uint64(best.Size), nil
} }
func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID uint64, cb storagemarket.DealSectorCommittedCallback) error { func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, cb storagemarket.DealSectorCommittedCallback) error {
checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) { checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) {
sd, err := n.StateMarketStorageDeal(ctx, abi.DealID(dealID), ts.Key()) sd, err := n.StateMarketStorageDeal(ctx, dealID, ts.Key())
if err != nil { if err != nil {
// TODO: This may be fine for some errors // TODO: This may be fine for some errors
@ -322,4 +323,13 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
return nil return nil
} }
func (n *ProviderNodeAdapter) GetChainHead(ctx context.Context) (shared.TipSetToken, abi.ChainEpoch, error) {
head, err := n.ChainHead(ctx)
if err != nil {
return nil, 0, err
}
return head.Key().Bytes(), head.Height(), nil
}
var _ storagemarket.StorageProviderNode = &ProviderNodeAdapter{} var _ storagemarket.StorageProviderNode = &ProviderNodeAdapter{}

View File

@ -43,7 +43,7 @@ func TestMessageFiltering(t *testing.T) {
To: a1, To: a1,
Nonce: 3, Nonce: 3,
Value: types.NewInt(500), Value: types.NewInt(500),
GasLimit: types.NewInt(50), GasLimit: 50,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
}, },
types.Message{ types.Message{
@ -51,7 +51,7 @@ func TestMessageFiltering(t *testing.T) {
To: a1, To: a1,
Nonce: 4, Nonce: 4,
Value: types.NewInt(500), Value: types.NewInt(500),
GasLimit: types.NewInt(50), GasLimit: 50,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
}, },
types.Message{ types.Message{
@ -59,7 +59,7 @@ func TestMessageFiltering(t *testing.T) {
To: a1, To: a1,
Nonce: 1, Nonce: 1,
Value: types.NewInt(800), Value: types.NewInt(800),
GasLimit: types.NewInt(100), GasLimit: 100,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
}, },
types.Message{ types.Message{
@ -67,7 +67,7 @@ func TestMessageFiltering(t *testing.T) {
To: a1, To: a1,
Nonce: 0, Nonce: 0,
Value: types.NewInt(800), Value: types.NewInt(800),
GasLimit: types.NewInt(100), GasLimit: 100,
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
}, },
types.Message{ types.Message{
@ -75,7 +75,7 @@ func TestMessageFiltering(t *testing.T) {
To: a1, To: a1,
Nonce: 2, Nonce: 2,
Value: types.NewInt(150), Value: types.NewInt(150),
GasLimit: types.NewInt(100), GasLimit: (100),
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
}, },
} }

View File

@ -23,7 +23,7 @@ import (
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery" "github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery"
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
deals "github.com/filecoin-project/go-fil-markets/storagemarket/impl" "github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation"
sectorbuilder "github.com/filecoin-project/go-sectorbuilder" sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/lotus/storage/sealmgr/stores" "github.com/filecoin-project/lotus/storage/sealmgr/stores"
@ -234,9 +234,12 @@ func Online() Option {
Override(new(*blocksync.BlockSyncService), blocksync.NewBlockSyncService), Override(new(*blocksync.BlockSyncService), blocksync.NewBlockSyncService),
Override(new(*peermgr.PeerMgr), peermgr.NewPeerMgr), Override(new(*peermgr.PeerMgr), peermgr.NewPeerMgr),
Override(new(dtypes.GraphsyncLoader), modules.GraphsyncLoader),
Override(new(dtypes.GraphsyncStorer), modules.GraphsyncStorer),
Override(new(dtypes.Graphsync), modules.Graphsync),
Override(RunHelloKey, modules.RunHello), Override(RunHelloKey, modules.RunHello),
Override(RunBlockSyncKey, modules.RunBlockSync), Override(RunBlockSyncKey, modules.RunBlockSync),
Override(RunChainGraphsync, modules.ChainGraphsync),
Override(RunPeerMgrKey, modules.RunPeerMgr), Override(RunPeerMgrKey, modules.RunPeerMgr),
Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks), Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks),
@ -245,8 +248,9 @@ func Online() Option {
Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient), Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient),
Override(new(dtypes.ClientDealStore), modules.NewClientDealStore), Override(new(dtypes.ClientDealStore), modules.NewClientDealStore),
Override(new(dtypes.ClientDataTransfer), modules.NewClientDAGServiceDataTransfer), Override(new(dtypes.ClientDatastore), modules.NewClientDatastore),
Override(new(*deals.ClientRequestValidator), modules.NewClientRequestValidator), Override(new(dtypes.ClientDataTransfer), modules.NewClientGraphsyncDataTransfer),
Override(new(*requestvalidation.ClientRequestValidator), modules.NewClientRequestValidator),
Override(new(storagemarket.StorageClient), modules.StorageClient), Override(new(storagemarket.StorageClient), modules.StorageClient),
Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter), Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter),
Override(RegisterClientValidatorKey, modules.RegisterClientValidator), Override(RegisterClientValidatorKey, modules.RegisterClientValidator),
@ -281,7 +285,7 @@ func Online() Option {
Override(new(retrievalmarket.RetrievalProvider), modules.RetrievalProvider), Override(new(retrievalmarket.RetrievalProvider), modules.RetrievalProvider),
Override(new(dtypes.ProviderDealStore), modules.NewProviderDealStore), Override(new(dtypes.ProviderDealStore), modules.NewProviderDealStore),
Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer), Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer),
Override(new(*deals.ProviderRequestValidator), modules.NewProviderRequestValidator), Override(new(*requestvalidation.ProviderRequestValidator), modules.NewProviderRequestValidator),
Override(new(dtypes.ProviderPieceStore), modules.NewProviderPieceStore), Override(new(dtypes.ProviderPieceStore), modules.NewProviderPieceStore),
Override(new(storagemarket.StorageProvider), modules.StorageProvider), Override(new(storagemarket.StorageProvider), modules.StorageProvider),
Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter), Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter),
@ -402,7 +406,6 @@ func Repo(r repo.Repo) Option {
Override(new(dtypes.ClientFilestore), modules.ClientFstore), Override(new(dtypes.ClientFilestore), modules.ClientFstore),
Override(new(dtypes.ClientBlockstore), modules.ClientBlockstore), Override(new(dtypes.ClientBlockstore), modules.ClientBlockstore),
Override(new(dtypes.ClientDAG), modules.ClientDAG), Override(new(dtypes.ClientDAG), modules.ClientDAG),
Override(new(dtypes.ClientGraphsync), modules.ClientGraphsync),
Override(new(ci.PrivKey), lp2p.PrivKey), Override(new(ci.PrivKey), lp2p.PrivKey),
Override(new(ci.PubKey), ci.PrivKey.GetPublic), Override(new(ci.PubKey), ci.PrivKey.GetPublic),

View File

@ -125,7 +125,7 @@ func (a *PaychAPI) PaychClose(ctx context.Context, addr address.Address) (cid.Ci
Method: builtin.MethodsPaych.Settle, Method: builtin.MethodsPaych.Settle,
Nonce: nonce, Nonce: nonce,
GasLimit: types.NewInt(500), GasLimit: 500,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }
@ -240,7 +240,7 @@ func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, s
Nonce: nonce, Nonce: nonce,
Method: builtin.MethodsPaych.UpdateChannelState, Method: builtin.MethodsPaych.UpdateChannelState,
Params: enc, Params: enc,
GasLimit: types.NewInt(100000), GasLimit: 100000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -11,10 +11,6 @@ import (
"github.com/ipfs/go-blockservice" "github.com/ipfs/go-blockservice"
"github.com/ipfs/go-car" "github.com/ipfs/go-car"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
graphsync "github.com/ipfs/go-graphsync/impl"
"github.com/ipfs/go-graphsync/ipldbridge"
gsnet "github.com/ipfs/go-graphsync/network"
"github.com/ipfs/go-graphsync/storeutil"
blockstore "github.com/ipfs/go-ipfs-blockstore" blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/routing" "github.com/libp2p/go-libp2p-core/routing"
@ -79,15 +75,6 @@ func ChainBlockservice(bs dtypes.ChainBlockstore, rem dtypes.ChainExchange) dtyp
return blockservice.New(bs, rem) return blockservice.New(bs, rem)
} }
func ChainGraphsync(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.ChainGCBlockstore, h host.Host) dtypes.ClientGraphsync {
graphsyncNetwork := gsnet.NewFromLibp2pHost(h)
ipldBridge := ipldbridge.NewIPLDBridge()
loader := storeutil.LoaderForBlockstore(ibs)
gs := graphsync.New(helpers.LifecycleCtx(mctx, lc), graphsyncNetwork, ipldBridge, loader, nil)
return gs
}
func ChainStore(lc fx.Lifecycle, bs dtypes.ChainBlockstore, ds dtypes.MetadataDS, syscalls runtime.Syscalls) *store.ChainStore { func ChainStore(lc fx.Lifecycle, bs dtypes.ChainBlockstore, ds dtypes.MetadataDS, syscalls runtime.Syscalls) *store.ChainStore {
chain := store.NewChainStore(bs, ds, syscalls) chain := store.NewChainStore(bs, ds, syscalls)

View File

@ -5,14 +5,20 @@ import (
"path/filepath" "path/filepath"
"reflect" "reflect"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipfs/go-merkledag"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/routing"
"go.uber.org/fx"
graphsyncimpl "github.com/filecoin-project/go-data-transfer/impl/graphsync" graphsyncimpl "github.com/filecoin-project/go-data-transfer/impl/graphsync"
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery" "github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery"
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl" retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network" rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
deals "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl" storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation"
smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network" smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network"
"github.com/filecoin-project/go-fil-markets/storedcounter" "github.com/filecoin-project/go-fil-markets/storedcounter"
"github.com/filecoin-project/go-statestore" "github.com/filecoin-project/go-statestore"
@ -22,17 +28,9 @@ import (
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace" "github.com/ipfs/go-datastore/namespace"
"github.com/ipfs/go-filestore" "github.com/ipfs/go-filestore"
graphsync "github.com/ipfs/go-graphsync/impl"
"github.com/ipfs/go-graphsync/ipldbridge"
gsnet "github.com/ipfs/go-graphsync/network"
"github.com/ipfs/go-graphsync/storeutil"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipfs/go-merkledag"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/routing"
"go.uber.org/fx"
"github.com/filecoin-project/lotus/markets/retrievaladapter" "github.com/filecoin-project/lotus/markets/retrievaladapter"
"github.com/filecoin-project/lotus/node/impl/full"
payapi "github.com/filecoin-project/lotus/node/impl/paych" payapi "github.com/filecoin-project/lotus/node/impl/paych"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/modules/helpers" "github.com/filecoin-project/lotus/node/modules/helpers"
@ -62,21 +60,26 @@ func ClientBlockstore(fstore dtypes.ClientFilestore) dtypes.ClientBlockstore {
// RegisterClientValidator is an initialization hook that registers the client // RegisterClientValidator is an initialization hook that registers the client
// request validator with the data transfer module as the validator for // request validator with the data transfer module as the validator for
// StorageDataTransferVoucher types // StorageDataTransferVoucher types
func RegisterClientValidator(crv *deals.ClientRequestValidator, dtm dtypes.ClientDataTransfer) { func RegisterClientValidator(crv *requestvalidation.ClientRequestValidator, dtm dtypes.ClientDataTransfer) {
if err := dtm.RegisterVoucherType(reflect.TypeOf(&deals.StorageDataTransferVoucher{}), crv); err != nil { if err := dtm.RegisterVoucherType(reflect.TypeOf(&requestvalidation.StorageDataTransferVoucher{}), crv); err != nil {
panic(err) panic(err)
} }
} }
// NewClientDAGServiceDataTransfer returns a data transfer manager that just // NewClientGraphsyncDataTransfer returns a data transfer manager that just
// uses the clients's Client DAG service for transfers // uses the clients's Client DAG service for transfers
func NewClientDAGServiceDataTransfer(h host.Host, gs dtypes.ClientGraphsync) dtypes.ClientDataTransfer { func NewClientGraphsyncDataTransfer(h host.Host, gs dtypes.Graphsync) dtypes.ClientDataTransfer {
return graphsyncimpl.NewGraphSyncDataTransfer(h, gs) return graphsyncimpl.NewGraphSyncDataTransfer(h, gs)
} }
// NewClientDealStore creates a statestore for the client to store its deals // NewClientDealStore creates a statestore for the client to store its deals
func NewClientDealStore(ds dtypes.MetadataDS) dtypes.ClientDealStore { func NewClientDealStore(ds dtypes.ClientDatastore) dtypes.ClientDealStore {
return statestore.New(namespace.Wrap(ds, datastore.NewKey("/deals/client"))) return statestore.New(ds)
}
// NewClientDatastore creates a datastore for the client to store its deals
func NewClientDatastore(ds dtypes.MetadataDS) dtypes.ClientDatastore {
return namespace.Wrap(ds, datastore.NewKey("/deals/client"))
} }
// ClientDAG is a DAGService for the ClientBlockstore // ClientDAG is a DAGService for the ClientBlockstore
@ -96,30 +99,18 @@ func ClientDAG(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.ClientBlocks
return dag return dag
} }
// ClientGraphsync creates a graphsync instance which reads and writes blocks func NewClientRequestValidator(deals dtypes.ClientDealStore) *requestvalidation.ClientRequestValidator {
// to the ClientBlockstore return requestvalidation.NewClientRequestValidator(deals)
func ClientGraphsync(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.ClientBlockstore, h host.Host) dtypes.ClientGraphsync {
graphsyncNetwork := gsnet.NewFromLibp2pHost(h)
ipldBridge := ipldbridge.NewIPLDBridge()
loader := storeutil.LoaderForBlockstore(ibs)
storer := storeutil.StorerForBlockstore(ibs)
gs := graphsync.New(helpers.LifecycleCtx(mctx, lc), graphsyncNetwork, ipldBridge, loader, storer)
return gs
} }
func NewClientRequestValidator(deals dtypes.ClientDealStore) *storageimpl.ClientRequestValidator { func StorageClient(h host.Host, ibs dtypes.ClientBlockstore, r repo.LockedRepo, dataTransfer dtypes.ClientDataTransfer, discovery *discovery.Local, deals dtypes.ClientDatastore, scn storagemarket.StorageClientNode) (storagemarket.StorageClient, error) {
return storageimpl.NewClientRequestValidator(deals)
}
func StorageClient(h host.Host, ibs dtypes.ClientBlockstore, r repo.LockedRepo, dataTransfer dtypes.ClientDataTransfer, discovery *discovery.Local, deals dtypes.ClientDealStore, scn storagemarket.StorageClientNode) storagemarket.StorageClient {
net := smnet.NewFromLibp2pHost(h) net := smnet.NewFromLibp2pHost(h)
return storageimpl.NewClient(net, ibs, dataTransfer, discovery, deals, scn) return storageimpl.NewClient(net, ibs, dataTransfer, discovery, deals, scn)
} }
// RetrievalClient creates a new retrieval client attached to the client blockstore // RetrievalClient creates a new retrieval client attached to the client blockstore
func RetrievalClient(h host.Host, bs dtypes.ClientBlockstore, pmgr *paychmgr.Manager, payapi payapi.PaychAPI, resolver retrievalmarket.PeerResolver, ds dtypes.MetadataDS) (retrievalmarket.RetrievalClient, error) { func RetrievalClient(h host.Host, bs dtypes.ClientBlockstore, pmgr *paychmgr.Manager, payapi payapi.PaychAPI, resolver retrievalmarket.PeerResolver, ds dtypes.MetadataDS, chainapi full.ChainAPI) (retrievalmarket.RetrievalClient, error) {
adapter := retrievaladapter.NewRetrievalClientNode(pmgr, payapi) adapter := retrievaladapter.NewRetrievalClientNode(pmgr, payapi, chainapi)
network := rmnet.NewFromLibp2pHost(h) network := rmnet.NewFromLibp2pHost(h)
sc := storedcounter.New(ds, datastore.NewKey("/retr")) sc := storedcounter.New(ds, datastore.NewKey("/retr"))
return retrievalimpl.NewClient(network, bs, adapter, resolver, ds, sc) return retrievalimpl.NewClient(network, bs, adapter, resolver, ds, sc)

View File

@ -1,16 +1,17 @@
package dtypes package dtypes
import ( import (
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/piecestore"
bserv "github.com/ipfs/go-blockservice" bserv "github.com/ipfs/go-blockservice"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/ipfs/go-filestore" "github.com/ipfs/go-filestore"
"github.com/ipfs/go-graphsync" "github.com/ipfs/go-graphsync"
blockstore "github.com/ipfs/go-ipfs-blockstore" blockstore "github.com/ipfs/go-ipfs-blockstore"
exchange "github.com/ipfs/go-ipfs-exchange-interface" exchange "github.com/ipfs/go-ipfs-exchange-interface"
ipld "github.com/ipfs/go-ipld-format" format "github.com/ipfs/go-ipld-format"
"github.com/ipld/go-ipld-prime"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-statestore" "github.com/filecoin-project/go-statestore"
) )
@ -24,13 +25,16 @@ type ChainGCLocker blockstore.GCLocker
type ChainGCBlockstore blockstore.GCBlockstore type ChainGCBlockstore blockstore.GCBlockstore
type ChainExchange exchange.Interface type ChainExchange exchange.Interface
type ChainBlockService bserv.BlockService type ChainBlockService bserv.BlockService
type ChainGraphsync graphsync.GraphExchange
type ClientFilestore *filestore.Filestore type ClientFilestore *filestore.Filestore
type ClientBlockstore blockstore.Blockstore type ClientBlockstore blockstore.Blockstore
type ClientDAG ipld.DAGService type ClientDAG format.DAGService
type ClientGraphsync graphsync.GraphExchange
type ClientDealStore *statestore.StateStore type ClientDealStore *statestore.StateStore
type ClientDatastore datastore.Batching
type GraphsyncLoader ipld.Loader
type GraphsyncStorer ipld.Storer
type Graphsync graphsync.GraphExchange
// ClientDataTransfer is a data transfer manager for the client // ClientDataTransfer is a data transfer manager for the client
type ClientDataTransfer datatransfer.Manager type ClientDataTransfer datatransfer.Manager
@ -41,6 +45,6 @@ type ProviderPieceStore piecestore.PieceStore
// ProviderDataTransfer is a data transfer manager for the provider // ProviderDataTransfer is a data transfer manager for the provider
type ProviderDataTransfer datatransfer.Manager type ProviderDataTransfer datatransfer.Manager
type StagingDAG ipld.DAGService type StagingDAG format.DAGService
type StagingBlockstore blockstore.Blockstore type StagingBlockstore blockstore.Blockstore
type StagingGraphsync graphsync.GraphExchange type StagingGraphsync graphsync.GraphExchange

42
node/modules/graphsync.go Normal file
View File

@ -0,0 +1,42 @@
package modules
import (
"io"
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/modules/helpers"
graphsync "github.com/ipfs/go-graphsync/impl"
"github.com/ipfs/go-graphsync/ipldbridge"
gsnet "github.com/ipfs/go-graphsync/network"
"github.com/ipfs/go-graphsync/storeutil"
"github.com/ipld/go-ipld-prime"
"github.com/libp2p/go-libp2p-core/host"
"go.uber.org/fx"
)
// GraphsyncStorer creates a storer that stores data in the client blockstore
func GraphsyncStorer(clientBs dtypes.ClientBlockstore) dtypes.GraphsyncStorer {
return dtypes.GraphsyncStorer(storeutil.StorerForBlockstore(clientBs))
}
// GraphsyncLoader creates a loader that reads from both the chain blockstore and the client blockstore
func GraphsyncLoader(clientBs dtypes.ClientBlockstore, chainBs dtypes.ChainBlockstore) dtypes.GraphsyncLoader {
clientLoader := storeutil.LoaderForBlockstore(clientBs)
chainLoader := storeutil.LoaderForBlockstore(chainBs)
return func(lnk ipld.Link, lnkCtx ipld.LinkContext) (io.Reader, error) {
reader, err := chainLoader(lnk, lnkCtx)
if err != nil {
return clientLoader(lnk, lnkCtx)
}
return reader, err
}
}
// Graphsync creates a graphsync instance from the given loader and storer
func Graphsync(mctx helpers.MetricsCtx, lc fx.Lifecycle, loader dtypes.GraphsyncLoader, storer dtypes.GraphsyncStorer, h host.Host) dtypes.Graphsync {
graphsyncNetwork := gsnet.NewFromLibp2pHost(h)
ipldBridge := ipldbridge.NewIPLDBridge()
gs := graphsync.New(helpers.LifecycleCtx(mctx, lc), graphsyncNetwork, ipldBridge, ipld.Loader(loader), ipld.Storer(storer))
return gs
}

View File

@ -4,23 +4,6 @@ import (
"context" "context"
"reflect" "reflect"
"github.com/filecoin-project/go-address"
dtgraphsync "github.com/filecoin-project/go-data-transfer/impl/graphsync"
piecefilestore "github.com/filecoin-project/go-fil-markets/filestore"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
"github.com/filecoin-project/go-fil-markets/storagemarket"
deals "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network"
"github.com/filecoin-project/go-fil-markets/storedcounter"
paramfetch "github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/go-statestore"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/ipfs/go-bitswap" "github.com/ipfs/go-bitswap"
"github.com/ipfs/go-bitswap/network" "github.com/ipfs/go-bitswap/network"
"github.com/ipfs/go-blockservice" "github.com/ipfs/go-blockservice"
@ -37,6 +20,24 @@ import (
"go.uber.org/fx" "go.uber.org/fx"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
dtgraphsync "github.com/filecoin-project/go-data-transfer/impl/graphsync"
piecefilestore "github.com/filecoin-project/go-fil-markets/filestore"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
"github.com/filecoin-project/go-fil-markets/storagemarket"
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation"
smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network"
"github.com/filecoin-project/go-fil-markets/storedcounter"
paramfetch "github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/go-statestore"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/crypto"
lapi "github.com/filecoin-project/lotus/api" 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/gen" "github.com/filecoin-project/lotus/chain/gen"
@ -183,8 +184,8 @@ func HandleDeals(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, h sto
// RegisterProviderValidator is an initialization hook that registers the provider // RegisterProviderValidator is an initialization hook that registers the provider
// request validator with the data transfer module as the validator for // request validator with the data transfer module as the validator for
// StorageDataTransferVoucher types // StorageDataTransferVoucher types
func RegisterProviderValidator(mrv *deals.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) { func RegisterProviderValidator(mrv *requestvalidation.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) {
if err := dtm.RegisterVoucherType(reflect.TypeOf(&deals.StorageDataTransferVoucher{}), mrv); err != nil { if err := dtm.RegisterVoucherType(reflect.TypeOf(&requestvalidation.StorageDataTransferVoucher{}), mrv); err != nil {
panic(err) panic(err)
} }
} }
@ -292,8 +293,8 @@ func SealTicketGen(fapi lapi.FullNode) sealing.TicketFn {
} }
} }
func NewProviderRequestValidator(deals dtypes.ProviderDealStore) *storageimpl.ProviderRequestValidator { func NewProviderRequestValidator(deals dtypes.ProviderDealStore) *requestvalidation.ProviderRequestValidator {
return storageimpl.NewProviderRequestValidator(deals) return requestvalidation.NewProviderRequestValidator(deals)
} }
func StorageProvider(ctx helpers.MetricsCtx, fapi lapi.FullNode, h host.Host, ds dtypes.MetadataDS, ibs dtypes.StagingBlockstore, r repo.LockedRepo, pieceStore dtypes.ProviderPieceStore, dataTransfer dtypes.ProviderDataTransfer, spn storagemarket.StorageProviderNode) (storagemarket.StorageProvider, error) { func StorageProvider(ctx helpers.MetricsCtx, fapi lapi.FullNode, h host.Host, ds dtypes.MetadataDS, ibs dtypes.StagingBlockstore, r repo.LockedRepo, pieceStore dtypes.ProviderPieceStore, dataTransfer dtypes.ProviderDataTransfer, spn storagemarket.StorageProviderNode) (storagemarket.StorageProvider, error) {

View File

@ -98,7 +98,7 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
} }
_, err = tnd.MpoolPushMessage(ctx, msg) _, err = tnd.MpoolPushMessage(ctx, msg)

View File

@ -37,7 +37,7 @@ func (pm *Manager) createPaych(ctx context.Context, from, to address.Address, am
Value: amt, Value: amt,
Method: builtin.MethodsInit.Exec, Method: builtin.MethodsInit.Exec,
Params: enc, Params: enc,
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }
@ -84,7 +84,7 @@ func (pm *Manager) addFunds(ctx context.Context, ch address.Address, from addres
From: from, From: from,
Value: amt, Value: amt,
Method: 0, Method: 0,
GasLimit: types.NewInt(1000000), GasLimit: 1000000,
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
} }

View File

@ -68,7 +68,7 @@ func (s *FPoStScheduler) declareFaults(ctx context.Context, fc uint64, params *m
Method: builtin.MethodsMiner.DeclareTemporaryFaults, Method: builtin.MethodsMiner.DeclareTemporaryFaults,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
GasLimit: types.NewInt(10000000), // i dont know help GasLimit: 10000000, // i dont know help
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }
@ -264,8 +264,8 @@ func (s *FPoStScheduler) submitPost(ctx context.Context, proof *abi.OnChainPoStV
From: s.worker, From: s.worker,
Method: builtin.MethodsMiner.SubmitWindowedPoSt, Method: builtin.MethodsMiner.SubmitWindowedPoSt,
Params: enc, Params: enc,
Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late
GasLimit: types.NewInt(10000000), // i dont know help GasLimit: 10000000, // i dont know help
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }

View File

@ -90,7 +90,7 @@ func checkSeal(ctx context.Context, maddr address.Address, si SectorInfo, api se
From: maddr, From: maddr,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: types.NewInt(9999999999), GasLimit: 9999999999,
Method: builtin.MethodsMarket.ComputeDataCommitment, Method: builtin.MethodsMarket.ComputeDataCommitment,
Params: ccparams, Params: ccparams,
} }

View File

@ -122,7 +122,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
Method: builtin.MethodsMiner.PreCommitSector, Method: builtin.MethodsMiner.PreCommitSector,
Params: enc, Params: enc,
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
GasLimit: types.NewInt(1000000 /* i dont know help */), GasLimit: 1000000, /* i dont know help */
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }
@ -217,7 +217,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
Method: builtin.MethodsMiner.ProveCommitSector, Method: builtin.MethodsMiner.ProveCommitSector,
Params: enc, Params: enc,
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
GasLimit: types.NewInt(1000000 /* i dont know help */), GasLimit: 1000000, /* i dont know help */
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }
@ -283,7 +283,7 @@ func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) erro
Method: builtin.MethodsMiner.DeclareTemporaryFaults, Method: builtin.MethodsMiner.DeclareTemporaryFaults,
Params: enc, Params: enc,
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
GasLimit: types.NewInt(1000000 /* i dont know help */), GasLimit: 1000000, /* i dont know help */
GasPrice: types.NewInt(1), GasPrice: types.NewInt(1),
} }