bitcoindevkit / rust-esplora-client

Bitcoin Esplora API client library. Supports plaintext, TLS and Onion servers. Blocking or async.
MIT License
29 stars 44 forks source link

`rust-esplora-client` shouldn't introduce an async runtime #102

Open tnull opened 1 month ago

tnull commented 1 month ago

In #98, a dependency on the async_std runtime was introduced. IIUC, this was done only to use its sleep method.

I don't think rust-esplora-client should make choices regarding which async runtime users should use. If anything, it should be using the by now default tokio rather than async_std.

I believe I already brought this up in the discussion of the precursor #71, which however seems now gone for some reason.

An alternative to pulling in an extra dependency for this would simply be to have the user specify a sleep callback function that would use whatever sleep functionality they have available in their runtime.

(cc @notmandatory @ValuedMammal)

tnull commented 1 month ago

Please note how ridiculous the dependency tree (which in a Bitcoin context should always also be read as 'increased security risk') is that async_std introduced -- all for a single method:

esplora-client v0.10.0 (/Users/erohrer/workspace/rust-esplora-client)
├── async-std v1.13.0
│   ├── async-channel v1.9.0
│   │   ├── concurrent-queue v2.5.0
│   │   │   └── crossbeam-utils v0.8.19
│   │   ├── event-listener v2.5.3
│   │   └── futures-core v0.3.30
│   ├── async-global-executor v2.4.1
│   │   ├── async-channel v2.3.1
│   │   │   ├── concurrent-queue v2.5.0 (*)
│   │   │   ├── event-listener-strategy v0.5.2
│   │   │   │   ├── event-listener v5.3.1
│   │   │   │   │   ├── concurrent-queue v2.5.0 (*)
│   │   │   │   │   ├── parking v2.2.1
│   │   │   │   │   └── pin-project-lite v0.2.13
│   │   │   │   └── pin-project-lite v0.2.13
│   │   │   ├── futures-core v0.3.30
│   │   │   └── pin-project-lite v0.2.13
│   │   ├── async-executor v1.13.1
│   │   │   ├── async-task v4.7.1
│   │   │   ├── concurrent-queue v2.5.0 (*)
│   │   │   ├── fastrand v2.0.1
│   │   │   ├── futures-lite v2.3.0
│   │   │   │   ├── fastrand v2.0.1
│   │   │   │   ├── futures-core v0.3.30
│   │   │   │   ├── futures-io v0.3.30
│   │   │   │   ├── parking v2.2.1
│   │   │   │   └── pin-project-lite v0.2.13
│   │   │   └── slab v0.4.9
│   │   │       [build-dependencies]
│   │   │       └── autocfg v1.1.0
│   │   ├── async-io v2.3.4
│   │   │   ├── async-lock v3.4.0
│   │   │   │   ├── event-listener v5.3.1 (*)
│   │   │   │   ├── event-listener-strategy v0.5.2 (*)
│   │   │   │   └── pin-project-lite v0.2.13
│   │   │   ├── cfg-if v1.0.0
│   │   │   ├── concurrent-queue v2.5.0 (*)
│   │   │   ├── futures-io v0.3.30
│   │   │   ├── futures-lite v2.3.0 (*)
│   │   │   ├── parking v2.2.1
│   │   │   ├── polling v3.7.3
│   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   ├── rustix v0.38.31
│   │   │   │   │   ├── bitflags v2.4.2
│   │   │   │   │   ├── errno v0.3.8
│   │   │   │   │   │   └── libc v0.2.152
│   │   │   │   │   └── libc v0.2.152
│   │   │   │   └── tracing v0.1.40
│   │   │   │       ├── pin-project-lite v0.2.13
│   │   │   │       └── tracing-core v0.1.32
│   │   │   │           └── once_cell v1.19.0
│   │   │   ├── rustix v0.38.31 (*)
│   │   │   ├── slab v0.4.9 (*)
│   │   │   └── tracing v0.1.40 (*)
│   │   ├── async-lock v3.4.0 (*)
│   │   ├── blocking v1.6.1
│   │   │   ├── async-channel v2.3.1 (*)
│   │   │   ├── async-task v4.7.1
│   │   │   ├── futures-io v0.3.30
│   │   │   ├── futures-lite v2.3.0 (*)
│   │   │   └── piper v0.2.4
│   │   │       ├── atomic-waker v1.1.2
│   │   │       ├── fastrand v2.0.1
│   │   │       └── futures-io v0.3.30
│   │   ├── futures-lite v2.3.0 (*)
│   │   └── once_cell v1.19.0
│   ├── async-io v2.3.4 (*)
│   ├── async-lock v3.4.0 (*)
│   ├── crossbeam-utils v0.8.19
│   ├── futures-core v0.3.30
│   ├── futures-io v0.3.30
│   ├── futures-lite v2.3.0 (*)
│   ├── kv-log-macro v1.0.7
│   │   └── log v0.4.20
│   │       └── value-bag v1.9.0
│   ├── log v0.4.20 (*)
│   ├── memchr v2.7.1
│   ├── once_cell v1.19.0
│   ├── pin-project-lite v0.2.13
│   ├── pin-utils v0.1.0
│   └── slab v0.4.9 (*)
ValuedMammal commented 1 month ago

Thanks for raising the issue @tnull