test and fix fork, add bigint parsing to lotus shed
This commit is contained in:
parent
7402b14df3
commit
19a65319ee
@ -6,4 +6,4 @@ const ForkFrigidHeight = 7950
|
|||||||
|
|
||||||
const ForkBootyBayHeight = 11000
|
const ForkBootyBayHeight = 11000
|
||||||
|
|
||||||
const ForkMissingSnowballs = 32000
|
const ForkMissingSnowballs = 33000
|
||||||
|
@ -40,7 +40,7 @@ func (sm *StateManager) handleStateForks(ctx context.Context, pstate cid.Cid, he
|
|||||||
log.Warnw("Adding more snow to the world", "height", i)
|
log.Warnw("Adding more snow to the world", "height", i)
|
||||||
pstate, err = fixTooFewSnowballs(ctx, sm, pstate)
|
pstate, err = fixTooFewSnowballs(ctx, sm, pstate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("booty bay bug fix failed: %w", err)
|
return cid.Undef, xerrors.Errorf("missing snowballs bug fix failed: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ func fixTooFewSnowballs(ctx context.Context, sm *StateManager, pstate cid.Cid) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
spast.TotalStorage.Int = sum
|
spast.TotalStorage.Int = sum
|
||||||
nspahead, err := cst.Put(ctx, spast)
|
nspahead, err := cst.Put(ctx, &spast)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, err
|
return cid.Undef, err
|
||||||
}
|
}
|
||||||
|
47
cmd/lotus-shed/bigint.go
Normal file
47
cmd/lotus-shed/bigint.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"gopkg.in/urfave/cli.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var bigIntParseCmd = &cli.Command{
|
||||||
|
Name: "bigint",
|
||||||
|
Description: "parse encoded big ints",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "enc",
|
||||||
|
Value: "base64",
|
||||||
|
Usage: "specify input encoding to parse",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
val := cctx.Args().Get(0)
|
||||||
|
|
||||||
|
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"))
|
||||||
|
}
|
||||||
|
|
||||||
|
iv := types.BigFromBytes(dec)
|
||||||
|
fmt.Println(iv.String())
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
@ -20,6 +20,7 @@ func main() {
|
|||||||
keyinfoCmd,
|
keyinfoCmd,
|
||||||
peerkeyCmd,
|
peerkeyCmd,
|
||||||
noncefix,
|
noncefix,
|
||||||
|
bigIntParseCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
|
Loading…
Reference in New Issue
Block a user