Allow to easily covert a type to from field elements. This is useful to convert values so that they can be hashed, and to pass/receive values from the VM.
It is unclear if the implementation should use the minimum number of field elements, or add padding as expected by the VM. I feel like this should be the minimum number of felts, and the VM crate should have another trait, say ToVMInput, which performs the encoding for the VM. The implementation for ToVMInput can be custom or be on top of ToFieldElements.
Proposal
Allow to easily covert a type to from field elements. This is useful to convert values so that they can be hashed, and to pass/receive values from the VM.
Outline
Alternatives
to_elements
andfrom_elements
on the same traitwinterfell
's ToElementsIssues
It is unclear if the implementation should use the minimum number of field elements, or add padding as expected by the VM. I feel like this should be the minimum number of felts, and the VM crate should have another trait, say
ToVMInput
, which performs the encoding for the VM. The implementation forToVMInput
can be custom or be on top ofToFieldElements
.Related
https://discord.com/channels/893151281848406016/1148602449247080478/1234523004650917898