Skip to content

fix(server): wire Identity config to node.UserIdent in buildNode#2105

Merged
kamuikatsurgi merged 1 commit intodevelopfrom
minhd-vu/fix-identity-config
Mar 5, 2026
Merged

fix(server): wire Identity config to node.UserIdent in buildNode#2105
kamuikatsurgi merged 1 commit intodevelopfrom
minhd-vu/fix-identity-config

Conversation

@minhd-vu
Copy link
Copy Markdown
Contributor

@minhd-vu minhd-vu commented Mar 4, 2026

Description

Fix the --identity flag not being applied when using bor server.

Problem

The bor server command accepts an Identity config field but buildNode() never sets node.Config.UserIdent, causing the identity to be silently ignored.

This means nodes running with bor server --identity=xxx always show the default client name in P2P communications, regardless of the --identity flag value.

Note: The legacy CLI (bor --identity=xxx) is unaffected as it uses setNodeUserIdent() inherited from go-ethereum.

Root Cause

The bor server command uses a separate HCL-based configuration system (internal/cli/server/) that doesn't exist in upstream go-ethereum. The buildNode() function manually constructs a node.Config struct but was missing the UserIdent field:

cfg := &node.Config{
    Name:    clientIdentifier,
    // UserIdent was missing here
    DataDir: c.DataDir,
    ...
}

Fix

Add the missing field assignment in buildNode():

cfg := &node.Config{
    Name:      clientIdentifier,
    UserIdent: c.Identity,  // <-- Added
    DataDir:   c.DataDir,
    ...
}

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
  • This PR requires changes to matic-cli

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on amoy
  • I have created new e2e tests into express-cli

Manual tests

  1. Start bor with identity: bor server --identity=my-node ...
  2. Connect a peer and verify the client name includes "my-node"
  3. Alternatively, use polycli p2p ping <enode> to observe the peer's client name

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 4, 2026

@cffls
Copy link
Copy Markdown
Contributor

cffls commented Mar 4, 2026

Does this work for config.toml?

@minhd-vu
Copy link
Copy Markdown
Contributor Author

minhd-vu commented Mar 4, 2026

Does this work for config.toml?

It should work for config.toml. The Identity field has both tags:

Identity string `hcl:"identity,optional" toml:"identity,optional"`

Copy link
Copy Markdown
Contributor

@cffls cffls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@kamuikatsurgi kamuikatsurgi merged commit 936ac97 into develop Mar 5, 2026
16 of 19 checks passed
@kamuikatsurgi kamuikatsurgi deleted the minhd-vu/fix-identity-config branch March 5, 2026 02:07
lucca30 pushed a commit that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants