0xPolygonMiden / miden-node

Reference implementation of the node for the Polygon Miden rollup
MIT License
53 stars 37 forks source link

Improve the node & faucet logs #484

Open Mirko-von-Leipzig opened 2 months ago

Mirko-von-Leipzig commented 2 months ago

As evidenced in #483, our logs are missing useful context.

A lot of this context is going missing because we are using structured error enums which aren't encapsulating the inner error.

Common suggestion is to prefer anyhow for errors in an application as usually we don't care about the what, only that an error happened. For libs instead thiserror/structure errors are suggested but these are just guidelines.

In general, we should use anyhow if we don't care to match on the exact error variant.

bobbinth commented 2 months ago

Common suggestion is to prefer anyhow for errors in an application as usually we don't care about the what, only that an error happened. For libs instead thiserror/structure errors are suggested but these are just guidelines.

I think this is roughly how things work now, no? Basically, we use thiserror in the libs and use anyhow in the miden-node binary.

Mirko-von-Leipzig commented 2 months ago

I think this is roughly how things work now, no? Basically, we use thiserror in the libs and use anyhow in the miden-node binary.

Correct; however these are just rough rules of thumb. The more accurate gauge is whether one cares about the error variants at all. Or put slightly differently - are our rpc, store and block-producer crates libraries, or are they just components on the node binary split into separate crates for organization/decoupling purposes?

Semantic games aside though, we just need to ensure that we don't lose any important context along the way. Something like anyhow makes that easier, but this is of course just as possible with thiserror or the other error types - just a bit more effort and care required. Though one does lose line info which could be helpful in logs.

Mirko-von-Leipzig commented 2 months ago

Hmm now that I've logged on to the actual instance, the logs provided initially seem to be truncated.

Error: Failed to serve store: initialisation of the Api has failed: Genesis block error: Failed to read genesis file "./genesis.dat": No such file or directory (os error 2)

On site logs appear to be fine ito context so maybe this is a non-issue. Could be worth taking a look regardless.

Mirko-von-Leipzig commented 4 weeks ago

Related to #499.