keep-starknet-strange / raito

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

[feat] create a `log!` macro #187

Closed maciejka closed 1 month ago

maciejka commented 1 month ago

Create a log! macro to improve debuggability. It should use scarb's procedural macro to create a log! macro call:

log!(DEBUG, "validating tx: {}", txid);

where arguments are:

log! should use println! under the hood to output messages.

Logging level should be controlled by scarb features, i.e.: it should be possible to set current log level by setting log related feature: log_level_trace, log_level_debug. No logging should be the default.

Reading:

This issue requires Rust knowledge.

ShantelPeters commented 1 month ago

Hi @maciejka can I please work on this?

onlydustapp[bot] commented 1 month ago

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

mubarak23 commented 1 month ago

@maciejka can i take this

PR for issue: #178 is ready here

so am available to start working on this right away

onlydustapp[bot] commented 1 month ago

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

maciejka commented 1 month ago

@maciejka can i take this

PR for issue: #178 is ready here

so am available to start working on this right away

Do you have any Rust experience?

maciejka commented 1 month ago

Hi @maciejka can I please work on this?

Do you have any Rust experience?

mubarak23 commented 1 month ago

@maciejka can i take this PR for issue: #178 is ready here so am available to start working on this right away

Do you have any Rust experience?

Yes, checkout my Github profile here

work on the following rust codebase

TropicalDog17 commented 1 month ago

Hi @maciejka, can I work on this issue? I have fairly amount of experience in Rust. Thanks!

https://github.com/paradigmxyz/reth/commits/main/?author=TropicalDog17 https://github.com/near/near-sdk-rs/pull/1220

onlydustapp[bot] commented 1 month ago

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

TropicalDog17 commented 1 month ago

Hi, I've follow the scarb guild for writing procedural macros, but I can't manage to import in in Cairo code. here is the logging package image

the file content is exactly the same as the example: https://docs.swmansion.com/scarb/docs/reference/procedural-macro.html#procedural-macro-packages-can-be-used-as-dependencies

image and I've imported to the client package, but the compiler doesn't seem to recognize the new logging package, and scarb build also fails to complete.

image

@maciejka @m-kus any idea about this, will appreciate any help. Thank you!

maciejka commented 1 month ago

@TropicalDog17 create a draft pr please, we will have a look then. You might have a look at alexandria macros.

TropicalDog17 commented 1 month ago

I've figured out @maciejka, but how to achieve

Logging level should be controlled by scarb [features](https://docs.swmansion.com/scarb/docs/reference/conditional-compilation.html#features), i.e.: it should be possible to set current log level by setting log related feature: log_level_trace, log_level_debug. No logging should be the default.

How to achieve the conditional compilation in Cairo, in rust I think we can get the feature value of config with cfg!() macro, but I can't figure how to do it in Cairo

maciejka commented 1 month ago

https://docs.swmansion.com/scarb/docs/reference/conditional-compilation.html#features

Let's continue this discussion in the pr.

maciejka commented 1 month ago

Closing as features support in Scarb is not mature enough yet.