Implement RLP decode for stdlib
- Lingua principale
- Rust
- Stelle
- 772
- Fork
- 352
- Merge medio
- 1g 12h
- PR unite (30g)
- 93
Descrizione
Hi,
Miden VM has a powerful ability to handle numerical mathematical problems, but many other types of data exist in real life, such as `String` types. We are thinking about ways to add String related libs in Miden VM. Here are some initial ideas.
The actual operations on `String` type data may include:
1. To check whether `String A` contains a sub-string `String B`
2. To concatenate two String `A || B`
3. etc.
It would be great if there is a way to extend Miden to handle non-numerical problems as well. Here are some ideas for dealing with `String` type data:
**RLP** (Recursive Length Prefix) is the main encoding method used to serialize objects in Ethereum. I'm wondering if we could allow the above operations on `Strings` by first RLP encoding the non-numeric type data.
> Here is one example:
> Alice wants to know if a sentence contains the word 'guitar'
> The sentence is : 'I can play guitar.'
> Its RLP encoded result is : [146, 73, 32, 99, 97, 110, 32, 112, 108, 97, 121, 32, 103, 117, 105, 116, 97, 114, 46]
> With RLP encoded result, It's much easier to tell if a sentence contains 'guitar': Alice can just compare the RLP encoded result.
> Besides, for `String` type integer such as '21', we can perform RLP decode operations within the VM to convert them to their original values -- 21 for subsequent numerical mathematical operation.
Maybe we could add the implementation of a **RLP decoder** in stdlib.
If you have any comments on this idea, please let me know.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.