-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
Why this stack-based design? Can we not just have a list of hashers, rather than a stack? |
It is an open question. |
I was initially thinking that this is implementation-specific, and that we could for example use a https://docs.rs/slab/latest/slab/ to allocate the hashers. However, if there are multiple different allocation strategies then a malicious runtime/PVF could do for example |
As a rule, hashers have well specified internal states, so morally a hasher host call takes the form:
In other words, the hasher should take |
I did use the formultation: "a pointer-size containing a buffer of byte content to send in the hasher." to try to stick with polkadot spec. But it really is just https://github.com/cheme/substrate/blob/9415e8f9ddac9b4ba26e903e103143607d0bdd7b/primitives/io/src/lib.rs#L1462 . This stick to existing slice passing for host function, I am not sure if it does a memory copy (I fear it does), even if I would really not think it need copy in this case, but I would put this consideration out of scope of the proposal (I mean it applies to all host function taking &[u8] as parameter). |
We will archive this repository in favor of the new RFCs repository by the Fellowship. So, I'm closing the issue here. I recommend opening a PR at the new repository. |
This PPP complement the blob storage proposal of #11 with a way to avoid some memory copies when hashing.
The idea is to keep state of hasher in the host, and only send chunks of bytes to it from the runtime.