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

fix(drive): panic if PlatformState has serialisation error #1945

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Jul 11, 2024

Issue being fixed or feature implemented

PlatfromState.fingerprint panics in case of serialization error.

What was done?

  • Returned error instead of expect

How Has This Been Tested?

Running tests

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@shumkov shumkov added this to the v1.0.0 milestone Jul 11, 2024
pub fn fingerprint(&self) -> [u8; 32] {
hash_double(
self.serialize_to_bytes()
.expect("expected to serialize state"),
Copy link
Member

Choose a reason for hiding this comment

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

The reason for the expect is that it can't actually fail. I went into the code to check this.

Copy link
Collaborator

@ogabrielides ogabrielides Jul 11, 2024

Choose a reason for hiding this comment

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

We ran into this today on a devnet due to a bug I introduced while testing in PR #1937

Copy link
Member

Choose a reason for hiding this comment

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

While I don't really mind this PR, can you explain what was introduced?

Copy link
Member Author

@shumkov shumkov Jul 12, 2024

Choose a reason for hiding this comment

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

We defined PlatformStateForSaving v2 and didn't handle it properly in one of try_from_platform_versioned so we got VersionMismatch error that failed serialisation.

@QuantumExplorer
Copy link
Member

merging this one in without CI check, as it is very simple.

@QuantumExplorer QuantumExplorer merged commit 7c3c072 into v1.0-dev Jul 15, 2024
10 of 16 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/drive/panic-on-serialization branch July 15, 2024 06:46
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.

3 participants