gengen

package
v1.15.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const InitialBaseFee = 100e6

Variables

This section is empty.

Functions

func MakeGenesisFunc

func MakeGenesisFunc(opts ...GenOption) genesis.InitFunc

MakeGenesisFunc returns a genesis function configured by a set of options.

Types

type CommitConfig

type CommitConfig struct {
	CommR     cid.Cid
	CommD     cid.Cid
	SectorNum abi.SectorNumber
	DealCfg   *DealConfig
	ProofType abi.RegisteredSealProof
}

CommitConfig carries all information needed to get a sector commitment in the genesis state.

func MakeCommitCfgs

func MakeCommitCfgs(n int) ([]*CommitConfig, error)

MakeCommitCfgs creates n gengen commit configs, casting strings to cids.

type CreateStorageMinerConfig

type CreateStorageMinerConfig struct {
	// Owner is the name of the key that owns this miner
	// It must be a name of a key from the configs 'Keys' list
	Owner int

	// PeerID is the peer ID to set as the miners owner
	PeerID string

	// CommittedSectors is the list of sector commitments in this miner's proving set
	CommittedSectors []*CommitConfig

	// RegisteredSealProof is the proof configuration used by this miner
	// (which implies sector size and window post partition size)
	SealProofType abi.RegisteredSealProof

	// ProvingPeriodStart is next chain epoch at which a miner will need to submit a windowed post
	// If unset, it will be set to the proving period.
	ProvingPeriodStart *abi.ChainEpoch

	MarketBalance abi.TokenAmount
}

CreateStorageMinerConfig holds configuration options used to create a storage miner in the genesis block. Note: Instances of this struct can be created from the contents of fixtures/setup.json, which means that a JSON encoder/decoder must exist for any of the struct's fields' types.

type DealConfig

type DealConfig struct {
	CommP     cid.Cid
	PieceSize uint64
	Verified  bool

	// StartEpoch is 0
	EndEpoch int64
}

DealConfig carries the information needed to specify a self-deal committing power to the market while initializing genesis miners

type GenOption

type GenOption func(*GenesisCfg) error

GenOption is a configuration option.

func GenKeys

func GenKeys(n int, prealloc string) GenOption

GenKeys returns a config option that sets the number of keys to generate

func GenTime

func GenTime(t uint64) GenOption

GenTime returns a config option setting the genesis time stamp

func ImportKeys

func ImportKeys(kis []key.KeyInfo, prealloc string) GenOption

ImportKeys returns a config option that imports keys and pre-allocates to them

func MinerConfigs

func MinerConfigs(minerCfgs []*CreateStorageMinerConfig) GenOption

func NetworkName

func NetworkName(name string) GenOption

NetworkName returns a config option that sets the network name.

func Prealloc

func Prealloc(idx int, amt string) GenOption

Prealloc returns a config option that sets up an actor account.

type GenesisCfg

type GenesisCfg struct {
	// Seed is used to sample randomness for generating keys
	Seed int64

	// KeysToGen is the number of random keys to generate and return
	KeysToGen int

	// Import keys are pre-generated keys to be imported. These keys will be appended to the generated keys.
	ImportKeys []*key.KeyInfo

	// PreallocatedFunds is a mapping from generated key index to string values of whole filecoin
	// that will be preallocated to each account
	PreallocatedFunds []string

	// Miners is a list of miners that should be set up at the start of the network
	Miners []*CreateStorageMinerConfig

	// Network is the name of the network
	Network string

	// Time is the genesis block time in unix seconds
	Time uint64
}

GenesisCfg is the top level configuration struct used to create a genesis block.

type GenesisGenerator

type GenesisGenerator struct {
	// contains filtered or unexported fields
}

func NewGenesisGenerator

func NewGenesisGenerator(bs blockstore.Blockstore) *GenesisGenerator

func (*GenesisGenerator) Init

func (g *GenesisGenerator) Init(cfg *GenesisCfg) error

type RenderedGenInfo

type RenderedGenInfo struct {
	// Keys is the set of keys generated
	Keys []*key.KeyInfo

	// Miners is the list of addresses of miners created
	Miners []*RenderedMinerInfo

	// GenesisCid is the cid of the created genesis block
	GenesisCid cid.Cid
}

RenderedGenInfo contains information about a genesis block creation

func GenGen

GenGen takes the genesis configuration and creates a genesis block that matches the description. It writes all chunks to the dagservice, and returns the final genesis block.

WARNING: Do not use maps in this code, they will make this code non deterministic.

func GenGenesisCar

func GenGenesisCar(cfg *GenesisCfg, out io.Writer) (*RenderedGenInfo, error)

GenGenesisCar generates a car for the given genesis configuration

type RenderedMinerInfo

type RenderedMinerInfo struct {
	// Owner is the key name of the owner of this miner
	Owner int

	// Address is the address generated on-chain for the miner
	Address address.Address

	// The amount of storage power this miner was created with
	RawPower abi.StoragePower
	QAPower  abi.StoragePower
}

RenderedMinerInfo contains info about a created miner

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL