mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Merge branch 'CLO/1.0'
This commit is contained in:
commit
9a36d3afc1
7 changed files with 90 additions and 72 deletions
|
|
@ -587,7 +587,7 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
|
|||
// setBootstrapNodes creates a list of bootstrap nodes from the command line
|
||||
// flags, reverting to pre-configured ones if none have been specified.
|
||||
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||
urls := params.MainnetBootnodes
|
||||
urls := params.CallistoMainnetBootnodes
|
||||
switch {
|
||||
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV4Flag.Name):
|
||||
if ctx.GlobalIsSet(BootnodesV4Flag.Name) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import (
|
|||
// Ethash proof-of-work protocol constants
|
||||
// Callisto reward 600 CLO.
|
||||
var (
|
||||
callistoBlockReward, _ = new(big.Int).SetString("600000000000000000000", 10) // Block reward in wei for successfully mining a block
|
||||
//callistoBlockReward, _ = new(big.Int).SetString("600000000000000000000", 10) // Block reward in wei for successfully mining a block
|
||||
FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
|
||||
ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
|
||||
maxUncles = 2 // Maximum number of uncles allowed in a single block
|
||||
|
|
@ -299,8 +299,8 @@ func (ethash *Ethash) CalcDifficulty(chain consensus.ChainReader, time uint64, p
|
|||
func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Header) *big.Int {
|
||||
next := new(big.Int).Add(parent.Number, big1)
|
||||
switch {
|
||||
case config.IsCallisto(next):
|
||||
return calcDifficultyCallisto(time, parent)
|
||||
//case config.IsCallisto(next):
|
||||
// return calcDifficultyCallisto(time, parent)
|
||||
case config.IsByzantium(next):
|
||||
return calcDifficultyByzantium(time, parent)
|
||||
case config.IsHomestead(next):
|
||||
|
|
@ -593,19 +593,16 @@ func accumulateRewards(config *params.ChainConfig, state *state.StateDB, header
|
|||
// Select the correct block reward based on chain progression
|
||||
blockReward := FrontierBlockReward
|
||||
|
||||
if config.IsCallisto(header.Number) {
|
||||
blockReward = callistoBlockReward
|
||||
}
|
||||
|
||||
if config.IsByzantium(header.Number) && !config.IsCallisto(header.Number) {
|
||||
if config.IsByzantium(header.Number) {
|
||||
blockReward = ByzantiumBlockReward
|
||||
}
|
||||
|
||||
treasuryPercent := getTreasuryPercent(header)
|
||||
if config.IsCallisto(header.Number) {
|
||||
blockReward = config.CallistoMinerReward
|
||||
}
|
||||
|
||||
reward := new(big.Int).Set(blockReward)
|
||||
treasuryReward := new(big.Int)
|
||||
treasuryReward.Mul(reward, big.NewInt(treasuryPercent))
|
||||
treasuryReward.Div(treasuryReward, big.NewInt(100))
|
||||
|
||||
// Accumulate the rewards for the miner and any included uncles
|
||||
r := new(big.Int)
|
||||
for _, uncle := range uncles {
|
||||
|
|
@ -620,18 +617,10 @@ func accumulateRewards(config *params.ChainConfig, state *state.StateDB, header
|
|||
}
|
||||
|
||||
if config.IsCallisto(header.Number) {
|
||||
reward.Sub(reward, treasuryReward)
|
||||
state.AddBalance(config.CallistoTreasuryAddress, treasuryReward)
|
||||
state.AddBalance(config.CallistoTreasuryAddress, config.CallistoTreasuryReward)
|
||||
state.AddBalance(config.CallistoStakeAddress, config.CallistoStakeReward)
|
||||
}
|
||||
|
||||
state.AddBalance(header.Coinbase, reward)
|
||||
}
|
||||
|
||||
// getTreasuryPercent computes the current block reward's percent will be for
|
||||
// dev subsidy.
|
||||
func getTreasuryPercent(header *types.Header) int64 {
|
||||
factorReduction := new(big.Int).Set(header.Number)
|
||||
factorReduction.Div(factorReduction, big.NewInt(2160000))
|
||||
|
||||
return 10 - (2 * factorReduction.Int64())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,8 +327,12 @@ func DefaultCallistoMainnetGenesisBlock() *Genesis {
|
|||
return &Genesis{
|
||||
Config: params.CallistoMainnetChainConfig,
|
||||
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
GasLimit: 4700000,
|
||||
Difficulty: big.NewInt(4000000),
|
||||
GasLimit: 10400000,
|
||||
Difficulty: big.NewInt(524288),
|
||||
Timestamp: 1519622213,
|
||||
Nonce: 0,
|
||||
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
|
||||
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
Alloc: decodePrealloc(callistoMainnetAllocData),
|
||||
}
|
||||
}
|
||||
|
|
@ -349,9 +353,13 @@ func DefaultTestnetGenesisBlock() *Genesis {
|
|||
func DefaultCallistoTestnetGenesisBlock() *Genesis {
|
||||
return &Genesis{
|
||||
Config: params.CallistoTestnetChainConfig,
|
||||
ExtraData: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000004fd2dead40490e7efb256899289896c844280e3dceb6e1affb81eae90695efd61e9d2c214f72b8cf0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
|
||||
GasLimit: 5200000,
|
||||
Difficulty: big.NewInt(1),
|
||||
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
GasLimit: 4700000,
|
||||
Difficulty: big.NewInt(524288),
|
||||
Timestamp: 1519622213,
|
||||
Nonce: 0,
|
||||
Coinbase: common.HexToAddress("0xc3F70b10CE5EC4aA47ce44Eb0B7900A883cd45Dd"),
|
||||
Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
Alloc: decodePrealloc(callistoTestnetAllocData),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -53,9 +53,14 @@ var DiscoveryV5Bootnodes = []string{
|
|||
//"enode://ecaebb39dafa9c1d811c4a2544b21a1bf604325f74c568f36ac7a9a5bb91c1b74d3378b059169fb56586735ff8b03533ac1748bec1edd07ea278bb2c40565e4f@52.161.13.240:30303",
|
||||
}
|
||||
|
||||
// CallistoTestnetBootnodes are the enode URLs of the P2P bootstrap nodes for the
|
||||
// Callisto tes network.
|
||||
var CallistoTestnetBootnodes = []string{
|
||||
"enode://6b857ecbb4ea5e4469cb132eb07a5885a346d34c34588ce3e40f27a9cd134db6da44eb76f6b0bb856361daa5045ad2333e1273e781209f2ec2a6be617554432e@138.197.90.157:30303",
|
||||
"enode://c19ce20fa8d079c488ec27e6defd4b0b7e17a4df667e9f9436ff54841f637db051cd43aecb7350c6ddcd2056597878a420d9083dec4076ab68e93c619bdbe77c@104.131.103.14:30303",
|
||||
var CallistoMainnetBootnodes = []string{
|
||||
"enode://ab0d9fe81f23653c3217303d3a4bc035be908b05f8b12d6f155ab4598d7760cfea1e009e414771279c9ffc3499950283afaabe099a5329c5a6013f57d77de0a6@104.236.96.118:30303",
|
||||
"enode://9e2d9dc2639e02893aa17c80e6ba8e8803fd3166083b622a841fc852161112720281514436f7605c89041d5efa1738215185c4c4024ff812b0f500c403cc0ab1@206.189.47.198:30303",
|
||||
"enode://149ba679e8851c3e0d030e0dc0336984b97c83ef649e68ec113dcf266449364cc1ec8ee27950f71b00c2182ef504894fa7bff19f6741978ced67e9e4b6536d2a@206.189.45.31:30303",
|
||||
}
|
||||
|
||||
// CallistoTestnetBootnodes are the enode URLs of the P2P bootstrap nodes for the
|
||||
// Callisto test network.
|
||||
var CallistoTestnetBootnodes = []string{
|
||||
"enode://1e1d25d9eafd92319ee85f502c2f5274a62029b3f9ec003cba259a600ae0def256a09ec505a569aabc4a447d2fd4df9c682243091730f83556693dab17206bd0@167.99.96.186:30303",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,20 +45,6 @@ var (
|
|||
Ethash: new(EthashConfig),
|
||||
}
|
||||
|
||||
// CallistoMainnetChainConfig contains the chain parameters to run a node on the Callisto Main network.
|
||||
CallistoMainnetChainConfig = &ChainConfig{
|
||||
ChainId: big.NewInt(104729),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
DAOForkBlock: big.NewInt(0),
|
||||
DAOForkSupport: false,
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
EIP155Block: big.NewInt(3),
|
||||
EIP158Block: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(4),
|
||||
CallistoBlock: big.NewInt(1),
|
||||
}
|
||||
|
||||
// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
|
||||
TestnetChainConfig = &ChainConfig{
|
||||
ChainId: big.NewInt(3),
|
||||
|
|
@ -74,24 +60,49 @@ var (
|
|||
Ethash: new(EthashConfig),
|
||||
}
|
||||
|
||||
// CallistoTestnetChainConfig contains the chain parameters to run a node on the Callisto test network.
|
||||
CallistoTestnetChainConfig = &ChainConfig{
|
||||
ChainId: big.NewInt(7919),
|
||||
CLOMinerReward, _ = new(big.Int).SetString("420000000000000000000", 10)
|
||||
CLOTreasuryReward, _ = new(big.Int).SetString("120000000000000000000", 10)
|
||||
CLOStakeReward, _ = new(big.Int).SetString("60000000000000000000", 10)
|
||||
|
||||
// CallistoMainnetChainConfig contains the chain parameters to run a node on the Callisto Main network.
|
||||
CallistoMainnetChainConfig = &ChainConfig{
|
||||
ChainId: big.NewInt(820),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
DAOForkBlock: big.NewInt(0),
|
||||
DAOForkBlock: nil,
|
||||
DAOForkSupport: false,
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
EIP155Block: big.NewInt(3),
|
||||
EIP158Block: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(4),
|
||||
CallistoBlock: big.NewInt(1),
|
||||
EIP155Block: big.NewInt(10),
|
||||
EIP158Block: big.NewInt(10),
|
||||
ByzantiumBlock: big.NewInt(20),
|
||||
CallistoBlock: big.NewInt(0),
|
||||
CallistoMinerReward: CLOMinerReward,
|
||||
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
|
||||
CallistoTreasuryReward: CLOTreasuryReward,
|
||||
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
|
||||
CallistoStakeReward: CLOStakeReward,
|
||||
|
||||
Clique: &CliqueConfig{
|
||||
Period: 10,
|
||||
Epoch: 30000,
|
||||
},
|
||||
Ethash: new(EthashConfig),
|
||||
}
|
||||
|
||||
CallistoTestnetChainConfig = &ChainConfig{
|
||||
ChainId: big.NewInt(7919),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
DAOForkBlock: nil,
|
||||
DAOForkSupport: false,
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
EIP155Block: big.NewInt(10),
|
||||
EIP158Block: big.NewInt(10),
|
||||
ByzantiumBlock: big.NewInt(20),
|
||||
CallistoBlock: big.NewInt(0),
|
||||
CallistoMinerReward: CLOMinerReward,
|
||||
CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"),
|
||||
CallistoTreasuryReward: CLOTreasuryReward,
|
||||
CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"),
|
||||
CallistoStakeReward: CLOStakeReward,
|
||||
|
||||
Ethash: new(EthashConfig),
|
||||
}
|
||||
|
||||
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
|
||||
|
|
@ -117,16 +128,16 @@ var (
|
|||
//
|
||||
// This configuration is intentionally not using keyed fields to force anyone
|
||||
// adding flags to the config to also have to set these fields.
|
||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, new(EthashConfig), nil}
|
||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0),common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), new(EthashConfig), nil}
|
||||
|
||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||
// and accepted by the Ethereum core developers into the Clique consensus.
|
||||
//
|
||||
// This configuration is intentionally not using keyed fields to force anyone
|
||||
// adding flags to the config to also have to set these fields.
|
||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0),common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
||||
|
||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, new(EthashConfig), nil}
|
||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, big.NewInt(0), common.Address{}, big.NewInt(0), new(EthashConfig), nil}
|
||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||
)
|
||||
|
||||
|
|
@ -154,7 +165,11 @@ type ChainConfig struct {
|
|||
ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
|
||||
|
||||
CallistoBlock *big.Int `json:"callistoBlock,omitempty"`
|
||||
CallistoMinerReward *big.Int `json:"callistoMinerReward,omitempty"`
|
||||
CallistoTreasuryAddress common.Address `json:"callistoTreasuryAddress,omitempty"`
|
||||
CallistoTreasuryReward *big.Int `json:"callistoTreasuryReward,omitempty"`
|
||||
CallistoStakeAddress common.Address `json:"callistoStakeAddress,omitempty"`
|
||||
CallistoStakeReward *big.Int `json:"callistoStakeReward,omitempty"`
|
||||
// Various consensus engines
|
||||
Ethash *EthashConfig `json:"ethash,omitempty"`
|
||||
Clique *CliqueConfig `json:"clique,omitempty"`
|
||||
|
|
@ -249,8 +264,6 @@ func (c *ChainConfig) GasTable(num *big.Int) GasTable {
|
|||
return GasTableEIP158
|
||||
}
|
||||
switch {
|
||||
case c.IsCallisto(num):
|
||||
return GasTableEIP158
|
||||
case c.IsEIP158(num):
|
||||
return GasTableEIP158
|
||||
case c.IsEIP150(num):
|
||||
|
|
@ -300,6 +313,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
|
|||
if c.IsEIP158(head) && !configNumEqual(c.ChainId, newcfg.ChainId) {
|
||||
return newCompatError("EIP158 chain ID", c.EIP158Block, newcfg.EIP158Block)
|
||||
}
|
||||
if isForkIncompatible(c.CallistoBlock, newcfg.CallistoBlock, head) {
|
||||
return newCompatError("Callisto fork block", c.CallistoBlock, newcfg.CallistoBlock)
|
||||
}
|
||||
if isForkIncompatible(c.ByzantiumBlock, newcfg.ByzantiumBlock, head) {
|
||||
return newCompatError("Byzantium fork block", c.ByzantiumBlock, newcfg.ByzantiumBlock)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const (
|
|||
VersionMajor = 1 // Major version component of the current release
|
||||
VersionMinor = 8 // Minor version component of the current release
|
||||
VersionPatch = 4 // Patch version component of the current release
|
||||
VersionMeta = "unstable" // Version metadata to append to the version string
|
||||
VersionMeta = "CLO stable" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
// Version holds the textual version string.
|
||||
|
|
|
|||
Loading…
Reference in a new issue