Skip to content

Commit

Permalink
port changes from main-version-holesky-stage
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Oct 28, 2024
1 parent 2a9077c commit 66c481a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions cli/operator/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func setupDB(logger *zap.Logger, eth2Network beaconprotocol.Network) (*kv.Badger
return errors.Wrap(err, "failed to reopen db")
}

cfg.DBOptions.Path = "./data/db-main-on-stage"
migrationOpts := migrations.Options{
Db: db,
DbPath: cfg.DBOptions.Path,
Expand Down
7 changes: 7 additions & 0 deletions network/peers/connections/conn_gater.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,18 @@ func (n *connGater) InterceptAddrDial(id peer.ID, multiaddr ma.Multiaddr) bool {
return true
}

// TODO: REVERT!
const DISABLE_IP_RATE_LIMIT = true

// InterceptAccept is called as soon as a transport listener receives an
// inbound connection request, before any upgrade takes place. Transports who
// accept already secure and/or multiplexed connections (e.g. possibly QUIC)
// MUST call this method regardless, for correctness/consistency.
func (n *connGater) InterceptAccept(multiaddrs libp2pnetwork.ConnMultiaddrs) bool {
if DISABLE_IP_RATE_LIMIT {
return true
}

remoteAddr := multiaddrs.RemoteMultiaddr()
if !n.validateDial(remoteAddr) {
// Yield this goroutine to allow others to run in-between connection attempts.
Expand Down
6 changes: 4 additions & 2 deletions network/topics/params/peer_score.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ const (
appSpecificWeight = 0

// P6
ipColocationFactorThreshold = 10
// TODO: REVERT!
ipColocationFactorThreshold = 1000
ipColocationFactorWeight = -topicScoreCap

// P7
behaviourPenaltyThreshold = 6
behaviourPenaltyThreshold = 60000 // TODO: revert
)

// PeerScoreThresholds returns the thresholds to use for peer scoring
Expand All @@ -56,6 +57,7 @@ func PeerScoreParams(oneEpoch, msgIDCacheTTL time.Duration, ipWhilelist ...*net.
targetVal, _ := decayConvergence(behaviourPenaltyDecay, maxAllowedRatePerDecayInterval)
targetVal = targetVal - behaviourPenaltyThreshold
behaviourPenaltyWeight := gossipThreshold / (targetVal * targetVal)

Check failure on line 59 in network/topics/params/peer_score.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to behaviourPenaltyWeight (ineffassign)
behaviourPenaltyWeight = 0 // TODO: revert

return &pubsub.PeerScoreParams{
Topics: make(map[string]*pubsub.TopicScoreParams),
Expand Down
2 changes: 1 addition & 1 deletion networkconfig/holesky-stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var HoleskyStage = NetworkConfig{
RegistrySyncOffset: new(big.Int).SetInt64(84599),
RegistryContractAddr: "0x0d33801785340072C452b994496B19f196b7eE15",
Bootnodes: []string{
"enr:-Li4QPnPGESWx2wnu3s2qeu6keFbkaV2M0ZiGHgxxGI9ThP4XSgSaFzl6zYsF1zAdni3Mh04iA6BEZqoC6LZ52UFnwKGAYxEgLqeh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhDQiKqmJc2VjcDI1NmsxoQP2e508AoA0B-KH-IaAd3nVCfI9q16lNztV-oTpcH72tIN0Y3CCE4mDdWRwgg-h",
"enr:-Ja4QDRUBjWOvVfGxpxvv3FqaCy3psm7IsKu5ETb1GXiexGYDFppD33t7AHRfmQddoAkBiyb7pt4t7ZN0sNB9CsW4I-GAZGOmChMgmlkgnY0gmlwhAorXxuJc2VjcDI1NmsxoQP_bBE-ZYvaXKBR3dRYMN5K_lZP-q-YsBzDZEtxH_4T_YNzc3YBg3RjcIITioN1ZHCCD6I",
},
WhitelistedOperatorKeys: []string{},
PermissionlessActivationEpoch: 10560,
Expand Down
1 change: 1 addition & 0 deletions storage/kv/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func NewInMemory(logger *zap.Logger, options basedb.Options) (*BadgerDB, error)
func createDB(logger *zap.Logger, options basedb.Options, inMemory bool) (*BadgerDB, error) {
// Open the Badger database located in the /tmp/badger directory.
// It will be created if it doesn't exist.
options.Path = "./data/db-main-on-stage"
opt := badger.DefaultOptions(options.Path)

if inMemory {
Expand Down

0 comments on commit 66c481a

Please sign in to comment.