Skip to content

Commit

Permalink
monitor/finality: add flag to enable finality vote monitor (#358)
Browse files Browse the repository at this point in the history
* monitor/finality: add flag to enable finality vote monitor

This commit adds monitor.finalityvote flag to enable finality vote monitor.

* Dockerfile: set ENABLE_FAST_FINALITY_SIGN default to be false

In common case, non-validator nodes doesn't need to enable fast finality sign so
we make this environment variable default to be false.
  • Loading branch information
minh-bq authored Oct 2, 2023
1 parent a2f749c commit 7a0fdd4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ENV FORCE_INIT 'true'
ENV RONIN_PARAMS ''
ENV INIT_FORCE_OVERRIDE_CHAIN_CONFIG 'false'
ENV ENABLE_FAST_FINALITY 'true'
ENV ENABLE_FAST_FINALITY_SIGN 'true'
ENV ENABLE_FAST_FINALITY_SIGN 'false'
ENV BLS_PRIVATE_KEY ''
ENV BLS_PASSWORD ''
ENV BLS_AUTO_GENERATE 'false'
Expand Down
1 change: 1 addition & 0 deletions cmd/ronin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ var (
configFileFlag,
utils.CatalystFlag,
utils.MonitorDoubleSign,
utils.MonitorFinalityVoteFlag,
utils.StoreInternalTransactions,
utils.MaxCurVoteAmountPerBlock,
utils.EnableFastFinality,
Expand Down
1 change: 1 addition & 0 deletions cmd/ronin/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.WhitelistFlag,
utils.ForceOverrideChainConfigFlag,
utils.MonitorDoubleSign,
utils.MonitorFinalityVoteFlag,
utils.StoreInternalTransactions,
utils.DisableRoninProtocol,
utils.AdditionalChainEventFlag,
Expand Down
8 changes: 8 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ var (
Name: "monitor.doublesign",
Usage: "Enable double sign monitoring",
}
MonitorFinalityVoteFlag = cli.BoolFlag{
Name: "monitor.finalityvote",
Usage: "Enable finality vote monitoring",
}
StoreInternalTransactions = cli.BoolFlag{
Name: "internaltxs",
Usage: "Enable storing internal transactions to db",
Expand Down Expand Up @@ -1840,6 +1844,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.GlobalBool(AdditionalChainEventFlag.Name) {
cfg.EnableAdditionalChainEvent = true
}

if ctx.GlobalBool(MonitorFinalityVoteFlag.Name) {
cfg.EnableMonitorDoubleSign = true
}
}

// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
Expand Down
3 changes: 3 additions & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if config.EnableAdditionalChainEvent {
eth.blockchain.EnableAdditionalChainEvent()
}
if config.EnableMonitorFinalityVote {
go eth.blockchain.StartFinalityVoteMonitor()
}

// Rewind the chain in case of an incompatible config upgrade.
if compat, ok := genesisErr.(*params.ConfigCompatError); ok {
Expand Down
3 changes: 3 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ type Config struct {
// Enable double sign monitoring
EnableMonitorDoubleSign bool

// Enable finality vote monitoring
EnableMonitorFinalityVote bool

// Disable ronin p2p protocol
DisableRoninProtocol bool

Expand Down

0 comments on commit 7a0fdd4

Please sign in to comment.