params

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: LGPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	GasLimitBoundDivisor uint64 = 1024      // The bound divisor of the gas limit, used in update calculations.
	MinGasLimit          uint64 = 200000    // Minimum the gas limit may ever be.
	GenesisGasLimit      uint64 = 105000000 // Gas limit of the Genesis block.

	CallValueTransferGas uint64 = 9000  // Paid for CALL when the value transfer is non-zero.
	CallNewAccountGas    uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.

	OrdinaryTxGas         uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
	TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
	VoteTxGas             uint64 = 35000 // 投票交易固定gas消耗
	RegisterTxGas         uint64 = 92000 // 注册候选节点固定gas消耗
	CreateAssetTxGas      uint64 = 67000 // 创建资产固定gas消耗
	IssueAssetTxGas       uint64 = 55000 // 发行资产固定gas消耗
	ReplenishAssetTxGas   uint64 = 25000 // 增发资产固定gas消耗
	ModifyAssetTxGas      uint64 = 35000 // 修改资产info固定gas消耗
	TransferAssetTxGas    uint64 = 30000 // 交易资产固定gas消耗
	ModifySigsTxGas       uint64 = 67000 // 设置多重签名账户交易固定gas消耗
	BoxTxGas              uint64 = 40000 // 设置箱子交易固定gas消耗

	TxMessageGas  uint64 = 68    // 交易中的message字段消耗gas
	TxDataZeroGas uint64 = 4     // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
	QuadCoeffDiv  uint64 = 512   // Divisor for the quadratic particle of the memory cost equation.
	SstoreSetGas  uint64 = 20000 // Once per SLOAD operation.
	EventDataGas  uint64 = 8     // Per byte in a LOG* operation's data.
	CallStipend   uint64 = 2300  // Free gas given at beginning of call.

	Sha3Gas          uint64 = 30    // Once per SHA3 operation.
	Sha3WordGas      uint64 = 6     // Once per word of the SHA3 operation's data.
	SstoreResetGas   uint64 = 5000  // Once per SSTORE operation if the zeroness changes from zero.
	JumpdestGas      uint64 = 1     // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
	CreateDataGas    uint64 = 200   //
	CallCreateDepth  uint64 = 1024  // Maximum depth of call/create stack.
	EventGas         uint64 = 375   // Per LOG* operation.
	CopyGas          uint64 = 3     //
	StackLimit       uint64 = 1024  // Maximum size of VM stack allowed.
	EventTopicGas    uint64 = 375   // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.
	CreateGas        uint64 = 32000 // Once per CREATE operation & contract-creation transaction.
	MemoryGas        uint64 = 3     // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL.
	TxDataNonZeroGas uint64 = 68    // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.

	MaxCodeSize = 24576 // Maximum bytecode to permit for a contract

	EcrecoverGas            uint64 = 3000   // Elliptic curve sender recovery gas price
	Sha256BaseGas           uint64 = 60     // Base price for a SHA256 operation
	Sha256PerWordGas        uint64 = 12     // Per-word price for a SHA256 operation
	Ripemd160BaseGas        uint64 = 600    // Base price for a RIPEMD160 operation
	Ripemd160PerWordGas     uint64 = 120    // Per-word price for a RIPEMD160 operation
	IdentityBaseGas         uint64 = 15     // Base price for a data copy operation
	IdentityPerWordGas      uint64 = 3      // Per-work price for a data copy operation
	ModExpQuadCoeffDiv      uint64 = 20     // Divisor for the quadratic particle of the big int modular exponentiation
	Bn256AddGas             uint64 = 500    // Gas needed for an elliptic curve addition
	Bn256ScalarMulGas       uint64 = 40000  // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGas     uint64 = 100000 // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGas uint64 = 80000  // Per-point price for an elliptic curve pairing check

	ForceSyncInternal           = 10 * time.Second // time to force sync blocks from other nodes
	DiscoverInternal            = 10 * time.Second // time to discover new peer node
	LeastPeersToDiscover        = 5                // start to discover if the number of peers is less than this
	MaxPackageLength     uint32 = 25 * 1024 * 1024 // 25M
	MaxTxsForMiner              = 10000            // max number of transactions when mining a block
)
View Source
const (
	// Max bytes length of extra data in block header
	MaxExtraDataLen = 256
	// Max acceptable transaction's life time. For control tx pool size.
	// Transactions will stay in tx pool till they expired or be packaged
	MaxTxLifeTime = 30 * 60
)
View Source
const (
	OrdinaryTx       uint16 = 0  // 普通交易,包括转账交易和调用智能合约交易
	CreateContractTx uint16 = 1  // 创建智能合约交易
	VoteTx           uint16 = 2  // 用户发送投票交易
	RegisterTx       uint16 = 3  // 申请参加竞选节点投票交易
	CreateAssetTx    uint16 = 4  // 创建资产
	IssueAssetTx     uint16 = 5  // 发行资产
	ReplenishAssetTx uint16 = 6  // 增发资产交易
	ModifyAssetTx    uint16 = 7  // 修改资产交易
	TransferAssetTx  uint16 = 8  // 交易资产
	ModifySignersTx  uint16 = 9  // 设置多重签名账户的签名者交易
	BoxTx            uint16 = 10 // 箱子交易

)

tx type

View Source
const (
	VersionMajor = 1 // Major version component of the current release
	VersionMinor = 4 // Minor version component of the current release
	VersionPatch = 3 // Patch version component of the current release
)

Variables

View Source
var (
	TermDuration            uint32 = 1000000                       // 每届间隔
	InterimDuration         uint32 = 1000                          // 过渡期
	RewardCheckHeight       uint32 = 100000                        // The height to check if miners' reward is set
	ReleaseEvilNodeDuration uint32 = 30000                         // 释放作恶节点的过度期高度30000个区块,按照3秒出块大概24h
	MinGasPrice                    = big.NewInt(1000000000)        // 默认的最低gas price 为1G mo
	MinCandidateDeposit            = common.Lemo2Mo("5000000")     // 注册成为候选节点的质押金额最小值
	DepositPoolAddress             = common.HexToAddress("0x1001") // 设置接收注册候选节点押金费用1000LEMO的地址
	DepositExchangeRate            = common.Lemo2Mo("100")         // 质押金额兑换票数兑换率 100LEMO换1票
	VoteExchangeRate               = common.Lemo2Mo("200")         // 投票票数兑换率 200LEMO换1票

	TermRewardPoolTotal = common.Lemo2Mo("900000000") // 奖励池总量
	TermRewardContract  = common.HexToAddress("0x09") // 换届奖励的预编译合约地址
	MinRewardPrecision  = common.Lemo2Mo("1")         // 1 LEMO

	MinerExtra = "" // the message in block leaved by miner. this const needs be moved to config file
)
View Source
var (
	DefaultGasTable = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     50,

		CreateBySuicide: 25000,
	}
)
View Source
var (
	TargetGasLimit uint64 = GenesisGasLimit // The artificial target
)
View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()
View Source
var VersionUint = func() uint32 {
	return VersionMajor*1000000 + VersionMinor*1000 + VersionPatch
}

Functions

This section is empty.

Types

type GasTable

type GasTable struct {
	ExtcodeSize uint64
	ExtcodeCopy uint64
	Balance     uint64
	SLoad       uint64
	Calls       uint64
	Suicide     uint64

	ExpByte uint64

	// CreateBySuicide occurs when the
	// refunded account is one that does
	// not exist. This logic is similar
	// to call. May be left nil. Nil means
	// not charged.
	CreateBySuicide uint64
}

type Reward added in v1.1.1

type Reward struct {
	Term  uint32   `json:"term" gencodec:"required"`
	Value *big.Int `json:"value" gencodec:"required"`
	Times uint32   `json:"times" gencodec:"required"`
}

func (Reward) MarshalJSON added in v1.1.1

func (r Reward) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Reward) UnmarshalJSON added in v1.1.1

func (r *Reward) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type RewardJson added in v1.1.1

type RewardJson struct {
	Term  uint32   `json:"term" gencodec:"required"`
	Value *big.Int `json:"value" gencodec:"required"`
}

func (RewardJson) MarshalJSON added in v1.1.1

func (r RewardJson) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RewardJson) UnmarshalJSON added in v1.1.1

func (r *RewardJson) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type RewardJsonMarshaling added in v1.1.1

type RewardJsonMarshaling struct {
	Term  hexutil.Uint32
	Value *hexutil.Big10
}

type RewardMarshaling added in v1.1.1

type RewardMarshaling struct {
	Term  hexutil.Uint32
	Value *hexutil.Big10
	Times hexutil.Uint32
}

type RewardsMap added in v1.1.1

type RewardsMap map[uint32]*Reward

The map to store the miner's reward

Jump to

Keyboard shortcuts

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