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

Clean up decoding of known-len component of messages between bootstrap client/server #3881

Merged
merged 29 commits into from
May 15, 2023

Conversation

Ben-PH
Copy link
Contributor

@Ben-PH Ben-PH commented Apr 28, 2023

  • document all added functions
  • try in sandbox /simulation/labnet
  • unit tests on the added/changed features
    • make tests compile
    • make tests pass
  • add logs allowing easy debugging in case the changes caused problems
  • if the API has changed, update the API specification

Copy link
Contributor Author

@Ben-PH Ben-PH left a comment

Choose a reason for hiding this comment

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

I've taken this approach instead of impl Deserializer<ServerMessageLeader> for ServerMessageLeaderDeserializer, as when I tried that, the type-system expectations compromises the error handling/information process without any meaningful benefit.

I've added a point to the follow up issues this relates to regarding the constants.

@Ben-PH Ben-PH requested a review from modship April 28, 2023 17:43
@Ben-PH Ben-PH self-assigned this Apr 28, 2023
@Ben-PH Ben-PH added the bootstrap Issues related to the bootstrap label Apr 28, 2023
@Ben-PH Ben-PH mentioned this pull request Apr 28, 2023
25 tasks
@Ben-PH Ben-PH changed the base branch from testnet_22 to bootstrap/use-read-loop May 3, 2023 13:59
@Ben-PH Ben-PH changed the base branch from bootstrap/use-read-loop to testnet_23 May 4, 2023 12:03
Comment on lines +240 to +241
self.read_exact_timeout(&mut msg_bytes, deadline)
.map_err(|(err, _consumed)| err)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

piggy backing off this PR: This change should have been part of #3885

fn from_be_bytes_min(buffer: &[u8], max_value: Self) -> Result<(Self, usize), ModelsError> {
let read_bytes = Self::be_bytes_min_length(max_value);
let skip_bytes = Self::MIN_BE_INT_BASE_SIZE - read_bytes;
let read_bytes = u32_be_bytes_min_length(max_value);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

const methods as part of traits is... difficult/impossible. Tried a macro, but to make it work "elegantly" would be a poor use of time. Given it's just two types, and not something that is likely to be generalised in the (near) future (from what I can tell), putting in a todo/follow-up is likely to be a distraction, though happy to be corrected.

@Ben-PH Ben-PH requested review from Eitu33 and removed request for Eitu33 May 4, 2023 14:04
@Ben-PH Ben-PH mentioned this pull request May 15, 2023
7 tasks
bors bot added a commit that referenced this pull request May 15, 2023
3948: Hotfix/peek loop r=AurelienFT a=Ben-PH

Adapted from #3881 

* [ ] document all added functions
* [ ] try in sandbox /simulation/labnet
* [ ] unit tests on the added/changed features
  * [ ] make tests compile
  * [ ] make tests pass 
* [ ] add logs allowing easy debugging in case the changes caused problems
* [ ] if the API has changed, update the API specification

Co-authored-by: Ben PHL <benphawke@gmail.com>
Co-authored-by: Ben <benphawke@gmail.com>
Co-authored-by: AurelienFT <aurelien.foucault@epitech.eu>
@AurelienFT AurelienFT merged commit 9caa928 into testnet_23 May 15, 2023
@Ben-PH Ben-PH mentioned this pull request May 22, 2023
15 tasks
@AurelienFT AurelienFT deleted the bootstrap/message-deser branch May 29, 2023 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bootstrap Issues related to the bootstrap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants