Page MenuHomePhabricator

[chronik] add Electrum RPC server.donation_address
AcceptedPublic

Authored by PiRK on Fri, Feb 21, 16:57.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

See https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-methods.html

Fulcrum sets a limit to 80 characters but allows any arbitrary string within that limit. Electrum ABC can handle wrong address formats via the usual "Pay to" URI parsing code.

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Fri, Feb 21, 16:57

Tail of the build log:

    Checking postcard v1.1.1
    Checking karyon_core v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking url v2.5.4
    Checking chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking serde_spanned v0.6.8
    Checking toml_datetime v0.6.8
   Compiling pyo3 v0.23.3
    Checking topo_sort v0.4.0
    Checking seahash v4.1.0
    Checking sync_wrapper v1.0.2
    Checking mime v0.3.17
    Checking sync_wrapper v0.1.2
    Checking winnow v0.6.20
    Checking tower v0.5.1
    Checking hyper-util v0.1.10
    Checking axum-core v0.4.5
    Checking tokio-tungstenite v0.24.0
    Checking memoffset v0.9.1
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.31
    Checking serde_path_to_error v0.1.16
    Checking unicode-segmentation v1.12.0
    Checking unindent v0.2.3
   Compiling karyon_jsonrpc_macro v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking matchit v0.7.3
    Checking base64 v0.22.1
    Checking convert_case v0.6.0
    Checking tower-http v0.5.2
    Checking futures v0.3.31
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
    Checking toml_edit v0.22.22
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.9
    Checking toml v0.8.19
   Compiling pyo3-macros v0.23.3
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling aws-lc-rs v1.11.1
   Compiling rustls v0.23.19
    Checking rustls-webpki v0.102.8
    Checking tokio-rustls v0.26.1
    Checking karyon_async_rustls v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking karyon_net v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking karyon_jsonrpc v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking rocksdb v0.21.0
    Checking chronik-db v0.1.0 (/work/chronik/chronik-db)
    Checking chronik-indexer v0.1.0 (/work/chronik/chronik-indexer)
    Checking chronik-http v0.1.0 (/work/chronik/chronik-http)
error: missing documentation for a struct field
  --> chronik/chronik-http/src/electrum.rs:68:5
   |
68 |     pub donation_address: String,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D missing-docs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(missing_docs)]`

error: could not compile `chronik-http` (lib) due to 1 previous error
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

    Checking karyon_core v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking postcard v1.1.1
    Checking url v2.5.4
    Checking chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
    Checking serde_spanned v0.6.8
    Checking toml_datetime v0.6.8
   Compiling pyo3 v0.23.3
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking winnow v0.6.20
    Checking seahash v4.1.0
    Checking sync_wrapper v0.1.2
    Checking sync_wrapper v1.0.2
    Checking mime v0.3.17
    Checking topo_sort v0.4.0
    Checking tower v0.5.1
    Checking hyper-util v0.1.10
    Checking memoffset v0.9.1
    Checking axum-core v0.4.5
    Checking tokio-tungstenite v0.24.0
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.31
    Checking serde_path_to_error v0.1.16
    Checking matchit v0.7.3
   Compiling karyon_jsonrpc_macro v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking unicode-segmentation v1.12.0
    Checking unindent v0.2.3
    Checking base64 v0.22.1
    Checking tower-http v0.5.2
    Checking futures v0.3.31
    Checking convert_case v0.6.0
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
    Checking toml_edit v0.22.22
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.9
   Compiling pyo3-macros v0.23.3
    Checking toml v0.8.19
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling aws-lc-rs v1.11.1
   Compiling rustls v0.23.19
    Checking rustls-webpki v0.102.8
    Checking tokio-rustls v0.26.1
    Checking karyon_async_rustls v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking karyon_net v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking karyon_jsonrpc v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking rocksdb v0.21.0
    Checking chronik-db v0.1.0 (/work/chronik/chronik-db)
    Checking chronik-indexer v0.1.0 (/work/chronik/chronik-indexer)
    Checking chronik-http v0.1.0 (/work/chronik/chronik-http)
error: missing documentation for a struct field
  --> chronik/chronik-http/src/electrum.rs:68:5
   |
68 |     pub donation_address: String,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D missing-docs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(missing_docs)]`

error: could not compile `chronik-http` (lib) due to 1 previous error
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
Fabien requested changes to this revision.Fri, Feb 21, 18:01
Fabien added a subscriber: Fabien.

back to your queue

This revision now requires changes to proceed.Fri, Feb 21, 18:01
Fabien requested changes to this revision.Mon, Feb 24, 08:17

I can see a reason to enforce the char limit. When dealing with UI representation of the donation address, you can be certain that it will fit in your UI field that way.
Another reason is that an abc server might be rejected for invalid content by clients checking the limit if such a thing exists.

Imo it's simple enough that it's worth doing it similar to fulcrum.

This revision now requires changes to proceed.Mon, Feb 24, 08:17

chech the donation address length

Fabien requested changes to this revision.Wed, Feb 26, 10:30
Fabien added inline comments.
chronik/chronik-cpp/chronik.cpp
88 ↗(On Diff #52773)

You should make it a constant

This revision now requires changes to proceed.Wed, Feb 26, 10:30

make max length a constexpr

Fabien requested changes to this revision.Wed, Feb 26, 12:59
Fabien added inline comments.
chronik/chronik-cpp/chronik.cpp
91–92 ↗(On Diff #52774)

You have a constant, use it. Same in init.cpp

This revision now requires changes to proceed.Wed, Feb 26, 12:59

use the constant in strings

This revision is now accepted and ready to land.Wed, Feb 26, 19:44