core

package
v1.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package core holds core protocol types and constants

Index

Constants

View Source
const SnapshotMajorFormat = "snapshot-major-block-%09d.bpt"
View Source
const ValidatorUpdateAdd = 1
View Source
const ValidatorUpdateRemove = 2

Variables

View Source
var Cron = cron.NewParser(cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)
View Source
var SnapshotMajorRegexp = regexp.MustCompile(`snapshot-major-block-\d+.bpt`)

Functions

This section is empty.

Types

type BigRat

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

func NewBigRat

func NewBigRat(num, denom int64) *BigRat

func (*BigRat) Div

func (x *BigRat) Div(y *BigRat) *BigRat

Div returns xₙ/yₙ · yₘ/xₘ.

func (*BigRat) Div2

func (x *BigRat) Div2(num, denom int64) *BigRat

Div returns xₙ/num · denom/xₘ.

func (*BigRat) Float64

func (x *BigRat) Float64() float64

Float64 returns xₙ/xₘ.

func (*BigRat) Int

func (x *BigRat) Int() *big.Int

Int returns xₙ/xₘ.

func (*BigRat) Mul

func (x *BigRat) Mul(y *BigRat) *BigRat

Mul returns xₙ/xₘ · yₙ/yₘ.

func (*BigRat) Mul2

func (x *BigRat) Mul2(num, denom int64) *BigRat

Mul2 returns xₙ/xₘ · num/denom.

func (*BigRat) Simplify

func (x *BigRat) Simplify() *BigRat

Simplify returns xₙ/xₘ with both parts reduced by their GCD.

type GlobalValues

type GlobalValues struct {
	Oracle  *protocol.AcmeOracle        `json:"oracle,omitempty" form:"oracle" query:"oracle" validate:"required"`
	Globals *protocol.NetworkGlobals    `json:"globals,omitempty" form:"globals" query:"globals" validate:"required"`
	Network *protocol.NetworkDefinition `json:"network,omitempty" form:"network" query:"network" validate:"required"`
	Routing *protocol.RoutingTable      `json:"routing,omitempty" form:"routing" query:"routing" validate:"required"`
	// ExecutorVersion is the active executor version.
	ExecutorVersion protocol.ExecutorVersion `json:"executorVersion,omitempty" form:"executorVersion" query:"executorVersion"`
	// contains filtered or unexported fields
}

func NewGlobals

func NewGlobals(g *GlobalValues) *GlobalValues

NewGlobals returns GlobalValues with uninitialized values set to the default.

func (*GlobalValues) AsSigner

func (g *GlobalValues) AsSigner(partition string) *globalSigner

func (*GlobalValues) Copy

func (v *GlobalValues) Copy() *GlobalValues

func (*GlobalValues) CopyAsInterface

func (v *GlobalValues) CopyAsInterface() interface{}

func (*GlobalValues) DiffValidators

func (g *GlobalValues) DiffValidators(h *GlobalValues, partitionID string) (map[[32]byte]ValidatorUpdate, error)

func (*GlobalValues) Equal

func (v *GlobalValues) Equal(u *GlobalValues) bool

func (*GlobalValues) FormatGlobals

func (g *GlobalValues) FormatGlobals() protocol.DataEntry

func (*GlobalValues) FormatNetwork

func (g *GlobalValues) FormatNetwork() protocol.DataEntry

func (*GlobalValues) FormatOracle

func (g *GlobalValues) FormatOracle() protocol.DataEntry

func (*GlobalValues) FormatRouting

func (g *GlobalValues) FormatRouting() protocol.DataEntry

func (*GlobalValues) InitializeDataAccounts added in v1.0.2

func (g *GlobalValues) InitializeDataAccounts(net config.NetworkUrl, getState getStateFunc, putState putStateFunc) error

InitializeDataAccounts sets the initial state of the network data accounts for genesis.

func (*GlobalValues) IsValid added in v1.1.0

func (v *GlobalValues) IsValid() error

func (*GlobalValues) Load

func (g *GlobalValues) Load(net config.NetworkUrl, getState getStateFunc) error

func (*GlobalValues) MarshalBinary added in v1.1.0

func (v *GlobalValues) MarshalBinary() ([]byte, error)

func (*GlobalValues) MarshalJSON added in v1.1.0

func (v *GlobalValues) MarshalJSON() ([]byte, error)

func (*GlobalValues) ParseGlobals

func (g *GlobalValues) ParseGlobals(entry protocol.DataEntry) error

func (*GlobalValues) ParseNetwork

func (g *GlobalValues) ParseNetwork(entry protocol.DataEntry) error

func (*GlobalValues) ParseOracle

func (g *GlobalValues) ParseOracle(entry protocol.DataEntry) error

func (*GlobalValues) ParseRouting

func (g *GlobalValues) ParseRouting(entry protocol.DataEntry) error

func (*GlobalValues) UnmarshalBinary added in v1.1.0

func (v *GlobalValues) UnmarshalBinary(data []byte) error

func (*GlobalValues) UnmarshalBinaryFrom added in v1.1.0

func (v *GlobalValues) UnmarshalBinaryFrom(rd io.Reader) error

func (*GlobalValues) UnmarshalJSON added in v1.1.0

func (v *GlobalValues) UnmarshalJSON(b []byte) error

func (*GlobalValues) ValidatorThreshold

func (g *GlobalValues) ValidatorThreshold(partition string) uint64

type Hash

type Hash []byte

func (Hash) As32

func (h Hash) As32() [32]byte

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Combine

func (h Hash) Combine(g Hash) Hash

func (Hash) Copy

func (h Hash) Copy() Hash

type ValidatorUpdate

type ValidatorUpdate int

Directories

Path Synopsis
block

Jump to

Keyboard shortcuts

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