Skip to content

chore: use jsonrpsee to support JSON-RPC v2 instead of manual implementation#2010

Merged
gilcu3 merged 21 commits intomainfrom
dsharifi/support-json-rpc-v2-instead
Feb 9, 2026
Merged

chore: use jsonrpsee to support JSON-RPC v2 instead of manual implementation#2010
gilcu3 merged 21 commits intomainfrom
dsharifi/support-json-rpc-v2-instead

Conversation

@DSharifi
Copy link
Contributor

@DSharifi DSharifi commented Feb 6, 2026

closes #2009

@DSharifi DSharifi marked this pull request as ready for review February 6, 2026 16:58
@DSharifi DSharifi changed the title chore: use json-rpsee to support JSON-RPC v2 instead of manual implementation chore: use jsonrpsee to support JSON-RPC v2 instead of manual implementation Feb 6, 2026
Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff. Interesting mock implementation. I'll play a bit with that one and get back if I have any concrete ideas for how it can be simplified. Anyway not blocking.

Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking some more I'm skeptical about using jsonrpsee as a dependency. Did you evaluate other alternatives? I'd love to know if this really is the best there is due to how awkward it is to work with it, as evident by the MockJsonRpcClient struct.

I'm very surprised such an established crate doesn't have a cloneable error type. I did look deeper into the result type and they do seem to just have overlooked this. Some result types are Clone, but for example this simple one doesn't implement it:

/// Represent a request that failed because of an invalid request id.
#[derive(Debug, thiserror::Error)]
pub enum InvalidRequestId {
	/// The request ID was parsed as valid ID but not a pending request.
	#[error("request ID={0} is not a pending call")]
	NotPendingRequest(String),

	/// The request ID was already assigned to a pending call.
	#[error("request ID={0} is already occupied by a pending call")]
	Occupied(String),

	/// The request ID format was invalid.
	#[error("request ID={0} is invalid")]
	Invalid(String),
}

Naturally this is open source so nothing negative about the authors or the crate itself. I'm happy it exists and that people are sharing these implementations in the public. I just don't think this is an acceptable standard as a dependency I'd like to use in our project.

netrome
netrome previously approved these changes Feb 8, 2026
Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay they had legit reasons for not exposing Clone on their top-level Error...

gilcu3
gilcu3 previously approved these changes Feb 9, 2026
Copy link
Contributor

@gilcu3 gilcu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sad to see mockall go, it looked pretty nice :)

netrome
netrome previously approved these changes Feb 9, 2026
Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for incorporating the suggestion 🙏

gilcu3
gilcu3 previously approved these changes Feb 9, 2026
@DSharifi DSharifi requested a review from netrome February 9, 2026 08:54
netrome
netrome previously approved these changes Feb 9, 2026
@DSharifi DSharifi dismissed stale reviews from netrome and gilcu3 via 6dab710 February 9, 2026 09:31
@DSharifi DSharifi added this pull request to the merge queue Feb 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 9, 2026
@DSharifi DSharifi added this pull request to the merge queue Feb 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 9, 2026
@gilcu3 gilcu3 added this pull request to the merge queue Feb 9, 2026
Merged via the queue into main with commit 11ed69d Feb 9, 2026
23 of 25 checks passed
@gilcu3 gilcu3 deleted the dsharifi/support-json-rpc-v2-instead branch February 9, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use jsonrpsee crate to support JSON-RPC v2

3 participants