Skip to content

Commit

Permalink
Add apollo config and refactor xlayer config
Browse files Browse the repository at this point in the history
  • Loading branch information
sieniven committed Jun 24, 2024
1 parent 582c2ea commit a326c61
Show file tree
Hide file tree
Showing 11 changed files with 768 additions and 114 deletions.
20 changes: 19 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import (
"os"
"path"

"time"

"github.com/ledgerwatch/erigon/cl/clparams"
"github.com/ledgerwatch/erigon/cmd/downloader/downloadernat"
"github.com/ledgerwatch/erigon/common/paths"
Expand All @@ -60,7 +62,6 @@ import (
"github.com/ledgerwatch/erigon/p2p/netutil"
"github.com/ledgerwatch/erigon/params"
"github.com/ledgerwatch/erigon/params/networkname"
"time"
)

// These are all the command line flags we support.
Expand Down Expand Up @@ -620,6 +621,23 @@ var (
Name: "debug.step-after",
Usage: "Start incrementing by debug.step after this block",
}
// XLayer apollo
ApolloEnableFlag = cli.BoolFlag{
Name: "zkevm.apollo-enable",
Usage: "Apollo enable flag.",
}
ApolloIPAddr = cli.StringFlag{
Name: "zkevm.apollo-ip-addr",
Usage: "Apollo IP address.",
}
ApolloAppId = cli.StringFlag{
Name: "zkevm.apollo-app-id",
Usage: "Apollo App ID.",
}
ApolloNamespaceName = cli.StringFlag{
Name: "zkevm.apollo-namespace-name",
Usage: "Apollo namespace name.",
}
// XLayer nacos
NacosURLsFlag = cli.StringFlag{
Name: "zkevm.nacos-urls",
Expand Down
4 changes: 2 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
cfg := backend.config

// For Xlayer
if len(cfg.NacosURLs) > 0 {
nacos.StartNacosClient(cfg.NacosURLs, cfg.NacosNamespaceId, cfg.NacosApplicationName, cfg.NacosExternalListenAddr)
if len(cfg.XLayer.Nacos.URLs) > 0 {
nacos.StartNacosClient(cfg.XLayer.Nacos.URLs, cfg.XLayer.Nacos.NamespaceId, cfg.XLayer.Nacos.ApplicationName, cfg.XLayer.Nacos.ExternalListenAddr)
}

// update the chain config with the zero gas from the flags
Expand Down
22 changes: 22 additions & 0 deletions eth/ethconfig/config_xlayer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ethconfig

type XLayerConfig struct {
Apollo ApolloConfig
Nacos NacosConfig
}

// NacosConfig is the config for nacos
type NacosConfig struct {
URLs string
NamespaceId string
ApplicationName string
ExternalListenAddr string
}

// ApolloConfig is the config for apollo
type ApolloConfig struct {
Enable bool
IP string
AppID string
NamespaceName string
}
5 changes: 1 addition & 4 deletions eth/ethconfig/config_zkevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ type Zk struct {
DebugStepAfter uint64

// For Xlayer
NacosURLs string
NacosNamespaceId string
NacosApplicationName string
NacosExternalListenAddr string
XLayer XLayerConfig

PoolManagerUrl string
DisableVirtualCounters bool
Expand Down
74 changes: 44 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/ledgerwatch/erigon

go 1.19
go 1.21

toolchain go1.22.2

require (
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230404044759-5dec854ce336
Expand All @@ -20,41 +22,42 @@ require (
github.com/VictoriaMetrics/metrics v1.23.1
github.com/anacrolix/sync v0.4.0
github.com/anacrolix/torrent v1.48.1-0.20230219022425-e8971ea0f1bf
github.com/apolloconfig/agollo/v4 v4.0.9
github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b
github.com/consensys/gnark-crypto v0.12.1
github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc
github.com/crate-crypto/go-kzg-4844 v0.2.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/crate-crypto/go-kzg-4844 v0.7.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/deckarep/golang-set v1.8.0
github.com/deckarep/golang-set/v2 v2.3.0
github.com/dgravesa/go-parallel v0.6.0
github.com/docker/docker v20.10.17+incompatible
github.com/dop251/goja v0.0.0-20230122112309-96b1610dd4f7
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127
github.com/dustin/go-humanize v1.0.1
github.com/edsrzf/mmap-go v1.1.0
github.com/emicklei/dot v1.0.0
github.com/emirpasic/gods v1.18.1
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e
github.com/gateway-fm/cdk-erigon-lib v0.0.0-20240415152010-66aa405ca33f
github.com/gateway-fm/vectorized-poseidon-gold v1.0.0
github.com/gballet/go-verkle v0.0.0-20221121182333-31427a1f2d35
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46
github.com/go-stack/stack v1.8.1
github.com/goccy/go-json v0.9.11
github.com/goccy/go-json v0.10.2
github.com/gofrs/flock v0.8.1
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/mock v1.6.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/google/btree v1.1.2
github.com/google/gofuzz v1.2.0
github.com/gorilla/websocket v1.5.0
github.com/gorilla/websocket v1.5.1
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/hashicorp/golang-lru/v2 v2.0.2
github.com/holiman/uint256 v1.2.2
github.com/holiman/uint256 v1.2.4
github.com/huandu/xstrings v1.4.0
github.com/huin/goupnp v1.1.0
github.com/huin/goupnp v1.3.0
github.com/iden3/go-iden3-crypto v0.0.15
github.com/jackc/pgx/v4 v4.18.1
github.com/jackpal/go-nat-pmp v1.0.2
Expand All @@ -73,7 +76,7 @@ require (
github.com/pelletier/go-toml/v2 v2.1.0
github.com/pion/stun v0.4.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.15.1
github.com/prometheus/client_golang v1.18.0
github.com/protolambda/eth2-shuffle v1.1.0
github.com/protolambda/ztyp v0.2.2
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7
Expand All @@ -87,19 +90,19 @@ require (
github.com/stretchr/testify v1.8.4
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e
github.com/tidwall/btree v1.6.0
github.com/ugorji/go/codec v1.1.13
github.com/ugorji/go/codec v1.2.7
github.com/ugorji/go/codec/codecgen v1.1.13
github.com/urfave/cli/v2 v2.25.7
github.com/urfave/cli/v2 v2.26.0
github.com/valyala/fastjson v1.6.4
github.com/vektah/gqlparser/v2 v2.5.1
github.com/xsleonard/go-merkle v1.1.0
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.22.0
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/net v0.24.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
golang.org/x/time v0.3.0
golang.org/x/time v0.5.0
google.golang.org/grpc v1.62.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf v1.33.0
Expand Down Expand Up @@ -135,7 +138,7 @@ require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/benbjohnson/immutable v0.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand All @@ -152,11 +155,12 @@ require (
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/garslo/gogen v0.0.0-20170307003452-d6ebae628c7c // indirect
github.com/gin-gonic/gin v1.7.7 // indirect
github.com/gin-gonic/gin v1.8.1 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
Expand All @@ -166,13 +170,14 @@ require (
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hermeznetwork/tracerr v0.3.2 // indirect
github.com/ianlancetaylor/cgosymbolizer v0.0.0-20220405231054-a1ae3e4bba26 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.0 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
Expand All @@ -181,7 +186,7 @@ require (
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/koron/go-ssdp v0.0.3 // indirect
github.com/kr/pretty v0.3.1 // indirect
Expand All @@ -201,10 +206,12 @@ require (
github.com/lispad/go-generics-tools v1.1.0 // indirect
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.19 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/miekg/dns v1.1.50 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
Expand Down Expand Up @@ -245,25 +252,32 @@ require (
github.com/pion/webrtc/v3 v3.1.42 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.2.1 // indirect
github.com/quic-go/qtls-go1-20 v0.1.1 // indirect
github.com/quic-go/quic-go v0.33.0 // indirect
github.com/quic-go/webtransport-go v0.5.2 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/supranational/blst v0.3.10 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/viper v1.17.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
Expand Down
Loading

0 comments on commit a326c61

Please sign in to comment.