chore:releasepolish v1.22 release (#10666)

* Update butterfly artifacts

* register actors v11

* Update calibration upgrade time

* State inspection shed cmds

* Fix

* make gen

* Fix swallowed errors

* Lint fixup

---------

Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>
This commit is contained in:
ZenGround0 2023-04-13 17:21:24 -04:00 committed by GitHub
parent 766bdedd29
commit ff9e706c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 187 additions and 6 deletions

View File

@ -1,2 +1,2 @@
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWF31bhPqjeAxNSCvWTLGq84iuMhKvbgK31rgTXfRjgByn
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWEY2LteCs2tYLmAWZ6U9eHzgnvmVsd5pSrKLg8nn3A6nh
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWEwwFTMAi8rMnVX4fzih9pW5xZgTMbcacAFPinaT1g4wo
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWSJ8KShJSdW8cqz29K7k3AR5frbAaun8gdW3ELFV3T4Ck

Binary file not shown.

View File

@ -73,11 +73,11 @@ const UpgradeSharkHeight = 16800 // 6 days after genesis
// 2023-02-21T16:30:00Z
const UpgradeHyggeHeight = 322354
// 2023-04-18T16:30:00Z
const UpgradeLightningHeight = 483634
// 2023-04-20T16:30:00Z
const UpgradeThunderHeight = UpgradeLightningHeight + 5760
const UpgradeLightningHeight = 489394
// 2023-04-24T16:30:00Z
const UpgradeThunderHeight = UpgradeLightningHeight + 11520
var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg32GiBV1,

View File

@ -51,6 +51,7 @@ func NewActorRegistry() *vm.ActorRegistry {
inv.Register(actorstypes.Version8, vm.ActorsVersionPredicate(actorstypes.Version8), builtin.MakeRegistry(actorstypes.Version8))
inv.Register(actorstypes.Version9, vm.ActorsVersionPredicate(actorstypes.Version9), builtin.MakeRegistry(actorstypes.Version9))
inv.Register(actorstypes.Version10, vm.ActorsVersionPredicate(actorstypes.Version10), builtin.MakeRegistry(actorstypes.Version10))
inv.Register(actorstypes.Version11, vm.ActorsVersionPredicate(actorstypes.Version11), builtin.MakeRegistry(actorstypes.Version11))
return inv
}

View File

@ -2,21 +2,28 @@ package main
import (
"context"
"encoding/json"
"fmt"
"os"
"path"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query"
levelds "github.com/ipfs/go-ds-leveldb"
ipldcbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log/v2"
ldbopts "github.com/syndtr/goleveldb/leveldb/opt"
"github.com/urfave/cli/v2"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin"
market11 "github.com/filecoin-project/go-state-types/builtin/v11/market"
"github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types"
@ -34,6 +41,85 @@ var marketCmd = &cli.Command{
marketExportDatastoreCmd,
marketImportDatastoreCmd,
marketDealsTotalStorageCmd,
marketCronStateCmd,
},
}
var marketCronStateCmd = &cli.Command{
Name: "cron-state",
Usage: "Display summary of all deal operation state scheduled for cron processing",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "tipset",
Usage: "specify tipset to call method on (pass comma separated array of cids)",
},
},
Action: func(cctx *cli.Context) error {
ctx := lcli.ReqContext(cctx)
api, closer, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer closer()
ts, err := lcli.LoadTipSet(ctx, cctx, api)
if err != nil {
return err
}
a, err := api.StateReadState(ctx, builtin.StorageMarketActorAddr, ts.Key())
if err != nil {
return err
}
st, ok := a.State.(map[string]interface{})
if !ok {
return xerrors.Errorf("failed to cast state map to expected form")
}
dealOpsRaw, ok := st["DealOpsByEpoch"].(map[string]interface{})
if !ok {
return xerrors.Errorf("failed to read sectors root from state")
}
// string is of the form "/:bafy.." so [2:] to drop the path
dealOpsRoot, err := cid.Parse(dealOpsRaw["/"])
if err != nil {
return err
}
bs := ReadOnlyAPIBlockstore{api}
adtStore := adt.WrapStore(ctx, ipldcbor.NewCborStore(&bs))
dealOpsEpochSet, err := adt.AsMap(adtStore, dealOpsRoot, builtin.DefaultHamtBitwidth)
if err != nil {
return err
}
dealOpsRecord := make(map[uint64][]abi.DealID)
if err := dealOpsEpochSet.ForEach(&cbg.Deferred{}, func(eKey string) error {
e, err := abi.ParseUIntKey(eKey)
if err != nil {
return err
}
dealOpsRecord[e] = make([]abi.DealID, 0)
return nil
}); err != nil {
return err
}
dealOpsMultiMap, err := market11.AsSetMultimap(adtStore, dealOpsRoot, builtin.DefaultHamtBitwidth, builtin.DefaultHamtBitwidth)
if err != nil {
return err
}
for e := range dealOpsRecord {
e := e
err := dealOpsMultiMap.ForEach(abi.ChainEpoch(e), func(id abi.DealID) error {
dealOpsRecord[e] = append(dealOpsRecord[e], id)
return nil
})
if err != nil {
return err
}
}
jsonStr, err := json.Marshal(dealOpsRecord)
if err != nil {
return err
}
fmt.Printf("%s\n", jsonStr)
return nil
},
}

View File

@ -3,16 +3,21 @@ package main
import (
"bufio"
"bytes"
"context"
"fmt"
"io"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/docker/go-units"
"github.com/ipfs/go-cid"
ipldcbor "github.com/ipfs/go-ipld-cbor"
block "github.com/ipfs/go-libipfs/blocks"
"github.com/mitchellh/go-homedir"
"github.com/urfave/cli/v2"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
@ -20,11 +25,13 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/builtin/v11/util/adt"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/crypto"
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
"github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
"github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -42,6 +49,93 @@ var minerCmd = &cli.Command{
minerFaultsCmd,
sendInvalidWindowPoStCmd,
generateAndSendConsensusFaultCmd,
sectorInfoCmd,
},
}
var _ ipldcbor.IpldBlockstore = new(ReadOnlyAPIBlockstore)
type ReadOnlyAPIBlockstore struct {
v0api.FullNode
}
func (b *ReadOnlyAPIBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block, error) {
bs, err := b.ChainReadObj(ctx, c)
if err != nil {
return nil, err
}
return block.NewBlock(bs), nil
}
func (b *ReadOnlyAPIBlockstore) Put(context.Context, block.Block) error {
return xerrors.Errorf("cannot put block, the backing blockstore is readonly")
}
var sectorInfoCmd = &cli.Command{
Name: "sectorinfo",
Usage: "Display cbor of sector info at <minerAddress> <sectorNumber>",
ArgsUsage: "[minerAddress] [sector number]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "tipset",
Usage: "specify tipset to call method on (pass comma separated array of cids)",
},
},
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 2 {
return fmt.Errorf("must pass miner address and sector number")
}
ctx := lcli.ReqContext(cctx)
api, closer, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer closer()
maddr, err := address.NewFromString(cctx.Args().First())
if err != nil {
return err
}
sn, err := strconv.ParseUint(cctx.Args().Slice()[1], 10, 64)
if err != nil {
return err
}
ts, err := lcli.LoadTipSet(ctx, cctx, api)
if err != nil {
return err
}
a, err := api.StateReadState(ctx, maddr, ts.Key())
if err != nil {
return err
}
st, ok := a.State.(map[string]interface{})
if !ok {
return xerrors.Errorf("failed to cast state map to expected form")
}
sectorsRaw, ok := st["Sectors"].(map[string]interface{})
if !ok {
return xerrors.Errorf("failed to read sectors root from state")
}
// string is of the form "/:bafy.." so [2:] to drop the path
sectorsRoot, err := cid.Parse(sectorsRaw["/"])
if err != nil {
return err
}
bs := ReadOnlyAPIBlockstore{api}
sectorsAMT, err := adt.AsArray(adt.WrapStore(ctx, ipldcbor.NewCborStore(&bs)), sectorsRoot, miner8.SectorsAmtBitwidth)
if err != nil {
return err
}
out := cbg.Deferred{}
found, err := sectorsAMT.Get(sn, &out)
if err != nil {
return err
}
if !found {
return xerrors.Errorf("sector number %d not found", sn)
}
fmt.Printf("%x\n", out.Raw)
return nil
},
}