Skip to content

Commit

Permalink
Merge pull request #5571 from filecoin-project/feat/lotus-seed-genesis
Browse files Browse the repository at this point in the history
lotus-seed command to generate lotus block
  • Loading branch information
magik6k authored Feb 10, 2021
2 parents cc0d281 + 039ca9f commit 332dc21
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/lotus-seed/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import (
"strconv"
"strings"

"github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/lotus/journal"
"github.com/filecoin-project/lotus/lib/blockstore"
"github.com/filecoin-project/lotus/node/modules/testing"
"github.com/google/uuid"
"github.com/mitchellh/go-homedir"
"github.com/urfave/cli/v2"
Expand All @@ -32,6 +37,7 @@ var genesisCmd = &cli.Command{
genesisNewCmd,
genesisAddMinerCmd,
genesisAddMsigsCmd,
genesisCarCmd,
},
}

Expand Down Expand Up @@ -302,3 +308,28 @@ func parseMultisigCsv(csvf string) ([]GenAccountEntry, error) {

return entries, nil
}

var genesisCarCmd = &cli.Command{
Name: "car",
Description: "write genesis car file",
ArgsUsage: "genesis template `FILE`",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "out",
Aliases: []string{"o"},
Value: "genesis.car",
Usage: "write output to `FILE`",
},
},
Action: func(c *cli.Context) error {
if c.Args().Len() != 1 {
return xerrors.Errorf("Please specify a genesis template. (i.e, the one created with `genesis new`)")
}
ofile := c.String("out")
jrnl := journal.NilJournal()
bstor := blockstore.NewTemporarySync()
sbldr := vm.Syscalls(ffiwrapper.ProofVerifier)
_, err := testing.MakeGenesis(ofile, c.Args().First())(bstor, sbldr, jrnl)()
return err
},
}

0 comments on commit 332dc21

Please sign in to comment.