Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 24, 2025

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 := range keys {
    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 := range metadata {
    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

Key Description
d DA included height - height of the data availability layer that has been included
l Last batch data - last batch data submitted to the data availability layer
last-submitted-header-height Last submitted header height to DA
last-submitted-data-height Last 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
Member

Do it after #2363 is merged

@Manav-Aggarwal
Copy link
Member

Open again after #2387 is merged

@github-project-automation github-project-automation bot moved this to Done in Evolve Jun 24, 2025
Copilot AI changed the title [WIP] [FEATURE] GetMetaData rpc query Add ListMetadataKeys and GetAllMetadata RPC methods for improved metadata discovery Jun 24, 2025
Copilot AI requested a review from Manav-Aggarwal June 24, 2025 16:51
@tac0turtle tac0turtle removed this from Evolve Aug 25, 2025
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.

[FEATURE] GetMetaData rpc query

2 participants