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

Harden block handler (Versioning) #4178

Merged
merged 13 commits into from
Jul 4, 2023

Conversation

sydhds
Copy link
Contributor

@sydhds sydhds commented Jun 30, 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

@sydhds sydhds requested review from Leo-Besancon and Eitu33 June 30, 2023 10:09
@sydhds sydhds force-pushed the feature/harden_block_handler_versioning_1 branch from f02d2d2 to 4cc60f5 Compare July 3, 2023 09:10
@sydhds sydhds requested a review from Eitu33 July 3, 2023 09:10
@sydhds sydhds requested a review from damip July 3, 2023 14:49
massa-versioning/src/versioning.rs Outdated Show resolved Hide resolved
@sydhds sydhds force-pushed the feature/harden_block_handler_versioning_1 branch from 08382e3 to 97a683f Compare July 4, 2023 08:22
@sydhds sydhds requested review from Eitu33 and Leo-Besancon July 4, 2023 08:22
if *entry_value == 0 {
self.stats.network_version_counters.remove(&removed_version);
}
}
}

if announced_network_version != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

didn't we remove the "0" special case ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We did in block header but we use it in mip store stats, when we received None we process it like it is nerwork version 0, this simplifies the code

Copy link
Member

@damip damip Jul 4, 2023

Choose a reason for hiding this comment

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

what if someone announces Some(0) ? I feel like it might simplify things now but in a year or so we will forget that 0 is a special case and make mistakes when modifying the code

Copy link
Collaborator

Choose a reason for hiding this comment

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

Some(0) should be semantically the same as announcing None, because we can never roll back versions. (We can always introduce a new version that rolls back previous changes, but we can't go from active version of 2 to 0.

Copy link
Member

@damip damip Jul 4, 2023

Choose a reason for hiding this comment

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

I'm still not a big fan of the "future devs will read the docs and always have in mind that Some(0) is equivalent to 0 when developing" approach, but if you all think it will never cause problems, I'm OK with it, otherwise we should probably change it. Could also be a followup

Copy link
Collaborator

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

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

I'm good with this version.

@sydhds sydhds requested a review from Leo-Besancon July 4, 2023 10:23
@sydhds sydhds requested a review from damip July 4, 2023 10:23
Copy link
Member

@damip damip left a comment

Choose a reason for hiding this comment

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

LGTM

@AurelienFT AurelienFT merged commit ceb6f55 into testnet_24 Jul 4, 2023
@sydhds sydhds deleted the feature/harden_block_handler_versioning_1 branch July 4, 2023 13:44
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.

5 participants