Page MenuHomePhabricator

[chronik] bump karyon_jsonrpc
AcceptedPublic

Authored by PiRK on Wed, Jan 8, 18:52.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

The latest commit on the master branch of the karyon repo changes RPC errors to accept non-static strings. This enables more helpful error messages in RPC responses.

In this diff we bump the version and fix our code to account for this breaking change in API.

Test Plan

ninja check-functional

Event Timeline

PiRK requested review of this revision.Wed, Jan 8, 18:52

nit: use format! rather than concat! and save a to_string() conversion

Fabien requested changes to this revision.Wed, Jan 8, 19:51
Fabien added a subscriber: Fabien.

Couple nits but otherwise looks good

chronik/chronik-http/src/electrum.rs
7 ↗(On Diff #52051)

I'm surprised this is needed

364 ↗(On Diff #52051)

can't you pass the string directly here ? and avoid the copy

This revision now requires changes to proceed.Wed, Jan 8, 19:51
chronik/chronik-http/src/electrum.rs
7 ↗(On Diff #52051)

I need to tell my IDE to stop adding imports automatically. I saw it in the diff and assumed that it was actually needed.

364 ↗(On Diff #52051)

In that case there will be two .to_string() conversions, here and below on line 375. In terms of performance it will be equivalent, but the string will be duplicated in the source code which imo is a bit more error prone.

remove unneeded import

This comment was removed by Fabien.
chronik/chronik-http/src/electrum.rs
364 ↗(On Diff #52051)

I think the clone would technically be unnecessary because if this error is returned then the following code is unreachable. Maybe rewriting this with an explicit if branch would solve this, if the compiler is smart enough to recognize that the various code branches are mutually exclusive ?

Fabien added inline comments.
chronik/chronik-http/src/electrum.rs
364 ↗(On Diff #52051)

if you're getting an error here the clone is not that bad, let's not try to over optimize

364 ↗(On Diff #52051)

Oh I missed it was reused, fine then

This revision is now accepted and ready to land.Thu, Jan 9, 10:03