Skip to content

Borsh 09 feature#61

Draft
dhruvja wants to merge 4 commits intomasterfrom
borsh-09-feature
Draft

Borsh 09 feature#61
dhruvja wants to merge 4 commits intomasterfrom
borsh-09-feature

Conversation

@dhruvja
Copy link
Contributor

@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).
lib = { path = "common/lib" }
memory = { path = "common/memory" }
sealable-trie = { path = "common/sealable-trie" }
sealable-trie = { path = "common/sealable-trie", features = ["borsh09"] }
Copy link
Contributor

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
Contributor 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
Contributor

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
Contributor 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
Contributor

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
Contributor

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.

@dhruvja
Copy link
Contributor 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
Contributor

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