Merge remote-tracking branch 'origin/testnet/3' into feat/storage-better-fetch
This commit is contained in:
commit
068e9a29d2
@ -116,7 +116,7 @@ type FullNodeStruct struct {
|
||||
StateNetworkName func(context.Context) (dtypes.NetworkName, error) `perm:"read"`
|
||||
StateMinerSectors func(context.Context, address.Address, *abi.BitField, bool, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||
StateMinerProvingSet func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||
StateMinerProvingDeadline func(context.Context, address.Address, types.TipSetKey) (*miner.DeadlineInfo, error) `perm:"read"`
|
||||
StateMinerProvingDeadline func(context.Context, address.Address, types.TipSetKey) (*miner.DeadlineInfo, error) `perm:"read"`
|
||||
StateMinerPower func(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error) `perm:"read"`
|
||||
StateMinerInfo func(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) `perm:"read"`
|
||||
StateMinerDeadlines func(context.Context, address.Address, types.TipSetKey) (*miner.Deadlines, error) `perm:"read"`
|
||||
@ -506,7 +506,7 @@ func (c *FullNodeStruct) StateMinerProvingSet(ctx context.Context, addr address.
|
||||
return c.Internal.StateMinerProvingSet(ctx, addr, tsk)
|
||||
}
|
||||
|
||||
func (c *FullNodeStruct) StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*miner.DeadlineInfo, error) {
|
||||
func (c *FullNodeStruct) StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*miner.DeadlineInfo, error) {
|
||||
return c.Internal.StateMinerProvingDeadline(ctx, addr, tsk)
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,6 @@ const WRatioDen = 2
|
||||
// /////
|
||||
// Proofs
|
||||
|
||||
// Epochs
|
||||
const FallbackPoStConfidence = 6
|
||||
|
||||
// Epochs
|
||||
const SealRandomnessLookback = Finality
|
||||
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
var log = logging.Logger("drand")
|
||||
|
||||
var drandServers = []string{
|
||||
"drand-test1.nikkolasg.xyz:5001",
|
||||
"drand-test3.nikkolasg.xyz:5003",
|
||||
}
|
||||
|
||||
var drandPubKey *dkey.DistPublic
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
|
@ -145,7 +145,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
{
|
||||
params := &market.VerifyDealsOnSectorProveCommitParams{
|
||||
DealIDs: []abi.DealID{dealIDs[pi]},
|
||||
SectorSize: m.SectorSize,
|
||||
SectorExpiry: preseal.Deal.EndEpoch,
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ func (ta *testActor) Exports() []interface{} {
|
||||
}
|
||||
|
||||
func (ta *testActor) Constructor(rt runtime.Runtime, params *adt.EmptyValue) *adt.EmptyValue {
|
||||
|
||||
rt.ValidateImmediateCallerAcceptAny()
|
||||
rt.State().Create(&testActorState{11})
|
||||
fmt.Println("NEW ACTOR ADDRESS IS: ", rt.Message().Receiver())
|
||||
|
||||
@ -82,6 +82,7 @@ func (ta *testActor) Constructor(rt runtime.Runtime, params *adt.EmptyValue) *ad
|
||||
}
|
||||
|
||||
func (ta *testActor) TestMethod(rt runtime.Runtime, params *adt.EmptyValue) *adt.EmptyValue {
|
||||
rt.ValidateImmediateCallerAcceptAny()
|
||||
var st testActorState
|
||||
rt.State().Readonly(&st)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
@ -557,10 +557,21 @@ func (t *Message) MarshalCBOR(w io.Writer) error {
|
||||
_, err := w.Write(cbg.CborNull)
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write([]byte{136}); err != nil {
|
||||
if _, err := w.Write([]byte{137}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// t.Version (int64) (int64)
|
||||
if t.Version >= 0 {
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Version))); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajNegativeInt, uint64(-t.Version)-1)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// t.To (address.Address) (struct)
|
||||
if err := t.To.MarshalCBOR(w); err != nil {
|
||||
return err
|
||||
@ -629,10 +640,35 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
|
||||
return fmt.Errorf("cbor input should be of type array")
|
||||
}
|
||||
|
||||
if extra != 8 {
|
||||
if extra != 9 {
|
||||
return fmt.Errorf("cbor input had wrong number of fields")
|
||||
}
|
||||
|
||||
// t.Version (int64) (int64)
|
||||
{
|
||||
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.Version = int64(extraI)
|
||||
}
|
||||
// t.To (address.Address) (struct)
|
||||
|
||||
{
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
)
|
||||
|
||||
const MessageVersion = 0
|
||||
|
||||
type ChainMsg interface {
|
||||
Cid() cid.Cid
|
||||
VMMessage() *Message
|
||||
@ -20,6 +22,8 @@ type ChainMsg interface {
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Version int64
|
||||
|
||||
To address.Address
|
||||
From address.Address
|
||||
|
||||
@ -56,6 +60,10 @@ func DecodeMessage(b []byte) (*Message, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if msg.Version != MessageVersion {
|
||||
return nil, fmt.Errorf("decoded message had incorrect version (%d)", msg.Version)
|
||||
}
|
||||
|
||||
return &msg, nil
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||
@ -53,6 +52,7 @@ type Runtime struct {
|
||||
internalExecutions []*types.ExecutionResult
|
||||
numActorsCreated uint64
|
||||
allowInternal bool
|
||||
callerValidated bool
|
||||
}
|
||||
|
||||
func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount {
|
||||
@ -109,6 +109,9 @@ func (rs *Runtime) Get(c cid.Cid, o vmr.CBORUnmarshaler) bool {
|
||||
if err := rs.cst.Get(context.TODO(), c, o); err != nil {
|
||||
var nfe notFoundErr
|
||||
if xerrors.As(err, &nfe) && nfe.IsNotFound() {
|
||||
if xerrors.As(err, new(cbor.SerializationError)) {
|
||||
panic(aerrors.Newf(exitcode.ErrSerialization, "failed to unmarshal cbor object %s", err))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@ -120,6 +123,9 @@ func (rs *Runtime) Get(c cid.Cid, o vmr.CBORUnmarshaler) bool {
|
||||
func (rs *Runtime) Put(x vmr.CBORMarshaler) cid.Cid {
|
||||
c, err := rs.cst.Put(context.TODO(), x)
|
||||
if err != nil {
|
||||
if xerrors.As(err, new(cbor.SerializationError)) {
|
||||
panic(aerrors.Newf(exitcode.ErrSerialization, "failed to marshal cbor object %s", err))
|
||||
}
|
||||
panic(aerrors.Fatalf("failed to put cbor object: %s", err))
|
||||
}
|
||||
return c
|
||||
@ -141,6 +147,11 @@ func (rs *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.Act
|
||||
}()
|
||||
|
||||
ret := f()
|
||||
|
||||
if !rs.callerValidated {
|
||||
rs.Abortf(exitcode.SysErrorIllegalActor, "Caller MUST be validated during method execution")
|
||||
}
|
||||
|
||||
switch ret := ret.(type) {
|
||||
case []byte:
|
||||
return ret, nil
|
||||
@ -164,6 +175,7 @@ func (rs *Runtime) Message() vmr.Message {
|
||||
}
|
||||
|
||||
func (rs *Runtime) ValidateImmediateCallerAcceptAny() {
|
||||
rs.abortIfAlreadyValidated()
|
||||
return
|
||||
}
|
||||
|
||||
@ -267,6 +279,7 @@ func (rs *Runtime) StartSpan(name string) vmr.TraceSpan {
|
||||
}
|
||||
|
||||
func (rt *Runtime) ValidateImmediateCallerIs(as ...address.Address) {
|
||||
rt.abortIfAlreadyValidated()
|
||||
imm := rt.Message().Caller()
|
||||
|
||||
for _, a := range as {
|
||||
@ -291,6 +304,7 @@ func (rs *Runtime) AbortStateMsg(msg string) {
|
||||
}
|
||||
|
||||
func (rt *Runtime) ValidateImmediateCallerType(ts ...cid.Cid) {
|
||||
rt.abortIfAlreadyValidated()
|
||||
callerCid, ok := rt.GetActorCodeCID(rt.Message().Caller())
|
||||
if !ok {
|
||||
panic(aerrors.Fatalf("failed to lookup code cid for caller"))
|
||||
@ -494,3 +508,10 @@ func (rt *Runtime) Pricelist() Pricelist {
|
||||
func (rt *Runtime) incrementNumActorsCreated() {
|
||||
rt.numActorsCreated++
|
||||
}
|
||||
|
||||
func (rt *Runtime) abortIfAlreadyValidated() {
|
||||
if rt.callerValidated {
|
||||
rt.Abortf(exitcode.SysErrorIllegalActor, "Method must validate caller identity exactly once")
|
||||
}
|
||||
rt.callerValidated = true
|
||||
}
|
||||
|
47
chain/vm/runtime_test.go
Normal file
47
chain/vm/runtime_test.go
Normal file
@ -0,0 +1,47 @@
|
||||
package vm
|
||||
|
||||
import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
)
|
||||
|
||||
type NotAVeryGoodMarshaler struct {}
|
||||
|
||||
func (*NotAVeryGoodMarshaler) MarshalCBOR(writer io.Writer) error {
|
||||
return xerrors.Errorf("no")
|
||||
}
|
||||
|
||||
var _ cbg.CBORMarshaler = &NotAVeryGoodMarshaler{}
|
||||
|
||||
func TestRuntimePutErrors(t *testing.T) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err == nil {
|
||||
t.Fatal("expected non-nil recovery")
|
||||
}
|
||||
|
||||
aerr := err.(aerrors.ActorError)
|
||||
if aerr.IsFatal() {
|
||||
t.Fatal("expected non-fatal actor error")
|
||||
}
|
||||
|
||||
if aerr.RetCode() != exitcode.ErrSerialization {
|
||||
t.Fatal("expected serialization error")
|
||||
}
|
||||
}()
|
||||
|
||||
rt := Runtime{
|
||||
cst: cbor.NewCborStore(nil),
|
||||
}
|
||||
|
||||
rt.Put(&NotAVeryGoodMarshaler{})
|
||||
t.Error("expected panic")
|
||||
}
|
@ -101,6 +101,7 @@ func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin addres
|
||||
numActorsCreated: nac,
|
||||
pricelist: PricelistByEpoch(vm.blockHeight),
|
||||
allowInternal: true,
|
||||
callerValidated: false,
|
||||
}
|
||||
|
||||
rt.cst = &cbor.BasicIpldStore{
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -483,16 +484,49 @@ var clientListDeals = &cli.Command{
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
deals, err := api.ClientListDeals(ctx)
|
||||
head, err := api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
localDeals, err := api.ClientListDeals(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var deals []deal
|
||||
for idx := range localDeals {
|
||||
onChain, err := api.StateMarketStorageDeal(ctx, localDeals[idx].DealID, head.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
deals = append(deals, deal{
|
||||
LocalDeal: localDeals[idx],
|
||||
OnChainDealState: onChain.State,
|
||||
})
|
||||
}
|
||||
|
||||
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
||||
fmt.Fprintf(w, "DealCid\tDealId\tProvider\tState\tPieceCID\tSize\tPrice\tDuration\tMessage\n")
|
||||
fmt.Fprintf(w, "DealCid\tDealId\tProvider\tState\tOn Chain?\tSlashed?\tPieceCID\tSize\tPrice\tDuration\tMessage\n")
|
||||
for _, d := range deals {
|
||||
fmt.Fprintf(w, "%s\t%d\t%s\t%s\t%s\t%d\t%s\t%d\t%s\n", d.ProposalCid, d.DealID, d.Provider, storagemarket.DealStates[d.State], d.PieceCID, d.Size, d.PricePerEpoch, d.Duration, d.Message)
|
||||
onChain := "N"
|
||||
if d.OnChainDealState.SectorStartEpoch != -1 {
|
||||
onChain = fmt.Sprintf("Y (epoch %d)", d.OnChainDealState.SectorStartEpoch)
|
||||
}
|
||||
|
||||
slashed := "N"
|
||||
if d.OnChainDealState.SlashEpoch != -1 {
|
||||
slashed = fmt.Sprintf("Y (epoch %d)", d.OnChainDealState.SlashEpoch)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%s\t%d\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%d\t%s\n", d.LocalDeal.ProposalCid, d.LocalDeal.DealID, d.LocalDeal.Provider, storagemarket.DealStates[d.LocalDeal.State], onChain, slashed, d.LocalDeal.PieceCID, d.LocalDeal.Size, d.LocalDeal.PricePerEpoch, d.LocalDeal.Duration, d.LocalDeal.Message)
|
||||
}
|
||||
return w.Flush()
|
||||
},
|
||||
}
|
||||
|
||||
type deal struct {
|
||||
LocalDeal lapi.DealInfo
|
||||
OnChainDealState market.DealState
|
||||
}
|
||||
|
@ -215,6 +215,7 @@ var CommonCommands = []*cli.Command{
|
||||
netCmd,
|
||||
versionCmd,
|
||||
logCmd,
|
||||
waitApiCmd,
|
||||
}
|
||||
|
||||
var Commands = []*cli.Command{
|
||||
@ -232,4 +233,5 @@ var Commands = []*cli.Command{
|
||||
versionCmd,
|
||||
walletCmd,
|
||||
logCmd,
|
||||
waitApiCmd,
|
||||
}
|
||||
|
34
cli/wait.go
Normal file
34
cli/wait.go
Normal file
@ -0,0 +1,34 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
)
|
||||
|
||||
var waitApiCmd = &cli.Command{
|
||||
Name: "wait-api",
|
||||
Usage: "Wait for lotus api to come online",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
for i := 0; i < 30; i++ {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
fmt.Printf("Not online yet... (%s)\n", err)
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
_, err = api.ID(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("timed out waiting for api to come online")
|
||||
},
|
||||
}
|
188
cmd/lotus-shed/bitfield.go
Normal file
188
cmd/lotus-shed/bitfield.go
Normal file
@ -0,0 +1,188 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
)
|
||||
|
||||
var bitFieldCmd = &cli.Command{
|
||||
Name: "bitfield",
|
||||
Description: "analyze bitfields",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "enc",
|
||||
Value: "base64",
|
||||
Usage: "specify input encoding to parse",
|
||||
},
|
||||
},
|
||||
Subcommands: []*cli.Command{
|
||||
bitFieldRunsCmd,
|
||||
bitFieldStatCmd,
|
||||
},
|
||||
}
|
||||
|
||||
var bitFieldRunsCmd = &cli.Command{
|
||||
Name: "runs",
|
||||
Description: "print bit runs in a bitfield",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "enc",
|
||||
Value: "base64",
|
||||
Usage: "specify input encoding to parse",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
var val string
|
||||
if cctx.Args().Present() {
|
||||
val = cctx.Args().Get(0)
|
||||
} else {
|
||||
b, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
val = string(b)
|
||||
}
|
||||
|
||||
var dec []byte
|
||||
switch cctx.String("enc") {
|
||||
case "base64":
|
||||
d, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decoding base64 value: %w", err)
|
||||
}
|
||||
dec = d
|
||||
case "hex":
|
||||
d, err := hex.DecodeString(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decoding hex value: %w", err)
|
||||
}
|
||||
dec = d
|
||||
default:
|
||||
return fmt.Errorf("unrecognized encoding: %s", cctx.String("enc"))
|
||||
}
|
||||
|
||||
rle, err := rlepluslazy.FromBuf(dec)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("opening rle: %w", err)
|
||||
}
|
||||
|
||||
rit, err := rle.RunIterator()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting run iterator: %w", err)
|
||||
}
|
||||
var idx uint64
|
||||
for rit.HasNext() {
|
||||
r, err := rit.NextRun()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("next run: %w", err)
|
||||
}
|
||||
if !r.Valid() {
|
||||
fmt.Print("!INVALID ")
|
||||
}
|
||||
s := "TRUE "
|
||||
if !r.Val {
|
||||
s = "FALSE"
|
||||
}
|
||||
|
||||
fmt.Printf("@%d %s * %d\n", idx, s, r.Len)
|
||||
|
||||
idx += r.Len
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var bitFieldStatCmd = &cli.Command{
|
||||
Name: "stat",
|
||||
Description: "print bitfield stats",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "enc",
|
||||
Value: "base64",
|
||||
Usage: "specify input encoding to parse",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
var val string
|
||||
if cctx.Args().Present() {
|
||||
val = cctx.Args().Get(0)
|
||||
} else {
|
||||
b, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
val = string(b)
|
||||
}
|
||||
|
||||
var dec []byte
|
||||
switch cctx.String("enc") {
|
||||
case "base64":
|
||||
d, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decoding base64 value: %w", err)
|
||||
}
|
||||
dec = d
|
||||
case "hex":
|
||||
d, err := hex.DecodeString(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decoding hex value: %w", err)
|
||||
}
|
||||
dec = d
|
||||
default:
|
||||
return fmt.Errorf("unrecognized encoding: %s", cctx.String("enc"))
|
||||
}
|
||||
|
||||
rle, err := rlepluslazy.FromBuf(dec)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("opening rle: %w", err)
|
||||
}
|
||||
|
||||
rit, err := rle.RunIterator()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting run iterator: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Raw length: %d bits (%d bytes)\n", len(dec) * 8, len(dec))
|
||||
|
||||
var ones, zeros, oneRuns, zeroRuns, invalid uint64
|
||||
|
||||
for rit.HasNext() {
|
||||
r, err := rit.NextRun()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("next run: %w", err)
|
||||
}
|
||||
if !r.Valid() {
|
||||
invalid++
|
||||
}
|
||||
if r.Val {
|
||||
ones += r.Len
|
||||
oneRuns++
|
||||
} else {
|
||||
zeros += r.Len
|
||||
zeroRuns++
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := rle.Count(); err != nil { // check overflows
|
||||
fmt.Println("Error: ", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Decoded length: %d bits\n", ones+zeros)
|
||||
fmt.Printf("\tOnes: %d\n", ones)
|
||||
fmt.Printf("\tZeros: %d\n", zeros)
|
||||
fmt.Printf("Runs: %d\n", oneRuns+zeroRuns)
|
||||
fmt.Printf("\tOne Runs: %d\n", oneRuns)
|
||||
fmt.Printf("\tZero Runs: %d\n", zeroRuns)
|
||||
fmt.Printf("Invalid runs: %d\n", invalid)
|
||||
return nil
|
||||
},
|
||||
}
|
@ -17,6 +17,7 @@ func main() {
|
||||
local := []*cli.Command{
|
||||
base32Cmd,
|
||||
base16Cmd,
|
||||
bitFieldCmd,
|
||||
keyinfoCmd,
|
||||
peerkeyCmd,
|
||||
noncefix,
|
||||
|
@ -107,7 +107,7 @@ var provingInfoCmd = &cli.Command{
|
||||
fmt.Printf("Chain Period Start: %s\n", epochTime(cd.CurrentEpoch, (cd.CurrentEpoch/miner.WPoStProvingPeriod)*miner.WPoStProvingPeriod))
|
||||
fmt.Printf("Chain Period End: %s\n\n", epochTime(cd.CurrentEpoch, (cd.CurrentEpoch/miner.WPoStProvingPeriod+1)*miner.WPoStProvingPeriod))
|
||||
|
||||
fmt.Printf("Proving Period Boundary: %d\n", cd.PeriodStart % miner.WPoStProvingPeriod)
|
||||
fmt.Printf("Proving Period Boundary: %d\n", cd.PeriodStart%miner.WPoStProvingPeriod)
|
||||
fmt.Printf("Proving Period Start: %s\n", epochTime(cd.CurrentEpoch, cd.PeriodStart))
|
||||
fmt.Printf("Next Period Start: %s\n\n", epochTime(cd.CurrentEpoch, cd.PeriodStart+miner.WPoStProvingPeriod))
|
||||
|
||||
|
2
extern/filecoin-ffi
vendored
2
extern/filecoin-ffi
vendored
@ -1 +1 @@
|
||||
Subproject commit 48b8566ba12159934f3aa0a3b370e75bdb3afa0d
|
||||
Subproject commit a0014b17f124b50bf4316cbbe13f85bb98046cc1
|
14
go.mod
14
go.mod
@ -12,22 +12,24 @@ require (
|
||||
github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f // indirect
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/drand/drand v0.7.2
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200424212533-860752305527
|
||||
github.com/filecoin-project/filecoin-ffi v0.0.0-20200326153646-e899cc1dd072
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200429002049-f137de961672
|
||||
github.com/filecoin-project/filecoin-ffi v0.0.0-20200427223233-a0014b17f124
|
||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be
|
||||
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e
|
||||
github.com/filecoin-project/go-bitfield v0.0.0-20200416002808-b3ee67ec9060
|
||||
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
|
||||
github.com/filecoin-project/go-data-transfer v0.0.0-20200408061858-82c58b423ca6
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200415011556-4378bd41b91f
|
||||
github.com/filecoin-project/go-fil-markets v0.1.0
|
||||
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-statestore v0.1.0
|
||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
|
||||
github.com/filecoin-project/sector-storage v0.0.0-20200428103407-5f1a27d52b30
|
||||
github.com/filecoin-project/specs-actors v1.0.1-0.20200424220637-349bd6297517
|
||||
github.com/filecoin-project/specs-actors v0.2.1-0.20200428232403-f0282340f59a
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102
|
||||
github.com/filecoin-project/storage-fsm v0.0.0-20200423114251-f3bea4aa8bd7
|
||||
github.com/filecoin-project/storage-fsm v0.0.0-20200427182014-01487d5ad3c8
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||
github.com/google/uuid v1.1.1
|
||||
github.com/gorilla/mux v1.7.4
|
||||
@ -53,7 +55,7 @@ require (
|
||||
github.com/ipfs/go-ipfs-exchange-offline v0.0.1
|
||||
github.com/ipfs/go-ipfs-files v0.0.7
|
||||
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-cbor v0.0.5-0.20200428170625-a0bd04d3cbdf
|
||||
github.com/ipfs/go-ipld-format v0.0.2
|
||||
github.com/ipfs/go-log v1.0.4
|
||||
github.com/ipfs/go-log/v2 v2.0.5
|
||||
|
33
go.sum
33
go.sum
@ -28,9 +28,7 @@ github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw=
|
||||
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
|
||||
github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs=
|
||||
@ -94,7 +92,6 @@ github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhY
|
||||
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
||||
github.com/dgraph-io/badger v1.6.1 h1:w9pSFNSdq/JPM1N12Fz/F/bzo993Is1W+Q7HjPzi7yg=
|
||||
github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU=
|
||||
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200120142413-c3333a5a830e h1:Jz7uYxTCDVrtL5tzPxPu6o7Ybhom8Az7sWmjUO1OkQc=
|
||||
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200120142413-c3333a5a830e/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM=
|
||||
github.com/dgraph-io/badger/v2 v2.0.3 h1:inzdf6VF/NZ+tJ8RwwYMjJMvsOALTHYdozn0qSl6XJI=
|
||||
github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM=
|
||||
@ -128,9 +125,10 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
|
||||
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.3 h1:luT/8kJ0WdMIqQ9Bm31W4JkuYCW0wUb26AvnD4WK59M=
|
||||
github.com/filecoin-project/chain-validation v0.0.3/go.mod h1:NCEGFjcWRjb8akWFSOXvU6n2efkWIqAeOKU6o5WBGQw=
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200424212533-860752305527 h1:g+eOYvv+UzyCWSaAvIrFWvHxFyaEI+oXsPJ1kNXxwiQ=
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200424212533-860752305527/go.mod h1:+asFT+GUoWM3VExvjELzLqusve2s/oQcVReqz7XjR3Q=
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200429002049-f137de961672 h1:RmZN2ZpsvXIAzxqVNoJwl+s+c2LSrGnu/ftfcq6babo=
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200429002049-f137de961672/go.mod h1:YELmfkVO2elLyNa5RgKSo+qPywQu9V811L4Dyod4D2g=
|
||||
github.com/filecoin-project/go-address v0.0.0-20191219011437-af739c490b4f/go.mod h1:rCbpXPva2NKF9/J4X6sr7hbKBgQCxyFtRj7KOZqoIms=
|
||||
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=
|
||||
@ -153,8 +151,8 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20200408061858-82c58b423ca6/
|
||||
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-20200114015428-74d100f305f8/go.mod h1:c8NTjvFVy1Ud02mmGDjOiMeawY2t6ALfrrdvAB01FQc=
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200415011556-4378bd41b91f h1:mPmWWrEwc/5zZW2E14m8a7HMrrOWREaflGZL1Iun/Aw=
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200415011556-4378bd41b91f/go.mod h1:vcX3y5FVyuclIZgogPG1uIvJxHLSBU54B1ANJ88uMNk=
|
||||
github.com/filecoin-project/go-fil-markets v0.1.0 h1:Inc+8CgtMQqm9jPkTGjumN5yXD4BinmoMXOPw+yUl6E=
|
||||
github.com/filecoin-project/go-fil-markets v0.1.0/go.mod h1:l0fV9dM7hdcwDkSd45UEwvGeUm/GhSDV/atFnZJ9Zt8=
|
||||
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.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
||||
@ -167,22 +165,25 @@ github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 h
|
||||
github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
||||
github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIiWBRilQjQ+5IiwdQ=
|
||||
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
|
||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b h1:fkRZSPrYpk42PV3/lIXiL0LHetxde7vyYYvSsttQtfg=
|
||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b/go.mod h1:Q0GQOBtKf1oE10eSXSlhN45kDBdGvEcVOqMiffqX+N8=
|
||||
github.com/filecoin-project/lotus v0.2.10/go.mod h1:om5PQA9ZT0lf16qI7Fz/ZGLn4LDCMqPC8ntZA9uncRE=
|
||||
github.com/filecoin-project/sector-storage v0.0.0-20200411000242-61616264b16d/go.mod h1:/yueJueMh0Yc+0G1adS0lhnedcSnjY86EjKsA20+DVY=
|
||||
github.com/filecoin-project/sector-storage v0.0.0-20200428103407-5f1a27d52b30 h1:MlenH1KWLpDHgPzP0BhZ2I87M52GTv/JDWkoOkjhhbU=
|
||||
github.com/filecoin-project/sector-storage v0.0.0-20200428103407-5f1a27d52b30/go.mod h1:q/V90xaSKTlu7KovS0uj+cAvlPPFrGn141ZO3iQNEdw=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504/go.mod h1:mdJraXq5vMy0+/FqVQIrnNlpQ/Em6zeu06G/ltQ0/lA=
|
||||
github.com/filecoin-project/specs-actors v0.2.0 h1:bKxloHLegeYJttIJbQjl4/tdsKOUtYtpiZsEfB4eOnI=
|
||||
github.com/filecoin-project/specs-actors v0.2.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
|
||||
github.com/filecoin-project/specs-actors v1.0.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
|
||||
github.com/filecoin-project/specs-actors v1.0.1-0.20200424220637-349bd6297517 h1:Qi8xaf90j4pdMn8NZZ8FWROsvaTu2iD/C2TT7gDRNQw=
|
||||
github.com/filecoin-project/specs-actors v1.0.1-0.20200424220637-349bd6297517/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
|
||||
github.com/filecoin-project/specs-actors v0.2.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
|
||||
github.com/filecoin-project/specs-actors v0.2.1-0.20200428232403-f0282340f59a h1:ElQ8+0qeXtBXwxDkSLH1pen+qxXkSySbIsg5ysQ7coc=
|
||||
github.com/filecoin-project/specs-actors v0.2.1-0.20200428232403-f0282340f59a/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 h1:6OTcpsTQBQM0f/A67oEi4E4YtYd6fzkMqbU8cPIWMMs=
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102 h1:T3f/zkuvgtgqcXrb0NO3BicuveGOxxUAMPa/Yif2kuE=
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=
|
||||
github.com/filecoin-project/storage-fsm v0.0.0-20200423114251-f3bea4aa8bd7 h1:o9eAbR2GZiCn32AKYBVAasL3NJCHVrGPdxPozr0l0mM=
|
||||
github.com/filecoin-project/storage-fsm v0.0.0-20200423114251-f3bea4aa8bd7/go.mod h1:kS9btPajAeZkv0pS6cBLxdCCr9SyQ0VdGoXrXT0/hDs=
|
||||
github.com/filecoin-project/storage-fsm v0.0.0-20200427182014-01487d5ad3c8 h1:2/Dc5e3/rOUOfzRy3lgmwkR6JWJwSnYpT9Ugks5UV7o=
|
||||
github.com/filecoin-project/storage-fsm v0.0.0-20200427182014-01487d5ad3c8/go.mod h1:3r93oPxn/GOmi83xxkkIMhbdulA8zjXcnecfcToeQl0=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
|
||||
@ -256,6 +257,8 @@ github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824/go.mod h1:OiEWyHgK+CWr
|
||||
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=
|
||||
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e h1:3YKHER4nmd7b5qy5t0GWDTwSn4OyRgfAXSmo6VnryBY=
|
||||
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e/go.mod h1:I8h3MITA53gN9OnWGCgaMa0JWVRdXthWw4M3CPM54OY=
|
||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
@ -376,8 +379,9 @@ github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyB
|
||||
github.com/ipfs/go-ipld-cbor v0.0.2/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc=
|
||||
github.com/ipfs/go-ipld-cbor v0.0.3/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc=
|
||||
github.com/ipfs/go-ipld-cbor v0.0.4/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
|
||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669 h1:jIVle1vGSzxyUhseYNEqd7qcDVRrIbJ7UxGwao70cF0=
|
||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
|
||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200428170625-a0bd04d3cbdf h1:PRCy+w3GocY77CBEwTprp6hn7PLiEU1YToKe7B+1FVk=
|
||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200428170625-a0bd04d3cbdf/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
|
||||
github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms=
|
||||
github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs=
|
||||
github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k=
|
||||
@ -856,7 +860,6 @@ github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAri
|
||||
github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||
@ -917,7 +920,6 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0/go.mod h1:x
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200121162646-b63bacf5eaf8/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200206220010-03c9665e2a66/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200402171437-3d27c146c105/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e h1:JY8o/ebUUrCYetWmjRCNghxC59cOEaili83rxPRQCLw=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
|
||||
@ -1149,7 +1151,6 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
|
||||
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -16,5 +16,6 @@ func SetupLogLevels() {
|
||||
logging.SetLogLevel("connmgr", "WARN")
|
||||
logging.SetLogLevel("advmgr", "DEBUG")
|
||||
logging.SetLogLevel("stores", "DEBUG")
|
||||
logging.SetLogLevel("nat", "INFO")
|
||||
}
|
||||
}
|
||||
|
@ -73,15 +73,15 @@ type special struct{ id int }
|
||||
|
||||
//nolint:golint
|
||||
var (
|
||||
DefaultTransportsKey = special{0} // Libp2p option
|
||||
DiscoveryHandlerKey = special{2} // Private type
|
||||
AddrsFactoryKey = special{3} // Libp2p option
|
||||
SmuxTransportKey = special{4} // Libp2p option
|
||||
RelayKey = special{5} // Libp2p option
|
||||
SecurityKey = special{6} // Libp2p option
|
||||
BaseRoutingKey = special{7} // fx groups + multiret
|
||||
NatPortMapKey = special{8} // Libp2p option
|
||||
ConnectionManagerKey = special{9} // Libp2p option
|
||||
DefaultTransportsKey = special{0} // Libp2p option
|
||||
DiscoveryHandlerKey = special{2} // Private type
|
||||
AddrsFactoryKey = special{3} // Libp2p option
|
||||
SmuxTransportKey = special{4} // Libp2p option
|
||||
RelayKey = special{5} // Libp2p option
|
||||
SecurityKey = special{6} // Libp2p option
|
||||
BaseRoutingKey = special{7} // fx groups + multiret
|
||||
NatPortMapKey = special{8} // Libp2p option
|
||||
ConnectionManagerKey = special{9} // Libp2p option
|
||||
AutoNATSvcKey = special{10} // Libp2p option
|
||||
)
|
||||
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
|
@ -654,7 +654,6 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
||||
var err error
|
||||
params, err := actors.SerializeParams(&market.VerifyDealsOnSectorProveCommitParams{
|
||||
DealIDs: precommit.Info.DealIDs,
|
||||
SectorSize: st.GetSectorSize(),
|
||||
SectorExpiry: precommit.Info.Expiration,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -20,8 +20,8 @@ import (
|
||||
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"
|
||||
"github.com/filecoin-project/go-storedcounter"
|
||||
"github.com/ipfs/go-bitswap"
|
||||
"github.com/ipfs/go-bitswap/network"
|
||||
"github.com/ipfs/go-blockservice"
|
||||
|
@ -31,9 +31,9 @@ import (
|
||||
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/requestvalidation"
|
||||
smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network"
|
||||
"github.com/filecoin-project/go-fil-markets/storedcounter"
|
||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
"github.com/filecoin-project/go-storedcounter"
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/beacon"
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/storage/mockstorage"
|
||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
||||
|
||||
"github.com/filecoin-project/go-fil-markets/storedcounter"
|
||||
"github.com/filecoin-project/go-storedcounter"
|
||||
"github.com/ipfs/go-datastore"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/libp2p/go-libp2p-core/crypto"
|
||||
|
196
scripts/devnet.bash
Executable file
196
scripts/devnet.bash
Executable file
@ -0,0 +1,196 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
session="lotus-interop"
|
||||
wdaemon="daemon"
|
||||
wminer="miner"
|
||||
wsetup="setup"
|
||||
wpledging="pledging"
|
||||
wcli="cli"
|
||||
wshell="cli"
|
||||
faucet="http://t01000.miner.interopnet.kittyhawk.wtf"
|
||||
|
||||
|
||||
PLEDGE_COUNT="${1:-20}"
|
||||
|
||||
if [ -z "$BRANCH" ]; then
|
||||
BRANCH="interopnet"
|
||||
fi
|
||||
|
||||
if [ -z "$BUILD" ]; then
|
||||
BUILD="no"
|
||||
fi
|
||||
|
||||
if [ -z "$DEVNET" ]; then
|
||||
DEVNET="yes"
|
||||
fi
|
||||
|
||||
BASEDIR=$(mktemp -d -t "lotus-interopnet.XXXX")
|
||||
|
||||
if [ "$BUILD" == "yes" ]; then
|
||||
git clone --branch "$BRANCH" https://github.com/filecoin-project/lotus.git "${BASEDIR}/build"
|
||||
fi
|
||||
|
||||
|
||||
mkdir -p "${BASEDIR}/scripts"
|
||||
mkdir -p "${BASEDIR}/bin"
|
||||
|
||||
cat > "${BASEDIR}/scripts/build.bash" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
|
||||
SCRIPTDIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
pushd \$SCRIPTDIR/../build
|
||||
|
||||
pwd
|
||||
env RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1 make clean deps lotus lotus-storage-miner lotus-shed
|
||||
cp lotus lotus-storage-miner lotus-shed ../bin/
|
||||
|
||||
popd
|
||||
EOF
|
||||
|
||||
cat > "${BASEDIR}/scripts/env.fish" <<EOF
|
||||
set -x PATH ${BASEDIR}/bin \$PATH
|
||||
set -x LOTUS_PATH ${BASEDIR}/.lotus
|
||||
set -x LOTUS_STORAGE_PATH ${BASEDIR}/.lotusstorage
|
||||
EOF
|
||||
|
||||
cat > "${BASEDIR}/scripts/env.bash" <<EOF
|
||||
export PATH=${BASEDIR}/bin:\$PATH
|
||||
export LOTUS_PATH=${BASEDIR}/.lotus
|
||||
export LOTUS_STORAGE_PATH=${BASEDIR}/.lotusstorage
|
||||
EOF
|
||||
|
||||
cat > "${BASEDIR}/scripts/create_miner.bash" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
|
||||
lotus wallet import ~/.genesis-sectors/pre-seal-t01000.key
|
||||
lotus-storage-miner init --genesis-miner --actor=t01000 --sector-size=2048 --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t01000.json --nosync
|
||||
EOF
|
||||
|
||||
cat > "${BASEDIR}/scripts/pledge_sectors.bash" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
while [ ! -d ${BASEDIR}/.lotusstorage ]; do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
while [ ! -f ${BASEDIR}/.lotusstorage/api ]; do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
sleep 30
|
||||
|
||||
sector=\$(lotus-storage-miner sectors list | tail -n1 | awk '{print \$1}' | tr -d ':')
|
||||
current="\$sector"
|
||||
|
||||
while true; do
|
||||
if (( \$(lotus-storage-miner sectors list | wc -l) > ${PLEDGE_COUNT} )); then
|
||||
break
|
||||
fi
|
||||
|
||||
while true; do
|
||||
state=\$(lotus-storage-miner sectors list | tail -n1 | awk '{print \$2}')
|
||||
|
||||
if [ -z "\$state" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
case \$state in
|
||||
PreCommit1 | PreCommit2 | Packing | Unsealed | PreCommitting | Committing | CommitWait | FinalizeSector ) sleep 30 ;;
|
||||
WaitSeed | Proving ) break ;;
|
||||
* ) echo "Unknown Sector State: \$state"
|
||||
lotus-storage-miner sectors status --log \$current
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
lotus-storage-miner sectors pledge
|
||||
|
||||
while [ "\$current" == "\$sector" ]; do
|
||||
sector=\$(lotus-storage-miner sectors list | tail -n1 | awk '{print \$1}' | tr -d ':')
|
||||
sleep 5
|
||||
done
|
||||
|
||||
current="\$sector"
|
||||
done
|
||||
EOF
|
||||
|
||||
cat > "${BASEDIR}/scripts/monitor.bash" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
|
||||
while true; do
|
||||
clear
|
||||
lotus sync status
|
||||
|
||||
echo
|
||||
echo
|
||||
echo Storage Miner Info
|
||||
lotus-storage-miner info
|
||||
|
||||
echo
|
||||
echo
|
||||
echo Sector List
|
||||
lotus-storage-miner sectors list | tail -n4
|
||||
|
||||
sleep 25
|
||||
|
||||
lotus-shed noncefix --addr \$(lotus wallet list) --auto
|
||||
|
||||
done
|
||||
EOF
|
||||
|
||||
chmod +x "${BASEDIR}/scripts/build.bash"
|
||||
chmod +x "${BASEDIR}/scripts/create_miner.bash"
|
||||
chmod +x "${BASEDIR}/scripts/pledge_sectors.bash"
|
||||
chmod +x "${BASEDIR}/scripts/monitor.bash"
|
||||
|
||||
if [ "$BUILD" == "yes" ]; then
|
||||
bash "${BASEDIR}/scripts/build.bash"
|
||||
else
|
||||
cp ./lotus ${BASEDIR}/bin/
|
||||
cp ./lotus-storage-miner ${BASEDIR}/bin/
|
||||
cp ./lotus-seed ${BASEDIR}/bin/
|
||||
cp ./lotus-shed ${BASEDIR}/bin/
|
||||
fi
|
||||
|
||||
tmux new-session -d -s $session -n $wsetup
|
||||
|
||||
tmux set-environment -t $session BASEDIR "$BASEDIR"
|
||||
|
||||
tmux new-window -t $session -n $wcli
|
||||
tmux new-window -t $session -n $wdaemon
|
||||
tmux new-window -t $session -n $wminer
|
||||
tmux new-window -t $session -n $wpledging
|
||||
|
||||
tmux kill-window -t $session:$wsetup
|
||||
|
||||
case $(basename $SHELL) in
|
||||
fish ) shell=fish ;;
|
||||
* ) shell=bash ;;
|
||||
esac
|
||||
|
||||
tmux send-keys -t $session:$wdaemon "source ${BASEDIR}/scripts/env.$shell" C-m
|
||||
tmux send-keys -t $session:$wminer "source ${BASEDIR}/scripts/env.$shell" C-m
|
||||
tmux send-keys -t $session:$wcli "source ${BASEDIR}/scripts/env.$shell" C-m
|
||||
tmux send-keys -t $session:$wpledging "source ${BASEDIR}/scripts/env.$shell" C-m
|
||||
tmux send-keys -t $session:$wshell "source ${BASEDIR}/scripts/env.$shell" C-m
|
||||
|
||||
tmux send-keys -t $session:$wdaemon "lotus-seed genesis new devnet.json" C-m
|
||||
tmux send-keys -t $session:$wdaemon "lotus-seed genesis add-miner devnet.json ~/.genesis-sectors/pre-seal-t01000.json" C-m
|
||||
tmux send-keys -t $session:$wdaemon "lotus daemon --api 48010 --lotus-make-genesis=dev.gen --genesis-template=devnet.json --bootstrap=false 2>&1 | tee -a ${BASEDIR}/daemon.log" C-m
|
||||
|
||||
export LOTUS_PATH="${BASEDIR}/.lotus"
|
||||
${BASEDIR}/bin/lotus wait-api
|
||||
|
||||
tmux send-keys -t $session:$wminer "${BASEDIR}/scripts/create_miner.bash" C-m
|
||||
tmux send-keys -t $session:$wminer "lotus-storage-miner run --api 48020 --nosync 2>&1 | tee -a ${BASEDIR}/miner.log" C-m
|
||||
tmux send-keys -t $session:$wcli "${BASEDIR}/scripts/monitor.bash" C-m
|
||||
tmux send-keys -t $session:$wpleding "${BASEDIR}/scripts/pledge_sectors.bash" C-m
|
||||
|
||||
tmux select-window -t $session:$wcli
|
||||
|
||||
tmux attach-session -t $session
|
||||
|
@ -102,7 +102,7 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
|
||||
evts := events.NewEvents(ctx, m.api)
|
||||
adaptedAPI := NewSealingAPIAdapter(m.api)
|
||||
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, 10000000, md.PeriodStart % miner.WPoStProvingPeriod)
|
||||
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, 10000000, md.PeriodStart%miner.WPoStProvingPeriod)
|
||||
m.sealing = sealing.New(adaptedAPI, NewEventsAdapter(evts), m.maddr, m.ds, m.sealer, m.sc, m.verif, &pcp)
|
||||
|
||||
go m.sealing.Run(ctx)
|
||||
|
@ -129,10 +129,10 @@ func (s *WindowPoStScheduler) Run(ctx context.Context) {
|
||||
}
|
||||
|
||||
if err := s.revert(ctx, lowest); err != nil {
|
||||
log.Error("handling head reverts in fallbackPost sched: %+v", err)
|
||||
log.Error("handling head reverts in windowPost sched: %+v", err)
|
||||
}
|
||||
if err := s.update(ctx, highest); err != nil {
|
||||
log.Error("handling head updates in fallbackPost sched: %+v", err)
|
||||
log.Error("handling head updates in windowPost sched: %+v", err)
|
||||
}
|
||||
|
||||
span.End()
|
||||
@ -173,6 +173,7 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err
|
||||
if deadlineEquals(s.activeDeadline, di) {
|
||||
return nil // already working on this deadline
|
||||
}
|
||||
|
||||
if !di.PeriodStarted() {
|
||||
return nil // not proving anything yet
|
||||
}
|
||||
@ -206,7 +207,7 @@ func (s *WindowPoStScheduler) abortActivePoSt() {
|
||||
s.abort()
|
||||
}
|
||||
|
||||
log.Warnf("Aborting Fallback PoSt (Deadline: %+v)", s.activeDeadline)
|
||||
log.Warnf("Aborting Window PoSt (Deadline: %+v)", s.activeDeadline)
|
||||
|
||||
s.activeDeadline = nil
|
||||
s.abort = nil
|
||||
|
Loading…
Reference in New Issue
Block a user