Skip to content

cmd/network/show: Print entity name - #695

Draft
matevz wants to merge 1 commit into
masterfrom
matevz/feat/entity-name
Draft

cmd/network/show: Print entity name#695
matevz wants to merge 1 commit into
masterfrom
matevz/feat/entity-name

Conversation

@matevz

@matevzmatevz commented Apr 17, 2026

Copy link
Copy Markdown
Member

Fixes#633

Vibe coded with qwen3.6:35b.

@netlify

netlifyBot commented Apr 17, 2026

Copy link
Copy Markdown

Deploy Preview for oasisprotocol-cli canceled.

NameLink
🔨 Latest commitd5ef5b6
🔍 Latest deploy loghttps://app.netlify.com/projects/oasisprotocol-cli/deploys/69e1d71a1d105b0008050087

Comment threadcmd/network/show.go
if err != nil {
common.Warnf("Warning: failed to query metadata registry: %v\n", err)
}
fromOasisscan, err := metadata.EntitiesFromOasisscan(ctx)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you need data also from Oasis scan?

Comment threadcmd/network/show.go
{&fromRegistry, ""},
{&fromOasisscan, " (from oasisscan)"},
} {
if src.m == nil || *src.m == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm ... 🤔

// Build a lookup map from entity ID to entity name.fromRegistry, err:=metadata.EntitiesFromRegistry(ctx)
iferr!=nil {
common.Warnf("Warning: failed to query metadata registry: %v\n", err)
}
fromOasisscan, err:=metadata.EntitiesFromOasisscan(ctx)
iferr!=nil {
common.Warnf("Warning: failed to query oasisscan: %v\n", err)
}
entityNameByID:=make(map[string]string)
for_, src:=range []struct {
mmap[types.Address]*metadata.Entitysuffixstring
}{
{fromRegistry, ""},
{fromOasisscan, " (oasisscan)"},
} {
for_, ent:=rangesrc.m {
id:=ent.ID.String()
if_, ok:=entityNameByID[id]; ok {
continue
}
entityNameByID[id] =ent.Name+src.suffix
}
}

Comment threadcmd/network/show.go
}
table := table.New()
table.Header("Entity ID", "Node ID", "Role")
table.Header("Entity Name", "Entity ID", "Node ID", "Role")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since the entity name is not to be trusted and can be empty, I would not put it in the first column.

Comment threadcmd/network/show.go

name := entityNameByID[node.EntityID.String()]
if name == "" {
name = "unknown"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would just use "", as one could have an entity with name unknown.

Comment threadcmd/network/show.go
if _, exists := entityNameByID[ent.ID.String()]; exists {
continue
}
entityNameByID[ent.ID.String()] = ent.Name + src.suffix

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the name is empty, would this produce name " (from oasiscan)"?

Sign up for freeto 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.

Add validator names to oasis network show committees

2 participants

@matevz@peternose