Skip to content

Commit

Permalink
Feature/2300 synchronizer detect if executor restart (#2306)
Browse files Browse the repository at this point in the history
* detect if executor restarts and stop synchonizer
  • Loading branch information
joanestebanr authored Jul 21, 2023
1 parent 31eb8a4 commit 978e77b
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 73 deletions.
6 changes: 3 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func start(cliCtx *cli.Context) error {
if poolInstance == nil {
poolInstance = createPool(c.Pool, l2ChainID, st, eventLog)
}
go runSynchronizer(*c, etherman, etm, st, poolInstance)
go runSynchronizer(*c, etherman, etm, st, poolInstance, eventLog)
case ETHTXMANAGER:
ev.Component = event.Component_EthTxManager
ev.Description = "Running eth tx manager service"
Expand Down Expand Up @@ -283,7 +283,7 @@ func newEtherman(c config.Config) (*etherman.Client, error) {
return etherman, nil
}

func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State, pool *pool.Pool) {
func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State, pool *pool.Pool, eventLog *event.EventLog) {
var trustedSequencerURL string
var err error
if !cfg.IsTrustedSequencer {
Expand All @@ -302,7 +302,7 @@ func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManager

sy, err := synchronizer.NewSynchronizer(
cfg.IsTrustedSequencer, etherman, st, pool, ethTxManager,
zkEVMClient, cfg.NetworkConfig.Genesis, cfg.Synchronizer,
zkEVMClient, eventLog, cfg.NetworkConfig.Genesis, cfg.Synchronizer,
)
if err != nil {
log.Fatal(err)
Expand Down
3 changes: 2 additions & 1 deletion event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const (
EventID_FinalizerRestart EventID = "FINALIZER RESTART"
// EventID_FinalizerBreakEvenGasPriceBigDifference is triggered when the finalizer recalculates the break even gas price and detects a big difference
EventID_FinalizerBreakEvenGasPriceBigDifference EventID = "FINALIZER BREAK EVEN GAS PRICE BIG DIFFERENCE"

// EventID_SynchonizerRestart is triggered when the Synchonizer restarts
EventID_SynchonizerRestart EventID = "SYNCHRONIZER RESTART"
// Source_Node is the source of the event
Source_Node Source = "node"

Expand Down
12 changes: 12 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chigopher/pathlib v0.15.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
Expand Down Expand Up @@ -76,6 +77,8 @@ require (
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.7.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
Expand All @@ -86,6 +89,7 @@ require (
github.com/jackc/puddle v1.3.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
Expand All @@ -96,21 +100,26 @@ require (
github.com/markbates/errx v1.1.0 // indirect
github.com/markbates/oncer v1.0.0 // indirect
github.com/markbates/safe v1.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rs/zerolog v1.29.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/skeema/knownhosts v1.1.1 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
Expand All @@ -121,15 +130,18 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 // indirect
github.com/valyala/fastjson v1.4.1 // indirect
github.com/vektra/mockery/v2 v2.32.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.1.0 // indirect
golang.org/x/tools v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
Loading

0 comments on commit 978e77b

Please sign in to comment.