Skip to content

Commit

Permalink
core,eth,params/types/coregeth,params/types/ctypes,params/types/genes…
Browse files Browse the repository at this point in the history
…isT,params/types/goethereum: s/ECBP1100DisableTransition/ECBP1100DeactivateTransition/g

The word Disable conflicts with the existing
ECBP1100NoDisable flag and feature.
That feature prevents the toggling of the ECBP1100
feature per the safety mechanisms of low peer count
and stale head.

Renaming to Deactivate is intended to clarify
the code usages.

Based on feedback provided here #592 (comment)

Date: 2023-12-06 07:21:58-07:00
Signed-off-by: meows <[email protected]>
  • Loading branch information
meowsbits committed Dec 6, 2023
1 parent 0b1b8e1 commit 4552ec1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion core/blockchain_af.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (bc *BlockChain) ArtificialFinalityNoDisable(n int32) {
atomic.StoreInt32(bc.artificialFinalityNoDisable, n)

if n == 1 {
disabledTransition := bc.chainConfig.GetECBP1100DisableTransition()
disabledTransition := bc.chainConfig.GetECBP1100DeactivateTransition()
if disabledTransition != nil && big.NewInt(int64(*disabledTransition)).Cmp(big.NewInt(0)) > 0 {
log.Warn("Disable ECBP1100 (MESS) block activation number is set together with '--ecbp1100.nodisable'.", "disable transition block", *disabledTransition)
}
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}
if config.ECBP1100Disable != nil {
if n := config.ECBP1100Disable.Uint64(); n != math.MaxUint64 {
if err := eth.blockchain.Config().SetECBP1100DisableTransition(&n); err != nil {
if err := eth.blockchain.Config().SetECBP1100DeactivateTransition(&n); err != nil {
return nil, err
}
}
Expand Down
6 changes: 3 additions & 3 deletions params/types/coregeth/chain_config_configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,11 @@ func (c *CoreGethChainConfig) SetECBP1100Transition(n *uint64) error {
return nil
}

func (c *CoreGethChainConfig) GetECBP1100DisableTransition() *uint64 {
func (c *CoreGethChainConfig) GetECBP1100DeactivateTransition() *uint64 {
return bigNewU64(c.ECBP1100DisableFBlock)
}

func (c *CoreGethChainConfig) SetECBP1100DisableTransition(n *uint64) error {
func (c *CoreGethChainConfig) SetECBP1100DeactivateTransition(n *uint64) error {
c.ECBP1100DisableFBlock = setBig(c.ECBP1100DisableFBlock, n)
return nil
}
Expand Down Expand Up @@ -683,7 +683,7 @@ func (c *CoreGethChainConfig) IsEnabled(fn func() *uint64, n *big.Int) bool {
}
fnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
if strings.Contains(fnName, "ECBP1100Transition") {
disabledTransition := c.GetECBP1100DisableTransition()
disabledTransition := c.GetECBP1100DeactivateTransition()
if disabledTransition != nil {
return big.NewInt(int64(*disabledTransition)).Cmp(n) > 0 && big.NewInt(int64(*f)).Cmp(n) <= 0
}
Expand Down
2 changes: 1 addition & 1 deletion params/types/coregeth/chain_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestCoreGethChainConfig_ECBP1100Disable(t *testing.T) {
enable := uint64(100)
disable := uint64(200)
_testConfig.SetECBP1100Transition(&enable)
_testConfig.SetECBP1100DisableTransition(&disable)
_testConfig.SetECBP1100DeactivateTransition(&disable)

n := uint64(10)
bigN := new(big.Int).SetUint64(n)
Expand Down
4 changes: 2 additions & 2 deletions params/types/ctypes/configurator_iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ type ProtocolSpecifier interface {

GetECBP1100Transition() *uint64
SetECBP1100Transition(n *uint64) error
GetECBP1100DisableTransition() *uint64
SetECBP1100DisableTransition(n *uint64) error
GetECBP1100DeactivateTransition() *uint64
SetECBP1100DeactivateTransition(n *uint64) error

GetEIP2315Transition() *uint64
SetEIP2315Transition(n *uint64) error
Expand Down
8 changes: 4 additions & 4 deletions params/types/genesisT/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,12 @@ func (g *Genesis) SetECBP1100Transition(n *uint64) error {
return g.Config.SetECBP1100Transition(n)
}

func (g *Genesis) GetECBP1100DisableTransition() *uint64 {
return g.Config.GetECBP1100DisableTransition()
func (g *Genesis) GetECBP1100DeactivateTransition() *uint64 {
return g.Config.GetECBP1100DeactivateTransition()
}

func (g *Genesis) SetECBP1100DisableTransition(n *uint64) error {
return g.Config.SetECBP1100DisableTransition(n)
func (g *Genesis) SetECBP1100DeactivateTransition(n *uint64) error {
return g.Config.SetECBP1100DeactivateTransition(n)
}

func (g *Genesis) IsEnabled(fn func() *uint64, n *big.Int) bool {
Expand Down
6 changes: 3 additions & 3 deletions params/types/goethereum/goethereum_configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ func (c *ChainConfig) SetECBP1100Transition(n *uint64) error {
return nil
}

func (c *ChainConfig) GetECBP1100DisableTransition() *uint64 {
func (c *ChainConfig) GetECBP1100DeactivateTransition() *uint64 {
return bigNewU64(c.ecbp1100DisableTransition)
}

func (c *ChainConfig) SetECBP1100DisableTransition(n *uint64) error {
func (c *ChainConfig) SetECBP1100DeactivateTransition(n *uint64) error {
c.ecbp1100DisableTransition = setBig(c.ecbp1100DisableTransition, n)
return nil
}
Expand Down Expand Up @@ -705,7 +705,7 @@ func (c *ChainConfig) IsEnabled(fn func() *uint64, n *big.Int) bool {
}
fnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
if strings.Contains(fnName, "ECBP1100Transition") {
disabledTransition := c.GetECBP1100DisableTransition()
disabledTransition := c.GetECBP1100DeactivateTransition()
if disabledTransition != nil {
return big.NewInt(int64(*disabledTransition)).Cmp(n) > 0 && big.NewInt(int64(*f)).Cmp(n) <= 0
}
Expand Down

0 comments on commit 4552ec1

Please sign in to comment.