appconsts

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 18

Documentation

Index

Constants

View Source
const (
	TimeoutPropose = time.Second * 10
	TimeoutCommit  = time.Second * 11
	// GoalBlockTime is the target time interval between blocks. Since the block
	// interval isn't enforced at consensus, the real block interval isn't
	// guaranteed to exactly match GoalBlockTime. GoalBlockTime is currently targeted
	// through static timeouts (i.e. TimeoutPropose, TimeoutCommit).
	GoalBlockTime = time.Second * 15
)
View Source
const (
	// NamespaceVersionSize is the size of a namespace version in bytes.
	NamespaceVersionSize = 1
	// NamespaceVersionMaxValue is the maximum value a namespace version can be.
	// This const must be updated if NamespaceVersionSize is changed.
	NamespaceVersionMaxValue = math.MaxUint8

	// NamespaceIDSize is the size of a namespace ID in bytes.
	NamespaceIDSize = 28

	// NamespaceSize is the size of a namespace (version + ID) in bytes.
	NamespaceSize = NamespaceVersionSize + NamespaceIDSize

	// ShareSize is the size of a share in bytes.
	ShareSize = 512

	// ShareInfoBytes is the number of bytes reserved for information. The info
	// byte contains the share version and a sequence start idicator.
	ShareInfoBytes = 1

	// SequenceLenBytes is the number of bytes reserved for the sequence length
	// that is present in the first share of a sequence.
	SequenceLenBytes = 4

	// ShareVersionZero is the first share version format.
	ShareVersionZero = uint8(0)

	// DefaultShareVersion is the defacto share version. Use this if you are
	// unsure of which version to use.
	DefaultShareVersion = ShareVersionZero

	// CompactShareReservedBytes is the number of bytes reserved for the location of
	// the first unit (transaction, ISR) in a compact share.
	CompactShareReservedBytes = 4

	// FirstCompactShareContentSize is the number of bytes usable for data in
	// the first compact share of a sequence.
	FirstCompactShareContentSize = ShareSize - NamespaceSize - ShareInfoBytes - SequenceLenBytes - CompactShareReservedBytes

	// ContinuationCompactShareContentSize is the number of bytes usable for
	// data in a continuation compact share of a sequence.
	ContinuationCompactShareContentSize = ShareSize - NamespaceSize - ShareInfoBytes - CompactShareReservedBytes

	// FirstSparseShareContentSize is the number of bytes usable for data in the
	// first sparse share of a sequence.
	FirstSparseShareContentSize = ShareSize - NamespaceSize - ShareInfoBytes - SequenceLenBytes

	// ContinuationSparseShareContentSize is the number of bytes usable for data
	// in a continuation sparse share of a sequence.
	ContinuationSparseShareContentSize = ShareSize - NamespaceSize - ShareInfoBytes

	// MinSquareSize is the smallest original square width.
	MinSquareSize = 1

	// MinshareCount is the minimum number of shares allowed in the original
	// data square.
	MinShareCount = MinSquareSize * MinSquareSize

	// MaxShareVersion is the maximum value a share version can be.
	MaxShareVersion = 127

	// BondDenom defines the native staking denomination
	BondDenom = "utia"
)

These constants were originally sourced from: https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/consensus.md#constants

They can not change throughout the lifetime of a network.

View Source
const (
	// DefaultGovMaxSquareSize is the default value for the governance modifiable
	// max square size.
	DefaultGovMaxSquareSize = 64

	// DefaultMaxBytes is the default value for the governance modifiable
	// maximum number of bytes allowed in a valid block.
	DefaultMaxBytes = DefaultGovMaxSquareSize * DefaultGovMaxSquareSize * ContinuationSparseShareContentSize

	// DefaultGasPerBlobByte is the default gas cost deducted per byte of blob
	// included in a PayForBlobs txn
	DefaultGasPerBlobByte = 8

	// DefaultMinGasPrice is the default min gas price that gets set in the app.toml file.
	// The min gas price acts as a filter. Transactions below that limit will not pass
	// a nodes `CheckTx` and thus not be proposed by that node.
	DefaultMinGasPrice = 0.002

	// DefaultUnbondingTime is the default time a validator must wait
	// to unbond in a proof of stake system. Any validator within this
	// time can be subject to slashing under conditions of misbehavior.
	DefaultUnbondingTime = 3 * 7 * 24 * time.Hour
)

The following defaults correspond to initial parameters of the network that can be changed, not via app versions but other means such as on-chain governance, or the nodes local config

View Source
const (
	LatestVersion = v1.Version
)

Variables

View Source
var (
	// DataCommitmentBlocksLimit is the maximnum number of blocks that a data commitment can span
	DataCommitmentBlocksLimit = consts.DataCommitmentBlocksLimit

	// NewBaseHashFunc is the base hash function used by NMT. Change accordingly
	// if another hash.Hash should be used as a base hasher in the NMT.
	NewBaseHashFunc = consts.NewBaseHashFunc

	// DefaultCodec is the default codec creator used for data erasure.
	DefaultCodec = rsmt2d.NewLeoRSCodec

	// SupportedShareVersions is a list of supported share versions.
	SupportedShareVersions = []uint8{ShareVersionZero}
)
View Source
var (
	DefaultSubtreeRootThreshold = SubtreeRootThreshold(LatestVersion)
	DefaultSquareSizeUpperBound = SquareSizeUpperBound(LatestVersion)
)

Functions

func HashLength added in v1.0.0

func HashLength() int

HashLength returns the length of a hash in bytes.

func SquareSizeUpperBound added in v1.0.0

func SquareSizeUpperBound(_ uint64) int

SquareSizeUpperBound is the maximum original square width possible for a version of the state machine. The maximum is decided through governance. See `DefaultGovMaxSquareSize`.

func SubtreeRootThreshold added in v1.0.0

func SubtreeRootThreshold(_ uint64) int

SubtreeRootThreshold works as a target upper bound for the number of subtree roots in the share commitment. If a blob contains more shares than this number, then the height of the subtree roots will increase by one so that the number of subtree roots in the share commitment decreases by a factor of two. This step is repeated until the number of subtree roots is less than the SubtreeRootThreshold.

The rationale for this value is described in more detail in ADR-013.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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