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

[Bug] Full BlockTransactions doesn't offer access to Transaction slice #665

Closed
sfyll opened this issue May 2, 2024 · 4 comments · Fixed by #666
Closed

[Bug] Full BlockTransactions doesn't offer access to Transaction slice #665

sfyll opened this issue May 2, 2024 · 4 comments · Fixed by #666
Labels
bug Something isn't working

Comments

@sfyll
Copy link

sfyll commented May 2, 2024

Component

rpc

What version of Alloy are you on?

No response

Operating System

None

Describe the bug

Hello sirs.

Wonderful job!

Filling the above. Basically, it's impossible to access the Full transaction field from the BlockTransactionHashesInner object as the only exposed API will collapse a Full transaction into its transaction hash. I would classify this as a bug and not a feature request as it is quite misleading, but happy to be corrected, mostly nomenclature to be honest. It does seem erroneous to download full payloads only to be offered access to the transaction hashes, which are returned in default mode anyways.

Obviously, something might have escaped me from the API, which might deprecate this bug report. Happy to stand corrected!

@sfyll sfyll added the bug Something isn't working label May 2, 2024
@prestwich
Copy link
Member

prestwich commented May 2, 2024

maybe i am missing something, but if let BlockTransactions::Full(txns) = block_txns { ... }, or a match block should unblock you.

regardless, it's straightforward to add an as_full(&self) -> Option<&[T]> so i'll do that

@prestwich
Copy link
Member

okay it turns out that all the impls here are only for T = Transaction so i may need a trait abstraction for Transaction if i want to make it reusable across networks 🤔

@prestwich
Copy link
Member

prestwich commented May 2, 2024

Pr #666 🤘 will add a convenience function to convert to Option<&[T]> and a convenience iterator over &T

@sfyll
Copy link
Author

sfyll commented May 2, 2024

damn that is very fast ! next one is on me then 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants