Skip to content
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

gateway/blocks-backend: GetBlock should not perform IPLD decoding #673

Open
Tracked by #10499
aschmahmann opened this issue Sep 17, 2024 · 0 comments
Open
Tracked by #10499
Labels
need/triage Needs initial labeling and prioritization

Comments

@aschmahmann
Copy link
Contributor

aschmahmann commented Sep 17, 2024

The gateway BlocksBackend's GetBlock function under the hood uses the dagservice's Get function which means it attempts to do an IPLD decoding of the block. This is not good because it means the gateway needs to understand the blocks codec in order to return it even when it doesn't really need to.

func (bb *BlocksBackend) GetBlock(ctx context.Context, path path.ImmutablePath) (ContentPathMetadata, files.File, error) {

nd, err := bb.dagService.Get(ctx, lastRoot)

As an example: rainbow does not support dag-jose and so sending a format=raw request to a rainbow gateway will fail even though it could pass.

A fix here is to use the blockservice directly instead of the dagservice for the GetBlock function's retrieval purposes after doing any path traversals required to get to the final block.

@aschmahmann aschmahmann added the need/triage Needs initial labeling and prioritization label Sep 17, 2024
@lidel lidel changed the title gateway/blocks-backend: gateway/blocks-backend: GetBlock should not perform IPLD decoding Sep 18, 2024
@lidel lidel mentioned this issue Sep 18, 2024
31 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

1 participant