NethermindEth / near-sffl

https://nffl.nethermind.io/
MIT License
6 stars 3 forks source link

Include signature in message receiving logs #264

Closed emlautarom1 closed 3 days ago

emlautarom1 commented 4 days ago

Current Behavior

Currently, when logging messages that contain a bls.Signature we're logging a pointer address rather than its contents.

New Behavior

Whenever we log these messages we log their value rather that their representation

Breaking Changes

This change should not introduce any breaking changes.

Observations

The original code used fmt.Sprintf("%#v", ...) in the log calls which did not dereference the pointers. This behavior is present since #12 but there is no clear indication on why it was done that way.

Hyodar commented 3 days ago

Great! Can you include a snippet of the logs right now?

emlautarom1 commented 3 days ago

It will look something like this:

2024-07-01T13:31:40.252-0300    INFO    rest_server/log_test.go:23      Received signed operator set update message     {"message": {"Message":{"Id":100,"Timestamp":200,"Operators":[{"Pubkey":{"X":3,"Y":4},"Weight":5}]},"BlsSignature":{"g1_point":{"X":1,"Y":2}},"OperatorId":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}

To get a better representation we could use something like BlsSignature.Serialize() which looks like the following:

2024-07-01T13:33:32.477-0300    INFO    rest_server/log_test.go:23      Received signed operator set update message     {"message": {"Message":{"Id":100,"Timestamp":200,"Operators":[{"Pubkey":{"X":3,"Y":4},"Weight":5}]},"BlsSignature":{"g1_point":{"X":1,"Y":2}},"OperatorId":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}, "signature": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAg=="}
Hyodar commented 3 days ago

That's all right really. Usually these signatures are represented as E(x, y) indeed, without hex.

Hyodar commented 3 days ago

It's fine as it is IMO

emlautarom1 commented 3 days ago

Merging and closing #247