Skip to content

User Agent suffix is not set in libp2p #9456

@aschmahmann

Description

@aschmahmann

Checklist

Installation method

built from source

Version

No response

Config

No response

Description

Create two nodes A and B. Start node A with --user-agent-suffix=foo. On node B run ipfs id <node A id> and see that the suffix is missing 😢.

The implementation in #8419 seems to have been implemented incorrectly and the sharness test "verifying behavior" only tests that the node itself knows about the suffix but not that it broadcasts it.

The issue stems from

var UserAgent = simpleOpt(libp2p.UserAgent(version.GetUserAgentVersion()))

where the user agent option is created. While the option is itself a function which will get called and run after the suffix has been processed and SetUserAgentSuffix called, the string passed into libp2p.UserAgent is fetched on package load.

func SetUserAgentSuffix(suffix string) {

Any fix that delays the setting of the user agent string until fx has asked for it should be fine. As for testing, I'd recommend using the scenario above to reproduce.

Metadata

Metadata

Assignees

Labels

kind/bugA bug in existing code (including security flaws)need/triageNeeds initial labeling and prioritization

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions