We currently have two ways to convert a Point to 32 bytes, using the .Bytes method and the MapToScalarField method. The latter requires you to serialize the scalar field, though you can think of it as 32 bytes.
~~For all intents and purposes in the verkle API, it seems we only need one of these. The root node uses the former, but for other internal nodes we use the latter. This PR changes it so that the root node is not treated differently from the other internal nodes and this allows us to remove .Bytes from the public API*. ~~
It is still used when serializing proofs, but from the point of view of a verkle trie library, a proof is(should be) just an opaque set of bytes.
*This PR alone won't allow us to remove .Bytes -- it is used in pedersen_hash/get_tree_key_hash. I'll make a PR to remove it from geth.
Rationale
We currently have two ways to convert a Point to 32 bytes, using the
.Bytes
method and theMapToScalarField
method. The latter requires you to serialize the scalar field, though you can think of it as 32 bytes.~~For all intents and purposes in the verkle API, it seems we only need one of these. The root node uses the former, but for other internal nodes we use the latter. This PR changes it so that the root node is not treated differently from the other internal nodes and this allows us to remove
.Bytes
from the public API*. ~~It is still used when serializing proofs, but from the point of view of a verkle trie library, a proof is(should be) just an opaque set of bytes.
*This PR alone won't allow us to remove
.Bytes
-- it is used in pedersen_hash/get_tree_key_hash. I'll make a PR to remove it from geth.Linking to https://github.com/crate-crypto/rust-verkle/issues/86
EDIT:
Ignacio pointed out that Serialize/Bytes is needed because we need to deserialize the root node in the header in order to use it in a proof.