nspcc-dev / neo-go

Go Node and SDK for the Neo blockchain
MIT License
123 stars 79 forks source link

RPC server confuses when logs RPC parameters #3694

Open carpawell opened 1 day ago

carpawell commented 1 day ago

At some point, you start to check logs to find errors and then you see some strange things that lead you to non-existent bugs...

Current Behavior

I saw processing rpc request {"method": "subscribe", "params": "[transaction_executed ]"} but I am sure it worked ok and params (after transaction_executed) were not an empty string.

Expected Behavior

I could see some string representation of the parameters I sent. It must have one, this was a JSON part at some step.

Possible Solution

I don't know.

Steps to Reproduce

Call some test like https://github.com/nspcc-dev/neo-go/blob/57eec71101bad9d6d01bbaeecba0a2105f9dbd6b/pkg/services/rpcsrv/subscription_test.go#L203-L209 and see that it passes but printed logs are confusing.

Context

Debugging subscription problems may lead to some not-needed deep research for nothing.

Regression

I guess no, @AnnaShaleva said it was kinda ok for years.

Your Environment

v0.106.3

roman-khimov commented 1 day ago

We can't log all parameters in their full length, but something can be improved here, because Param.String() is not a regular stringer interface, it's used for string extraction from parameters and not everything is a string. I'd say it's a misuse of "String()" name for a different method.