fix: tracer: emit raw peer ids for compatibility with libp2p tracer #10271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issues
The pubsub tracer emits traces in JSON format or posts JSON documents to an opensearch endpoint. The traces are a combination of libp2p-pubsub traces and a custom LotusTraceEvent, intermixed in the JSON stream. The libp2p traces use
[]byte
as the type for peer IDs which, in JSON, is base64 encoded.The LotusTraceEvent type uses a
string
for peer IDs (prettified) which is emitted as-is in the JSON.However clients have no sensible way to distinguish the two encodings, the stream consists of a mix of the two representations:
If a client attempts to decode into a struct using a
[]byte
field they will get the base64 decoded bytes of the libp2p peer IDs and the garbled base64 decoding of the pretty peer ID emitted in LotusTraceEventIf they use a string field, they get the pretty peer ID from LotusTraceEvent and a base64 encoded string for the libp2p traces.
Since one supported client is ElasticSearch, there is not much scope for the user to decode the peer IDs properly.
Fix this by using
[]byte
and raw peer IDs in the LotusTraceEvent to retain compatibility the pre-existing libp2p trace field typeProposed Changes
Change
LotusTraceEvent.PeerID
andTraceEventPeerScore.PeerID
types to[]byte
Additional Info
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, testarea
, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps