Skip to content

Add ListMetadataKeys and GetAllMetadata RPC methods for improved metadata discovery - #2387

Closed
Manav-Aggarwal with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-2386
Closed

Add ListMetadataKeys and GetAllMetadata RPC methods for improved metadata discovery#2387
Manav-Aggarwal with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-2386

Conversation

CopilotAI commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

Problem

The existing GetMetadata RPC query requires users to know the specific metadata keys beforehand, which are scattered throughout the codebase. This makes it difficult for users to discover what metadata is available or to query all node metadata efficiently.

Solution

This PR implements two new RPC methods while maintaining backward compatibility:

1. ListMetadataKeys() - Metadata Discovery

Returns all available metadata keys with human-readable descriptions:

keys, err:=client.ListMetadataKeys(ctx)
for_, key:=rangekeys {
fmt.Printf("Key: %s - %s\n", key.Key, key.Description)
}

2. GetAllMetadata() - Omni Query

Returns all node metadata in a single call, reducing round trips:

metadata, err:=client.GetAllMetadata(ctx)
for_, entry:=rangemetadata {
fmt.Printf("%s: %v\n", entry.Key, entry.Value)
}

Key Features

  • Discoverable: Users can explore available metadata without prior knowledge
  • Efficient: Single call to get all metadata reduces network overhead
  • Robust: Gracefully handles missing or unavailable metadata keys
  • Backward Compatible: Existing GetMetadata method unchanged
  • Well-Documented: Comprehensive API documentation and examples

REST Endpoints

Added convenient HTTP endpoints for web integrations:

  • GET /api/v1/metadata/keys - Lists metadata keys with descriptions
  • GET /api/v1/metadata - Returns available keys and RPC method info

Implementation Details

  • Centralized metadata key constants in types package for consistency
  • Updated all references throughout the codebase to use centralized constants
  • Generated new protobuf definitions with proper message types
  • Comprehensive test coverage for RPC methods, HTTP endpoints, and error cases

Current Metadata Keys

KeyDescription
dDA included height - height of the data availability layer that has been included
lLast batch data - last batch data submitted to the data availability layer
last-submitted-header-heightLast submitted header height to DA
last-submitted-data-heightLast submitted data height to DA

Fixes#2386.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • buf.build
    • Triggering command: /usr/local/bin/buf generate --path=./proto/rollkit --template=buf.gen.yaml --config=buf.yaml (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Manav-Aggarwal

Copy link
Copy Markdown
Member

Do it after #2363 is merged

@Manav-Aggarwal

Copy link
Copy Markdown
Member

Open again after #2387 is merged

CopilotAI changed the title [WIP] [FEATURE] GetMetaData rpc queryAdd ListMetadataKeys and GetAllMetadata RPC methods for improved metadata discoveryJun 24, 2025
CopilotAI requested a review from Manav-AggarwalJune 24, 2025 16:51
@tac0turtletac0turtle removed this from EvolveAug 25, 2025
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.

[FEATURE] GetMetaData rpc query

3 participants

@Manav-Aggarwal@tac0turtle