diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index 5f1a827545..ed306736e8 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -328,10 +328,10 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H } number := header.Number.Uint64() - // According to BEP188, after Bohr fork, an in-turn validator is allowed to broadcast + // According to BEP188, after Boneh fork, an in-turn validator is allowed to broadcast // a mined block earlier but not earlier than its parent's timestamp when the block is ready . if header.Time > uint64(time.Now().Unix()) { - if !chain.Config().IsBohr(header.Number) || header.Difficulty.Cmp(diffInTurn) != 0 { + if !chain.Config().IsBoneh(header.Number) || header.Difficulty.Cmp(diffInTurn) != 0 { return consensus.ErrFutureBlock } var parent *types.Header @@ -883,7 +883,7 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res } // BEP-188 allows an in-turn validator to broadcast the mined block earlier - // but not earlier than its parent's timestamp after Bohr fork. + // but not earlier than its parent's timestamp after Boneh fork. // At the same time, small block which means gas used rate is less than // gasUsedRateDemarcation does not broadcast early to avoid an upcoming fat block. delay := time.Duration(0) @@ -891,7 +891,7 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res if header.GasLimit != 0 { gasUsedRate = header.GasUsed * 100 / header.GasLimit } - if p.chainConfig.IsBohr(header.Number) && header.Difficulty.Cmp(diffInTurn) == 0 && gasUsedRate >= gasUsedRateDemarcation { + if p.chainConfig.IsBoneh(header.Number) && header.Difficulty.Cmp(diffInTurn) == 0 && gasUsedRate >= gasUsedRateDemarcation { parent := chain.GetHeader(header.ParentHash, number-1) if parent == nil || parent.Number.Uint64() != number-1 || parent.Hash() != header.ParentHash { return consensus.ErrUnknownAncestor @@ -1323,7 +1323,7 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad } else { delay := initialBackOffTime validators := snap.validators() - if p.chainConfig.IsBohr(header.Number) { + if p.chainConfig.IsBoneh(header.Number) { // reverse the key/value of snap.Recents to get recentsMap recentsMap := make(map[common.Address]uint64, len(snap.Recents)) for seen, recent := range snap.Recents { diff --git a/core/systemcontracts/upgrade.go b/core/systemcontracts/upgrade.go index 6f4d3addf6..414fcf76f0 100644 --- a/core/systemcontracts/upgrade.go +++ b/core/systemcontracts/upgrade.go @@ -50,7 +50,7 @@ var ( moranUpgrade = make(map[string]*Upgrade) - bohrUpgrade = make(map[string]*Upgrade) + bonehUpgrade = make(map[string]*Upgrade) ) func init() { @@ -483,9 +483,9 @@ func init() { }, } - // TODO: update the commit url of bohr upgrade - bohrUpgrade[mainNet] = &Upgrade{ - UpgradeName: "bohr", + // TODO: update the commit url of boneh upgrade + bonehUpgrade[mainNet] = &Upgrade{ + UpgradeName: "boneh", Configs: []*UpgradeConfig{ { ContractAddr: common.HexToAddress(SlashContract), @@ -505,8 +505,8 @@ func init() { }, } - bohrUpgrade[chapelNet] = &Upgrade{ - UpgradeName: "bohr", + bonehUpgrade[chapelNet] = &Upgrade{ + UpgradeName: "boneh", Configs: []*UpgradeConfig{ { ContractAddr: common.HexToAddress(SlashContract), @@ -531,8 +531,8 @@ func init() { }, } - bohrUpgrade[rialtoNet] = &Upgrade{ - UpgradeName: "bohr", + bonehUpgrade[rialtoNet] = &Upgrade{ + UpgradeName: "boneh", Configs: []*UpgradeConfig{ { ContractAddr: common.HexToAddress(SlashContract), @@ -600,8 +600,8 @@ func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.I applySystemContractUpgrade(moranUpgrade[network], blockNumber, statedb, logger) } - if config.IsOnBohr(blockNumber) { - applySystemContractUpgrade(bohrUpgrade[network], blockNumber, statedb, logger) + if config.IsOnBoneh(blockNumber) { + applySystemContractUpgrade(bonehUpgrade[network], blockNumber, statedb, logger) } /* diff --git a/core/vm/contracts.go b/core/vm/contracts.go index ec2377b6f4..ac7fa57bcb 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -111,7 +111,7 @@ var PrecompiledContractsMoran = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{101}): &iavlMerkleProofValidateMoran{}, } -var PrecompiledContractsBohr = map[common.Address]PrecompiledContract{ +var PrecompiledContractsBoneh = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{1}): &ecrecover{}, common.BytesToAddress([]byte{2}): &sha256hash{}, common.BytesToAddress([]byte{3}): &ripemd160hash{}, @@ -123,7 +123,7 @@ var PrecompiledContractsBohr = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{9}): &blake2F{}, common.BytesToAddress([]byte{100}): &tmHeaderValidate{}, - common.BytesToAddress([]byte{101}): &iavlMerkleProofValidateBohr{}, + common.BytesToAddress([]byte{101}): &iavlMerkleProofValidateBoneh{}, } // PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum @@ -155,7 +155,7 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{ } var ( - PrecompiledAddressesBohr []common.Address + PrecompiledAddressesBoneh []common.Address PrecompiledAddressesMoran []common.Address PrecompiledAddressesNano []common.Address PrecompiledAddressesBerlin []common.Address @@ -183,16 +183,16 @@ func init() { for k := range PrecompiledContractsMoran { PrecompiledAddressesMoran = append(PrecompiledAddressesMoran, k) } - for k := range PrecompiledContractsBohr { - PrecompiledAddressesBohr = append(PrecompiledAddressesBohr, k) + for k := range PrecompiledContractsBoneh { + PrecompiledAddressesBoneh = append(PrecompiledAddressesBoneh, k) } } // ActivePrecompiles returns the precompiles enabled with the current configuration. func ActivePrecompiles(rules params.Rules) []common.Address { switch { - case rules.IsBohr: - return PrecompiledAddressesBohr + case rules.IsBoneh: + return PrecompiledAddressesBoneh case rules.IsMoran: return PrecompiledAddressesMoran case rules.IsNano: diff --git a/core/vm/contracts_lightclient.go b/core/vm/contracts_lightclient.go index 9d90781f87..705848bbdc 100644 --- a/core/vm/contracts_lightclient.go +++ b/core/vm/contracts_lightclient.go @@ -155,15 +155,15 @@ func (c *iavlMerkleProofValidateMoran) Run(input []byte) (result []byte, err err return c.basicIavlMerkleProofValidate.Run(input) } -type iavlMerkleProofValidateBohr struct { +type iavlMerkleProofValidateBoneh struct { basicIavlMerkleProofValidate } -func (c *iavlMerkleProofValidateBohr) RequiredGas(_ []byte) uint64 { +func (c *iavlMerkleProofValidateBoneh) RequiredGas(_ []byte) uint64 { return params.IAVLMerkleProofValidateGas } -func (c *iavlMerkleProofValidateBohr) Run(input []byte) (result []byte, err error) { +func (c *iavlMerkleProofValidateBoneh) Run(input []byte) (result []byte, err error) { c.basicIavlMerkleProofValidate.proofRuntime = lightclient.Ics23CompatibleProofRuntime() c.basicIavlMerkleProofValidate.verifiers = []merkle.ProofOpVerifier{ forbiddenAbsenceOpVerifier, diff --git a/core/vm/contracts_lightclient_test.go b/core/vm/contracts_lightclient_test.go index 9397fe8091..5787b70159 100644 --- a/core/vm/contracts_lightclient_test.go +++ b/core/vm/contracts_lightclient_test.go @@ -146,7 +146,7 @@ func TestIcs23Proof(t *testing.T) { input := append(totalLengthPrefix, merkleProofInput...) - validator := iavlMerkleProofValidateBohr{} + validator := iavlMerkleProofValidateBoneh{} success, err := validator.Run(input) require.NoError(t, err) expectedResult := make([]byte, 32) diff --git a/core/vm/evm.go b/core/vm/evm.go index 42a5a64ac0..65a874519b 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -52,8 +52,8 @@ type ( func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { var precompiles map[common.Address]PrecompiledContract switch { - case evm.chainRules.IsBohr: - precompiles = PrecompiledContractsBohr + case evm.chainRules.IsBoneh: + precompiles = PrecompiledContractsBoneh case evm.chainRules.IsMoran: precompiles = PrecompiledContractsMoran case evm.chainRules.IsNano: diff --git a/params/config.go b/params/config.go index 1660cc3640..b79cc39714 100644 --- a/params/config.go +++ b/params/config.go @@ -300,7 +300,7 @@ var ( NanoBlock: big.NewInt(21962149), MoranBlock: big.NewInt(22107423), GibbsBlock: big.NewInt(23846001), - BohrBlock: nil, // todo: TBD + BonehBlock: nil, // todo: TBD Parlia: &ParliaConfig{ Period: 3, @@ -327,7 +327,7 @@ var ( GibbsBlock: big.NewInt(22800220), NanoBlock: big.NewInt(23482428), MoranBlock: big.NewInt(23603940), - BohrBlock: nil, // todo: TBD + BonehBlock: nil, // todo: TBD Parlia: &ParliaConfig{ Period: 3, Epoch: 200, @@ -353,7 +353,7 @@ var ( GibbsBlock: big.NewInt(400), NanoBlock: nil, MoranBlock: nil, - BohrBlock: nil, + BonehBlock: nil, Parlia: &ParliaConfig{ Period: 3, @@ -382,7 +382,7 @@ var ( GibbsBlock: big.NewInt(0), NanoBlock: nil, MoranBlock: nil, - BohrBlock: nil, + BonehBlock: nil, MuirGlacierBlock: nil, BerlinBlock: nil, // Don't enable Berlin directly, we're YOLOing it YoloV3Block: big.NewInt(0), @@ -502,7 +502,7 @@ type ChainConfig struct { GibbsBlock *big.Int `json:"gibbsBlock,omitempty" toml:",omitempty"` // gibbsBlock switch block (nil = no fork, 0 = already activated) NanoBlock *big.Int `json:"nanoBlock,omitempty" toml:",omitempty"` // nanoBlock switch block (nil = no fork, 0 = already activated) MoranBlock *big.Int `json:"moranBlock,omitempty" toml:",omitempty"` // moranBlock switch block (nil = no fork, 0 = already activated) - BohrBlock *big.Int `json:"bohrBlock,omitempty" toml:",omitempty"` // bohrBlock switch block (nil = no fork, 0 = already activated) + BonehBlock *big.Int `json:"bonehBlock,omitempty" toml:",omitempty"` // bonehBlock switch block (nil = no fork, 0 = already activated) // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty" toml:",omitempty"` @@ -553,7 +553,7 @@ func (c *ChainConfig) String() string { default: engine = "unknown" } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Bohr: %v, Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Boneh: %v, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -580,7 +580,7 @@ func (c *ChainConfig) String() string { c.GibbsBlock, c.NanoBlock, c.MoranBlock, - c.BohrBlock, + c.BonehBlock, engine, ) } @@ -736,12 +736,12 @@ func (c *ChainConfig) IsOnMoran(num *big.Int) bool { return configNumEqual(c.MoranBlock, num) } -func (c *ChainConfig) IsBohr(num *big.Int) bool { - return isForked(c.BohrBlock, num) +func (c *ChainConfig) IsBoneh(num *big.Int) bool { + return isForked(c.BonehBlock, num) } -func (c *ChainConfig) IsOnBohr(num *big.Int) bool { - return configNumEqual(c.BohrBlock, num) +func (c *ChainConfig) IsOnBoneh(num *big.Int) bool { + return configNumEqual(c.BonehBlock, num) } // CheckCompatible checks whether scheduled fork transitions have been imported @@ -872,8 +872,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi if isForkIncompatible(c.MoranBlock, newcfg.MoranBlock, head) { return newCompatError("moran fork block", c.MoranBlock, newcfg.MoranBlock) } - if isForkIncompatible(c.BohrBlock, newcfg.BohrBlock, head) { - return newCompatError("bohr fork block", c.BohrBlock, newcfg.BohrBlock) + if isForkIncompatible(c.BonehBlock, newcfg.BonehBlock, head) { + return newCompatError("boneh fork block", c.BonehBlock, newcfg.BonehBlock) } return nil } @@ -946,7 +946,7 @@ type Rules struct { IsMerge bool IsNano bool IsMoran bool - IsBohr bool + IsBoneh bool } // Rules ensures c's ChainID is not nil. @@ -970,6 +970,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules { IsMerge: isMerge, IsNano: c.IsNano(num), IsMoran: c.IsMoran(num), - IsBohr: c.IsBohr(num), + IsBoneh: c.IsBoneh(num), } }