Releases: Someguy123/steem-rpc-scanner
v2.1.0 - Node ordering for `app.py`, method-only testing with `test_methods`, and other major improvements
New Features
Example usage of new features:
# Scan nodes.conf, including plugin tests - and sort the results placing nodes with the most successful API tests
# at the top, and least working tests at the bottom.
./app.py -q --plugins --sort tests
# Same again, but place nodes which have 'Hive' as their network at the top.
./app.py -q --plugins --sort hive
# Testing a mixture of supported and unsupported methods
./health.py test_methods https://hived.privex.io account_history_api.get_account_history condenser_api.get_blog condenser_api.get_version condenser_api.get_config
# Testing a supported method
./health.py test_method https://hived.privex.io condenser_api.get_blog
# Testing an unsupported method
./health.py test_method https://hived.privex.io condenser_api.get_config
# Same as above, but using run.sh pipenv wrapper instead of health.py
./run.sh health test_methods https://hived.privex.io account_history_api.get_account_history condenser_api.get_blog condenser_api.get_version condenser_api.get_config
./run.sh health test_method https://hived.privex.io condenser_api.get_blog
./run.sh health test_method https://hived.privex.io condenser_api.get_config
List of new features
-
Added support for ordering the scanner results outputted by
app.py
, along with reversing the results. -
Improved health metrics for
app.py
output, such as support forOut-of-sync
status. -
Improved colour scale, instead of just red/yellow/green - rows/columns can go between red, light red,
yellow, light yellow, and green, depending on how bad the node's health is. -
Added new
test_methods
andtest_method
commands tohealth.py
, which uses ONLY the plugin scanning fromMethodTests
-
Much like
health.py
scan, bothtest_methods
andtest_method
return a UNIX exit code based on whether or not the
node is considered "good" -
The
test_methods
command tests a list of API methods for a given RPC node against one or more nodes.- You can optionally specify a custom list of methods to test on the command line
- If you don't specify any methods to test, then it will scan all supported methods, just like
health.py scan
- You can specify
-l
or--min-methods
to control how many methods in total must pass their tests before
a node is considered "good" (thus returnining a0
exit code)
-
The
test_method
command works the same astest_methods
, except it only tests a singular API method
against an RPC node, and returns the appropriate exit code based on whether that individual method
passed or not. -
For both commands, you can also specify methods which aren't supported by the scanner. This means
you can test methods that don't yet have a full method test implemented.However, be aware that the test for unsupported methods only checks that there were no errors
returned in the JSON result, and that there was a non-emptyresults
key. It cannot verify
that the results returned are actually in the correct format that applications would expect. -
If you want to test a method which requires certain JSON-RPC parameters to be specified for it to
work at all, you can specify parameters that should be used for all unsupported methods being tested
with--params
(defaults to[]
).For newer appbase / Hivemind APIs, many of them don't work with a standard blank list
[]
, but
will work if you pass a blank dictionary{}
as params.
-
General Developer Changelog
-
health.py
MAX_SCORE
moved into settings- Added intro text to help epilog with source code link, license, repo link, and copyright etc.
- Refactored various argparse arguments into
arguments.py
- Added new
test_methods
andtest_method
sub-commands / functions score_node
now appropriately compensates scoring when plugin testing is disabled.- Added logging
-
app.py
- Moved argparse description into epilog, with much longer help text, and partially auto-generated help,
such as which sorting options are reversed by default, and what sorting aliases are available - As with
health.py
, refactored various argparse arguments intoarguments.py
- Adjusted
scan
to read the CLI arguments, interpret them, and pass them to the completely overhauledprint_nodes
function,
to support ordering of the results, along with reversing the order of the results.
- Moved argparse description into epilog, with much longer help text, and partially auto-generated help,
-
RPCScanner.py
-
NodeStatus object
plugins
attribute is no longer mandatory - now has a blank list factory- Added
broken_plugins
attribute - Added
scanned_at
attribute - Added new
Unreliable
status to_statuses
- Added class properties
server_type
,server
,head_block
,ssl
,avg_retries
,res_time
, andapi_tests
- Added
get
method, to improve compatibility with functions/methods which expect dictionaries. - Added magic methods
__contains__
,__getitem__
,__str__
and__repr__
-
RPCScanner class
-
Cleaned up old
.format()
strings into modern python f-stringsf"{x} {y:<20}"
-
plugin_test
now appends tobroken_plugins
when plugin tests fail, so that they can be analyzed -
Completely overhauled
print_nodes
with a new method written from the ground up (but should be mostly backwards compatible),
which supports dynamic ordering / reversal of the rows.- Columns and row data are now independent objects
NodeTableColumn
andNodeTableRow
, making it easier to add support for new
node columns, as well as dynamically adjust column names, column padding, and row content padding. - Added
enabled_columns
static attribute, allowing for columns to be enabled/disabled without editing the code. - The new heart of
print_nodes
- the classmethod_node_table_row
- makes use of modernNodeStatus
objects, instead
of relying on the dictionary compatibility layer of NodeStatus. - Nodes which are out-of-sync are now shown with the status
Out-of-sync
in red.
- Columns and row data are now independent objects
-
Various other small code quality and reliability improvements
-
-
-
MethodTests.py
- only notable change is some adjustments to the whitelist/blacklist functionality oftest_all
, so
thatsettings.SKIP_API_LIST
is used appropriately. -
rpc.py
- Cleaned up old
.format()
strings into modern python f-stringsf"{x} {y:<20}"
- Removed a lot of old commented code lines
- Refactored RPC error handling into new function
handle_graphene_error
- Improved RPC error handling with new customised
RPCError
exception, along with sub-exceptions to ease handling
more common RPC errors. - Converted standard 3-item tuple output of the methods in
NodePlug
to use the newnamedtuple
-RPCBenchResult
. Since
it's anamedtuple
, it should be backwards compatible with any old code that expects normal tuples.
- Cleaned up old
-
settings.py
/core.py
- New helper functions
find_parent
,find_file
, andscan_paths
for more robust handling of user-specified file paths.
These allow for relative paths to easily be resolved using some preset dynamic search paths. LOG_DIR
now uses the newfind_parent
function to resolve an absolute path to it's log folder, prevents issues if a
user wants to specify a custom log folder.- Added CSV setting
SKIP_API_LIST
, which is designed to contain RPC API methods that should be skipped during scanning. - Moved
MAX_SCORE
fromhealth.py
intosettings.py
, and made it possible to specify it using an environment variable
(however, it's not recommended to do that, since the scoring algorithm has been tested and tuned for a max of 50). settings.node_file
is resolved into an absolute path usingfind_file
withincore.py
.
- New helper functions
-
Various other small fixes, minor changes and improvements
v2.0.0 - Move from Twisted to native AsyncIO + major overhaul
All of the project has been migrated from Twisted Reactor to native Python AsyncIO, which affects
almost every single file in the project, so I'm not going to go into detail on the individual changes
for that.
This release is a major overhaul, with many new features, improvements, fixes and more. Not everything
is listed below, but most important changes are covered in great detail.
Key Changes
-
Many previously hardcoded settings have been changed so that they can be specified via either
environment variables, CLI arguments, or both. -
Various new environment variables and CLI arguments
-
Argument parsing in
app.py
andhealth.py
have been re-formatted, and now respect
the values inrpcscanner.settings
as defaults. -
Node list file
- The default node list file has been changed from
nodes.txt
tonodes.conf
- this
allows for IDEs and text editors to apply some syntax highlighting, especially for comments,
along with being able to use more assistive IDE features such as keyboard shortcuts to quickly
comment / uncomment nodes. core.py
now uses regex to extract nodes from the node list, instead of a simple.readlines()
and a.strip()
loop. This means in-line comments next to listed RPC nodes are now possible,
without causing a problem with the file parsing.nodes.txt.example
is nowexample.nodes.conf
- which has had many RPC nodes added and removed,
plus fancy comment blocks to separate sections of nodes in the file, and inline comments
demarcating who runs each node (if known).
- The default node list file has been changed from
-
rpcscanner/MethodTests.py
- The instance attribute
MethodTests.METHOD_MAP
has now been refactored into a module level
attribute. This allows external RPC method testing functions/methods to be configured, alongside
the ones built into theMethodTests
class. - API Method testing functions now take a first argument
host
- this is to compensate for
the newly added capability for adding external RPC method testing functions/methods, by
making the pre-existing methods consistent with how an external method would receive the
host URL being tested. - Added new
test_all
method, which works similarly to the originaltest
method, but
tests all supported API methods, or a subset if you specify a whitelist/blacklist.
- The instance attribute
-
rpcscanner/rpc.py
- Classes and functions in this file which previously expected a
reactor
instance to be passed
to them, no longer take areactor
argument. This is a breaking change, as the order of
arguments for various functions/methods/constructors have changed. - General cleanup of
NodePlug._ident_jussi
, including refactoring the server type identification
code into a static method which parses a dict/str response.
- Classes and functions in this file which previously expected a
-
health.py
- The default
MAX_SCORE
is now50
instead of20
- The scoring algorithm used in
score_node
has been tweaked, and also has a new scoring metric based
on whether a node is out of sync, applying a varying score penalty based on how badly out of sync
the node is. - New fields
Network
andPassedStages
have been added to the individual RPC health output - The
Time
field for individual RPC health has been adjusted to show how far behind the node is.
- The default
-
rpcscanner/RPCScanner.py
- The server scanning stages have been adjusted to provide partial compatibility for older Steem-based networks
such as Whaleshares, by usingdatabase_api
instead ofcondenser_api
, along with some other small adjustments. - The scanning stages now detect the
network
that a node is on, based on the native currency of the network
returning within the dynamic global props. By network, I meanSteem
,Hive
,Whaleshares
etc. - Various new methods such as
add_tasks
andrpc_tasks
and others, which are helper methods for dealing with
AsyncIO, reducing code duplication filter_badnodes
andidentify_nodes
have both been cleaned up, and have some new features added to them, related
to the newnetwork
detection.plugin_test
now records the timing + retries for individual plugin testing.
- The server scanning stages have been adjusted to provide partial compatibility for older Steem-based networks
-
App-wide changes
verbose
andquiet
have been refactored to behave differently.verbose
is now more respected,
whilequiet
is stricter on the log messages that it allows through- Various changes to the logging system, including the addition of log files, with automatic
log folder creation to avoid issues. - Migrated from standard
requirements.txt
to pipenv, as pipenv handles both dependency management,
and creation/maintenance of virtualenv's. - Added
run.sh
runner script, to make it easier to install, update, and run rpcscanner via pipenv. - Added a
Dockerfile
, so that rpc-scanner can be easily ran within a Docker container on any platform.
Pre-built images coming soon. - General reliability and user experience improvements across the application
and various other fixes, changes and improvements...