params

package
v0.0.0-...-c0ba9c8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainNetworkId = 99
	TestNetworkId = 101
	DevNetworkId  = 100
	NetworkId188  = 188
)
View Source
const (
	// These are the multipliers for MOAC denominations.
	// Example: To get the sha value of an amount in 'Grand', use
	//
	//    new(big.Int).Mul(value, big.NewInt(params.Grand))
	//
	Sha     = 1
	Femtomc = 1e3
	Picomc  = 1e6
	Xiao    = 1e9
	Sand    = 1e12
	Milli   = 1e15
	Mc      = 1e18
	Moac    = 1e18
	Grand   = 1e21
)
View Source
const (
	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains.
	BloomBitsBlocks uint64 = 4096

	TimerPingInterval time.Duration = 1

	DirectCallLimitPerBlock = 2048
	DirectCallGasLimit      = 4000000

	SubchainMsgLimit = 10000
	ScsMsgLimit      = 1000

	DirectCall   = 1
	BroadCast    = 2
	ControlMsg   = 3
	ScsShakeHand = 4
	ScsPing      = 5

	// None            = -1
	RegOpen         = 0
	RegClose        = 1
	CreateProposal  = 2
	DisputeProposal = 3
	ApproveProposal = 4
	RegAdd          = 5
	RegAsMonitor    = 6
	RegAsBackup     = 7
)
View Source
const (
	MaximumExtraDataSize  uint64 = 32    // Maximum size extra data may be after Genesis.
	ExpByteGas            uint64 = 10    // Times ceil(log256(exponent)) for the EXP instruction.
	SloadGas              uint64 = 50    // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
	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.
	TxGas                 uint64 = 1000  // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. ori 21000
	TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
	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.
	LogDataGas            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.
	SstoreClearGas   uint64 = 5000  // Once per SSTORE operation if the zeroness doesn't change.
	SstoreRefundGas  uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero.
	JumpdestGas      uint64 = 1     // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
	EpochDuration    uint64 = 30000 // Duration between proof-of-work epochs.
	CallGas          uint64 = 40    // Once per CALL operation & message call transaction.
	CreateDataGas    uint64 = 200   //
	CallCreateDepth  uint64 = 1024  // Maximum depth of call/create stack.
	ExpGas           uint64 = 10    // Once per EXP instruction
	LogGas           uint64 = 375   // Per LOG* operation.
	CopyGas          uint64 = 3     //
	StackLimit       uint64 = 1024  // Maximum size of VM stack allowed.
	TierStepGas      uint64 = 0     // Once per operation, for a selection of them.
	LogTopicGas      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.
	SuicideRefundGas uint64 = 24000 // Refunded following a suicide operation.
	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
	NuwaMaxCodeSize = 51200 // 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    // GasRemaining needed for an elliptic curve addition
	Bn256ScalarMulGas       uint64 = 40000  // GasRemaining 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
	SystemContractGas       uint64 = 0      // system contract gas
	NotifyScsGas            uint64 = 2000   // GasRemaining used to notify SCS
)

MOAC Need to update the parameters

View Source
const (
	VersionName  = "nuwa" // Major version name in the Roadmap: Pangu 0.8; Nuwa 1.0; Fuxi 1.1; Shennong 1.2;
	VersionMajor = 1      // Major version component of the current release
	VersionMinor = 0      // Minor version component of the current release
	VersionPatch = 4      // Patch version component of the current release
	VersionMeta  = "rc"   // Version metadata to append to the version string
)

2018/03/20, 1st release is Pangu 0.8.0 2018/07/28, nuwa test version 1.0.0 2018/09/20, nuwa version 1.0.3, fixed memory leaking issue under pressure test.

Variables

View Source
var (
	SCSService             = false
	ShowToPublic           = false
	VnodeServiceCfg        = "localhost:50062"
	VnodeBeneficialAddress = ""
	VnodeIp                = ""
)

Updated 2018/04/10 default value for the SCS service

View Source
var (
	MainnetGenesisHash = common.HexToHash("0x6b9661646439fab926ffc9bccdf3abb572d5209ae59e3390abf76aee4e2d49cd") // Mainnet genesis hash to enforce below configs on
	TestnetGenesisHash = common.HexToHash("0xb44f499ad420fbba3d4a7e05e9485cddc0e70e3e3622919a5d945e9ed4f7699c") // Testnet genesis hash to enforce below configs on
)
View Source
var (
	// MainnetChainConfig is the chain parameters to run a node on the main network.
	MainnetChainConfig = &ChainConfig{
		ChainId:            big.NewInt(MainNetworkId),
		PanguBlock:         big.NewInt(0),
		RemoveEmptyAccount: true,

		NuwaBlock: big.NewInt(647200),

		Ethash: new(EthashConfig),
	}

	// TestnetChainConfig contains the chain parameters to run a node on the test network.
	TestnetChainConfig = &ChainConfig{
		ChainId:            big.NewInt(TestNetworkId),
		PanguBlock:         big.NewInt(0),
		RemoveEmptyAccount: true,

		NuwaBlock: big.NewInt(616700),

		Ethash: new(EthashConfig),
	}

	AllProtocolChanges = &ChainConfig{big.NewInt(DevNetworkId), big.NewInt(0), true, big.NewInt(0), new(EthashConfig)} //, nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), new(EthashConfig), nil}
	TestChainConfig    = &ChainConfig{big.NewInt(DevNetworkId), big.NewInt(0), true, big.NewInt(0), new(EthashConfig)} //, nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), new(EthashConfig), nil}

	TestRules = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	GasLimitBoundDivisor   = big.NewInt(1024)                  // The bound divisor of the gas limit, used in update calculations.
	MinGasLimit            = big.NewInt(5000)                  // Minimum the gas limit may ever be.
	GenesisGasLimit        = big.NewInt(9000000)               // GasRemaining limit of the Genesis block.
	TargetGasLimit         = new(big.Int).Set(GenesisGasLimit) // The artificial target
	DifficultyBoundDivisor = big.NewInt(2048)                  // The bound divisor of the difficulty, used in the update calculations.
	GenesisDifficulty      = big.NewInt(131072)                // Difficulty of the Genesis block.
	MinimumDifficulty      = big.NewInt(131072)                // The minimum that the difficulty may ever be.
	DurationLimit          = big.NewInt(13)                    // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
)
View Source
var DAOForkBlockExtra = common.FromHex("0x64616f2d686172642d666f726b")

DAOForkBlockExtra is the block header extra-data field to set for the DAO fork point and a number of consecutive blocks to allow fast/light syncers to correctly pick the side they want ("dao-hard-fork").

View Source
var DAOForkExtraRange = big.NewInt(10)

DAOForkExtraRange is the number of consecutive blocks from the DAO fork point to override the extra-data in to prevent no-fork attacks.

View Source
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")

DAORefundContract is the address of the refund contract to send DAO balances to.

View Source
var (

	//	GasTableEIP158 = GasTable{
	//With high ExpBytes gas
	GasTablePangu = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     50,

		CreateBySuicide: 25000,
	}
)
View Source
var MainnetBootnodes = []string{

	"enode://3d8ba7cef2dcc8e25bd508e6a42d7b36a957afe8dc5cd9603ffd0857aae68b2768a06de6054816edec407a4579b15b5c7494e9c7e8323b015d6e9d518576e9eb@18.233.50.84:30333",
	"enode://6f29307c8715502c11791704759d88910e091f5d4a6daf509fc9d0d8653967fd2cda76c94731e2db6654ff889a684a55f9a6bc6f0b3144282eb2c3e7cbccb4b1@18.211.187.153:30333",
	"enode://1cf0eb6052ee692e85cf5447c9b1ef95c57f23e2efe1cd8cd5a01b44feadc3395f3aa02e0b1130dffcfdac3225b3ce8d773bfd148efadc3846353337a45c99a2@54.71.244.228:30333",
	"enode://bebab9587e939fab7e21922864cdf6668193e1fcfe5f69ef128216c96e5e08dae1a8d9b99e0cb158bd040c9ac249c3569d43675f0e637fb2cf9e2df9e39738d7@52.34.175.72:30333",

	"enode://68c48e272a78e288c9e86ca2c272cf51ed9dbbe305e8f257cf347b4282dc04bc404ca25178025661216b4f15d610b1d536ab3c8610ca4357251ba85451a889c4@18.130.240.247:30333",

	"enode://624c26083a9be2ac0624bc5e4d88633aca89f62bbca1e7929a05bfc9f06a42202168b12ed5303f95e26296f8092d07b61071eedaccfe7027ceb0e7330589bc5c@13.211.142.153:30333",

	"enode://4c8fac5ed1f8e5676d8f6b722fdb69b289dd58fe5844f0ae036b9d257bc6c4ebb94641cd590f8d7ed282c7690217eaf17898712b974ce23cfccbe167edc1faa0@35.182.237.1:30333",

	"enode://ab485ba14e3955cedeff78ef760bc34c450f80396ea5f2c9a2669e2aa7d16dec014a6772a5eacd3726f8ee83cc0877ce2c0cf2a9a95b6e3e239df15bcbe52d58@47.88.237.205:30333",

	"enode://3303754238a2a2f07aadf7683224768c562822517e270b38fad7cf6df9c1af6d94a42ce361bbe965a38f2a2b1dfc2873518a8c20a5a004e8aa105d3bc3dd4a8b@47.74.9.125:30333",

	"enode://9675508dfc11685d762f0b95f9f939af872baf2d2f289e6b142768030dd62a8f413fc7baa6bd2744a4ec7bf8d001ed59dc82e47e46702092097dcc7a7f08beee@139.198.122.215:30333",
}
View Source
var TestnetBootnodes = []string{

	"enode://e88a288b19e55a79cdeabd9c5326602dbb2ba5a5e29eca66bdddf20d598cf7126fce9080b53399ef02e200891cd590b6ff9c23a8c15789f04790d1e69054bd9c@39.108.79.40:30333",

	"enode://fcb843289fb0b692fc9d2449e8dce7b9143b735263f99c594d8c5c196f1cff9066812b5b978cca13edf17efa712f0e3e776f6880f92bc5fd58d0d27e3239f8d6@47.98.255.26:30333",

	"enode://154ce8ba69e7a24c237a4c69928c814b4341877e623d9a0ce373ce97132d098c3c671122049ae85e5d081e8763a4d0f38178736457bd7197a6b75a49fa50156d@107.155.107.194:30333",

	"enode://a44e287b1a3e2f6e898d92469242b42360f05f701594bc098b21930799ef41f92fe6c51cc51a1ca49ff4b887c63abd9c7a9786fba4317ab851d5c6043829b3ac@107.155.125.100:30333",

	"enode://77fa8dd1bd80002f16abb9ea9fe7073025ba20b3d494eedb0980a859200a45b2de585be9071cbeada2f49904ac888b6423e1c4bcde3e57e543c423a9fa68c5c3@107.155.125.100:30333",
}

TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Pangu 0.8.1 test network.

View Source
var Version = func() string {
	v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

Version holds the textual version string.

View Source
var VersionNum = func() string {
	v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
	return v
}()

VersionNum only returns the version number.

View Source
var VersionWithName = func() string {
	v := fmt.Sprintf("%s %d.%d.%d", VersionName, VersionMajor, VersionMinor, VersionPatch)
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

Version holds the textual version string with Full name.

Functions

func DAODrainList

func DAODrainList() []common.Address

DAODrainList is the list of accounts whose full balances will be moved into a refund contract at the beginning of the dao-fork block.

func VersionWithCommit

func VersionWithCommit(gitCommit string) string

Types

type ChainConfig

type ChainConfig struct {
	ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection

	PanguBlock         *big.Int `json:"panguBlock,omitempty"`         // Pangu switch block (nil = no fork, 0 = already pangu)
	RemoveEmptyAccount bool     `json:"removeEmptyAccount,omitempty"` //Replace EIP158 check and should be set to true

	NuwaBlock *big.Int `json:"nuwaBlock,omitempty"` // nuwa switch block (nil = no fork, 0 = already on nuwa)

	// Various consensus engines
	Ethash *EthashConfig `json:"ethash,omitempty"`
}

ChainConfig is the core config which determines the blockchain settings.

ChainConfig is stored in the database on a per block basis. This means that any network, identified by its genesis block, can have its own set of configuration options. default is to omitempty Accounts EIP158

func (*ChainConfig) CheckCompatible

func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError

CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.

func (*ChainConfig) GasTable

func (c *ChainConfig) GasTable(num *big.Int) GasTable

GasTable returns the gas table corresponding to the current phase (pangu or pangu reprice).

The returned GasTable's fields shouldn't, under any circumstances, be changed. Used the

func (*ChainConfig) IsNuwa

func (c *ChainConfig) IsNuwa(num *big.Int) bool

func (*ChainConfig) IsPangu

func (c *ChainConfig) IsPangu(num *big.Int) bool

IsPangu returns whether num is either equal to the pangu block or greater.

func (*ChainConfig) IsRemoveEmptyAccount

func (c *ChainConfig) IsRemoveEmptyAccount(num *big.Int) bool

Remove the Empty account To replace the EIP158Block check Default is to remove all empty Accounts

func (*ChainConfig) Rules

func (c *ChainConfig) Rules(num *big.Int) Rules

Pangu 0.8 version

func (*ChainConfig) String

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface. Removed the uncessary

type CliqueConfig

type CliqueConfig struct {
	Period uint64 `json:"period"` // Number of seconds between blocks to enforce
	Epoch  uint64 `json:"epoch"`  // Epoch length to reset votes and checkpoint
}

Not used CliqueConfig is the consensus engine configs for proof-of-authority based sealing.

func (*CliqueConfig) String

func (c *CliqueConfig) String() string

String implements the stringer interface, returning the consensus engine details.

type ConfigCompatError

type ConfigCompatError struct {
	What string
	// block numbers of the stored and new configurations
	StoredConfig, NewConfig *big.Int
	// the block number to which the local chain must be rewound to correct the error
	RewindTo uint64
}

ConfigCompatError is raised if the locally-stored blockchain is initialised with a ChainConfig that would alter the past.

func (*ConfigCompatError) Error

func (err *ConfigCompatError) Error() string

type EthashConfig

type EthashConfig struct{}

EthashConfig is the consensus engine configs for proof-of-work based sealing.

func (*EthashConfig) String

func (c *EthashConfig) String() string

String implements the stringer interface, returning the consensus engine details.

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 Rules

type Rules struct {
	ChainId *big.Int
	IsPangu bool
	IsNuwa  bool
}

Rules wraps ChainConfig and is merely syntatic sugar or can be used for functions that do not have or require information about the block.

Rules is a one time interface meaning that it shouldn't be used in between transition phases.

type ScsKind

type ScsKind int64
const (
	None ScsKind = iota
	ConsensusScs
	MonitorScs
	BackupScs
	MatchSelTarget
)

Jump to

Keyboard shortcuts

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