Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
is-ip
5.0.0 is significantly slower than 4.0.0. This is due to adding protection against regex DoS.It does so by wrapping its regex calls in
node:vm
apis with a timeout.Although the resulting code is protected against regex DoS, its also ~6000x slower, so slow that it shows up with non-negligible time in Lodestar cpu profiles.
Solution:
Replace
is-ip
dependency with@chainsafe/is-ip
.@chainsafe/is-ip
is a drop-in replacement foris-ip
that is a transliteration of some of rust's std net code - this.It's ~300x faster for valid IPv4 values, ~30x faster for valid IPv6 values than
is-ip
5.0.0. And it's not vulnerable to regex DoS because it doesn't use regex, rather it uses a simple parser built just for the job of parsing IP addr strings.See discussion: