Skip to content

Conversation

@randombit
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the chore label Dec 22, 2025
@randombit
Copy link
Contributor Author

Since now commitment openings are only stored in memory it's quite likely we don't really need a transition strategy here, but to me it still feels a little safer. The PR changes the default encoding for P-256 to use bytestrings (since we don't have a P256 key yet) and uses the old encoding for K256 and Ed25519. There are two todos that would be addressed

  • First, after some suitable interval changing the default serialization to bytestrings
  • Later on, removing the old compat deserialization logic entirely

We could alternately just do it all at once on the assumption that EccScalarBytes is really not serialized to disk anywhere. This would be a rather simpler patch.

@randombit randombit marked this pull request as ready for review December 22, 2025 20:50
@randombit randombit requested a review from a team as a code owner December 22, 2025 20:50
Copy link
Contributor

@fspreiss fspreiss left a comment

Choose a reason for hiding this comment

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

Thanks, @randombit! Even though we assume that CspSecretKey::IDkgCommitmentOpening(CommitmentOpeningBytes) are only stored in the canister secret key store, which is only ever persisted in memory and not on disk, and thus this backwards-compatible de-serialization should not ever be needed, I'm OK with going the fail-safe way and adding it anyway.


#[test]
fn test_scalarbytes_deserialization_compact_cbor_format() {
let old_ser = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename to compact_ser or so?

}
}

/// DeserializeScalar to use deserialize_any for the inner value
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there maybe a space missing in DeserializeScalar?

Comment on lines +626 to +627
// Use deserialize_any to handle both bytes and seq
let bytes: Box<[u8; 32]> = map.next_value_seed(BytesOrArrayScalar)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment only makes sense knowing that BytesOrArrayScalar uses deserialize_any, so maybe say "Use BytesOrArrayScalar, which uses deserialize_any, to handle both bytes and seq".

@fspreiss
Copy link
Contributor

fspreiss commented Jan 5, 2026

Please add a PR description before merging: maybe all that is needed is to copy/paste most/parts of this comment.

@fspreiss fspreiss requested a review from andreacerulli January 5, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants