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

fix: force raw codec if requested #644

Merged
merged 3 commits into from
Jan 4, 2023
Merged

fix: force raw codec if requested #644

merged 3 commits into from
Jan 4, 2023

Conversation

Arqu
Copy link
Collaborator

@Arqu Arqu commented Dec 21, 2022

@Arqu Arqu added the fix Fixes a bug label Dec 21, 2022
@Arqu Arqu self-assigned this Dec 21, 2022
.await;
assert_eq!(http::StatusCode::OK, res.status());
let body = hyper::body::to_bytes(res.into_body()).await.unwrap();
let ufs = iroh_unixfs::unixfs::UnixfsNode::decode(&test_setup.root_cid, body).unwrap();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Am slightly confused on how to unpack this further without significantly complicating things.

// Resolve the root block.
let (root_cid, loaded_cid) = self.resolve_root(&path, &mut ctx).await?;
match loaded_cid.source {
Source::Store(_) => inc!(ResolverMetrics::CacheHit),
_ => inc!(ResolverMetrics::CacheMiss),
}

let codec = Codec::try_from(root_cid.codec()).context("unknown codec")?;
let codec = match force_raw {
true => Codec::Raw,
Copy link
Contributor

Choose a reason for hiding this comment

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

this works, but is really misusing the current setup

Copy link
Contributor

Choose a reason for hiding this comment

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

but I guess it works for now

@Arqu
Copy link
Collaborator Author

Arqu commented Jan 4, 2023

@dignifiedquire where we at with this?

Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

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

lets ship it for now

@Arqu Arqu merged commit 53b9220 into main Jan 4, 2023
@Arqu Arqu deleted the arqu/verify_hash branch January 4, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

raw block response fails hash verification
2 participants