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

core: make StoreKey, StoreValue and FunctionArgs serde serialisable #8985

Merged
merged 2 commits into from
May 2, 2023

Conversation

mina86
Copy link
Contributor

@mina86 mina86 commented Apr 28, 2023

Derive serialisation code for StoreKey, StoreVlaue and FunctionArgs
primitive types and then use those types more in various structures
which so far has been using raw Vec<u8> instead.

This improves self-documentation of the code (the type of the struct
field indicates what it is) and moves base64 format declaration to the
primitive types rather than having to annotate individual structures
with #[serde(with = ...)].

On the flip side, it does add a couple .into() calls when converting
between one of the aforementioned types and Vec<u8>.

Derive serialisation code for StoreKey, StoreVlaue and FunctionArgs
primitive types and then use those types more in various structures
which so far has been using raw `Vec<u8>` instead.

This improves self-documentation of the code (the type of the struct
field indicates what it is) and moves base64 format declaration to the
primitive types rather than having to annotate individual structures
with `#[serde(with = ...)]`.

On the flip side, it does add a couple `.into()` calls when converting
between one of the aforementioned types and `Vec<u8>`.
@mina86 mina86 requested a review from a team as a code owner April 28, 2023 14:11
@mina86 mina86 requested a review from jakmeier April 28, 2023 14:11
@mina86
Copy link
Contributor Author

mina86 commented Apr 28, 2023

I'm honestly not sure if this is an improvement. I’ll leave it up for you guys to decide. ;)

@jakmeier jakmeier added the C-housekeeping Category: Refactoring, cleanups, code quality label May 2, 2023
Copy link
Contributor

@jakmeier jakmeier left a comment

Choose a reason for hiding this comment

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

I like the explicit typing! But let's wait for the data platform team's input regarding breaking changes in primitives.

Comment on lines +218 to +219
pub key: StoreKey,
pub value: StoreValue,
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: This looks like a breaking change for the published primitives crate

Copy link
Contributor

Choose a reason for hiding this comment

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

@khorolets would this be a problem? Serialized, the data should look the same, it's only a breaking change on the code level, as constructors needs to be updated.

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem like a problem for us. What nearcore version are these changes expected to land at? I want us to check the underlying stuff and ensure we do not lose data or prevent services from being stuck 😬

Copy link
Contributor

Choose a reason for hiding this comment

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

@khorolets it will land in neard binary version 1.35 if we merge it within the next couple of weeks. For the crates version, I guess we will have to bump one from the current version and would end up with 0.17.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me

Copy link
Contributor

@jakmeier jakmeier left a comment

Choose a reason for hiding this comment

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

@mina86 please ACK if you want me to add the auto-merge label

@mina86
Copy link
Contributor Author

mina86 commented May 2, 2023

@mina86 please ACK if you want me to add the auto-merge label

Yes please.

@near-bulldozer near-bulldozer bot merged commit 416b38c into near:master May 2, 2023
@mina86 mina86 deleted the b branch May 2, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-housekeeping Category: Refactoring, cleanups, code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants