- Take the "include_unrelayed" as a parameter instead of switching on on
the admin context; there isn't likely to be anything sensitive there,
and it makes little sense for a wallet to get *different* results just
because it happens to be talking to a localhost oxend.
- Change the histogram code so that it always returns a fixed size
- Various improvements to histogram output; most notably printing a more
useful indication of what the histogram outputs are (e.g. instead of:
Age Txes Bytes
now 0 0
8.0 minutes ago 0 0
16.1 minutes ago 0 0
24.1 minutes ago 0 0
32.2 minutes ago 0 0
40.2 minutes ago 0 0
48.3 minutes ago 0 0
56.3 minutes ago 0 0
64.3 minutes ago 0 0
72.4 minutes ago 2 4559
it now displays the ranges:
Age Txes Bytes
now - 10.6min ago 0 0
10.6min - 21.3min ago 0 0
21.3min - 32.0min ago 0 0
32.0min - 42.6min ago 0 0
42.6min - 53.2min ago 0 0
53.2min - 63.9min ago 0 0
63.9min - 74.6min ago 0 0
74.6min - 85.2min ago 0 0
85.2min - 1.6hr ago 0 0
1.6hr - 1.8hr ago 2 4559
Rather than serializing in the `invoke` call, we now return a variant
(bt, json, or string) from invoke and let the RPC server deal with it.
This significantly simplifies the JSON RPC interface because it lets us
move json objects around, which is particularly useful for building a
json_rpc response and lets us avoid the vector of strings hack that was
needed for epee json serialization.
This also lets the RPC caller decide what it wants to accept -- so the
OMQ RPC can deal with anything (bt, json, binary), while the http
json_rpc handler only accepts json, and the http/legacy binary handlers
accepts json or strings, but not bt_value.
This also fixes a but in the json_rpc handler that failed when given an
"id" value that wasn't a string (such as a number).
- add documentation
- change download/upload speed values to B/s instead of KiB/s
- return times as milliseconds instead of seconds, and rename those
fields from ..._time to ..._ms.
- Code cleanup of state strings
- remove completely unused peer state "idle"
It makes no sense for the definition to be there (except that it was
for epee serialization purposes), so move it into tx_memory_pool where
it belongs, and convert it to json on the fly for the rpc method that
wants it.
Autodetect is not that useful in the first place, even if we weren't
PoS, but is especially useless now.
miner_conf.json is this probably-never-used feature to load some extra
crap into the tx_extra. Just kill it.
Remove the ability (and RPC endpoint) to print the hashrate periodically
to stdout because that is pretty dumb.
Removes a bunch of epee garbage and replaces it with std::chrono.
In particular:
- TIME_MEASURE_* macros are gone because they are garbage.
- epee::get_tick_count() is gone because it is garbage.
- epee::get_ns_count() is gone because it is garbage.
- TIME_MEASURE_NS_* macros are gone because they are unused and garbage.
- PROFILE_FUNC_* macros are gone because they are unused and garbage.
- profile_tools::local_call_account is gone because it is unused and
garbage.
- various places passing around ints (which could be seconds,
milliseconds, or nanoseconds) changed to pass std::chrono duration
types.
- Make it compile/work
- Take outputs as a list of output indices. We never need "amount" in
Oxen (it will always be 0).
- Add backwards compatibility to still take outputs as
[{"amount":0,"index":n},...] when making a json request.
- Add an "as_tuple" bool parameter: if specified then you get results in
a much denser tuple form rather than a dict, which can make a huge
difference in the response size when requesting many outputs.
- Supports loading into tuples, std::arrays, std::pairs from a list of
the correct size.
- Supports loading into vectors of arbitrary types (include vector,
tuples, binary types, etc.)
- Removes system_clock type as we aren't using it (and because it won't
be recursively handled nicely when nested, especially for json).
Use `- \p paramname Description` rather than `\arg \c paramname
Description`.
\arg is for compatibility with some particular doc format and is
equivalent to - except that - can be nested while \arg cannot.
\c and \p are equivalent, but \p is explicitly intended for parameters.
Updates the internal callers of get_service_nodes to properly deal with
the new request format/fields.
Note that this also introduces some significant changes to the
`print_sn` output:
- contributor formats are more compact (one line per contributor), show
reserved amounts (if != contributed amouont), and show the stake %.
- reworded "Operator Cut (% of Fee Reward)" to "Operator Fee"
- checkpoint/pulse vote format is completely overhauled to list voted
and missed heights separately.
- pulse votes now show the pulse round for non-zero round results.
- timestamp checks renamed to Quorumnet tests
- qnet & timesync results now just print the number of successes/fails
rather than a list of true/false values.
Converts request parsing and result generation for get_service_nodes and
get_service_node_status.
Note that there are some significant changes here (due to no longer
having to be under epee's output constraints) that significantly reduce
the size of an all-service-nodes request by nearly half, most notably in
a significantly more compact representation of vote/participation
results.
- added a "decomm_reasons" which decomposes the reason codes into string
values such as:
"decomm_reasons": {
"all": ["uptime"],
"some": ["pulse", "lokinet"]
}
- reworded/fixed/expanded various field descriptions
- Various Loki currency references changed to OXEN
- added "operator_fee" which is a rounded operator fee expressed as
thousanths of a percent (e.g. 100000 means 100%, 4567 means 4.567%).
This is inaccurate but much easier to deal with than the raw
portions_for_operator value (especially because the value *usually*
exceeds what can be stored in a double, and thus is not safe with
various JSON parsers).
- added "swarm" which is a hex string representation of the swarm_id,
because swarm_id also isn't double-storage safe.
- reserved and total_reserved fields are now only included if they are
actually different from the amount/total_contributed values.
- various uptime-proof-dependent values (like versions, public ip,
ports) are now omitted if we haven't received an uptime proof yet.
- Flipped inverted descriptions of timestamp participation / synced
values in the RPC documentation.
- checkpoint/pulse/timecheck/timesync participations data is completely
redesigned to be less bloated; the names are now changed to
"checkpoint_votes" and "pulse_votes" and information is returned much
more compactly using lists of lists and/or plain values rather than
lists of dicts that repeat a ton of fields.
- Renamed timestamp_participation in the RPC to quorumnet_tests since,
although we're doing the test for time checking, the main purpose of
the participation is to see that we can reach them. As above, the
result value is significantly more compact: [SUCCESS,FAILS] instead of
an array of dicts.
- Similarly renamed timesync_status to timesync_tests ("status" was
fine, but changing the value completely to [SUCCESS,FAILS] warrants a
name change).
- dropped the "as_json" field because it is asking oxend to
double-encode json, and that is retarded.
- also applies all the same refactoring to get_service_node_status
(which is really just a shortcut for getting the current node's status
out of get_service_nodes).
- overhauled how "fields" works to take a list of field names (the dict
is name: bool values is still supported for backwards compatibility).
Also extended fields to handle "locked_contributions" as a supported
field (so that you can easily omit it, since it often isn't cared
about).
At MERROR they don't print at the default --log-level=0, so you get
output such as:
2021-08-06 18:04:08.073 I Starting up oxend services...
2021-08-06 18:04:08.073 I Starting core
2021-08-06 18:04:08.073 F Failed to start core
2021-08-06 18:04:08.173 I Deinitializing daemon objects...
with no actual error displayed as to why it failed to start. With this
change you get:
2021-08-06 18:04:14.004 F Please specify an IPv4 public address which the service node & storage server is accessible from with: '--service-node-public-ip <ip address>'
2021-08-06 18:04:14.004 F IMPORTANT: One or more required service node-related configuration settings/options were omitted or invalid; please fix them and restart oxend.
2021-08-06 18:04:14.004 F Failed to start core
- Moves the json binary handling code into new rpc_binary.h
- Adds support for storing/loading vectors of binary types
(crypto::hash, etc.), and vectors of strings.
*Nothing* calls `print_money()` with a decimal place value, for good
reason: it's a stupid thing to want to do. Similarly nothing gives a
decimal places argument to `get_unit()`.
This removes the dumb unused decimal place argument.
- make checkpoint and pulse participation distinct types
- make the container act a little more like an stl container
- replace check_participation() with a failures() method that just
returns the number of failures (so the caller can decide whether that
is bad or not).
- As a consequence of the above, failures now trigger on N+1 failures,
while previously they required N+1 failures *and* 8 total responses.
There is no need to wait for all 8 as far as I can see since we will
be failing no matter what the next 3 responses are.
- Removed the serialization code (hopefully this doesn't break
everything outside the RPC code).
- Simplify/DRY the code that records participation
The bt-encoding, in particular, is aimed at more efficient wallet3 rpc
interactions with a daemon.
This removes the rigidity from RPC request responses, making it easier
to return useful constructs that the current epee code doesn't support
(like lists of lists), and also adds support for bt-encoded RPC requests
(intended to eventually replace the ".bin" endpoints with Monero NIH
binary encoding).
Instead endpoints now set a nlohmann::json response object with whatever
arbitrary values they want without having to add a bunch of limited epee
serialization macro hell.
So, for example, to set the value "foo" to 20, you use:
rpc.response["height"] = 20;
Binary values (for things like hashes) are handled by going through a proxy object:
rpc.response_hex["hash"] = hash; // hash is a crypto::hash
which, for json, is equivalent to:
rpc.response["hash"] = tools::type_to_hex(hash);
but when the response is to be bt-encoded it leaves it as binary for
more efficient transfers.
There is also a `response_b64` that converts json-destined values to
base64 instead of hex (and again leaves bt-destined values as binary).
Parsing of incoming requests now moves to a new
core_rpc_server_command_parser file, which does free-form parsing from a
nlohmann::json or bt_dict_consumer, and has various templated helper
functions to make this easier.
This is preliminary: this builds the basic infrastucture for handling
requests, and converts three endpoints:
- get_info
- get_height
- ons_resolve
Currently only `make daemon` builds (there is code in the wallet that
hasn't been updated yet), and the other RPC interfaces are disabled by
this commit (until they get converted to the new style).