Skip to content

rpc: update FetchAssetMeta to allow fetch by group key #1591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jun 9, 2025

This commit refactors the FetchAssetMeta RPC implementation in rpcserver.go. The main function now uses a top-level switch statement that dispatches to dedicated helper functions for handling requests by asset ID, meta hash, and group key.

The following helper functions were introduced:

  • fetchMetaByAssetID
  • fetchMetaByMetaHash
  • fetchMetaByGroupKey

Each helper encapsulates the logic for fetching and processing asset metadata based on the specific identifier type (including handling both raw byte and hex-encoded string inputs via the main dispatcher).

This change improves code organization and readability of the FetchAssetMeta method without altering its external behavior.

Unit tests in rpcserver_test.go have been reviewed and updated to ensure continued coverage of all cases, including new sub-tests for raw byte inputs for each identifier type.

Fixes #1504

This commit refactors the `FetchAssetMeta` RPC implementation in
`rpcserver.go`. The main function now uses a top-level switch statement
that dispatches to dedicated helper functions for handling requests
by asset ID, meta hash, and group key.

The following helper functions were introduced:
- `fetchMetaByAssetID`
- `fetchMetaByMetaHash`
- `fetchMetaByGroupKey`

Each helper encapsulates the logic for fetching and processing asset
metadata based on the specific identifier type (including handling both
raw byte and hex-encoded string inputs via the main dispatcher).

This change improves code organization and readability of the
`FetchAssetMeta` method without altering its external behavior.

Unit tests in `rpcserver_test.go` have been reviewed and updated to
ensure continued coverage of all cases, including new sub-tests for
raw byte inputs for each identifier type.
@Roasbeef Roasbeef changed the title refactor: Use helper functions in FetchAssetMeta RPC rpc: update FetchAssetMeta to allow fetch by group key Jun 9, 2025
@Roasbeef
Copy link
Member Author

Roasbeef commented Jun 9, 2025

Looks like it updated the protoc version along the way, so a lot of the diff is small updates in all the generated files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

[bug]: FetchAssetMeta should accept group_key as an input alternative to asset_id
1 participant