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

Borsh 09 feature #61

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Borsh 09 feature #61

wants to merge 4 commits into from

Conversation

dhruvja
Copy link
Collaborator

@dhruvja dhruvja commented Oct 26, 2023

Adding the borsh09 as a feature in sealable_trie crate so that projects using an older version of borsh can use the compatible version and not face version conflicts.

mina86 and others added 3 commits October 26, 2023 15:29
We need to change sealable-trie to support multiple borsh crate
versions.  Since it’s borsh-serialising CryptoHash, this by extension
means that lib needs to support all the same versions of borsh.

To avoid the latter, rather than serialising and deserialising
CryptoHash, deal with the underlying arrays of bytes.  This makes
sealable-trie code slightly more verbose but removes the need for
lib to support multiple borsh versions.

(We’ll see whether the support will need to be eventually added.
So far this simplifies stuff a bit).
@@ -42,7 +43,7 @@ strum = { version = "0.25.0", default-features = false, features = ["derive"] }

lib = { path = "common/lib" }
memory = { path = "common/memory" }
sealable-trie = { path = "common/sealable-trie" }
sealable-trie = { path = "common/sealable-trie", features = ["borsh09"] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
sealable-trie = { path = "common/sealable-trie", features = ["borsh09"] }
sealable-trie = { path = "common/sealable-trie" }

Enable this where you need it rather than globally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually enabled it for testing so that the rust-analyzer catches it. But will remove it

Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a --all-features test in CI so that should cover it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in that case i need to remove the features on imports like u mentioned

Comment on lines 26 to +29

[features]
borsh = ["dep:borsh", "lib/borsh"]
borsh09 = ["dep:borsh09", "lib/borsh"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
[features]
borsh = ["dep:borsh", "lib/borsh"]
borsh09 = ["dep:borsh09", "lib/borsh"]

This isn’t needed. lib/borsh after all is not used any longer. You might need to merge upstream I guess.

Comment on lines +8 to +15
#[cfg(feature = "borsh")]
use borsh::maybestd::io;
#[cfg(feature = "borsh")]
use borsh::{BorshDeserialize, BorshSerialize};
#[cfg(feature = "borsh09")]
use borsh09::maybestd::io;
#[cfg(feature = "borsh09")]
use borsh09::{BorshDeserialize, BorshSerialize};
Copy link
Collaborator

Choose a reason for hiding this comment

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

You probably need to remove all those uses and instead use full paths in places where the given types are used. Otherwise we get conflicts.

common/sealable-trie/src/proof/serialisation.rs Outdated Show resolved Hide resolved
@dhruvja
Copy link
Collaborator Author

dhruvja commented Oct 27, 2023

I thinnk we can close this for now. Lets open it when we face issue with borsh. Right now its fine imo.

@dhruvja dhruvja requested a review from mina86 October 27, 2023 05:51
@mina86 mina86 marked this pull request as draft October 27, 2023 13:39
@mina86
Copy link
Collaborator

mina86 commented Oct 27, 2023

Sounds good. We can keep it as draft in the meanwhile.

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