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

Inherent functions to_bytes / from_bytes #2583

Open
tcharding opened this issue Mar 13, 2024 · 6 comments
Open

Inherent functions to_bytes / from_bytes #2583

tcharding opened this issue Mar 13, 2024 · 6 comments

Comments

@tcharding
Copy link
Member

tcharding commented Mar 13, 2024

All types that have a fixed length binary encoding should have inherent functions:

  • to_bytes or into_bytes (depending on naming convention)
  • from_bytes

If the type implements the consensus traits then the encoding produced by to_bytes should match that produced by consensus_encode.

references

Please consider doing #1458 at the same time.

@tcharding
Copy link
Member Author

This issue needs concept ack'ing by other maintainers please.

@apoelstra
Copy link
Member

concept ACK from me.

@Kixunil
Copy link
Collaborator

Kixunil commented Mar 13, 2024

I feel like I already opened this but too lazy to search. Anyway, maybe to_consensus_bytes/from_consensus_bytes instead?

@apoelstra
Copy link
Member

I'd be okay with that, though these names would be a bit less discoverable.

@15IITian
Copy link
Contributor

15IITian commented Mar 14, 2024

I feel like I already opened this but too lazy to search.

@Kixunil , Do you mean this #1458 ?

@tcharding
Copy link
Member Author

Oh yes that one is similar, should be done at the same time. Leaving this one open too because of the differences.

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

No branches or pull requests

4 participants