From 8d870a03b5dde11a3f77a9134a77abd2e7bd22a0 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 11 Mar 2020 18:47:13 +0100 Subject: [PATCH 01/20] Fix Error and Result being returne at the same time in JSON-RPC Signed-off-by: Jakub Sztandera --- lib/jsonrpc/handler.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/jsonrpc/handler.go b/lib/jsonrpc/handler.go index 88a20ee1f..bca1bdf78 100644 --- a/lib/jsonrpc/handler.go +++ b/lib/jsonrpc/handler.go @@ -230,9 +230,6 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer } } } - if handler.valOut != -1 { - resp.Result = callResult[handler.valOut].Interface() - } if resp.Result != nil && reflect.TypeOf(resp.Result).Kind() == reflect.Chan { // Channel responses are sent from channel control goroutine. // Sending responses here could cause deadlocks on writeLk, or allow @@ -252,6 +249,11 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer } } + // check error as JSON-RPC spec prohibits error and value at the same time + if resp.Error == nil && handler.valOut != -1 { + resp.Result = callResult[handler.valOut].Interface() + } + w(func(w io.Writer) { if err := json.NewEncoder(w).Encode(resp); err != nil { log.Error(err) From 21b34ba1334a359126e9fff95706433ae9b486cf Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 11 Mar 2020 19:14:49 +0100 Subject: [PATCH 02/20] Fix chan handling Signed-off-by: Jakub Sztandera --- lib/jsonrpc/handler.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/jsonrpc/handler.go b/lib/jsonrpc/handler.go index bca1bdf78..29e8af1cc 100644 --- a/lib/jsonrpc/handler.go +++ b/lib/jsonrpc/handler.go @@ -230,7 +230,13 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer } } } - if resp.Result != nil && reflect.TypeOf(resp.Result).Kind() == reflect.Chan { + + var res interface{} + if handler.valOut != -1 { + res = callResult[handler.valOut].Interface() + } + + if res != nil && reflect.TypeOf(res).Kind() == reflect.Chan { // Channel responses are sent from channel control goroutine. // Sending responses here could cause deadlocks on writeLk, or allow // sending channel messages before this rpc call returns @@ -250,8 +256,8 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer } // check error as JSON-RPC spec prohibits error and value at the same time - if resp.Error == nil && handler.valOut != -1 { - resp.Result = callResult[handler.valOut].Interface() + if resp.Error == nil { + resp.Result = res } w(func(w io.Writer) { From 06ce4f21c54cba694a81b3cf133e1a5454bec7d7 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 14 Mar 2020 15:08:24 +0100 Subject: [PATCH 03/20] Warn on non zero result with error Signed-off-by: Jakub Sztandera --- lib/jsonrpc/handler.go | 15 ++++++++++----- lib/jsonrpc/util.go | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/jsonrpc/handler.go b/lib/jsonrpc/handler.go index 29e8af1cc..4268e8af6 100644 --- a/lib/jsonrpc/handler.go +++ b/lib/jsonrpc/handler.go @@ -231,12 +231,16 @@ 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 { res = callResult[handler.valOut].Interface() + kind = callResult[handler.valOut].Kind() + nonZero = !callResult[handler.valOut].IsZero() } - if res != nil && reflect.TypeOf(res).Kind() == reflect.Chan { + if res != nil && kind == reflect.Chan { // Channel responses are sent from channel control goroutine. // Sending responses here could cause deadlocks on writeLk, or allow // sending channel messages before this rpc call returns @@ -253,12 +257,13 @@ func (h handlers) handle(ctx context.Context, req request, w func(func(io.Writer Code: 1, Message: err.(error).Error(), } - } - - // check error as JSON-RPC spec prohibits error and value at the same time - if resp.Error == nil { + } 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) { if err := json.NewEncoder(w).Encode(resp); err != nil { diff --git a/lib/jsonrpc/util.go b/lib/jsonrpc/util.go index 03b0bf7bd..aab88ece8 100644 --- a/lib/jsonrpc/util.go +++ b/lib/jsonrpc/util.go @@ -19,6 +19,10 @@ func (p *param) UnmarshalJSON(raw []byte) error { } func (p *param) MarshalJSON() ([]byte, error) { + if p.v.Kind() == reflect.Invalid { + return p.data, nil + } + return json.Marshal(p.v.Interface()) } From f259bc6a099d28e91eaa63c12fc97a6743c7c05d Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Tue, 17 Mar 2020 17:25:12 -0700 Subject: [PATCH 04/20] feat(graphsync): unified graphsync instance setup a single graphsync that loads from both the chainstore & client blockstore --- go.mod | 1 + node/builder.go | 8 ++++--- node/modules/chain.go | 13 ----------- node/modules/client.go | 20 ++-------------- node/modules/dtypes/storage.go | 13 +++++++---- node/modules/graphsync.go | 42 ++++++++++++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 node/modules/graphsync.go diff --git a/go.mod b/go.mod index 9ed763841..8f007f4b0 100644 --- a/go.mod +++ b/go.mod @@ -60,6 +60,7 @@ require ( github.com/ipfs/go-merkledag v0.2.4 github.com/ipfs/go-path v0.0.7 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/libp2p/go-libp2p v0.5.2 github.com/libp2p/go-libp2p-circuit v0.1.4 diff --git a/node/builder.go b/node/builder.go index 4dca1bc6f..2a7227d86 100644 --- a/node/builder.go +++ b/node/builder.go @@ -230,9 +230,12 @@ func Online() Option { Override(new(*blocksync.BlockSyncService), blocksync.NewBlockSyncService), 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(RunBlockSyncKey, modules.RunBlockSync), - Override(RunChainGraphsync, modules.ChainGraphsync), Override(RunPeerMgrKey, modules.RunPeerMgr), Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks), @@ -241,7 +244,7 @@ func Online() Option { Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient), Override(new(dtypes.ClientDealStore), modules.NewClientDealStore), - Override(new(dtypes.ClientDataTransfer), modules.NewClientDAGServiceDataTransfer), + Override(new(dtypes.ClientDataTransfer), modules.NewClientGraphsyncDataTransfer), Override(new(*deals.ClientRequestValidator), modules.NewClientRequestValidator), Override(new(storagemarket.StorageClient), modules.StorageClient), Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter), @@ -387,7 +390,6 @@ func Repo(r repo.Repo) Option { Override(new(dtypes.ClientFilestore), modules.ClientFstore), Override(new(dtypes.ClientBlockstore), modules.ClientBlockstore), Override(new(dtypes.ClientDAG), modules.ClientDAG), - Override(new(dtypes.ClientGraphsync), modules.ClientGraphsync), Override(new(ci.PrivKey), lp2p.PrivKey), Override(new(ci.PubKey), ci.PrivKey.GetPublic), diff --git a/node/modules/chain.go b/node/modules/chain.go index fd48f4d56..4d97d503d 100644 --- a/node/modules/chain.go +++ b/node/modules/chain.go @@ -11,10 +11,6 @@ import ( "github.com/ipfs/go-blockservice" "github.com/ipfs/go-car" "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" "github.com/libp2p/go-libp2p-core/host" "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) } -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 { chain := store.NewChainStore(bs, ds, syscalls) diff --git a/node/modules/client.go b/node/modules/client.go index 3024948b9..4b7997842 100644 --- a/node/modules/client.go +++ b/node/modules/client.go @@ -22,10 +22,6 @@ import ( "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/namespace" "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" @@ -68,9 +64,9 @@ func RegisterClientValidator(crv *deals.ClientRequestValidator, dtm dtypes.Clien } } -// 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 -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) } @@ -96,18 +92,6 @@ func ClientDAG(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.ClientBlocks return dag } -// ClientGraphsync creates a graphsync instance which reads and writes blocks -// to the ClientBlockstore -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 { return storageimpl.NewClientRequestValidator(deals) } diff --git a/node/modules/dtypes/storage.go b/node/modules/dtypes/storage.go index 1e6f74f23..1756a9637 100644 --- a/node/modules/dtypes/storage.go +++ b/node/modules/dtypes/storage.go @@ -9,7 +9,8 @@ import ( "github.com/ipfs/go-graphsync" blockstore "github.com/ipfs/go-ipfs-blockstore" 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" "github.com/filecoin-project/go-statestore" ) @@ -24,14 +25,16 @@ type ChainGCLocker blockstore.GCLocker type ChainGCBlockstore blockstore.GCBlockstore type ChainExchange exchange.Interface type ChainBlockService bserv.BlockService -type ChainGraphsync graphsync.GraphExchange type ClientFilestore *filestore.Filestore type ClientBlockstore blockstore.Blockstore -type ClientDAG ipld.DAGService -type ClientGraphsync graphsync.GraphExchange +type ClientDAG format.DAGService type ClientDealStore *statestore.StateStore +type GraphsyncLoader ipld.Loader +type GraphsyncStorer ipld.Storer +type Graphsync graphsync.GraphExchange + // ClientDataTransfer is a data transfer manager for the client type ClientDataTransfer datatransfer.Manager @@ -41,6 +44,6 @@ type ProviderPieceStore piecestore.PieceStore // ProviderDataTransfer is a data transfer manager for the provider type ProviderDataTransfer datatransfer.Manager -type StagingDAG ipld.DAGService +type StagingDAG format.DAGService type StagingBlockstore blockstore.Blockstore type StagingGraphsync graphsync.GraphExchange diff --git a/node/modules/graphsync.go b/node/modules/graphsync.go new file mode 100644 index 000000000..13c1dde10 --- /dev/null +++ b/node/modules/graphsync.go @@ -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 +} From 24fb72f926e81bf3f0fd4321efbed5b80c8033b3 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 17 Mar 2020 20:30:55 -0700 Subject: [PATCH 05/20] Set minimum miner size to 2048 bytes in debug mode --- build/params_debug.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/params_debug.go b/build/params_debug.go index b381651ea..22a5bed54 100644 --- a/build/params_debug.go +++ b/build/params_debug.go @@ -4,10 +4,14 @@ package build import ( "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() { InsecurePoStValidation = true + + power.ConsensusMinerMinPower = big.NewInt(2048) } var SectorSizes = []abi.SectorSize{2048} From 66a950942e7b57e07453e1c2f9a9b44736f9c722 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 17 Mar 2020 22:08:14 -0700 Subject: [PATCH 06/20] add a usage text to import-data command --- cmd/lotus-storage-miner/market.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-storage-miner/market.go b/cmd/lotus-storage-miner/market.go index 87fe08bd9..ea5de6345 100644 --- a/cmd/lotus-storage-miner/market.go +++ b/cmd/lotus-storage-miner/market.go @@ -46,8 +46,9 @@ var dealsCmd = &cli.Command{ } var dealsImportDataCmd = &cli.Command{ - Name: "import-data", - Usage: "Manually import data for a deal", + Name: "import-data", + Usage: "Manually import data for a deal", + ArgsUsage: " ", Action: func(cctx *cli.Context) error { api, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil { From 51cf5d5f1b0246ffeb9a25389f53296fd40edcbb Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Tue, 17 Mar 2020 01:58:00 -0400 Subject: [PATCH 07/20] New Actor Addresses should be generated as per spec - The pubkey address address of the sender should be used, not the ID address - We should use the internal callSeqNum as input (was hard-coded to zero) - The external message nonce should be used, not the actor's nonce in the post-increment state --- chain/vm/runtime.go | 19 ++++++++++--------- chain/vm/vm.go | 28 +++++++++++++++++----------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index 27d728efa..97b244690 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -40,9 +40,12 @@ type Runtime struct { sys runtime.Syscalls // address that started invoke chain - origin address.Address + origin address.Address + originNonce uint64 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) { @@ -158,19 +161,14 @@ func (rs *Runtime) Store() vmr.Store { func (rt *Runtime) NewActorAddress() address.Address { 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) } - act, err := rt.state.GetActor(rt.origin) - if err != nil { - rt.Abortf(exitcode.SysErrInternal, "getting top level actor: %v", err) - } - - if err := binary.Write(&b, binary.BigEndian, act.Nonce); err != nil { + if err := binary.Write(&b, binary.BigEndian, rt.originNonce); err != nil { 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) } addr, err := address.NewActorAddress(b.Bytes()) @@ -341,6 +339,9 @@ func (rt *Runtime) internalSend(to address.Address, method abi.MethodNum, value Subcalls: subrt.internalExecutions, } + if subrt != nil { + rt.internalCallCounter = subrt.internalCallCounter + } rt.internalExecutions = append(rt.internalExecutions, &er) return ret, err } diff --git a/chain/vm/vm.go b/chain/vm/vm.go index fa890eac7..6b147e573 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -115,18 +115,20 @@ func (bs *gasChargingBlocks) Put(blk block.Block) error { 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 types.BigInt, icc int64) *Runtime { rt := &Runtime{ - ctx: ctx, - vm: vm, - state: vm.cstate, - msg: msg, - origin: origin, - height: vm.blockHeight, - sys: vm.Syscalls, + ctx: ctx, + vm: vm, + state: vm.cstate, + msg: msg, + origin: origin, + originNonce: originNonce, + height: vm.blockHeight, + sys: vm.Syscalls, - gasUsed: usedGas, - gasAvailable: msg.GasLimit, + gasUsed: usedGas, + gasAvailable: msg.GasLimit, + internalCallCounter: icc, } rt.cst = &cbor.BasicIpldStore{ Blocks: &gasChargingBlocks{rt.ChargeGas, vm.cst.Blocks}, @@ -206,11 +208,15 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime, gasUsed := types.NewInt(gasCharge) origin := msg.From + on := msg.Nonce + var icc int64 = 0 if parent != nil { gasUsed = types.BigAdd(parent.gasUsed, gasUsed) 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 { defer func() { parent.gasUsed = rt.gasUsed From f22f427cdecb9d40003f49e5009c601da6d4bfcb Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Tue, 17 Mar 2020 03:31:45 -0400 Subject: [PATCH 08/20] Put the correct error into ExecutionResult --- chain/vm/runtime.go | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index 97b244690..ba23172e2 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -315,35 +315,34 @@ func (rt *Runtime) internalSend(to address.Address, method abi.MethodNum, value } defer st.ClearSnapshot() - ret, err, subrt := rt.vm.send(ctx, msg, rt, 0) - if err != nil { - if err := st.Revert(); err != nil { - return nil, aerrors.Escalate(err, "failed to revert state tree after failed subcall") + ret, errSend, subrt := rt.vm.send(ctx, msg, rt, 0) + if errSend != nil { + if errRevert := st.Revert(); errRevert != nil { + return nil, aerrors.Escalate(errRevert, "failed to revert state tree after failed subcall") } } mr := types.MessageReceipt{ - ExitCode: exitcode.ExitCode(aerrors.RetCode(err)), + ExitCode: exitcode.ExitCode(aerrors.RetCode(errSend)), Return: ret, GasUsed: types.EmptyInt, } - var es = "" - if err != nil { - es = err.Error() - } er := ExecutionResult{ - Msg: msg, - MsgRct: &mr, - Error: es, - Subcalls: subrt.internalExecutions, + Msg: msg, + MsgRct: &mr, + } + + if errSend != nil { + er.Error = errSend.Error() } if subrt != nil { + er.Subcalls = subrt.internalExecutions rt.internalCallCounter = subrt.internalCallCounter } rt.internalExecutions = append(rt.internalExecutions, &er) - return ret, err + return ret, errSend } func (rs *Runtime) State() vmr.StateHandle { From 993505b461a836c5f0057a17560b8d3b31ee650b Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Tue, 17 Mar 2020 04:30:50 -0400 Subject: [PATCH 09/20] Enable full validation tests --- chain/validation/factories.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chain/validation/factories.go b/chain/validation/factories.go index 9a9cb7960..bfdcc4449 100644 --- a/chain/validation/factories.go +++ b/chain/validation/factories.go @@ -41,7 +41,7 @@ func (f *Factories) NewRandomnessSource() vstate.RandomnessSource { func (f *Factories) NewValidationConfig() vstate.ValidationConfig { trackGas := false 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 return NewConfig(trackGas, checkExit, checkRet) } diff --git a/go.mod b/go.mod index 81ee29499..f50652859 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/coreos/go-systemd/v22 v22.0.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/go-address v0.0.2-0.20200218010043-eb9bb40ed5be github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e diff --git a/go.sum b/go.sum index b24ce8be3..a4767b026 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,8 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP 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/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E= -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.20200311235406-31f0d58e13e4/go.mod h1:7HoEkq8OWN3vGcCZ4SRGxAPeL/mLckS+PNV3F0XmrCs= +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.20200318065243-0ccb5ec3afc5/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/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be h1:TooKBwR/g8jG0hZ3lqe9S5sy2vTUcLOZLlz3M5wGn2E= From 6fda3c877eae991d3347c387345056fcbb885d6f Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Sat, 29 Feb 2020 20:15:02 -0800 Subject: [PATCH 10/20] Re: #1302: Refine invalid message filtering - This commit slightly weakens the current invalid message check - The behaviour is that if you can't add a message to your pool, you *probably* won't broadcast it to your peers - The exceptions are that you will broadcast a message if you fail to validate it because nonce / balance lookup fails - This commit also lowers the invalid message log to debug (to lessen the annoyance of several invalid messages coming in, and hopefully to prevent confusion among node operators) --- chain/messagepool/messagepool.go | 6 ++++-- chain/sub/incoming.go | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 6d10ced49..390b2bad8 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -45,6 +45,8 @@ var ( ErrNotEnoughFunds = errors.New("not enough funds to execute transaction") ErrInvalidToAddr = errors.New("message had invalid to address") + + ErrBroadcastAnyway = errors.New("broadcasting message despite validation fail") ) const ( @@ -313,7 +315,7 @@ func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error snonce, err := mp.getStateNonce(m.Message.From, curTs) 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 { @@ -322,7 +324,7 @@ func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error balance, err := mp.getStateBalance(m.Message.From, curTs) 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()) { diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index 7c7039483..be1643425 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -2,6 +2,7 @@ package sub import ( "context" + "golang.org/x/xerrors" "time" 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 { - 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.Insert(metrics.FailureType, "add"), ) stats.Record(ctx, metrics.MessageValidationFailure.M(1)) - return false + return xerrors.Is(err, messagepool.ErrBroadcastAnyway) } stats.Record(ctx, metrics.MessageValidationSuccess.M(1)) return true From eacf991bb269e850e0921a7366048025da804be4 Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 10:21:50 -0700 Subject: [PATCH 11/20] update go-fil-markets dependency --- go.mod | 9 ++++++++- go.sum | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f50652859..cab730882 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/coreos/go-systemd/v22 v22.0.0 github.com/docker/go-units v0.4.0 + github.com/fd/go-nat v1.0.0 // indirect 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/go-address v0.0.2-0.20200218010043-eb9bb40ed5be @@ -19,7 +20,7 @@ require ( 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-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-paramfetch v0.0.2-0.20200218225740-47c639bab663 github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2 @@ -32,6 +33,7 @@ require ( github.com/google/uuid v1.1.1 github.com/gorilla/mux v1.7.3 github.com/gorilla/websocket v1.4.1 + github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824 // indirect github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/golang-lru v0.5.4 github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e @@ -52,6 +54,7 @@ require ( github.com/ipfs/go-ipfs-exchange-interface v0.0.1 github.com/ipfs/go-ipfs-exchange-offline v0.0.1 github.com/ipfs/go-ipfs-files v0.0.4 + github.com/ipfs/go-ipfs-flags v0.0.1 // indirect github.com/ipfs/go-ipfs-routing v0.1.0 github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669 github.com/ipfs/go-ipld-format v0.0.2 @@ -93,8 +96,12 @@ require ( github.com/stretchr/testify v1.4.0 github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba github.com/whyrusleeping/cbor-gen v0.0.0-20200222160900-51052a1e8191 + github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible // indirect + github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible // indirect + github.com/whyrusleeping/go-smux-yamux v2.0.8+incompatible // indirect github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d + github.com/whyrusleeping/yamux v1.1.5 // indirect go.opencensus.io v0.22.2 go.uber.org/dig v1.8.0 // indirect go.uber.org/fx v1.9.0 diff --git a/go.sum b/go.sum index a4767b026..35d77c65b 100644 --- a/go.sum +++ b/go.sum @@ -119,11 +119,14 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5 h1 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-20200304003055-d449a980d4bd/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts= +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-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/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/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/go.mod h1:NcE+iL0bbYnamGmYQgCPVGbSaf8VF2/CLra/61B3I3I= github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 h1:k9qVR9ItcziSB2rxtlkN/MDWNlbsI6yzec+zjUatLW0= @@ -335,6 +338,7 @@ 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-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= 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/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/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43rAdyGA+yRQuy6ju0ucZkWpYc1F2CTQtZTVW/4= From ec3e86ad18e52cdbe83f682f55f7986df838d08a Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 10:44:54 -0700 Subject: [PATCH 12/20] update retrieval client node adapter to new API --- go.sum | 1 + markets/retrievaladapter/client.go | 36 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/go.sum b/go.sum index 35d77c65b..327479078 100644 --- a/go.sum +++ b/go.sum @@ -338,6 +338,7 @@ 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-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= 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/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= diff --git a/markets/retrievaladapter/client.go b/markets/retrievaladapter/client.go index 461fadd81..39fae18b6 100644 --- a/markets/retrievaladapter/client.go +++ b/markets/retrievaladapter/client.go @@ -5,26 +5,33 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-fil-markets/retrievalmarket" - payapi "github.com/filecoin-project/lotus/node/impl/paych" - "github.com/filecoin-project/lotus/paychmgr" + "github.com/filecoin-project/go-fil-markets/shared" "github.com/filecoin-project/specs-actors/actors/abi" "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 { - pmgr *paychmgr.Manager - payapi payapi.PaychAPI + chainapi full.ChainAPI + pmgr *paychmgr.Manager + payapi payapi.PaychAPI } // NewRetrievalClientNode returns a new node adapter for a retrieval client that talks to the // Lotus Node -func NewRetrievalClientNode(pmgr *paychmgr.Manager, payapi payapi.PaychAPI) retrievalmarket.RetrievalClientNode { - return &retrievalClientNode{pmgr: pmgr, payapi: payapi} +func NewRetrievalClientNode(pmgr *paychmgr.Manager, payapi payapi.PaychAPI, chainapi full.ChainAPI) retrievalmarket.RetrievalClientNode { + return &retrievalClientNode{pmgr: pmgr, payapi: payapi, chainapi: chainapi} } // 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 -func (rcn *retrievalClientNode) GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, minerAddress address.Address, clientFundsAvailable abi.TokenAmount) (address.Address, error) { +// between a client and a miner and ensures the client has the given amount of +// 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) 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 // 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) -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) if err != nil { return nil, err } 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 +} From 6622576cf822c24ed740762ed1bd9f7db2c671e3 Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 10:51:25 -0700 Subject: [PATCH 13/20] update retrieval provider node adapter to new API --- markets/retrievaladapter/provider.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/markets/retrievaladapter/provider.go b/markets/retrievaladapter/provider.go index 487fe2466..40a04d614 100644 --- a/markets/retrievaladapter/provider.go +++ b/markets/retrievaladapter/provider.go @@ -6,6 +6,7 @@ import ( "github.com/filecoin-project/go-address" "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/specs-actors/actors/abi" "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} } -func (rpn *retrievalProviderNode) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) { - addr, err := rpn.full.StateMinerWorker(ctx, miner, types.EmptyTSK) +func (rpn *retrievalProviderNode) GetMinerWorkerAddress(ctx context.Context, miner address.Address, tok shared.TipSetToken) (address.Address, error) { + tsk, err := types.TipSetKeyFromBytes(tok) + if err != nil { + return address.Undef, err + } + + addr, err := rpn.full.StateMinerWorker(ctx, miner, tsk) return addr, err } @@ -41,7 +47,18 @@ func (rpn *retrievalProviderNode) UnsealSector(ctx context.Context, sectorID uin return rpn.sealer.ReadPieceFromSealedSector(ctx, abi.SectorNumber(sectorID), 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) 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 +} From a8dd6a831cd2d56828b9bee8feb273507a23e9be Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 11:37:32 -0700 Subject: [PATCH 14/20] implement storage client and provider node adapters --- markets/storageadapter/client.go | 29 +++++++++++--------- markets/storageadapter/provider.go | 43 ++++++++++++++++++------------ 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 0c0c0fa18..4e2b77b19 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -6,6 +6,10 @@ import ( "bytes" "context" + "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/builtin" samarket "github.com/filecoin-project/specs-actors/actors/builtin/market" @@ -13,10 +17,6 @@ import ( "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/chain/events" "github.com/filecoin-project/lotus/chain/market" @@ -115,10 +115,6 @@ func (n *ClientNodeAdapter) ListClientDeals(ctx context.Context, addr address.Ad 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. func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error { // (Provider Node API) @@ -161,7 +157,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 // 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!") pubmsg, err := c.cs.GetMessage(*deal.PublishMessage) @@ -223,12 +219,12 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor 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) { - sd, err := stmgr.GetStorageDeal(ctx, c.StateManager, abi.DealID(dealId), ts) + sd, err := stmgr.GetStorageDeal(ctx, c.StateManager, dealId, ts) if err != nil { // TODO: This may be fine for some errors @@ -367,4 +363,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{} diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index 0a03d3094..5ed052f50 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -7,6 +7,9 @@ import ( "context" "io" + "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/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin/market" @@ -16,8 +19,6 @@ import ( logging "github.com/ipfs/go-log/v2" "golang.org/x/xerrors" - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -51,7 +52,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") worker, err := n.StateMinerWorker(ctx, deal.Proposal.Provider, types.EmptyTSK) @@ -96,11 +97,11 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark } // 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 { - _, 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 { return xerrors.Errorf("AddPiece failed: %s", err) } @@ -132,9 +133,13 @@ func (n *ProviderNodeAdapter) ListProviderDeals(ctx context.Context, addr addres return out, nil } -func (n *ProviderNodeAdapter) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) { - addr, err := n.StateMinerWorker(ctx, miner, types.EmptyTSK) - return addr, err +func (n *ProviderNodeAdapter) GetMinerWorkerAddress(ctx context.Context, miner address.Address, tok shared.TipSetToken) (address.Address, error) { + tsk, err := types.TipSetKeyFromBytes(tok) + 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) { @@ -149,10 +154,6 @@ func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr, wallet addr 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. func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) error { // (Provider Node API) @@ -189,9 +190,8 @@ func (n *ProviderNodeAdapter) GetBalance(ctx context.Context, addr address.Addre return utils.ToSharedBalance(bal), nil } -func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context, dealID uint64) (sectorID uint64, offset uint64, length uint64, err error) { - - refs, err := n.secb.GetRefs(abi.DealID(dealID)) +func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context, dealID abi.DealID) (sectorID uint64, offset uint64, length uint64, err error) { + refs, err := n.secb.GetRefs(dealID) if err != nil { return 0, 0, 0, err } @@ -219,9 +219,9 @@ func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context 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) { - sd, err := n.StateMarketStorageDeal(ctx, abi.DealID(dealID), ts.Key()) + sd, err := n.StateMarketStorageDeal(ctx, dealID, ts.Key()) if err != nil { // TODO: This may be fine for some errors @@ -322,4 +322,13 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide 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{} From f59bf6fab1f26475b1d43a9024880c18c104fc00 Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 11:57:22 -0700 Subject: [PATCH 15/20] wire up dtypes.ClientDatastore --- node/builder.go | 20 ++++++++++---------- node/modules/client.go | 26 ++++++++++++++++---------- node/modules/dtypes/storage.go | 4 ++-- node/modules/storageminer.go | 10 +++++----- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/node/builder.go b/node/builder.go index 2a7227d86..80e3fcd87 100644 --- a/node/builder.go +++ b/node/builder.go @@ -5,6 +5,13 @@ import ( "errors" "time" + "github.com/filecoin-project/go-fil-markets/retrievalmarket" + "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/impl/requestvalidation" + sectorbuilder "github.com/filecoin-project/go-sectorbuilder" + "github.com/filecoin-project/specs-actors/actors/runtime" + storage2 "github.com/filecoin-project/specs-storage/storage" blockstore "github.com/ipfs/go-ipfs-blockstore" logging "github.com/ipfs/go-log" ci "github.com/libp2p/go-libp2p-core/crypto" @@ -19,14 +26,6 @@ import ( "go.uber.org/fx" "golang.org/x/xerrors" - "github.com/filecoin-project/go-fil-markets/retrievalmarket" - "github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery" - "github.com/filecoin-project/go-fil-markets/storagemarket" - deals "github.com/filecoin-project/go-fil-markets/storagemarket/impl" - sectorbuilder "github.com/filecoin-project/go-sectorbuilder" - "github.com/filecoin-project/specs-actors/actors/runtime" - storage2 "github.com/filecoin-project/specs-storage/storage" - "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/blocksync" @@ -244,8 +243,9 @@ func Online() Option { Override(new(retrievalmarket.RetrievalClient), modules.RetrievalClient), Override(new(dtypes.ClientDealStore), modules.NewClientDealStore), + Override(new(dtypes.ClientDatastore), modules.NewClientDatastore), Override(new(dtypes.ClientDataTransfer), modules.NewClientGraphsyncDataTransfer), - Override(new(*deals.ClientRequestValidator), modules.NewClientRequestValidator), + Override(new(*requestvalidation.ClientRequestValidator), modules.NewClientRequestValidator), Override(new(storagemarket.StorageClient), modules.StorageClient), Override(new(storagemarket.StorageClientNode), storageadapter.NewClientNodeAdapter), Override(RegisterClientValidatorKey, modules.RegisterClientValidator), @@ -276,7 +276,7 @@ func Online() Option { Override(new(retrievalmarket.RetrievalProvider), modules.RetrievalProvider), Override(new(dtypes.ProviderDealStore), modules.NewProviderDealStore), 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(storagemarket.StorageProvider), modules.StorageProvider), Override(new(storagemarket.StorageProviderNode), storageadapter.NewProviderNodeAdapter), diff --git a/node/modules/client.go b/node/modules/client.go index 4b7997842..15edc10d6 100644 --- a/node/modules/client.go +++ b/node/modules/client.go @@ -11,8 +11,8 @@ import ( 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" + "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" "github.com/filecoin-project/go-statestore" @@ -29,6 +29,7 @@ import ( "go.uber.org/fx" "github.com/filecoin-project/lotus/markets/retrievaladapter" + "github.com/filecoin-project/lotus/node/impl/full" payapi "github.com/filecoin-project/lotus/node/impl/paych" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/helpers" @@ -58,8 +59,8 @@ func ClientBlockstore(fstore dtypes.ClientFilestore) dtypes.ClientBlockstore { // RegisterClientValidator is an initialization hook that registers the client // request validator with the data transfer module as the validator for // StorageDataTransferVoucher types -func RegisterClientValidator(crv *deals.ClientRequestValidator, dtm dtypes.ClientDataTransfer) { - if err := dtm.RegisterVoucherType(reflect.TypeOf(&deals.StorageDataTransferVoucher{}), crv); err != nil { +func RegisterClientValidator(crv *requestvalidation.ClientRequestValidator, dtm dtypes.ClientDataTransfer) { + if err := dtm.RegisterVoucherType(reflect.TypeOf(&requestvalidation.StorageDataTransferVoucher{}), crv); err != nil { panic(err) } } @@ -71,8 +72,13 @@ func NewClientGraphsyncDataTransfer(h host.Host, gs dtypes.Graphsync) dtypes.Cli } // NewClientDealStore creates a statestore for the client to store its deals -func NewClientDealStore(ds dtypes.MetadataDS) dtypes.ClientDealStore { - return statestore.New(namespace.Wrap(ds, datastore.NewKey("/deals/client"))) +func NewClientDealStore(ds dtypes.ClientDatastore) dtypes.ClientDealStore { + 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 @@ -92,18 +98,18 @@ func ClientDAG(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.ClientBlocks return dag } -func NewClientRequestValidator(deals dtypes.ClientDealStore) *storageimpl.ClientRequestValidator { - return storageimpl.NewClientRequestValidator(deals) +func NewClientRequestValidator(deals dtypes.ClientDealStore) *requestvalidation.ClientRequestValidator { + return requestvalidation.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 { +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) { net := smnet.NewFromLibp2pHost(h) return storageimpl.NewClient(net, ibs, dataTransfer, discovery, deals, scn) } // 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) { - adapter := retrievaladapter.NewRetrievalClientNode(pmgr, payapi) +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, chainapi) network := rmnet.NewFromLibp2pHost(h) sc := storedcounter.New(ds, datastore.NewKey("/retr")) return retrievalimpl.NewClient(network, bs, adapter, resolver, ds, sc) diff --git a/node/modules/dtypes/storage.go b/node/modules/dtypes/storage.go index 1756a9637..0098f5b06 100644 --- a/node/modules/dtypes/storage.go +++ b/node/modules/dtypes/storage.go @@ -3,6 +3,7 @@ package dtypes import ( datatransfer "github.com/filecoin-project/go-data-transfer" "github.com/filecoin-project/go-fil-markets/piecestore" + "github.com/filecoin-project/go-statestore" bserv "github.com/ipfs/go-blockservice" "github.com/ipfs/go-datastore" "github.com/ipfs/go-filestore" @@ -11,8 +12,6 @@ import ( exchange "github.com/ipfs/go-ipfs-exchange-interface" format "github.com/ipfs/go-ipld-format" "github.com/ipld/go-ipld-prime" - - "github.com/filecoin-project/go-statestore" ) // MetadataDS stores metadata @@ -30,6 +29,7 @@ type ClientFilestore *filestore.Filestore type ClientBlockstore blockstore.Blockstore type ClientDAG format.DAGService type ClientDealStore *statestore.StateStore +type ClientDatastore datastore.Batching type GraphsyncLoader ipld.Loader type GraphsyncStorer ipld.Storer diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index c127db179..fb4644afe 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -12,8 +12,8 @@ import ( 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" + "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" @@ -180,8 +180,8 @@ func HandleDeals(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, h sto // RegisterProviderValidator is an initialization hook that registers the provider // request validator with the data transfer module as the validator for // StorageDataTransferVoucher types -func RegisterProviderValidator(mrv *deals.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) { - if err := dtm.RegisterVoucherType(reflect.TypeOf(&deals.StorageDataTransferVoucher{}), mrv); err != nil { +func RegisterProviderValidator(mrv *requestvalidation.ProviderRequestValidator, dtm dtypes.ProviderDataTransfer) { + if err := dtm.RegisterVoucherType(reflect.TypeOf(&requestvalidation.StorageDataTransferVoucher{}), mrv); err != nil { panic(err) } } @@ -289,8 +289,8 @@ func SealTicketGen(fapi lapi.FullNode) sealing.TicketFn { } } -func NewProviderRequestValidator(deals dtypes.ProviderDealStore) *storageimpl.ProviderRequestValidator { - return storageimpl.NewProviderRequestValidator(deals) +func NewProviderRequestValidator(deals dtypes.ProviderDealStore) *requestvalidation.ProviderRequestValidator { + 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) { From 4458d090b3bb1453561756435b09689025f5f254 Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 11:57:32 -0700 Subject: [PATCH 16/20] tidy --- go.mod | 7 ------- go.sum | 15 --------------- 2 files changed, 22 deletions(-) diff --git a/go.mod b/go.mod index cab730882..db498f6fc 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/coreos/go-systemd/v22 v22.0.0 github.com/docker/go-units v0.4.0 - github.com/fd/go-nat v1.0.0 // indirect 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/go-address v0.0.2-0.20200218010043-eb9bb40ed5be @@ -33,7 +32,6 @@ require ( github.com/google/uuid v1.1.1 github.com/gorilla/mux v1.7.3 github.com/gorilla/websocket v1.4.1 - github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824 // indirect github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/golang-lru v0.5.4 github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e @@ -54,7 +52,6 @@ require ( github.com/ipfs/go-ipfs-exchange-interface v0.0.1 github.com/ipfs/go-ipfs-exchange-offline v0.0.1 github.com/ipfs/go-ipfs-files v0.0.4 - github.com/ipfs/go-ipfs-flags v0.0.1 // indirect github.com/ipfs/go-ipfs-routing v0.1.0 github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669 github.com/ipfs/go-ipld-format v0.0.2 @@ -96,12 +93,8 @@ require ( github.com/stretchr/testify v1.4.0 github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba github.com/whyrusleeping/cbor-gen v0.0.0-20200222160900-51052a1e8191 - github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible // indirect - github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible // indirect - github.com/whyrusleeping/go-smux-yamux v2.0.8+incompatible // indirect github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d - github.com/whyrusleeping/yamux v1.1.5 // indirect go.opencensus.io v0.22.2 go.uber.org/dig v1.8.0 // indirect go.uber.org/fx v1.9.0 diff --git a/go.sum b/go.sum index 327479078..6147e1b56 100644 --- a/go.sum +++ b/go.sum @@ -98,7 +98,6 @@ 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/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY= 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.20200318065243-0ccb5ec3afc5/go.mod h1:7HoEkq8OWN3vGcCZ4SRGxAPeL/mLckS+PNV3F0XmrCs= github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5 h1:/MmWluswvDIbuPvBct4q6HeQgVm62O2DzWYTB38kt4A= @@ -117,15 +116,12 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww= github.com/filecoin-project/go-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-markets v0.0.0-20200304003055-d449a980d4bd h1:tLOl4GWJKQjpjqvSYSW0FoIjhoAzJSEoRibqkVFlaCE= -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 h1:856ZUIBb2K8+C5nepxi4FQ/yeTSWdr4mWbjs1JbByGU= 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/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/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/go.mod h1:NcE+iL0bbYnamGmYQgCPVGbSaf8VF2/CLra/61B3I3I= @@ -195,7 +191,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/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/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-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= @@ -211,7 +206,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/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= 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/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= @@ -234,7 +228,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.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-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/go.mod h1:7BMxYRi5cbR/GJ1A8mYSHvMLXLkHgYdrJ6VlNGobd0o= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= @@ -293,7 +286,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.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE= 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/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= @@ -346,7 +338,6 @@ github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43 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/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/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= @@ -520,7 +511,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/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.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-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= @@ -776,9 +766,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.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE= 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/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= @@ -789,7 +776,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/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/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8= 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= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -844,7 +830,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/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/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-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= From 366db2f38c9b5ebf11d3efb78614ea44153ef702 Mon Sep 17 00:00:00 2001 From: laser Date: Wed, 18 Mar 2020 12:43:06 -0700 Subject: [PATCH 17/20] adjust import order as per PR feedback --- markets/storageadapter/client.go | 3 ++- markets/storageadapter/provider.go | 7 ++++--- node/builder.go | 15 ++++++++------- node/modules/client.go | 11 ++++++----- node/modules/dtypes/storage.go | 7 ++++--- node/modules/storageminer.go | 31 +++++++++++++++--------------- 6 files changed, 40 insertions(+), 34 deletions(-) diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 4e2b77b19..2f6028fd4 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -6,6 +6,8 @@ import ( "bytes" "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" @@ -15,7 +17,6 @@ import ( 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/crypto" - "golang.org/x/xerrors" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/events" diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index 5ed052f50..d4e27babe 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -7,6 +7,10 @@ import ( "context" "io" + "github.com/ipfs/go-cid" + logging "github.com/ipfs/go-log/v2" + "golang.org/x/xerrors" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-fil-markets/shared" "github.com/filecoin-project/go-fil-markets/storagemarket" @@ -15,9 +19,6 @@ import ( "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" - logging "github.com/ipfs/go-log/v2" - "golang.org/x/xerrors" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" diff --git a/node/builder.go b/node/builder.go index 80e3fcd87..46a0543a7 100644 --- a/node/builder.go +++ b/node/builder.go @@ -5,13 +5,6 @@ import ( "errors" "time" - "github.com/filecoin-project/go-fil-markets/retrievalmarket" - "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/impl/requestvalidation" - sectorbuilder "github.com/filecoin-project/go-sectorbuilder" - "github.com/filecoin-project/specs-actors/actors/runtime" - storage2 "github.com/filecoin-project/specs-storage/storage" blockstore "github.com/ipfs/go-ipfs-blockstore" logging "github.com/ipfs/go-log" ci "github.com/libp2p/go-libp2p-core/crypto" @@ -26,6 +19,14 @@ import ( "go.uber.org/fx" "golang.org/x/xerrors" + "github.com/filecoin-project/go-fil-markets/retrievalmarket" + "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/impl/requestvalidation" + sectorbuilder "github.com/filecoin-project/go-sectorbuilder" + "github.com/filecoin-project/specs-actors/actors/runtime" + storage2 "github.com/filecoin-project/specs-storage/storage" + "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/blocksync" diff --git a/node/modules/client.go b/node/modules/client.go index 15edc10d6..006a94c14 100644 --- a/node/modules/client.go +++ b/node/modules/client.go @@ -5,6 +5,12 @@ import ( "path/filepath" "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" "github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery" @@ -22,11 +28,6 @@ import ( "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/namespace" "github.com/ipfs/go-filestore" - 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/node/impl/full" diff --git a/node/modules/dtypes/storage.go b/node/modules/dtypes/storage.go index 0098f5b06..126fa0e54 100644 --- a/node/modules/dtypes/storage.go +++ b/node/modules/dtypes/storage.go @@ -1,9 +1,6 @@ package dtypes import ( - datatransfer "github.com/filecoin-project/go-data-transfer" - "github.com/filecoin-project/go-fil-markets/piecestore" - "github.com/filecoin-project/go-statestore" bserv "github.com/ipfs/go-blockservice" "github.com/ipfs/go-datastore" "github.com/ipfs/go-filestore" @@ -12,6 +9,10 @@ import ( exchange "github.com/ipfs/go-ipfs-exchange-interface" 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" ) // MetadataDS stores metadata diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index fb4644afe..21a9dbd66 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -4,6 +4,22 @@ import ( "context" "reflect" + "github.com/ipfs/go-bitswap" + "github.com/ipfs/go-bitswap/network" + "github.com/ipfs/go-blockservice" + "github.com/ipfs/go-datastore" + "github.com/ipfs/go-datastore/namespace" + 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" + "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" @@ -21,21 +37,6 @@ import ( "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/network" - "github.com/ipfs/go-blockservice" - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/namespace" - 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" - "golang.org/x/xerrors" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" From ddf1beac6c95cf68bfffb821955f8258b6ed6ebc Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 18 Mar 2020 13:45:37 -0700 Subject: [PATCH 18/20] change gas limit to be a normal int64 --- chain/gen/gen.go | 2 +- chain/gen/genesis/util.go | 2 +- chain/market/fundmgr.go | 2 +- chain/stmgr/call.go | 6 +-- chain/stmgr/forks_test.go | 4 +- chain/stmgr/stmgr.go | 4 +- chain/store/weight.go | 4 +- chain/types/cbor_gen.go | 72 ++++++++++++++++++++++++------ chain/types/message.go | 4 +- chain/types/message_receipt.go | 4 +- chain/types/mock/chain.go | 2 +- chain/types/types_test.go | 2 +- chain/types_test.go | 2 +- chain/validation/applier.go | 7 +-- chain/vm/runtime.go | 15 +++---- chain/vm/vm.go | 33 +++++++------- cli/chain.go | 2 +- cli/multisig.go | 6 +-- cli/send.go | 2 +- cli/state.go | 6 +-- cmd/chain-noise/main.go | 5 ++- cmd/lotus-chainwatch/storage.go | 4 +- cmd/lotus-chainwatch/templates.go | 4 +- cmd/lotus-fountain/main.go | 6 +-- cmd/lotus-shed/nonce-fix.go | 2 +- cmd/lotus-storage-miner/init.go | 4 +- cmd/lotus-storage-miner/rewards.go | 2 +- markets/storageadapter/client.go | 2 +- markets/storageadapter/provider.go | 4 +- miner/miner_test.go | 10 ++--- node/impl/paych/paych.go | 4 +- node/node_test.go | 2 +- paychmgr/simple.go | 4 +- storage/fpost_run.go | 6 +-- storage/sealing/checks.go | 2 +- storage/sealing/states.go | 6 +-- 36 files changed, 148 insertions(+), 100 deletions(-) diff --git a/chain/gen/gen.go b/chain/gen/gen.go index aab6db675..1a0ae8ca0 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -416,7 +416,7 @@ func getRandomMessages(cg *ChainGen) ([]*types.SignedMessage, error) { Method: 0, - GasLimit: types.NewInt(10000), + GasLimit: 10000, GasPrice: types.NewInt(0), } diff --git a/chain/gen/genesis/util.go b/chain/gen/genesis/util.go index 22cb7c33d..e080eb90b 100644 --- a/chain/gen/genesis/util.go +++ b/chain/gen/genesis/util.go @@ -36,7 +36,7 @@ func doExecValue(ctx context.Context, vm *vm.VM, to, from address.Address, value From: from, Method: method, Params: params, - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, GasPrice: types.NewInt(0), Value: value, Nonce: act.Nonce, diff --git a/chain/market/fundmgr.go b/chain/market/fundmgr.go index 76f0c795c..73989bf98 100644 --- a/chain/market/fundmgr.go +++ b/chain/market/fundmgr.go @@ -70,7 +70,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add From: wallet, Value: toAdd, GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, Method: builtin.MethodsMarket.AddBalance, Params: params, }) diff --git a/chain/stmgr/call.go b/chain/stmgr/call.go index 88373620a..cef9dc449 100644 --- a/chain/stmgr/call.go +++ b/chain/stmgr/call.go @@ -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) } - if msg.GasLimit == types.EmptyInt { - msg.GasLimit = types.NewInt(10000000000) + if msg.GasLimit == 0 { + msg.GasLimit = 10000000000 } if msg.GasPrice == types.EmptyInt { msg.GasPrice = types.NewInt(0) @@ -38,7 +38,7 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate if span.IsRecordingEvents() { 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.StringAttribute("value", msg.Value.String()), ) diff --git a/chain/stmgr/forks_test.go b/chain/stmgr/forks_test.go index f70bd106b..1265ee69f 100644 --- a/chain/stmgr/forks_test.go +++ b/chain/stmgr/forks_test.go @@ -181,7 +181,7 @@ func TestForkHeightTriggers(t *testing.T) { To: builtin.InitActorAddr, Method: builtin.MethodsInit.Exec, Params: enc, - GasLimit: types.NewInt(10000), + GasLimit: 10000, GasPrice: types.NewInt(0), } sig, err := cg.Wallet().Sign(ctx, cg.Banker(), m.Cid().Bytes()) @@ -208,7 +208,7 @@ func TestForkHeightTriggers(t *testing.T) { Method: 2, Params: nil, Nonce: nonce, - GasLimit: types.NewInt(10000), + GasLimit: 10000, GasPrice: types.NewInt(0), } nonce++ diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index dff0d9fe3..71e0c4caf 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -228,7 +228,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B Nonce: sysAct.Nonce, Value: types.NewInt(0), GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1 << 30), + GasLimit: 1 << 30, Method: builtin.MethodsReward.AwardBlockReward, Params: params, } @@ -260,7 +260,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B Nonce: ca.Nonce, Value: 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, Params: nil, } diff --git a/chain/store/weight.go b/chain/store/weight.go index d4005bb3d..3c9826b77 100644 --- a/chain/store/weight.go +++ b/chain/store/weight.go @@ -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) } - if msg.GasLimit == types.EmptyInt { - msg.GasLimit = types.NewInt(10000000000) + if msg.GasLimit == 0 { + msg.GasLimit = 10000000000 } if msg.GasPrice == types.EmptyInt { msg.GasPrice = types.NewInt(0) diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index 64f055026..0adccccbb 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -656,9 +656,15 @@ func (t *Message) MarshalCBOR(w io.Writer) error { return err } - // t.GasLimit (big.Int) (struct) - if err := t.GasLimit.MarshalCBOR(w); err != nil { - return err + // t.GasLimit (int64) (int64) + if t.GasLimit >= 0 { + 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) @@ -746,14 +752,30 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { } } - // t.GasLimit (big.Int) (struct) - + // t.GasLimit (int64) (int64) { - - if err := t.GasLimit.UnmarshalCBOR(br); err != nil { + maj, extra, err := cbg.CborReadHeader(br) + var extraI int64 + if err != nil { 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) @@ -1043,9 +1065,15 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error { return err } - // t.GasUsed (big.Int) (struct) - if err := t.GasUsed.MarshalCBOR(w); err != nil { - return err + // t.GasUsed (int64) (int64) + if t.GasUsed >= 0 { + 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 } @@ -1107,14 +1135,30 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Return); err != nil { return err } - // t.GasUsed (big.Int) (struct) - + // t.GasUsed (int64) (int64) { - - if err := t.GasUsed.UnmarshalCBOR(br); err != nil { + maj, extra, err := cbg.CborReadHeader(br) + var extraI int64 + if err != nil { 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 } diff --git a/chain/types/message.go b/chain/types/message.go index 7d41c8379..c3006d418 100644 --- a/chain/types/message.go +++ b/chain/types/message.go @@ -21,7 +21,7 @@ type Message struct { Value BigInt GasPrice BigInt - GasLimit BigInt + GasLimit int64 Method abi.MethodNum Params []byte @@ -87,7 +87,7 @@ func (m *Message) Cid() cid.Cid { func (m *Message) RequiredFunds() BigInt { return BigAdd( m.Value, - BigMul(m.GasPrice, m.GasLimit), + BigMul(m.GasPrice, NewInt(uint64(m.GasLimit))), ) } diff --git a/chain/types/message_receipt.go b/chain/types/message_receipt.go index bcb20443e..6671595ff 100644 --- a/chain/types/message_receipt.go +++ b/chain/types/message_receipt.go @@ -9,9 +9,9 @@ import ( type MessageReceipt struct { ExitCode exitcode.ExitCode Return []byte - GasUsed BigInt + GasUsed int64 } 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 } diff --git a/chain/types/mock/chain.go b/chain/types/mock/chain.go index c9687fa72..b10ebe728 100644 --- a/chain/types/mock/chain.go +++ b/chain/types/mock/chain.go @@ -27,7 +27,7 @@ func MkMessage(from, to address.Address, nonce uint64, w *wallet.Wallet) *types. From: from, Value: types.NewInt(1), Nonce: nonce, - GasLimit: types.NewInt(1), + GasLimit: 1, GasPrice: types.NewInt(0), } diff --git a/chain/types/types_test.go b/chain/types/types_test.go index d912c20e3..a2b47ad51 100644 --- a/chain/types/types_test.go +++ b/chain/types/types_test.go @@ -27,7 +27,7 @@ func BenchmarkSerializeMessage(b *testing.B) { Nonce: 197, Method: 1231254, Params: []byte("some bytes, idk. probably at least ten of them"), - GasLimit: NewInt(126723), + GasLimit: 126723, GasPrice: NewInt(1776234), } diff --git a/chain/types_test.go b/chain/types_test.go index 17b6c9cdd..55baf4a28 100644 --- a/chain/types_test.go +++ b/chain/types_test.go @@ -19,7 +19,7 @@ func TestSignedMessageJsonRoundtrip(t *testing.T) { Method: 1235126, Value: types.NewInt(123123), GasPrice: types.NewInt(1234), - GasLimit: types.NewInt(9992969384), + GasLimit: 9992969384, Nonce: 123123, }, } diff --git a/chain/validation/applier.go b/chain/validation/applier.go index 78b15ec60..b13ac68f8 100644 --- a/chain/validation/applier.go +++ b/chain/validation/applier.go @@ -4,6 +4,7 @@ import ( "context" "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/crypto" "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{ ExitCode: exitcode.ExitCode(ret.ExitCode), ReturnValue: ret.Return, - GasUsed: ret.GasUsed, + GasUsed: big.NewInt(ret.GasUsed), } return mr, nil @@ -91,7 +92,7 @@ func (a *Applier) ApplyTipSetMessages(state vstate.VMWrapper, blocks []vtypes.Bl ExitCode: exitcode.ExitCode(ret.ExitCode), ReturnValue: ret.Return, - GasUsed: ret.GasUsed, + GasUsed: big.NewInt(ret.GasUsed), }) return nil }) @@ -130,7 +131,7 @@ func toLotusMsg(msg *vtypes.Message) *types.Message { Value: types.BigInt{Int: msg.Value.Int}, GasPrice: types.BigInt{Int: msg.GasPrice.Int}, - GasLimit: types.NewInt(uint64(msg.GasLimit)), + GasLimit: msg.GasLimit, Params: msg.Params, } diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index ba23172e2..4740c44d5 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -34,8 +34,8 @@ type Runtime struct { height abi.ChainEpoch cst cbor.IpldStore - gasAvailable types.BigInt - gasUsed types.BigInt + gasAvailable int64 + gasUsed int64 sys runtime.Syscalls @@ -325,7 +325,7 @@ func (rt *Runtime) internalSend(to address.Address, method abi.MethodNum, value mr := types.MessageReceipt{ ExitCode: exitcode.ExitCode(aerrors.RetCode(errSend)), Return: ret, - GasUsed: types.EmptyInt, + GasUsed: 0, } er := ExecutionResult{ @@ -421,10 +421,9 @@ func (rt *Runtime) stateCommit(oldh, newh cid.Cid) aerrors.ActorError { return nil } -func (rt *Runtime) ChargeGas(amount uint64) { - toUse := types.NewInt(amount) - rt.gasUsed = types.BigAdd(rt.gasUsed, toUse) - if rt.gasUsed.GreaterThan(rt.gasAvailable) { - rt.Abortf(exitcode.SysErrOutOfGas, "not enough gas: used=%s, available=%s", rt.gasUsed, rt.gasAvailable) +func (rt *Runtime) ChargeGas(toUse int64) { + rt.gasUsed = rt.gasUsed + toUse + if rt.gasUsed > rt.gasAvailable { + rt.Abortf(exitcode.SysErrOutOfGas, "not enough gas: used=%d, available=%d", rt.gasUsed, rt.gasAvailable) } } diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 6b147e573..29d0afc00 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -91,7 +91,7 @@ func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Ad var _ cbor.IpldBlockstore = (*gasChargingBlocks)(nil) type gasChargingBlocks struct { - chargeGas func(uint64) + chargeGas func(int64) under cbor.IpldBlockstore } @@ -101,13 +101,13 @@ func (bs *gasChargingBlocks) Get(c cid.Cid) (block.Block, error) { if err != nil { 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 } 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 { return aerrors.Escalate(err, "failed to write data to disk") @@ -115,7 +115,7 @@ func (bs *gasChargingBlocks) Put(blk block.Block) error { return nil } -func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin address.Address, originNonce uint64, usedGas types.BigInt, icc int64) *Runtime { +func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin address.Address, originNonce uint64, usedGas int64, icc int64) *Runtime { rt := &Runtime{ ctx: ctx, vm: vm, @@ -184,7 +184,7 @@ type ApplyRet struct { } 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 @@ -206,12 +206,12 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime, } } - gasUsed := types.NewInt(gasCharge) + gasUsed := gasCharge origin := msg.From on := msg.Nonce var icc int64 = 0 if parent != nil { - gasUsed = types.BigAdd(parent.gasUsed, gasUsed) + gasUsed = parent.gasUsed + gasUsed origin = parent.origin on = parent.originNonce icc = parent.internalCallCounter + 1 @@ -240,8 +240,11 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime, } func checkMessage(msg *types.Message) error { - if msg.GasLimit == types.EmptyInt { - return xerrors.Errorf("message gas no gas limit set") + if msg.GasLimit == 0 { + 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 { @@ -274,8 +277,8 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet, if err != nil { return nil, xerrors.Errorf("could not serialize message: %w", err) } - msgGasCost := uint64(len(serMsg)) * gasPerMessageByte - if msgGasCost > msg.GasLimit.Uint64() { + msgGasCost := int64(len(serMsg)) * gasPerMessageByte + if msgGasCost > msg.GasLimit { return &ApplyRet{ MessageReceipt: types.MessageReceipt{ ExitCode: exitcode.SysErrOutOfGas, @@ -312,7 +315,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet, }, nil } - gascost := types.BigMul(msg.GasLimit, msg.GasPrice) + gascost := types.BigMul(types.NewInt(uint64(msg.GasLimit)), msg.GasPrice) totalCost := types.BigAdd(gascost, msg.Value) if fromActor.Balance.LessThan(totalCost) { return &ApplyRet{ @@ -340,7 +343,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet, } var errcode uint8 - var gasUsed types.BigInt + var gasUsed int64 if errcode = aerrors.RetCode(actorErr); errcode != 0 { gasUsed = msg.GasLimit @@ -351,7 +354,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet, } else { gasUsed = rt.gasUsed // 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 { return nil, xerrors.Errorf("failed to refund gas") } @@ -362,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) } - gasReward := types.BigMul(msg.GasPrice, gasUsed) + gasReward := types.BigMul(msg.GasPrice, types.NewInt(uint64(gasUsed))) if err := Transfer(gasHolder, rwAct, gasReward); err != nil { return nil, xerrors.Errorf("failed to give miner gas reward: %w", err) } diff --git a/cli/chain.go b/cli/chain.go index 6d091ce81..84fe75c0e 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -796,7 +796,7 @@ var slashConsensusFault = &cli.Command{ From: def, Value: types.NewInt(0), GasPrice: types.NewInt(1), - GasLimit: types.NewInt(10000000), + GasLimit: 10000000, Method: builtin.MethodsPower.ReportConsensusFault, Params: params, } diff --git a/cli/multisig.go b/cli/multisig.go index 9d1123f6e..cf9579664 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -123,7 +123,7 @@ var msigCreateCmd = &cli.Command{ Method: builtin.MethodsInit.Exec, Params: enc, GasPrice: types.NewInt(1), - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, Value: types.BigInt(filval), } @@ -353,7 +353,7 @@ var msigProposeCmd = &cli.Command{ Value: types.NewInt(0), Method: builtin.MethodsMultisig.Propose, Params: enc, - GasLimit: types.NewInt(100000), + GasLimit: 100000, GasPrice: types.NewInt(1), } @@ -439,7 +439,7 @@ var msigApproveCmd = &cli.Command{ Value: types.NewInt(0), Method: builtin.MethodsMultisig.Approve, Params: enc, - GasLimit: types.NewInt(100000), + GasLimit: 100000, GasPrice: types.NewInt(1), } diff --git a/cli/send.go b/cli/send.go index 1a329ddad..46efadf8b 100644 --- a/cli/send.go +++ b/cli/send.go @@ -62,7 +62,7 @@ var sendCmd = &cli.Command{ From: fromAddr, To: toAddr, Value: types.BigInt(val), - GasLimit: types.NewInt(1000), + GasLimit: 1000, GasPrice: types.NewInt(0), } diff --git a/cli/state.go b/cli/state.go index 0809d0240..47a6b87d6 100644 --- a/cli/state.go +++ b/cli/state.go @@ -349,7 +349,7 @@ var stateReplaySetCmd = &cli.Command{ fmt.Println("Replay receipt:") fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode) 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 { 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("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) return nil }, @@ -928,7 +928,7 @@ var stateCallCmd = &cli.Command{ From: froma, To: toa, Value: types.BigInt(value), - GasLimit: types.NewInt(10000000000), + GasLimit: 10000000000, GasPrice: types.NewInt(0), Method: abi.MethodNum(method), Params: params, diff --git a/cmd/chain-noise/main.go b/cmd/chain-noise/main.go index 23440335c..dc64b70ed 100644 --- a/cmd/chain-noise/main.go +++ b/cmd/chain-noise/main.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/filecoin-project/specs-actors/actors/crypto" "math/rand" "os" "time" + "github.com/filecoin-project/specs-actors/actors/crypto" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" @@ -76,7 +77,7 @@ func sendSmallFundsTxs(ctx context.Context, api api.FullNode, from address.Addre From: from, To: sendSet[rand.Intn(20)], Value: types.NewInt(1), - GasLimit: types.NewInt(100000), + GasLimit: 100000, GasPrice: types.NewInt(0), } diff --git a/cmd/lotus-chainwatch/storage.go b/cmd/lotus-chainwatch/storage.go index 9e657ae71..25c676951 100644 --- a/cmd/lotus-chainwatch/storage.go +++ b/cmd/lotus-chainwatch/storage.go @@ -662,7 +662,7 @@ create temp table msgs (like messages excluding constraints) on commit drop; m.Nonce, m.Value.String(), m.GasPrice.String(), - m.GasLimit.String(), + m.GasLimit, m.Method, m.Params, ); err != nil { @@ -706,7 +706,7 @@ create temp table recs (like receipts excluding constraints) on commit drop; c.state.String(), c.idx, m.ExitCode, - m.GasUsed.String(), + m.GasUsed, m.Return, ); err != nil { return err diff --git a/cmd/lotus-chainwatch/templates.go b/cmd/lotus-chainwatch/templates.go index d1ad6984d..67534f1e9 100644 --- a/cmd/lotus-chainwatch/templates.go +++ b/cmd/lotus-chainwatch/templates.go @@ -279,7 +279,7 @@ type Message struct { Value sbig GasPrice sbig - GasLimit sbig + GasLimit int64 Method abi.MethodNum Params []byte @@ -324,7 +324,7 @@ func (h *handler) messages(filter string, args ...interface{}) (out []types.Mess Nonce: r.Nonce, Value: types.BigInt(r.Value), GasPrice: types.BigInt(r.GasPrice), - GasLimit: types.BigInt(r.GasLimit), + GasLimit: r.GasLimit, Method: r.Method, Params: r.Params, } diff --git a/cmd/lotus-fountain/main.go b/cmd/lotus-fountain/main.go index 382e55d59..a09748522 100644 --- a/cmd/lotus-fountain/main.go +++ b/cmd/lotus-fountain/main.go @@ -190,7 +190,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) { To: to, GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000), + GasLimit: 1000, }) if err != nil { w.WriteHeader(400) @@ -256,7 +256,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) { To: owner, GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000), + GasLimit: 1000, }) if err != nil { w.WriteHeader(400) @@ -285,7 +285,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) { Method: builtin.MethodsPower.CreateMiner, Params: params, - GasLimit: types.NewInt(10000000), + GasLimit: 10000000, GasPrice: types.NewInt(0), } diff --git a/cmd/lotus-shed/nonce-fix.go b/cmd/lotus-shed/nonce-fix.go index 827fd4921..8b12e4795 100644 --- a/cmd/lotus-shed/nonce-fix.go +++ b/cmd/lotus-shed/nonce-fix.go @@ -89,7 +89,7 @@ var noncefix = &cli.Command{ From: addr, To: addr, Value: types.NewInt(1), - GasLimit: types.NewInt(1000), + GasLimit: 1000, GasPrice: types.NewInt(1), Nonce: i, } diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index bf552cd68..f6be19e20 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -500,7 +500,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address. Params: enc, Value: types.NewInt(0), GasPrice: types.NewInt(0), - GasLimit: types.NewInt(100000000), + GasLimit: 100000000, } smsg, err := api.MpoolPushMessage(ctx, msg) @@ -571,7 +571,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID, Method: builtin.MethodsPower.CreateMiner, Params: params, - GasLimit: types.NewInt(10000000), + GasLimit: 10000000, GasPrice: types.NewInt(0), } diff --git a/cmd/lotus-storage-miner/rewards.go b/cmd/lotus-storage-miner/rewards.go index c7525325a..ce8b0291c 100644 --- a/cmd/lotus-storage-miner/rewards.go +++ b/cmd/lotus-storage-miner/rewards.go @@ -100,7 +100,7 @@ var rewardsRedeemCmd = &cli.Command{ Nonce: workerNonce, Value: types.NewInt(0), GasPrice: types.NewInt(1), - GasLimit: types.NewInt(100000), + GasLimit: 100000, Method: builtin.MethodsReward.WithdrawReward, Params: params, }) diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 0c0c0fa18..565c8cb39 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -127,7 +127,7 @@ func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, From: addr, Value: amount, GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, Method: builtin.MethodsMarket.AddBalance, }) if err != nil { diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index 0a03d3094..3d1ef5e57 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -73,7 +73,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark From: worker, Value: types.NewInt(0), GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, Method: builtin.MethodsMarket.PublishStorageDeals, Params: params, }) @@ -161,7 +161,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address From: addr, Value: amount, GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, Method: builtin.MethodsMarket.AddBalance, }) if err != nil { diff --git a/miner/miner_test.go b/miner/miner_test.go index 2a896dc4c..328562bb8 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -43,7 +43,7 @@ func TestMessageFiltering(t *testing.T) { To: a1, Nonce: 3, Value: types.NewInt(500), - GasLimit: types.NewInt(50), + GasLimit: 50, GasPrice: types.NewInt(1), }, types.Message{ @@ -51,7 +51,7 @@ func TestMessageFiltering(t *testing.T) { To: a1, Nonce: 4, Value: types.NewInt(500), - GasLimit: types.NewInt(50), + GasLimit: 50, GasPrice: types.NewInt(1), }, types.Message{ @@ -59,7 +59,7 @@ func TestMessageFiltering(t *testing.T) { To: a1, Nonce: 1, Value: types.NewInt(800), - GasLimit: types.NewInt(100), + GasLimit: 100, GasPrice: types.NewInt(1), }, types.Message{ @@ -67,7 +67,7 @@ func TestMessageFiltering(t *testing.T) { To: a1, Nonce: 0, Value: types.NewInt(800), - GasLimit: types.NewInt(100), + GasLimit: 100, GasPrice: types.NewInt(1), }, types.Message{ @@ -75,7 +75,7 @@ func TestMessageFiltering(t *testing.T) { To: a1, Nonce: 2, Value: types.NewInt(150), - GasLimit: types.NewInt(100), + GasLimit: (100), GasPrice: types.NewInt(1), }, } diff --git a/node/impl/paych/paych.go b/node/impl/paych/paych.go index a9b0d9d54..8676cbfd3 100644 --- a/node/impl/paych/paych.go +++ b/node/impl/paych/paych.go @@ -125,7 +125,7 @@ func (a *PaychAPI) PaychClose(ctx context.Context, addr address.Address) (cid.Ci Method: builtin.MethodsPaych.Settle, Nonce: nonce, - GasLimit: types.NewInt(500), + GasLimit: 500, GasPrice: types.NewInt(0), } @@ -240,7 +240,7 @@ func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, s Nonce: nonce, Method: builtin.MethodsPaych.UpdateChannelState, Params: enc, - GasLimit: types.NewInt(100000), + GasLimit: 100000, GasPrice: types.NewInt(0), } diff --git a/node/node_test.go b/node/node_test.go index c915c9328..3984e6aea 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -97,7 +97,7 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a Params: enc, Value: types.NewInt(0), GasPrice: types.NewInt(0), - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, } _, err = tnd.MpoolPushMessage(ctx, msg) diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 92e0601db..653f58491 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -37,7 +37,7 @@ func (pm *Manager) createPaych(ctx context.Context, from, to address.Address, am Value: amt, Method: builtin.MethodsInit.Exec, Params: enc, - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, GasPrice: types.NewInt(0), } @@ -84,7 +84,7 @@ func (pm *Manager) addFunds(ctx context.Context, ch address.Address, from addres From: from, Value: amt, Method: 0, - GasLimit: types.NewInt(1000000), + GasLimit: 1000000, GasPrice: types.NewInt(0), } diff --git a/storage/fpost_run.go b/storage/fpost_run.go index dc38d7f4b..c3835764e 100644 --- a/storage/fpost_run.go +++ b/storage/fpost_run.go @@ -67,7 +67,7 @@ func (s *FPoStScheduler) declareFaults(ctx context.Context, fc uint64, params *m Method: builtin.MethodsMiner.DeclareTemporaryFaults, Params: enc, Value: types.NewInt(0), - GasLimit: types.NewInt(10000000), // i dont know help + GasLimit: 10000000, // i dont know help GasPrice: types.NewInt(1), } @@ -258,8 +258,8 @@ func (s *FPoStScheduler) submitPost(ctx context.Context, proof *abi.OnChainPoStV From: s.worker, Method: builtin.MethodsMiner.SubmitWindowedPoSt, Params: enc, - Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late - GasLimit: types.NewInt(10000000), // i dont know help + Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late + GasLimit: 10000000, // i dont know help GasPrice: types.NewInt(1), } diff --git a/storage/sealing/checks.go b/storage/sealing/checks.go index c7bec0228..ce0f5c385 100644 --- a/storage/sealing/checks.go +++ b/storage/sealing/checks.go @@ -90,7 +90,7 @@ func checkSeal(ctx context.Context, maddr address.Address, si SectorInfo, api se From: maddr, Value: types.NewInt(0), GasPrice: types.NewInt(0), - GasLimit: types.NewInt(9999999999), + GasLimit: 9999999999, Method: builtin.MethodsMarket.ComputeDataCommitment, Params: ccparams, } diff --git a/storage/sealing/states.go b/storage/sealing/states.go index e12860447..f66c97905 100644 --- a/storage/sealing/states.go +++ b/storage/sealing/states.go @@ -121,7 +121,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf Method: builtin.MethodsMiner.PreCommitSector, Params: enc, 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), } @@ -212,7 +212,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) Method: builtin.MethodsMiner.ProveCommitSector, Params: enc, 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), } @@ -278,7 +278,7 @@ func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) erro Method: builtin.MethodsMiner.DeclareTemporaryFaults, Params: enc, 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), } From f1327b75c301f0404d7f0fc00ab1ef9de47c5da7 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 18 Mar 2020 15:16:50 -0700 Subject: [PATCH 19/20] update to latest specs actors code --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index db498f6fc..3a9ae8276 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200314022627-38af9db49ba2 github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 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-20200303233430-1a5a408f7513 github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 github.com/go-ole/go-ole v1.2.4 // indirect diff --git a/go.sum b/go.sum index 6147e1b56..c17af0f03 100644 --- a/go.sum +++ b/go.sum @@ -135,6 +135,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-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-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/go.mod h1:sC2Ck2l1G8hXI5Do/3sp0yxbMRMnukbFwP9KF1CRFLw= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= From da631478a8cdbf8a39f814a33c943a918c2cc448 Mon Sep 17 00:00:00 2001 From: Travis Person Date: Thu, 19 Mar 2020 00:22:59 +0000 Subject: [PATCH 20/20] New interop network info --- build/bootstrap/bootstrappers.pi | 2 +- build/genesis/devnet.car | Bin 5243 -> 5067 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bootstrap/bootstrappers.pi b/build/bootstrap/bootstrappers.pi index cf7f8e68b..a94a863fd 100644 --- a/build/bootstrap/bootstrappers.pi +++ b/build/bootstrap/bootstrappers.pi @@ -1 +1 @@ -/dns4/t01000.miner.interoptnet.kittyhawk.wtf/tcp/1347/p2p/12D3KooWK7jRsuaw43bF7FWPdJNUD9wMK1dReGDSusnyTuP45UGi +/dns4/t01000.miner.interopnet.kittyhawk.wtf/tcp/1347/p2p/12D3KooWA9Y7wdECo7S77anUXAAqDA799EWoyF69Qfypjbm5koes diff --git a/build/genesis/devnet.car b/build/genesis/devnet.car index b296d9572a922d18d8f10e95812acc1cbd99c831..ffdb5ec239fab27ed6cee1bbded115250203d5e7 100644 GIT binary patch delta 1739 zcmeyZaaw(XNZ$ilV36#DZEy#{k5{pUr)h@Etq@z{#V>5BW`=VeZwvNhS6fylBidct(o>J{F`4A zBpY|t@7uDRN$a*9k9+w!YZhx8!(XOl@>f43F8w=Mg1JedUFk^1@5os<&E+^e(tMM& z#O+FMwwJ_u9x>dK|9H5Tj73M*+`}-`~JEae(%?9 z{x3RZRmZ+bi{H6Uj%A%jSdlQBkHS-{gMJF<>cbNbE>WqMZkQLnW=HpI=HCW!b_oni ze>|z4T+e1{-NOipE<%c%89169|2K3rIWxRqcWq{Nt6U;X6Y@!pkh-@f-=VgF#VJ;&ByLW*Ec z>I53B#=sbQP+p-lO=4A#k5>BpH6I)b7B33@wB@K-%>6aH0$D@tH@ZvcOlIVgQ?NCe zCc>3FvDjYbo8F<~vigra5!X1EJET9ITwXtKZKoz!k;%b_O`@!s71y3_3oE&CrEbC` zPs5$|`>eY>ek9GTFp&T&Voh{+v^*wz*yz*WSBm^ki}-sZCV4uC|D09#ZS6+0NitwX zUvvIG2)g`kJ)r|7Zb_zkLg~60 zDZ0|LWz$W~m&PsgvzFXF>0r^ThNC~k_AZDKa$nj$C6C`zlKEwYZccu3VoqLaiEg5i zfpJn&iivKTL5jJqNvd(8u0^t0lCF`3rIEQ=qDiWuS=u5`Xu2b0bd!q&0|!I%!bHQy zrc$N=&n+r@H!e{SGON{8dbCizX@c6C$!~d2DiX?oZNO|}RxhG^>vrY>vz7ObUU@!q zft$Yg*KG>EFYZ6!K5^`H(kYK{M+PKM6H?sj#E=3+-x8!07#J9uBpG!W=CMMOHx8}# zaEo9`x2=r>WF;u|9+FqMa^9yic;=Pct^o@^89j;q;}CbhMSUY{p3%F9U)B3JhE4Vp zP}O5ZsJ|p1`Pr?y>X6%xl}0Q2&3&)3K72K?`@(efh(%vYl>GD=8W|@C3g{}Qm-!|1 z$fhg)i~e=lc~+9udG1GxJab}v51rT>^O%91jiHfg@cU1o}4&8vq<#j><{%3>DiuDVpAt`Dsc4uc*8SUO-N1;7$NFehyA$2azim>$thf+SP&UPwVI!iwC({eS>!rK$Jmz|7GFH0>d&dkqa zT+75*xZnws0wE0(Q!^EIe@gtZUBg4ln&YtIahtm32FHJOEiK)@HtJnO?zx=zWs?^O zYXdR&WEDmO=8V}UlfxNh32U0dXsVDO`kHzFmpxg&5{nK*_$vPleDdi|Zq0#>;(u$u zUi*4%?&Oz@MhY|b7Pt4iv~?ybvDcd2o-*IY_uXpI7?B2T&h5E@KR87uTQlud2)loQ zZ|`=-4Z`omfOgxP!)0++4nJpBE%bO+z#JI~zjB_=-LO`S5Kd+*Q0&u>CE z*)5!0&t_@R%Ls`sLW-LiIGP>*H*`$?%ofbsI53B#=sbQP+sBc-spsk%Whw_Z#kB}TT*p-NgPx6f9u837pArZT+h8HIEhP6VZpoo zr{x3>-!0(Sv#DwRJOP=;MCLpNt*oBiUrg0E+|UK7d9+uJt8j1a2pSuvkAqLH_R`yu%r7f+bMliDbMjJ4bd!uN4bqH^ zOmtI{Q_Xcv(h?JOEe#Vbbd!=SEKJi3k_?R#O&57W(;Fe9n_MIqm>8NDCK@(2l`_pK zmE!Bu&Nv~=wcR}^HQ2dQUrTE88{U(Ogfd(f2W#DK28+?ZvH^ z&8mMg`CqSVQ{(#e($$dx$mMT0MWMuDFp@wh9*fy9flUDr*LSkhg;Ol2+T#y zO-Qzdh+O{hSHCbSN{D&SDgJ`KNAsT;I^LmSqL~PwPw#cAuRr+_7no@P($( zhl+-O%EC8iGBh$x-V0QhdhyZZ0QP1xTV|`MNq+v}6HO}%6-4aM#jtMuYwC3=lA)1# z@>zZ*ZB~R+y;sd)I@H~~^2Y*^AWqg5k+)iEwQS!n{$gZ!@=cLYxX5HKK}BsggnAiu zB@w%nc}X`zOr)OOo_OM~Tv!6{)m^SRVc&Oi=BP+d4ii+YXGf^#*&!qSe#+CBgGvr7 z-41Kd-`*X|*4^0UoOjld}2fY_@7ii5URgGG)x?q7Z_imT@RqTn1VxIXlNQ~3{(9>uO-j@bp9 J-wEDj1OR?yOYQ&w