kaspanet / rusty-kaspa

Kaspa full-node and related libraries in the Rust programming language. This is a Beta version at the final testing phases.
ISC License
350 stars 105 forks source link

Fix ContextualNetAddress parsing #433

Closed orgr closed 1 month ago

coderofstuff commented 2 months ago

This fixes rpclisten only. Have you checked if the other params rpclisten_borsh and rpclisten_json also need the same fix? Some other params like listen or anything that takes in contextualnetaddress or something like a netaddress may also need attention. Please see if those need attention as well.

Overall, we need to ensure that all the parameters can be passed in somehow, so it'd be great to just cover every param and try setting them via config and cli to see that they all still work.

callid0n commented 2 months ago

for some reason it doesn't like the line appdir="K:\Testnet11\Data" below is what I'm testing, I commented out params until I found the one that was failing

testnet=true utxoindex=true disable-upnp=true perf-metrics=true appdir="K:\Testnet11\Data"

testnet-suffix=11

rpclisten="0.0.0.0:16310"

listen="0.0.0.0:16311"

ram-scale=1.5

addpeer="192.168.3.170:16311"

log-level="info,kaspad_lib::daemon=trace"

.\kaspad.exe --configfile "K:\Testnet11\Binaries\configfile.toml" error: failed parsing config file, reason: invalid escape sequence expected b, f, n, r, t, u, U, \, "

seems like a double backslash does work as the backslash may be an escape character

this works

appdir="K:\\Testnet11\\Data"
callid0n commented 2 months ago

All the below will run, except add-peers="192.168.3.170:16311"...it throws this error

\kaspad.exe  --configfile "K:\Testnet11\Binaries\configfile.toml"
error: failed parsing config file, reason: invalid type: string "192.168.3.170:16311", expected a sequence

testnet=true
utxoindex=true
disable-upnp=true
perf-metrics=true
appdir="K:\\Testnet11\\Data"
testnet-suffix=11
rpclisten="0.0.0.0:16310"
listen="0.0.0.0:16311"
ram-scale=1.5
add-peers="192.168.3.170:16311"
log-level="info,kaspad_lib::daemon=trace"

...however, not seeing the perf metrics displayed, so looks like it's accepting the config file, but not applying and showing metrics.

here is the equivalent CLI. Note that in order to show --perf-metrics, it must also be used with --loglevel=info,kaspad_lib::daemon=trace

./kaspad.exe --testnet --netsuffix=11 --utxoindex --disable-upnp --perf-metrics --appdir "K:\Testnet11\Data" --rpclisten="0.0.0.0:16310" --listen="0.0.0.0:16311" --ram-scale=1.5 --addpeer=192.168.3.170:16311 --loglevel=info,kaspad_lib::daemon=trace
orgr commented 2 months ago

add-peers expects an array so it would be

add-peers = ["123.4.5.6", "192.168.1.1"]

or single value ["123.4.5.6"]

Maybe ini format is closer to what you're expecting, I'll check the library aspect mentioned

orgr commented 2 months ago

the perf-meters issue is because of an issue with the log-level, @callid0n should be working now, any more sneaky options I might have missed?

TODO

callid0n commented 2 months ago

tested the following and they're accepted in the config file and seem to be working. Perf metrics are showing and "add-peers" is accepting single and multiple with port number and connecting. Need to run some additional tests over time to verify that the "ram-scale" is applying correctly and limiting RAM to the value provided.

testnet=true
utxoindex=true
disable-upnp=true
perf-metrics=true
appdir="K:\\Testnet11\\Data"
testnet-suffix=11
rpclisten="0.0.0.0:16310"
listen="0.0.0.0:16311"
ram-scale=1.5
add-peers=["192.168.3.208:16311","192.168.3.170:16311"]
log-level="info,kaspad_lib::daemon=trace"
michaelsutton commented 2 months ago

Perhaps serde rename should be applied to:

inbound_limit -> maxinpeers outbound_target -> outpeers

and perhaps other fields I'm missing. Ideally we find a way to avoid maintaining these multiple renames (both on args definition and serde attributes), but that can be a future fix

callid0n commented 2 months ago

This works.

connect-peers=["192.168.3.170:16311"]