mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 19:40:36 +00:00
Add PulseChain config
This commit is contained in:
parent
ea9e62ca3d
commit
bb8cbea609
@ -442,6 +442,10 @@ type ChainConfig struct {
|
||||
// Various consensus engines
|
||||
Ethash *EthashConfig `json:"ethash,omitempty"`
|
||||
Clique *CliqueConfig `json:"clique,omitempty"`
|
||||
|
||||
// PulseChain modifications
|
||||
PrimordialPulseBlock *big.Int `json:"primordialPulseBlock,omitempty"` // PrimordialPulseBlock switch block (nil = no fork, 0 = already activated)
|
||||
Treasury *Treasury `json:"treasury,omitempty"` // An optional treasury which will receive allocations during the PrimordialPulseBlock
|
||||
}
|
||||
|
||||
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
||||
@ -647,6 +651,12 @@ func (c *ChainConfig) IsPrague(time uint64) bool {
|
||||
return isTimestampForked(c.PragueTime, time)
|
||||
}
|
||||
|
||||
// IsPrimordialPulseBlock returns whether or not the given block is the primordial pulse block.
|
||||
func (c *ChainConfig) IsPrimordialPulseBlock(num *big.Int) bool {
|
||||
// Returns whether or not the given block is the PrimordialPulseBlock.
|
||||
return c.PrimordialPulseBlock != nil && c.PrimordialPulseBlock.Cmp(num) == 0
|
||||
}
|
||||
|
||||
// CheckCompatible checks whether scheduled fork transitions have been imported
|
||||
// with a mismatching chain configuration.
|
||||
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError {
|
||||
@ -804,6 +814,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
|
||||
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) {
|
||||
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime)
|
||||
}
|
||||
if isForkBlockIncompatible(c.PrimordialPulseBlock, newcfg.PrimordialPulseBlock, headNumber) {
|
||||
return newBlockCompatError("PrimordialPulse fork block", c.PrimordialPulseBlock, newcfg.PrimordialPulseBlock)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
51
params/pulse.go
Normal file
51
params/pulse.go
Normal file
@ -0,0 +1,51 @@
|
||||
package params
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
)
|
||||
|
||||
// Optional treasury for launching PulseChain testnets
|
||||
type Treasury struct {
|
||||
Addr string `json:"addr"`
|
||||
Balance *math.HexOrDecimal256 `json:"balance"`
|
||||
}
|
||||
|
||||
var (
|
||||
PulseChainTestnetConfig = &ChainConfig{
|
||||
ChainID: big.NewInt(942),
|
||||
HomesteadBlock: big.NewInt(1_150_000),
|
||||
DAOForkBlock: big.NewInt(1_920_000),
|
||||
DAOForkSupport: true,
|
||||
EIP150Block: big.NewInt(2_463_000),
|
||||
EIP150Hash: common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"),
|
||||
EIP155Block: big.NewInt(2_675_000),
|
||||
EIP158Block: big.NewInt(2_675_000),
|
||||
ByzantiumBlock: big.NewInt(4_370_000),
|
||||
ConstantinopleBlock: big.NewInt(7_280_000),
|
||||
PetersburgBlock: big.NewInt(7_280_000),
|
||||
IstanbulBlock: big.NewInt(9_069_000),
|
||||
MuirGlacierBlock: big.NewInt(9_200_000),
|
||||
BerlinBlock: big.NewInt(12_244_000),
|
||||
LondonBlock: big.NewInt(12_965_000),
|
||||
ArrowGlacierBlock: big.NewInt(13_773_000),
|
||||
GrayGlacierBlock: big.NewInt(15_050_000),
|
||||
TerminalTotalDifficulty: MainnetTerminalTotalDifficulty, // 58_750_000_000_000_000_000_000
|
||||
TerminalTotalDifficultyPassed: true,
|
||||
Ethash: new(EthashConfig),
|
||||
PrimordialPulseBlock: big.NewInt(15_700_000), // TODO: UPDATE FORK BLOCK
|
||||
Treasury: testnetTreasury(),
|
||||
}
|
||||
)
|
||||
|
||||
func testnetTreasury() *Treasury {
|
||||
var pulseChainTestnetTreasuryBalance math.HexOrDecimal256
|
||||
pulseChainTestnetTreasuryBalance.UnmarshalText([]byte("0xC9F2C9CD04674EDEA40000000"))
|
||||
|
||||
return &Treasury{
|
||||
Addr: "0xceB59257450820132aB274ED61C49E5FD96E8868",
|
||||
Balance: &pulseChainTestnetTreasuryBalance,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user