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

shim: blob query #167

Merged
merged 1 commit into from
Jan 2, 2024
Merged

shim: blob query #167

merged 1 commit into from
Jan 2, 2024

Conversation

rphmeier
Copy link
Contributor

No description provided.

Copy link
Contributor Author

rphmeier commented Dec 29, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

BlockRef::Number(n) => write!(f, "{}", n),
BlockRef::Hash(h) => write!(f, "0x{}", hex::encode(&h[..])),
}
fn decode_hash(input: &str) -> Result<Option<[u8; 32]>, String> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Would appreciate not mixing new features and refactorings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not graphite-pilled enough to keep things that small. at the time, it would've required stacking on top of only some of the changes within the file, stashing the other ones, and then popping the stash to build on top of the refactored decoder

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. I suggested that because for me it seemed like a simple operation.

.block_hash(n)
.await?
.ok_or_else(|| anyhow::anyhow!("No block with number {}", n))?
.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

goddammit. I was trying to guard the API from precisely this thing and failed!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Specifically the .0 thing?

I did notice there's a comment in the sugondat_rpc file: "NOTE: we specifically avoid prolifiration of subxt types around the codebase. To that end, we avoid returning H256 and instead return [u8; 32] directly."

And yet, pub async fn block_hash(&self, height: u64) -> anyhow::Result<Option<H256>> returns the H256. Seems like an easy fix, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's precisely what I meant. If you look at blame, my name will pop on both of those lines.

} else {
println!(
" Blob #{}, Namespace {}, {} bytes",
i + 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it's a good idea to have the descrepancy between the cli input and here. In the CLI it's the zero-based and here it's 1-based.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The extrinsic index is zero-based, whereas the blob index is 1-based. if we need consistency between two (different) indexes, I would prefer they both be 0-based rather than 1-based.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened #170 & we can discuss there

@rphmeier rphmeier force-pushed the rh-shim-block-query branch from f79eecd to 93059ee Compare December 31, 2023 22:20
@rphmeier rphmeier force-pushed the rh-shim-block-query branch from 93059ee to 7cae1e7 Compare January 1, 2024 21:31
@rphmeier rphmeier force-pushed the rh-shim-blob-query branch from 110b39a to 4b642aa Compare January 1, 2024 21:31
Base automatically changed from rh-shim-block-query to main January 2, 2024 10:25
@pepyakin pepyakin force-pushed the rh-shim-blob-query branch from 4b642aa to 1feca1e Compare January 2, 2024 12:13
@pepyakin pepyakin merged commit a9bd7fb into main Jan 2, 2024
5 checks passed
@pepyakin pepyakin deleted the rh-shim-blob-query branch January 2, 2024 12:24
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.

2 participants