Page MenuHomePhabricator

[Chronik] Add `/script/:type/:payload/history`
ClosedPublic

Authored by tobias_ruck on Apr 3 2023, 00:04.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC28ee0a6dab28: [Chronik] Add `/script/:type/:payload/history`
Summary

This is sort-of the combination of /script/:type/:payload/confirmed-txs and /script/:type/:payload/unconfirmed-txs, except sorted in reverse-chronological order.

We start pages at the most recent mempool tx, go backwards in the mempool until we reach the oldest tx in the mempool, then continue with the most recent DB tx and go backwards from there.

Note that unlike confirmed_txs and unconfirmed_txs, the order of txs observed by fetching multiple pages can change if new txs are added, or the page size is changed. This is because txs are fetched from the DB the order they appear on the blockchain, and only then are sorted by time_first_seen.

Depends on D13613 and D13612.

Test Plan

ninja check-crates && ninja check-functional

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-script-history
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22908
Build 45436: Build Diffbuild-without-wallet · build-diff · build-debug · build-clang-tidy · build-clang · build-chronik
Build 45435: arc lint + arc unit

Event Timeline

Don't index OP_RETURN outputs

Tail of the build log:

    Checking cobs v0.2.3
    Checking ryu v1.0.11
    Checking percent-encoding v2.2.0
    Checking try-lock v0.2.3
    Checking httparse v1.8.0
    Checking prost v0.11.8
    Checking futures-util v0.3.25
    Checking object v0.29.0
    Checking tracing v0.1.37
    Checking form_urlencoded v1.1.0
    Checking want v0.3.0
    Checking http-range-header v0.3.0
    Checking httpdate v1.0.2
    Checking seahash v4.1.0
    Checking bitflags v1.3.2
    Checking mime v0.3.16
    Checking matchit v0.6.0
    Checking sync_wrapper v0.1.1
   Compiling chronik-lib v0.1.0 (/work/chronik/chronik-lib)
    Checking mio v0.8.5
    Checking socket2 v0.4.7
    Checking num_cpus v1.14.0
    Checking librocksdb-sys v0.10.0+7.9.2 (https://github.com/rust-rocksdb/rust-rocksdb.git?rev=a6103ef#a6103ef3)
    Checking rocksdb v0.20.1 (https://github.com/rust-rocksdb/rust-rocksdb.git?rev=a6103ef#a6103ef3)
    Checking tokio v1.25.0
    Checking chronik-util v0.1.0 (/work/chronik/chronik-util)
    Checking heapless v0.7.15
    Checking serde_urlencoded v0.7.1
    Checking serde_path_to_error v0.1.8
    Checking serde_json v1.0.89
    Checking backtrace v0.3.66
    Checking stable-eyre v0.2.2
    Checking abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
    Checking futures-executor v0.3.25
    Checking axum-core v0.3.0
error: missing documentation for a struct
   --> /work/abc-ci-builds/build-chronik/cargo/build/debug/build/chronik-proto-9ab325f1cd5d6f08/out/chronik.rs:116:1
    |
116 | pub struct TxHistoryPage {
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D missing-docs` implied by `-D warnings`

error: missing documentation for a struct field
   --> /work/abc-ci-builds/build-chronik/cargo/build/debug/build/chronik-proto-9ab325f1cd5d6f08/out/chronik.rs:118:5
    |
118 |     pub txs: ::prost::alloc::vec::Vec<Tx>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a struct field
   --> /work/abc-ci-builds/build-chronik/cargo/build/debug/build/chronik-proto-9ab325f1cd5d6f08/out/chronik.rs:120:5
    |
120 |     pub num_pages: u32,
    |     ^^^^^^^^^^^^^^^^^^

    Checking postcard v1.0.1
error: could not compile `chronik-proto` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

   Compiling serde_path_to_error v0.1.8
   Compiling futures-executor v0.3.25
   Compiling axum-core v0.3.0
   Compiling futures v0.3.25
   Compiling stable-eyre v0.2.2
   Compiling abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
   Compiling postcard v1.0.1
warning: missing documentation for a struct
   --> /work/abc-ci-builds/build-chronik/cargo/build/debug/build/chronik-proto-5fd6b1dc95557ca7/out/chronik.rs:116:1
    |
116 | pub struct TxHistoryPage {
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> chronik/chronik-proto/src/lib.rs:7:1
    |
7   | / abc_rust_lint::lint! {
8   | |     pub mod proto {
9   | |         //! Module with protobuf structs/enums for the Chronik HTTP server.
10  | |         include!(concat!(env!("OUT_DIR"), "/chronik.rs"));
11  | |     }
12  | | }
    | |_^
    = note: this warning originates in the macro `abc_rust_lint::lint` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: missing documentation for a struct field
   --> /work/abc-ci-builds/build-chronik/cargo/build/debug/build/chronik-proto-5fd6b1dc95557ca7/out/chronik.rs:118:5
    |
118 |     pub txs: ::prost::alloc::vec::Vec<Tx>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: missing documentation for a struct field
   --> /work/abc-ci-builds/build-chronik/cargo/build/debug/build/chronik-proto-5fd6b1dc95557ca7/out/chronik.rs:120:5
    |
120 |     pub num_pages: u32,
    |     ^^^^^^^^^^^^^^^^^^

   Compiling tower v0.4.13
   Compiling hyper v0.14.23
warning: `chronik-proto` (lib) generated 3 warnings
   Compiling chronik-db v0.1.0 (/work/chronik/chronik-db)
   Compiling tower-http v0.3.4
   Compiling chronik-indexer v0.1.0 (/work/chronik/chronik-indexer)
   Compiling axum v0.6.0
   Compiling chronik-http v0.1.0 (/work/chronik/chronik-http)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/rustc2WFZZ2/symbols.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.115ck2d9rfimrxv3.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.146c5sm0pjnwul1h.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.16uhvwrp3pipworl.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.17bh0q0nx4qmx885.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.183imgjqbe8wd8ir.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.185by9zxyjdsre88.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1hnwsc0r9ish7w4g.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1jto2lsh1gycu8wr.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1jutwfw4muuiz82i.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1kyyyqpbv89c9c72.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1llszfcpevxoocyy.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1mlxasdn1xrzge4q.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1nbte5h5ywhuap5z.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1nhxvvchlauiqxqk.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1pkmrhoq6rdf486a.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1pknldg48o1pr1ij.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1rl561rpglrl7ipe.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1vf5rubtxf1wxfhj.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1w1rpnmqvcjuzf18.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1x8yfuvxicr6mj13.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.1zmo1wahm8a9h3aq.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.20ozu1lbuh02zl9j.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.24nomfu2vhn2tpp9.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.26o9jnern6jyk8dt.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2a25n53kbj4ck1lw.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2bdxkriko6i8f8nf.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2dc05b5uibzo9jf2.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2et9m0khbyu3ldom.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2i9cm7wi6hbv4s34.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2ifcfocxwwvziplj.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2iqtmqntvik8l4e.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2ouzm5tk5o9dc4es.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2pneq6hs31oz23kr.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2q3f8g5h5efadbdh.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2q5tmb4hsrxf9rsr.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2rwfvj5sr51b2mh5.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2saj5dtud2utes6h.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2tkzsoctecgdxyzc.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2w1ph4g8y4gc3fz7.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2xuo96avn8t3jgh0.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2xzb6gh49tu18w0f.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2yw2rb3enqxois9w.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.31f98e9kc9q7httj.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.35y938l5he4sgoqt.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.364pw48vj747joid.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.370hmsxxvdx2o8y5.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3cfa3eyzgypmv3gw.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3gqpkdkstnmzqkng.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3hhdbrulxk9zm77n.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3hu8wub86s07fvq1.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3ia8yfsp68j0vxxj.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3ibltvm3evlmav7t.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3iz3whkt14nxi2dt.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3o79g50ybe0aykkc.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3rehvi8l1hamnu1t.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3ri42t8bjp129dhd.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3tt6pgvpbpneb7ph.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3u69xjtngzvj8uud.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3ut8u9vz4buyj52r.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3uxmr1ivmzmiv13f.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.3vya8b4gw3bmrc1t.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.408ew2hy29b5d94j.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.423ygobmc0k1dnfk.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.432yyl0y1xyk6uwg.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.437v2jr7pmbt12t9.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.43lcqi7vy2dvjgbo.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.442rat53hq0umhq1.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.44rh1ebyvvwqqnm0.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.47ip5ejb3ohjul50.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.47j788vbvssbexkn.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.481kcz65ntqxvxy6.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.48u59iinzurwduxf.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.48ziexz7x17254xy.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.49dgmdv3tc0s675c.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4a7z1jv1ughdpf3d.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4e0wvx7mkrmo3p1a.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4fv1b1kzfqmobdd9.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4gk8ai4zfssmtkeo.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4gmc1hie9qh587e6.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4hryqxfufhal9vkk.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4hwgbkvye1dtrem5.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4ibagm5fy4izdef.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4iwpstzbb50imr5j.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4kaq0irpavlfufy2.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4khidcl6gapds0mq.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4m79ke10uprv81u3.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4mkkovpma23kui74.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4n3mba4v0cj36fla.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4rryu1usunxqgx0e.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4smrdly70ergek5p.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4vk7klu13m9eshye.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4x06drbw8prgd2k6.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4xal7fpn11159j0h.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.4xrwxj126we67a86.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.5250g55z3vjkmvkl.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.53i2xp29zsyw6a2q.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.54021olegdfp1qak.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.54kms7e4xvdwh4cn.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.58l7xyo31rcbw64.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.5bhxvzvkgnsj6fqj.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.5ebvzpodbpmlyoht.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.5fl6gayixck82qvy.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.6kd500p5xb2vssq.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.9i66zgekivtxu8.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.ato7zjf0r1om4pg.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.bpo2owwt60hytw7.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.cu21muwlm4rj4tk.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.eu33o3z8zt3w9hd.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.f3krmdckvtyltlp.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.jysf0dn39ep7mt.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.l0t1lnuvtliphiu.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.l37623qlknhdagq.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.mxrlwtfscrljkav.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.qhg3ihjcpii05b1.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.sm0jq6m9vvp73v5.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.ue6136z5lv5hma1.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.unznbqa8qhvj52k.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.vmpgl9a1trlc9iw.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.yhfwn1rbj3s9peu.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.yum29q81w60osu8.rcgu.o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051.2iyg95dj1w5mkuj7.rcgu.o" "-Wl,--as-needed" "-L" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps" "-L" "/work/abc-ci-builds/build-chronik/cargo/build/debug/build/cxx-87e1d61f3068422b/out" "-L" "/work/abc-ci-builds/build-chronik/cargo/build/debug/build/link-cplusplus-6136bb10ec67ea19/out" "-L" "/work/abc-ci-builds/build-chronik/cargo/build/debug/build/librocksdb-sys-b817efd3d4cfec2e/out" "-L" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libtempdir-21dc497bca9f0870.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libremove_dir_all-15f3852968579a65.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/librand-f056d972f6977665.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libchronik_proto-f85ca94365c180de.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libprost-8dfb6d9ed565d1a3.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libpretty_assertions-508e42b853d42076.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libdiff-7184101235e0e6b9.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libansi_term-6faac332fc66d352.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libchronik_util-3024d0159ba67de5.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libchronik_db-5d65a6f3232b5b78.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libpostcard-4f02b61b842f69a9.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libheapless-c99ae5d736a6193a.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libstable_deref_trait-ad529b684dac5c84.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libspin-2c942d0f705f646c.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/liblock_api-4a8de252dc8370dc.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libscopeguard-d487ed2e69b7d92b.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libhash32-4fd9b26ad1350444.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libbyteorder-f9c9976d4f9fcda2.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libcobs-9f719dbf2fe54bc3.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libseahash-add612473fe7d4fe.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libserde-cff355a36fb1be4c.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/librocksdb-6695d9e8fddde9fe.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/liblibrocksdb_sys-6073582b3d02c1ef.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libchronik_bridge-7a8d7856663ce9fb.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libcxx-4b5b07b49782288f.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/liblink_cplusplus-d3204fdda0b41d82.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libbitcoinsuite_core-057ee29618cc0eb9.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libhex-9a35852279a02a51.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libthiserror-9dba2c229ea3da50.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libabc_rust_error-2ed83e390ca7aa39.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libstable_eyre-8d4461136a426355.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libbacktrace-63466902ebd6437a.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libminiz_oxide-81111ae4bd866654.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libadler-099abb8cc9514dbc.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libobject-c7f1b65965b728b1.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libmemchr-f6b9a8c2de763734.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/liblibc-5d6e4d5c22ced3d9.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libaddr2line-e3c9cd90e270012d.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libgimli-22c5e15010e742a3.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libcfg_if-b0d748998f3e028f.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/librustc_demangle-0bcc0dc530a635d1.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libeyre-003710e595e2055f.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libindenter-fe3a98df0f1ac620.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libonce_cell-c92f83ca0f267559.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libhttp-3f19fa729eb56827.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libitoa-a937c4606d36a346.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libbytes-c78d6d3aea4fe05c.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libfnv-7858bf75e39d6d2d.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-176eee24ecde3b39.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-805d87a03fc23874.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-e9e7bde123bf13c4.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-d7dee63469c9af76.rlib" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libabc_rust_lint-cd774b985076262e.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-c6192dd4c4d410ac.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-ff7377081f1949cc.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-1cb453c5b22d87c0.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-ef80a3f609e31ec2.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-a690952b7d7394ed.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-33a38bd462dea42b.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-2804c2e5e3dadb10.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-6cea4a991902c072.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-3f9cac5a3a01ae1f.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-be29f577ccd2e0c7.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-40cbcc82de628eb3.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-ce9e735ebca3a756.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-52730b1d9cce8f6d.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-dbd9b472d3582c61.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-8f1d87098c577a9e.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-72ca4bc0b0597905.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-cdff4f89b0741001.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-92115cdd0b50e8be.rlib" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-7f2d6606c0ceff89.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lstdc++" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/work/abc-ci-builds/build-chronik/cargo/build/debug/deps/chronik_indexer-7a80c8fc60a74051" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: /work/abc-ci-builds/build-chronik/cargo/build/debug/deps/libchronik_bridge-7a8d7856663ce9fb.rlib(chronik_bridge-7a8d7856663ce9fb.49w98ramy3qm8r5r.rcgu.o): in function `chronik_bridge::ffi::ffi_inner::compress_script':
          /work/chronik/chronik-bridge/src/ffi.rs:228: undefined reference to `chronik_bridge$cxxbridge1$compress_script'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `chronik-indexer` due to previous error
warning: build failed, waiting for other jobs to finish...
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

fix test build, remove chronik-bridge dependency in chronik-db

Rebase from master, simplify code

tobias_ruck retitled this revision from [Chronik] Implement script tx history to [Chronik] Add `/script/:type/:payload/unconfirmed-txs`.Apr 6 2023, 20:47
tobias_ruck edited the summary of this revision. (Show Details)

use the same mocktime_offsets as in chronik_script_unconfirmed_txs

tobias_ruck retitled this revision from [Chronik] Add `/script/:type/:payload/unconfirmed-txs` to [Chronik] Add `/script/:type/:payload/history`.
Fabien requested changes to this revision.Apr 7 2023, 08:10
Fabien added inline comments.
chronik/chronik-indexer/src/query/group_history.rs
363 ↗(On Diff #39373)

The name does not really imply all the assumptions:

  • the txs are already sorted by tx num
  • the mempool txs should not be sorted
  • the mempool txs should be contiguous at the beginning of the vector
  • the num_page_mempool_txs tells it's sorting a page, and is the vector starting offset for this sort

All in all this is a very specialized method. If there is no plan to reuse it, better have it inlined; otherwise it should better be a more generic method, even if there is a small performance cost: sort by txnum first, don't panic if there is a mempool tx, etc.

test/functional/chronik_script_history.py
69 ↗(On Diff #39373)

Now is a good time to start factoring all these query methods and use some Chronik objects in the tests. This is one more test that will need to be refactored otherwise, better do it first and avoid the cost of the rework.

143 ↗(On Diff #39373)

Make it a constant

315 ↗(On Diff #39373)

Nice to have the comment Order for different page sizes is not guaranteed within blocks. but we shouldn't really be testing that, it's not a feature but an implementation detail (given other test conditions this assert could be false). The only thing that matters is that the txs are the same.

This revision now requires changes to proceed.Apr 7 2023, 08:10

Inline rev_sort_txs, use ChronikClient, use genesis_cb_tx, remove test if order inconsistent

reformat some calls in chronik_script_history.py

This revision is now accepted and ready to land.Apr 9 2023, 06:23