keep-starknet-strange / raito

Bitcoin ZK client written in Cairo.
https://raito.wtf
MIT License
40 stars 34 forks source link

[feat] implement `Encode` trait for structs that need it #81

Closed TAdev0 closed 2 months ago

TAdev0 commented 2 months ago

77 introduced Encode trait and implemented it for Span<T> and ByteArray types. We also need to implement it for some structs that need it

PavitraAgarwal21 commented 2 months ago

Can I take this issue

onlydustapp[bot] commented 2 months ago

Hey @PavitraAgarwal21! Thanks for showing interest. We've created an application for you to contribute to Raito - Bitcoin ZK Client. Go check it out on OnlyDust!

lana-shanghai commented 2 months ago

Assigned @PavitraAgarwal21 You have to implement Encode for Transaction, TxIn, TxOut, and OutPoint pls feel free to ask any questions!

PavitraAgarwal21 commented 2 months ago

@lana-shanghai can we use the alexandria library

m-kus commented 2 months ago

@lana-shanghai can we use the alexandria library

Which method do you need from Alexandria?

lana-shanghai commented 2 months ago

@lana-shanghai can we use the alexandria library

Why do you need it? For structs you need custom encodings. I would take a look at how it is done in pure Rust. You can reuse Alexandria of course, but in this context it doesn't have what you need imo

PavitraAgarwal21 commented 2 months ago

I'm exploring an alternative approach to implementing compact encoding, which typically relies on bit-shifting operations like shr and shl

m-kus commented 2 months ago

I'm exploring an alternative approach to implementing compact encoding, which typically relies on bit-shifting operations like shr and shl

There are shl and shr in utils

PavitraAgarwal21 commented 2 months ago

Hey I couldn't find a to_little_endian function. Can we create one to simplify compact size encoding and transaction serialization?

m-kus commented 2 months ago

Hey I couldn't find a to_little_endian function. Can we create one to simplify compact size encoding and transaction serialization?

You can use append_word_rev to extend output buffer with a LE integer

TAdev0 commented 2 months ago

hi @PavitraAgarwal21 , whats up with this issue?

PavitraAgarwal21 commented 2 months ago

able to make the draft PR soon

m-kus commented 2 months ago

@PavitraAgarwal21 we need to merge this, I'm reassigning the task (your contribution still counts though it's partial)