Skip to content

Replace middle-step serialization of InputNoteCommitment with direct constructor #1783

@juan518munoz

Description

@juan518munoz

Current deserealization of InputNoteCommitment from its proto counterpart involves a middle step of converting the inner fields to bytes, then build from_bytes:

// TODO: https://github.com/0xMiden/node/issues/1783
// InputNoteCommitment has private fields, so we reconstruct it via
// serialization roundtrip using its Serializable/Deserializable impls.
let mut bytes = Vec::new();
nullifier.write_into(&mut bytes);
header.write_into(&mut bytes);
InputNoteCommitment::read_from_bytes(&bytes)
.map_err(|err| ConversionError::deserialization_error("InputNoteCommitment", err))
}

After 0xMiden/protocol#2588 we should be able to remove the serialization middle step, and replace the instantiation of the type with from_parts_unchecked().

Original discussion

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions