-
Notifications
You must be signed in to change notification settings - Fork 219
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
refactor(proto)!: remove proto timestamp wrapper types #5833
refactor(proto)!: remove proto timestamp wrapper types #5833
Conversation
I marked this controversial. Obviously, there are some tests to fix up, but having done the work I'm not sure I like the PR. It feels like we've taken a strongly typed paradigm such as having a new block tip, or not, and allowed the chance for defaults like a 0 filled vec take it's place, creating a vaguely strongly typed paradigm. It's not an all or nothing though in the case of timestamps a forced u64 can often make sense. What we're losing is having null types in the database and instead, as a default will always land us in 1970. In the case of one function we expected a timestamp relatively close to the current date, and skipped it if None. If we default to 0 we would end up querying everything in the table. As the default would be 1970 and we would query everything Alas, these are just thoughts. I'll continue on, and see if anyone else holds an opinion. Edit: I forgot to add a recommendation. I think getting rid of the protobuf wrappers is still a good idea. But it may be beneficial if we manually map the proto message from its value default or otherwise, into an Option again. This would leave almost all the code exactly the same other than some minor adjustments in the serializers/deserializers. |
f2ea0d9
to
5ec7e51
Compare
Update on my previous comment: More or less what I had written in the recommendation was what some others had in mind. This PR has been updated to reflect that. So the changes are only in the proto types, and serialization/deserialization where needed. Tari types shouldn't need to change here. |
5ec7e51
to
fac0acb
Compare
fac0acb
to
109a9bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just the one we need accept and cannot error on. I think its find that we just accept a 0 zero
Description --- This PR will remove the google proto bytes wrapper in favour of using a standard vec. Motivation and Context --- Use standard rust types, instead of library specific types. Related to #5833 How Has This Been Tested? --- CI What process can a PR reviewer use to test or verify this change? --- Previously used test values included `None`, `Some(vec![])` and `Some(FixedHash::zero())`. This PR removes the option wrappers and as a result the previous `Some(vec![])` values will be `vec![]` and considered the equivalent to `None`. <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [ ] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [x] Other - Please specify Messages between new and old nodes are likely to break.
109a9bf
to
4ae725a
Compare
4ae725a
to
e199048
Compare
Description
We were making use of 3 proto wrapper types. These types deserialize into option types and in some cases are not what we want.
This PR will update 2 of these types, while saving the third for an additional PR.
Motivation and Context
Use standard rust types, instead of library specific types.
Closes: #5797
How Has This Been Tested?
CI
What process can a PR reviewer use to test or verify this change?
Pay close attention to changes around timestamps. Could get tricky.
Notably, we were using
Some(0)
in some tests for timestamps. This was a valid timestamp for us, because it wasn'tNone
. Now we're treating0
as an invalid timestamp. So any test withNone
became0
but tests withSome(0)
are presumably tests that should have had valid timestamps but this was the easiest minimal value that was accepted.Breaking Changes
Messages between new and old nodes are likely to break.