Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Genesis Creation Functionality to Binary #1819

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions examples/morpheusvm/cmd/morpheusvm/genesis/genesis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis

import (
"fmt"

"github.com/spf13/cobra"

"github.com/ava-labs/hypersdk/examples/morpheusvm/tests/workload"
)

const minBlockGap = 100

func init() {
cobra.EnablePrefixMatching = true
}

func NewCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "genesis",
Short: "Prints out the genesis",
RunE: genesisFunc,
}
return cmd
}

func genesisFunc(*cobra.Command, []string) error {
networkConfig, err := workload.NewTestNetworkConfig(minBlockGap)
if err != nil {
return err
}

fmt.Println(networkConfig.GenesisBytes())
return nil
}
2 changes: 2 additions & 0 deletions examples/morpheusvm/cmd/morpheusvm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ava-labs/avalanchego/vms/rpcchainvm"
"github.com/spf13/cobra"

"github.com/ava-labs/hypersdk/examples/morpheusvm/cmd/morpheusvm/genesis"
"github.com/ava-labs/hypersdk/examples/morpheusvm/cmd/morpheusvm/version"
"github.com/ava-labs/hypersdk/examples/morpheusvm/vm"
)
Expand All @@ -31,6 +32,7 @@ func init() {
func init() {
rootCmd.AddCommand(
version.NewCommand(),
genesis.NewCommand(),
)
}

Expand Down
Loading