Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable MESS #592

Merged
merged 9 commits into from
Dec 6, 2023
Merged

Disable MESS #592

merged 9 commits into from
Dec 6, 2023

Conversation

meowsbits
Copy link
Contributor

This PR drafts the disablement of MESS/ECBP1100, anticipated to occur on ETC concurrently with the Spiral network upgrade.

Following convention, a configuration override flag --ecbp1100.disable=[number] is provided.

As-is, this draft uses runtime and reflect at the Configurator implementation level to handle the actual enable/disable logic (9e274d0). Alternatively, we could consider instead adding conditions at the places where the configuration is referenced to handle it, like the example below.

diff --git a/core/forkchoice.go b/core/forkchoice.go
index d07cdf6aa4..55d898c3a0 100644
--- a/core/forkchoice.go
+++ b/core/forkchoice.go
@@ -162,7 +162,8 @@ func (f *ForkChoice) ReorgNeeded(current *types.Header, extern *types.Header) (b
                        return reorg, nil
                }
        }
-       if !f.chain.Config().IsEnabled(f.chain.Config().GetECBP1100Transition, current.Number) {
+       if !f.chain.Config().IsEnabled(f.chain.Config().GetECBP1100Transition, current.Number) ||
+               f.chain.Config().IsEnabled(f.chain.Config().GetECBP1100DisableTransition, current.Number) {
                return reorg, nil
        }

…es/ctypes,params/types/genesisT,params/types/goethereum: ECBP1100Disable: cli flag for override, config implementation

Date: 2023-11-29 14:45:34-07:00
Signed-off-by: meows <b5c6@protonmail.com>
Date: 2023-11-29 14:46:29-07:00
Signed-off-by: meows <b5c6@protonmail.com>
…ble logic with runtime,reflection

This may not be ideal from a CPU/time
perspective (expected slow), but since
this is likely a temporary code path
as we expect to remove MESS code once
the fork is passed, it may be sufficient,
and is certainly a smaller change than
adding -Disabled conditions at each
occurrence of IsEnabled/ECBP1100 in the code.

Date: 2023-11-29 15:52:37-07:00
Signed-off-by: meows <b5c6@protonmail.com>
@@ -669,6 +681,13 @@ func (c *CoreGethChainConfig) IsEnabled(fn func() *uint64, n *big.Int) bool {
if f == nil || n == nil {
return false
}
fnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice hack in order to check if both are enabled, either way it will not stay for too long.

p.s.: I hope I don't read back this comment in 1-2 years and the code is still here :)

@ziogaschr
Copy link
Member

I wonder if we also have to handle cases where --ecbp1100.nodisable is set.

Shall we force disable and raise a warning? This is what we prefer, on the other way, it's against the user's preference.
I think if user decided to use --ecbp1100.nodisable we can only show a warning but we can't force a disable.

@@ -2081,6 +2086,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.EthDiscoveryURLs = SplitAndTrim(urls)
}
}
CheckExclusive(ctx, ECBP1100DisableFlag, ECBP1100NoDisableFlag)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meowsbits this is probably better to be removed (I added it).

A node operator might indeed want the nodisable functionality, so if he still wants to enable ECBP-1100 he has to do --ecbp1100.disable=69420123 --ecbp1100.nodisable.

The thing is that with the above check, this is not allowed.

@meowsbits
Copy link
Contributor Author

Good point on the nodisable flag. That feature was on request, and was intended to turn off the MinPeers and StaleHead safety mechanisms. The concern was that the safety mechanisms could be used to knock a node off the canonical network, assuming that the canonical network followed MESS. If was MESS was on, they wanted it to stay on.

MESS is only enabled if a peer has greater than or equal to the MinimumSyncPeers peers. In Core-Geth this value is by default 5.
MESS is disabled if, once synced, a node's head block is not changed within a time limit (ie becomes stale). In Core-Geth this value is by default 30 * 13 seconds
https://github.com/ethereumclassic/ECIPs/blob/master/_specs/ecip-1100.md#implementation

So its my understanding that conceptually there's no conflict with these flags, although you're definitely right to point to it.

@ziogaschr
Copy link
Member

Oh, so this will not allow MESS to be disabled only once it has been enabled.
Is this right? If yes, then there is no conflict indeed.

Copy link
Contributor

@diega diega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

params/config_classic.go Outdated Show resolved Hide resolved
@meowsbits
Copy link
Contributor Author

meowsbits commented Dec 5, 2023

The naming/conceptual conflict of ecbp1100.nodisable and GetECBP1100DisableTransition is annoying and confusing.

IMO ecbp1100.nodisable could have been better named ecbp1100.nosafety, but now is unchangeable since it holds an API place in the flags and config TOML marshalling:

	ECBP1100NoDisableFlag = &cli.BoolFlag{
		Name:  "ecbp1100.nodisable",
		Usage: "Short-circuit ECBP-1100 (MESS) disable/safety mechanisms; (yields a permanent-once-activated state, deactivating auto-shutoff mechanisms)",
	}
	// ECBP1100NoDisable overrides
	// When this value is *true, ECBP100 will not (ever) be disabled; when *false, it will never be enabled.
	ECBP1100NoDisable *bool `toml:",omitempty"`

This configuration value is used as:

func (bc *BlockChain) EnableArtificialFinality(enable bool, logValues ...interface{}) {
	// Short circuit if AF state is enabled and nodisable=true.
	if bc.artificialFinalityNoDisable != nil && atomic.LoadInt32(bc.artificialFinalityNoDisable) == 1 &&
		bc.IsArtificialFinalityEnabled() && !enable {
		log.Warn("Preventing disable artificial finality", "enabled", true, "nodisable", true)
		return
	}

How about renaming our new GetECBP1100DisableTransition and her associated fields to ECBP1100Deactivate instead to lessen the confusion? "Activation" being common language for turning on fork features ("block activation number"), and we're talking about "turning off" the feature.

- 1100disable flag deactivates the feature
- 1100.nodisable prevents safety mechanisms from
  toggling it once activated

Date: 2023-12-06 07:11:04-07:00
Signed-off-by: meows <b5c6@protonmail.com>
meowsbits added a commit that referenced this pull request Dec 6, 2023
…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 <b5c6@protonmail.com>
meowsbits added a commit that referenced this pull request Dec 6, 2023
…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 <b5c6@protonmail.com>

cmd/geth,cmd/utils,core,eth,eth/ethconfig,params/types/coregeth: ECBP1100: s/enable/activate/g,s/disable/deactivate/g

rename all references besides the method name

Date: 2023-12-06 07:50:14-07:00
Signed-off-by: meows <b5c6@protonmail.com>
meowsbits added a commit that referenced this pull request Dec 6, 2023
…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 <b5c6@protonmail.com>

cmd/geth,cmd/utils,core,eth,eth/ethconfig,params/types/coregeth: ECBP1100: s/enable/activate/g,s/disable/deactivate/g

rename all references besides the method name

Date: 2023-12-06 07:50:14-07:00
Signed-off-by: meows <b5c6@protonmail.com>

params,params/types/coregeth,params/types/goethereum: ECBP1100-deactivate: rename config fields s/disable/deactivate/g

Date: 2023-12-06 08:07:08-07:00
Signed-off-by: meows <b5c6@protonmail.com>

core: (lint) remove unnecessary leading newline

Date: 2023-12-06 08:09:00-07:00
Signed-off-by: meows <b5c6@protonmail.com>
ECBP1100FBlock: big.NewInt(11_380_000), // ETA 09 Oct 2020
ECIP1099FBlock: big.NewInt(11_700_000), // Etchash (DAG size limit)
ECBP1100FBlock: big.NewInt(11_380_000), // ETA 09 Oct 2020
ECBP1100DeactivateFBlock: big.NewInt(69_420_123),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not forget to set the block_number here or we wait for this PR to be merged and set it at #595

Copy link
Contributor Author

@meowsbits meowsbits Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just set it here == Spiral 907295d

@meowsbits meowsbits requested review from ziogaschr and diega December 6, 2023 15:12
meowsbits added a commit that referenced this pull request Dec 6, 2023
…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 <b5c6@protonmail.com>

cmd/geth,cmd/utils,core,eth,eth/ethconfig,params/types/coregeth: ECBP1100: s/enable/activate/g,s/disable/deactivate/g

rename all references besides the method name

Date: 2023-12-06 07:50:14-07:00
Signed-off-by: meows <b5c6@protonmail.com>

params,params/types/coregeth,params/types/goethereum: ECBP1100-deactivate: rename config fields s/disable/deactivate/g

Date: 2023-12-06 08:07:08-07:00
Signed-off-by: meows <b5c6@protonmail.com>

core: (lint) remove unnecessary leading newline

Date: 2023-12-06 08:09:00-07:00
Signed-off-by: meows <b5c6@protonmail.com>

params/types/goethereum: ECBP100: s/disableTransition/deactivateTransition/g

Date: 2023-12-06 08:17:12-07:00
Signed-off-by: meows <b5c6@protonmail.com>
…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 <b5c6@protonmail.com>

cmd/geth,cmd/utils,core,eth,eth/ethconfig,params/types/coregeth: ECBP1100: s/enable/activate/g,s/disable/deactivate/g

rename all references besides the method name

Date: 2023-12-06 07:50:14-07:00
Signed-off-by: meows <b5c6@protonmail.com>

params,params/types/coregeth,params/types/goethereum: ECBP1100-deactivate: rename config fields s/disable/deactivate/g

Date: 2023-12-06 08:07:08-07:00
Signed-off-by: meows <b5c6@protonmail.com>

core: (lint) remove unnecessary leading newline

Date: 2023-12-06 08:09:00-07:00
Signed-off-by: meows <b5c6@protonmail.com>

params/types/goethereum: ECBP100: s/disableTransition/deactivateTransition/g

Date: 2023-12-06 08:17:12-07:00
Signed-off-by: meows <b5c6@protonmail.com>

params/types/coregeth: ECBP100: s/disable/deactivate/g

Date: 2023-12-06 08:19:09-07:00
Signed-off-by: meows <b5c6@protonmail.com>
…de flags to --override.X,

and categorize these flags.

Date: 2023-12-06 08:02:58-07:00
Signed-off-by: meows <b5c6@protonmail.com>
This configures the deactivation of MESS
to coincide with the Spiral hardfork.

Date: 2023-12-06 08:29:02-07:00
Signed-off-by: meows <b5c6@protonmail.com>
Copy link
Contributor

@diega diega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢²

@meowsbits meowsbits marked this pull request as ready for review December 6, 2023 18:12
@meowsbits meowsbits merged commit b4523a0 into master Dec 6, 2023
7 checks passed
@meowsbits meowsbits deleted the disable-mess branch December 6, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants