genesis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHRP    = errors.New("invalid HRP")
	ErrInvalidTarget = errors.New("invalid target")
)

Functions

This section is empty.

Types

type CustomAllocation

type CustomAllocation struct {
	Address string `json:"address"` // bech32 address
	Balance uint64 `json:"balance"`
}

type EmissionBalancer

type EmissionBalancer struct {
	MaxSupply       uint64 `json:"maxSupply"`       // Max supply of NAI
	EmissionAddress string `json:"emissionAddress"` // Emission address
}

type Genesis

type Genesis struct {
	// State Parameters
	StateBranchFactor merkledb.BranchFactor `json:"stateBranchFactor"`

	// Chain Parameters
	MinBlockGap      int64 `json:"minBlockGap"`      // ms
	MinEmptyBlockGap int64 `json:"minEmptyBlockGap"` // ms

	// Chain Fee Parameters
	MinUnitPrice               chain.Dimensions `json:"minUnitPrice"`
	UnitPriceChangeDenominator chain.Dimensions `json:"unitPriceChangeDenominator"`
	WindowTargetUnits          chain.Dimensions `json:"windowTargetUnits"` // 10s
	MaxBlockUnits              chain.Dimensions `json:"maxBlockUnits"`     // must be possible to reach before block too large

	// Tx Parameters
	ValidityWindow int64 `json:"validityWindow"` // ms

	// Tx Fee Parameters
	BaseComputeUnits          uint64 `json:"baseUnits"`
	BaseWarpComputeUnits      uint64 `json:"baseWarpUnits"`
	WarpComputeUnitsPerSigner uint64 `json:"warpUnitsPerSigner"`
	OutgoingWarpComputeUnits  uint64 `json:"outgoingWarpComputeUnits"`
	StorageKeyReadUnits       uint64 `json:"storageKeyReadUnits"`
	StorageValueReadUnits     uint64 `json:"storageValueReadUnits"` // per chunk
	StorageKeyAllocateUnits   uint64 `json:"storageKeyAllocateUnits"`
	StorageValueAllocateUnits uint64 `json:"storageValueAllocateUnits"` // per chunk
	StorageKeyWriteUnits      uint64 `json:"storageKeyWriteUnits"`
	StorageValueWriteUnits    uint64 `json:"storageValueWriteUnits"` // per chunk

	// Allocates
	CustomAllocation []*CustomAllocation `json:"customAllocation"`

	// Emission Balancer Info
	EmissionBalancer EmissionBalancer `json:"emissionBalancer"`
}

func Default

func Default() *Genesis

func New

func New(b []byte, _ []byte) (*Genesis, error)

func (*Genesis) GetStateBranchFactor

func (g *Genesis) GetStateBranchFactor() merkledb.BranchFactor

func (*Genesis) Load

func (g *Genesis) Load(ctx context.Context, tracer trace.Tracer, mu state.Mutable) error

func (*Genesis) Rules

func (g *Genesis) Rules(_ int64, networkID uint32, chainID ids.ID) *Rules

TODO: use upgradeBytes

type Rules

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

func (*Rules) ChainID

func (r *Rules) ChainID() ids.ID

func (*Rules) FetchCustom

func (*Rules) FetchCustom(string) (any, bool)

func (*Rules) GetBaseComputeUnits

func (r *Rules) GetBaseComputeUnits() uint64

func (*Rules) GetBaseWarpComputeUnits

func (r *Rules) GetBaseWarpComputeUnits() uint64

func (*Rules) GetMaxBlockUnits

func (r *Rules) GetMaxBlockUnits() chain.Dimensions

func (*Rules) GetMinBlockGap

func (r *Rules) GetMinBlockGap() int64

func (*Rules) GetMinEmptyBlockGap

func (r *Rules) GetMinEmptyBlockGap() int64

func (*Rules) GetMinUnitPrice

func (r *Rules) GetMinUnitPrice() chain.Dimensions

func (*Rules) GetOutgoingWarpComputeUnits

func (r *Rules) GetOutgoingWarpComputeUnits() uint64

func (*Rules) GetSponsorStateKeysMaxChunks

func (*Rules) GetSponsorStateKeysMaxChunks() []uint16

func (*Rules) GetStorageKeyAllocateUnits

func (r *Rules) GetStorageKeyAllocateUnits() uint64

func (*Rules) GetStorageKeyReadUnits

func (r *Rules) GetStorageKeyReadUnits() uint64

func (*Rules) GetStorageKeyWriteUnits

func (r *Rules) GetStorageKeyWriteUnits() uint64

func (*Rules) GetStorageValueAllocateUnits

func (r *Rules) GetStorageValueAllocateUnits() uint64

func (*Rules) GetStorageValueReadUnits

func (r *Rules) GetStorageValueReadUnits() uint64

func (*Rules) GetStorageValueWriteUnits

func (r *Rules) GetStorageValueWriteUnits() uint64

func (*Rules) GetUnitPriceChangeDenominator

func (r *Rules) GetUnitPriceChangeDenominator() chain.Dimensions

func (*Rules) GetValidityWindow

func (r *Rules) GetValidityWindow() int64

func (*Rules) GetWarpComputeUnitsPerSigner

func (r *Rules) GetWarpComputeUnitsPerSigner() uint64

func (*Rules) GetWarpConfig

func (*Rules) GetWarpConfig(ids.ID) (bool, uint64, uint64)

func (*Rules) GetWindowTargetUnits

func (r *Rules) GetWindowTargetUnits() chain.Dimensions

func (*Rules) NetworkID

func (r *Rules) NetworkID() uint32

Jump to

Keyboard shortcuts

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