This repository was archived by the owner on Feb 23, 2026. It is now read-only.
fix(sidecar): JSON-RPC error codes#658
Merged
Conversation
thedevbirb
commented
Jan 10, 2025
| impl From<CommitmentError> for JsonError { | ||
| fn from(err: CommitmentError) -> Self { | ||
| // Reference: https://www.jsonrpc.org/specification#error_object | ||
| // TODO: the custom defined ones should be clearly documented. |
Contributor
Author
There was a problem hiding this comment.
We should write custom defined errors in the bolt documentation website
Contributor
Author
There was a problem hiding this comment.
cc @mempirate, if you want to take a look at current error codes
763126a to
6c22d7a
Compare
d603515 to
d94bb81
Compare
merklefruit
reviewed
Jan 13, 2025
Comment on lines
+68
to
+70
| /// FIXME: (thedevbirb, 2025-13-01) this should be removed because it is dead code, | ||
| /// but it allows Rust to pull the correct axum version and not older ones from | ||
| /// dependencies (commit-boost). |
Collaborator
There was a problem hiding this comment.
huh... what? this is a new one...
Contributor
Author
There was a problem hiding this comment.
This is what I'm getting if I remove that variant:
error[E0277]: the trait bound `WithRejection<axum::Json<JsonRpcRequest>, CommitmentError>: FromRequest<Arc<CommitmentsApiInner>, _>` is not satisfied because the trait comes from a different crate version
--> src/api/commitments/server/handlers.rs:51:38
|
51 | WithRejection(Json(payload), _): WithRejection<Json<JsonRpcRequest>, CommitmentError>,
| ^^^^^^^^^^^^^ the trait `FromRequest<Arc<CommitmentsApiInner>, _>` is not implemented for `WithRejection<axum::Json<JsonRpcRequest>, CommitmentError>`
|
= note: Function argument is not a valid axum extractor.
See `https://docs.rs/axum/0.8/axum/extract/index.html` for details
note: there are multiple different versions of crate `axum_core` in the dependency graph
--> /Users/birb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-core-0.5.0/src/extract/mod.rs:85:1
|
85 | pub trait FromRequest<S, M = private::ViaRequest>: Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this is the required trait
|
::: src/api/builder.rs:3:5
|
3 | use axum::{
| ---- one version of crate `axum_core` is used here, as a dependency of crate `axum`
|
::: src/signer/commit_boost.rs:8:5
|
8 | use cb_common::{
| --------- one version of crate `axum_core` is used here, as a dependency of crate `axum`
|
::: /Users/birb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-extra-0.10.0/src/extract/with_rejection.rs:60:1
|
60 | pub struct WithRejection<E, R>(pub E, pub PhantomData<R>);
| ------------------------------ this type doesn't implement the required trait
|
::: /Users/birb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-core-0.4.5/src/ext_traits/request.rs:6:5
|
6 | pub trait Sealed {}
| ---------------- this is the found trait
= help: you can use `cargo tree` to explore your dependency tree
error[E0277]: the trait bound `fn(HeaderMap, axum::extract::State<Arc<CommitmentsApiInner>>, WithRejection<axum::Json<JsonRpcRequest>, CommitmentError>) -> impl futures::Future<Output = Result<axum::Json<JsonRpcResponse>, CommitmentError>> {handlers::rpc_entrypoint}: Handler<_, _>` is not satisfied because the trait comes from a different crate version
--> src/api/commitments/server/mod.rs:170:26
|
170 | .route("/", post(handlers::rpc_entrypoint))
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(HeaderMap, State<Arc<CommitmentsApiInner>>, WithRejection<Json<JsonRpcRequest>, ...>) -> ... {rpc_entrypoint}`
|
= note: the full name for the type has been written to '/Users/birb/work/cb/bolt/bolt-sidecar/target/debug/deps/bolt_sidecar-4f96b73b107ca223.long-type-2057463047293510438.txt'
= note: consider using `--verbose` to print the full type name to the console
= note: Consider using `#[axum::debug_handler]` to improve the error message
note: there are multiple different versions of crate `axum` in the dependency graph
--> /Users/birb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.8.1/src/handler/mod.rs:134:1
|
134 | pub trait Handler<T, S>: Clone + Send + Sync + Sized + 'static {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this is the required trait
|
::: src/api/builder.rs:3:5
|
3 | use axum::{
| ---- one version of crate `axum` is used here, as a direct dependency of the current crate
|
::: src/signer/commit_boost.rs:8:5
|
8 | use cb_common::{
| --------- one version of crate `axum` is used here, as a dependency of crate `cb_common`
|
::: /Users/birb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.9/src/boxed.rs:62:1
|
62 | pub(crate) trait ErasedIntoRoute<S, E>: Send {
| -------------------------------------------- this is the found trait
= help: you can use `cargo tree` to explore your dependency tree
For more information about this error, try `rustc --explain E0277`.
warning: `bolt-sidecar` (lib) generated 1 warning
error: could not compile `bolt-sidecar` (lib) due to 2 previous errors; 1 warning emitted
I cannot override the axum version of the dependency because it is a breaking change. I think it's fine. Let's wait until they update
Collaborator
There was a problem hiding this comment.
Ok fine with me! Will try to bump axum on commit boost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some internal errors were reported with a wrong status code, and others were not matching the JSON-RPC specification closely.
The changes required a small refactoring here and there.