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

Move the Encoder/Encode/Decode traits from Storage to a different crate #2403

Open
3 tasks
acerone85 opened this issue Oct 28, 2024 · 2 comments
Open
3 tasks

Comments

@acerone85
Copy link
Contributor

Context:

The storage crate defines three traits, Encoder Encode and Decode to encode and decode data that can be serialized/deserialized with Serde. See

pub trait Encoder {

In #2388, a similar approach is taken in the p2p service, where similar are defined and implemented. These traits serve the same purpose as the storage ones, but they have a slightly different interface. See

pub trait Encoder: Send {
.

Proposal:

  • Move the Encoder, Encode and Decode trait from storage to a separate crate (maybe fuel_types?)
  • Change the interface to be compatible with the traits used both in the P2P service and in the storage crate,
  • Refactor P2P service and Storage crate to implement the new traits, and deprecate the old ones.
@xgreenx
Copy link
Collaborator

xgreenx commented Oct 28, 2024

I don't see the reason to move mentioned traits from fuel-core-storage. Looks like a right place for them. If you need the same functionality, you can use fuel-core-storage crate directly, since you work with the storage types.

@acerone85
Copy link
Contributor Author

no problems, it just looked to me that if we start using similar traits in other parts of the code that are not related to storage, (e.g. P2P service), then it might be worth moving them.

After #2388, I would still refactor the traits so that we don't have multiple definitions of Encoder/Encode/Decode with slightly different signatures.

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

2 participants