Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
This is a Rust port of Python's stdlib graphlib. It passes all of the standard libraries tests and is a drop in replacement. This also happens to be Python 3.7 compatible, so it can be used as a backport. Since usage is exactly the same as the standard libraries, please refer to their documentation for usage details.
See this project on GitHub.
from graphlib2 import TopologicalSorter
graph = {0: [1], 1: [2]} # 0 depends on 1, 1 depends on 2
ts = TopologicalSorter(graph)
ts.prepare()
while ts.is_active():
ready_nodes = ts.get_ready()
ts.done(*ready_nodes) # all at a time or one by one
This was primarily written for di and for me to learn Rust. In other words: please vet the code yourself before using this.
TopologicalSorter.copy()
which copies a prepared or unprepared graph so that it can be executed multiple times.ToplologicalSorter[int]
works at runtime).The implementation was designed for the specific use case of adding all nodes, calling prepare()
then copying and executing in a loop:
from graphlib2 import TopologicalSorter
graph = {0: [1], 1: [2]}
ts = TopologicalSorter(graph)
ts.prepare()
while True: # hot loop
t = ts.copy()
while t.is_active():
ready_nodes = t.get_ready()
t.done(*ready_nodes)
This means that the focus is on the performance of TopologicalSorter.get_ready()
and TopologicalSorter.done()
, and only minimal effort was put into other methods (prepare()
, add()
and get_static_order()
), although these are still quite performant.
make init
make test
If your pull request gets approved and merged, it will automatically be relased to PyPi (every commit to main
is released).
FAQs
Rust port of the Python stdlib graphlib modules
We found that graphlib2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.