Page MenuHomePhabricator

[chronik] add an optional checkpoint_height query parameters to the block-header endpoint
ClosedPublic

Authored by PiRK on Aug 1 2024, 10:17.

Details

Reviewers
tobias_ruck
Fabien
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABC0a75b25cc085: [chronik] add an optional checkpoint_height query parameters to the block…
Summary

Return a merkle root for all block hashes up to checkpoint_height, as well as the merkle branch of the queried block header up to root, deepest pairing first.

For the block headers range API, the additional merkle data is included only for the last header. A user can trivially check that the returned headers are a valid chain, then use the checkpoint merkle data to check that the last header is part of the checkpointed chain.

Depends on D16756

Test Plan

ninja check-functional

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Tail of the build log:

[239/582] Building CXX object src/CMakeFiles/common.dir/common/args.cpp.o
[240/582] Building CXX object src/CMakeFiles/common.dir/config.cpp.o
[241/582] Building CXX object src/CMakeFiles/common.dir/compressor.cpp.o
[242/582] Building CXX object src/CMakeFiles/common.dir/eventloop.cpp.o
[243/582] Building CXX object src/CMakeFiles/common.dir/consensus/merkle.cpp.o
[244/582] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/pubkey.cpp.o
[245/582] Building CXX object src/CMakeFiles/common.dir/feerate.cpp.o
[246/582] Building CXX object src/CMakeFiles/script.dir/script/standard.cpp.o
[247/582] Building CXX object src/CMakeFiles/common.dir/key_io.cpp.o
[248/582] Building CXX object src/CMakeFiles/common.dir/coins.cpp.o
[249/582] Building CXX object src/CMakeFiles/common.dir/net_permissions.cpp.o
[250/582] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/uint256.cpp.o
[251/582] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/arith_uint256.cpp.o
[252/582] Building CXX object src/CMakeFiles/common.dir/netbase.cpp.o
[253/582] Building CXX object src/CMakeFiles/common.dir/policy/policy.cpp.o
[254/582] Building CXX object src/CMakeFiles/common.dir/primitives/block.cpp.o
[255/582] Building CXX object src/CMakeFiles/common.dir/protocol.cpp.o
[256/582] Building CXX object src/CMakeFiles/script.dir/script/sigencoding.cpp.o
[257/582] Building CXX object src/CMakeFiles/common.dir/common/system.cpp.o
[258/582] Building CXX object src/CMakeFiles/common.dir/rpc/util.cpp.o
[259/582] Building CXX object src/CMakeFiles/common.dir/scheduler.cpp.o
[260/582] Building CXX object src/CMakeFiles/bitcoinconsensus.dir/consensus/amount.cpp.o
[261/582] Building CXX object src/CMakeFiles/common.dir/merkleblock.cpp.o
[262/582] Building CXX object src/CMakeFiles/common.dir/key.cpp.o
[263/582] Building C object src/secp256k1/CMakeFiles/recover-bench.dir/src/bench_recover.c.o
[264/582] Building CXX object src/CMakeFiles/common.dir/common/bloom.cpp.o
[265/582] Building CXX object src/CMakeFiles/common.dir/cashaddrenc.cpp.o
[266/582] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[267/582] Linking C static library src/secp256k1/libsecp256k1.a
[268/582] Linking C executable src/secp256k1/recover-bench
[269/582] Building CXX object src/CMakeFiles/common.dir/networks/abc/chainparamsconstants.cpp.o
[270/582] Building C object src/secp256k1/CMakeFiles/verify-bench.dir/src/bench_verify.c.o
[271/582] Building CXX object src/CMakeFiles/common.dir/outputtype.cpp.o
[272/582] Building C object src/secp256k1/CMakeFiles/sign-bench.dir/src/bench_sign.c.o
[273/582] Linking C executable src/secp256k1/verify-bench
[274/582] Linking C executable src/secp256k1/sign-bench
[275/582] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[276/582] Building CXX object src/CMakeFiles/common.dir/warnings.cpp.o
[277/582] Building CXX object src/CMakeFiles/common.dir/kernel/chainparams.cpp.o
[278/582] Building CXX object src/CMakeFiles/common.dir/networks/abc/checkpoints.cpp.o
[279/582] Building CXX object src/CMakeFiles/common.dir/netaddress.cpp.o
[280/582] Building CXX object src/CMakeFiles/script.dir/script/signingprovider.cpp.o
[281/582] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[282/582] Linking C executable src/secp256k1/ecmult-bench
[283/582] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[284/582] Linking C executable src/secp256k1/internal-bench
[285/582] Building CXX object src/CMakeFiles/common.dir/core_write.cpp.o
[286/582] Building CXX object src/CMakeFiles/common.dir/core_read.cpp.o
[287/582] Building CXX object src/CMakeFiles/common.dir/rpc/rawtransaction_util.cpp.o
[288/582] Building CXX object src/CMakeFiles/common.dir/psbt.cpp.o
[289/582] Linking CXX static library src/libcommon.a
[290/582] Linking CXX static library src/libscript.a
[291/582] Linking CXX static library src/libbitcoinconsensus.a
[292/582] Linking CXX shared library src/libbitcoinconsensus.so.0.29.12
[293/582] Creating library symlink src/libbitcoinconsensus.so.0 src/libbitcoinconsensus.so
[294/582] Linking CXX executable src/bitcoin-tx
[295/582] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[296/582] Linking CXX executable src/bitcoin-cli
ninja: build stopped: cannot make progress due to previous errors.
Build chronik-client-integration-tests failed with exit code 1

Tail of the build log:

    Checking sha1 v0.10.6
    Checking embedded-io v0.4.0
    Checking data-encoding v2.5.0
    Checking cobs v0.2.3
    Checking utf-8 v0.7.6
    Checking smallvec v1.13.2
    Checking ryu v1.0.17
    Checking httpdate v1.0.3
    Checking tungstenite v0.21.0
    Checking postcard v1.0.8
    Checking pin-project v1.1.5
    Checking chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
   Compiling prost-build v0.11.9
    Checking chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
    Checking serde_spanned v0.6.6
    Checking toml_datetime v0.6.6
   Compiling pyo3 v0.22.2
    Checking seahash v4.1.0
    Checking sync_wrapper v0.1.2
    Checking mime v0.3.17
    Checking topo_sort v0.4.0
    Checking winnow v0.6.13
    Checking memoffset v0.9.1
    Checking axum-core v0.4.3
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking hyper v1.2.0
    Checking tower v0.4.13
    Checking tokio-tungstenite v0.21.0
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking sync_wrapper v1.0.1
    Checking hyper-util v0.1.3
    Checking base64 v0.21.7
    Checking matchit v0.7.3
    Checking unindent v0.2.3
    Checking unicode-segmentation v1.11.0
    Checking tower-http v0.5.2
    Checking futures v0.3.30
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking convert_case v0.6.0
    Checking toml_edit v0.22.14
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
error: missing documentation for a method
  --> chronik/chronik-bridge/src/ffi.rs:10:1
   |
10 | #[cxx::bridge(namespace = "chronik_bridge")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D missing-docs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(missing_docs)]`

error: could not compile `chronik-bridge` (lib) due to 1 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

Tail of the build log:

   Compiling axum v0.7.5
   Compiling librocksdb-sys v0.11.0+8.1.1
   Compiling chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling rocksdb v0.21.0
   Compiling chronik-db v0.1.0 (/work/chronik/chronik-db)
   Compiling chronik-indexer v0.1.0 (/work/chronik/chronik-indexer)
warning: unused variable: `root`
   --> chronik/chronik-indexer/src/query/blocks.rs:355:17
    |
355 |             let root = root.to_le_bytes();
    |                 ^^^^ help: if this is intentional, prefix it with an underscore: `_root`
    |
note: the lint level is defined here
   --> chronik/chronik-indexer/src/lib.rs:7:1
    |
7   | / abc_rust_lint::lint! {
8   | |     pub mod avalanche;
9   | |     pub mod subs_group;
10  | |     pub mod indexer;
...   |
14  | |     pub mod merkle;
15  | | }
    | |_^
    = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
    = note: this warning originates in the macro `abc_rust_lint::lint` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused variable: `branch`
   --> chronik/chronik-indexer/src/query/blocks.rs:356:17
    |
356 |             let branch: Vec<_> =
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_branch`

   Compiling chronik-http v0.1.0 (/work/chronik/chronik-http)
error[E0277]: the trait bound `fn(axum::extract::Path<String>, Query<HashMap<String, String>>, Extension<Arc<tokio::sync::RwLock<ChronikIndexer>>>, Extension<Arc<Node>>) -> impl futures::Future<Output = Result<Protobuf<BlockHeader>, ReportError>> {server::handle_block_header}: Handler<_, _>` is not satisfied
   --> chronik/chronik-http/src/server.rs:162:30
    |
162 |                 routing::get(handle_block_header),
    |                 ------------ ^^^^^^^^^^^^^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Path<String>, Query<HashMap<String, String>>, Extension<Arc<...>>, ...) -> ... {handle_block_header}`
    |                 |
    |                 required by a bound introduced by this call
    |
    = help: the following other types implement trait `Handler<T, S>`:
              <Layered<L, H, T, S> as Handler<T, S>>
              <MethodRouter<S> as Handler<(), S>>
note: required by a bound in `axum::routing::get`
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.5/src/routing/method_routing.rs:385:1
    |
385 | top_level_handler_fn!(get, GET);
    | ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
    | |                     |
    | |                     required by a bound in this function
    | required by this bound in `get`
    = note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `chronik-http` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
warning: `chronik-indexer` (lib) generated 2 warnings (run `cargo fix --lib -p chronik-indexer` to apply 2 suggestions)
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1

rebase on D16747 and fix scope for branch & root vars

Now it compiles, but is still lacking tests

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

   Compiling bitcoinsuite-slp v0.1.0 (/work/chronik/bitcoinsuite-slp)
   Compiling abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
   Compiling chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
   Compiling toml v0.8.14
   Compiling chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
   Compiling rocksdb v0.21.0
   Compiling chronik-db v0.1.0 (/work/chronik/chronik-db)
    Finished test [unoptimized + debuginfo] target(s) in 4m 44s
     Running unittests src/lib.rs (abc-ci-builds/build-chronik-plugins/cargo/build/debug/deps/chronik_db-a3c26c153718321c)

running 37 tests
test groups::script::tests::test_script_group ... ok
test index_tx::tests::test_tx_num_cache ... ok
test io::block_stats::tests::test_block_stats ... ok
test io::group_utxos::tests::test_value_group_utxos ... ok
test io::group_history::tests::test_value_group_history ... ok
test io::token::tests::test_batch_common::test_batch_cycle ... ok
test io::token::tests::test_batch_common::test_batch_skip_validation ... ok
test io::token::tests::test_batch_common::test_batch_topological_sort ... ok
test io::token::tests::test_batch_burn::test_batch_burn ... ok
test io::token::tests::test_batch_alp::test_batch_alp ... ok
test mem::group_history::tests::test_mempool_group_history ... ok
test mem::group_utxos::tests::test_mempool_group_utxos ... ok
test mem::spent_by::tests::test_mempool_spent_by ... ok
test io::token::tests::test_batch_disconnect_block::test_batch_disconnect ... ok
test io::token::tests::test_batch_genesis::test_batch_genesis_alp ... ok
test io::spent_by::tests::test_spent_by ... ok
test io::token::tests::test_batch_nft::test_batch_slp_nft1 ... ok
test io::token::tests::test_batch_genesis::test_batch_genesis_slp_fungible ... ok
test ser::tests::test_deserialize_err ... ok
test ser::tests::test_deserialize_leftover_err ... ok
test ser::tests::test_err_display_deserialize ... ok
test ser::tests::test_err_display_deserialize_leftover ... ok
test ser::tests::test_err_display_serialize ... ok
test ser::tests::test_roundtrip ... ok
test ser::tests::test_roundtrip_vec ... ok
test io::token::tests::test_batch_vault::test_batch_vault ... ok
test ser::tests::test_serialize_err ... ok
test io::token::tests::test_batch_unknown::test_batch_unknown ... ok
test io::merge::tests::test_catch_merge ... ok
test mem::tokens::tests::test_mempool_tokens ... ok
test reverse_lookup::tests::test_reverse_lookup ... ok
test plugins::io::tests::test_plugin_metas ... ok
test plugins::io::tests::test_plugin_writer ... ok
test index_tx::tests::test_prepare_indexed_txs ... ok
test io::blocks::tests::test_blocks ... ok
test io::txs::tests::test_insert_txs ... ok
test reverse_lookup::tests::test_reverse_lookup_rng ... ok

test result: ok. 37 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.38s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
PiRK edited the summary of this revision. (Show Details)
PiRK edited the test plan for this revision. (Show Details)

add functional test, fix checkpoint_height <-> block_height mistake in blocks.rs

PiRK retitled this revision from [chronik] add an optional cp_height query parameters to the block-header endpoint to [chronik] add an optional checkpoint_height query parameters to the block-header endpoint.

Tail of the build log:

    Checking sha1 v0.10.6
    Checking cobs v0.2.3
    Checking utf-8 v0.7.6
    Checking httpdate v1.0.3
    Checking ryu v1.0.17
    Checking data-encoding v2.5.0
    Checking embedded-io v0.4.0
    Checking smallvec v1.13.2
    Checking postcard v1.0.8
    Checking pin-project v1.1.5
    Checking tungstenite v0.21.0
    Checking chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
    Checking toml_datetime v0.6.6
   Compiling prost-build v0.11.9
    Checking serde_spanned v0.6.6
    Checking chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
   Compiling pyo3 v0.22.2
    Checking mime v0.3.17
    Checking seahash v4.1.0
    Checking winnow v0.6.13
    Checking sync_wrapper v0.1.2
    Checking topo_sort v0.4.0
    Checking axum-core v0.4.3
    Checking memoffset v0.9.1
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking hyper v1.2.0
    Checking tower v0.4.13
    Checking tokio-tungstenite v0.21.0
    Checking unicode-segmentation v1.11.0
    Checking matchit v0.7.3
    Checking unindent v0.2.3
    Checking base64 v0.21.7
    Checking sync_wrapper v1.0.1
    Checking futures v0.3.30
    Checking tower-http v0.5.2
    Checking hyper-util v0.1.3
    Checking convert_case v0.6.0
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking toml_edit v0.22.14
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
error: missing documentation for a method
  --> chronik/chronik-bridge/src/ffi.rs:10:1
   |
10 | #[cxx::bridge(namespace = "chronik_bridge")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D missing-docs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(missing_docs)]`

error: could not compile `chronik-bridge` (lib) due to 1 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

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.32s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
PiRK edited the summary of this revision. (Show Details)

implement the checkpoint data for the range of headers endpoint as well. TODO: more functional tests, invalidate merkle cache in case of reorrg

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.35s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1

functional tests for block_headers with checkpoint_height

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.34s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

add missing mandatory doc for method

Tail of the build log:

   Compiling bitcoinsuite-slp v0.1.0 (/work/chronik/bitcoinsuite-slp)
   Compiling abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
   Compiling chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
   Compiling toml v0.8.14
   Compiling chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
   Compiling rocksdb v0.21.0
   Compiling chronik-db v0.1.0 (/work/chronik/chronik-db)
    Finished test [unoptimized + debuginfo] target(s) in 6m 26s
     Running unittests src/lib.rs (abc-ci-builds/build-chronik-plugins/cargo/build/debug/deps/chronik_db-a3c26c153718321c)

running 37 tests
test groups::script::tests::test_script_group ... ok
test index_tx::tests::test_tx_num_cache ... ok
test io::merge::tests::test_catch_merge ... ok
test io::group_utxos::tests::test_value_group_utxos ... ok
test io::block_stats::tests::test_block_stats ... ok
test io::token::tests::test_batch_common::test_batch_cycle ... ok
test io::token::tests::test_batch_alp::test_batch_alp ... ok
test io::token::tests::test_batch_common::test_batch_topological_sort ... ok
test io::token::tests::test_batch_common::test_batch_skip_validation ... ok
test io::token::tests::test_batch_burn::test_batch_burn ... ok
test mem::group_history::tests::test_mempool_group_history ... ok
test mem::group_utxos::tests::test_mempool_group_utxos ... ok
test mem::spent_by::tests::test_mempool_spent_by ... ok
test io::spent_by::tests::test_spent_by ... ok
test io::token::tests::test_batch_disconnect_block::test_batch_disconnect ... ok
test io::token::tests::test_batch_genesis::test_batch_genesis_alp ... ok
test io::token::tests::test_batch_genesis::test_batch_genesis_slp_fungible ... ok
test plugins::io::tests::test_plugin_metas ... ok
test ser::tests::test_deserialize_err ... ok
test ser::tests::test_deserialize_leftover_err ... ok
test ser::tests::test_err_display_deserialize ... ok
test ser::tests::test_err_display_deserialize_leftover ... ok
test ser::tests::test_err_display_serialize ... ok
test ser::tests::test_roundtrip ... ok
test ser::tests::test_roundtrip_vec ... ok
test ser::tests::test_serialize_err ... ok
test io::group_history::tests::test_value_group_history ... ok
test io::token::tests::test_batch_nft::test_batch_slp_nft1 ... ok
test io::token::tests::test_batch_vault::test_batch_vault ... ok
test mem::tokens::tests::test_mempool_tokens ... ok
test io::token::tests::test_batch_unknown::test_batch_unknown ... ok
test reverse_lookup::tests::test_reverse_lookup ... ok
test plugins::io::tests::test_plugin_writer ... ok
test index_tx::tests::test_prepare_indexed_txs ... ok
test io::blocks::tests::test_blocks ... ok
test io::txs::tests::test_insert_txs ... ok
test reverse_lookup::tests::test_reverse_lookup_rng ... ok

test result: ok. 37 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.56s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.35s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1

invalidate merkle tree cache in case a block is disconnected, add tests

use if let to fix compilation warning

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.35s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1

Tail of the build log:

    Checking serde_spanned v0.6.6
    Checking toml_datetime v0.6.6
   Compiling prost-build v0.11.9
   Compiling pyo3 v0.22.2
    Checking hyper v1.2.0
    Checking seahash v4.1.0
    Checking topo_sort v0.4.0
    Checking winnow v0.6.13
    Checking sync_wrapper v0.1.2
    Checking mime v0.3.17
    Checking tokio-tungstenite v0.21.0
    Checking tower v0.4.13
    Checking axum-core v0.4.3
    Checking memoffset v0.9.1
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking hyper-util v0.1.3
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking matchit v0.7.3
    Checking unicode-segmentation v1.11.0
    Checking sync_wrapper v1.0.1
    Checking base64 v0.21.7
    Checking unindent v0.2.3
    Checking tower-http v0.5.2
    Checking futures v0.3.30
    Checking convert_case v0.6.0
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking toml_edit v0.22.14
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
    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: this expression creates a reference which is immediately dereferenced by the compiler
   --> chronik/chronik-http/src/handlers.rs:389:33
    |
389 |     let blocks = indexer.blocks(&node);
    |                                 ^^^^^ help: change this to: `node`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`

error: this expression creates a reference which is immediately dereferenced by the compiler
   --> chronik/chronik-http/src/handlers.rs:403:33
    |
403 |     let blocks = indexer.blocks(&node);
    |                                 ^^^^^ help: change this to: `node`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

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

Tail of the build log:

test chronik/bitcoinsuite-core/src/bytes.rs - bytes::read_array (line 55) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::from_be_slice (line 264) ... ok
test chronik/bitcoinsuite-core/src/block/block_hash.rs - block::block_hash::BlockHash::to_vec (line 46) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::from_le_hex (line 289) ... ok
test chronik/bitcoinsuite-core/src/script/opcode.rs - script::opcode::Opcode (line 12) ... ok
test chronik/bitcoinsuite-core/src/script/opcode.rs - script::opcode::opcode_number_to_name (line 86) ... ok
test chronik/bitcoinsuite-core/src/script/opcode.rs - script::opcode::Opcode::number (line 75) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::hex_le (line 168) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::from_le_slice (line 242) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::to_be_bytes (line 150) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::to_be_vec (line 225) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::hex_be (line 190) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::to_le_vec (line 208) ... ok
test chronik/bitcoinsuite-core/src/hash.rs - hash::Hashed::to_le_bytes (line 138) ... ok
test chronik/bitcoinsuite-core/src/script/pubkey.rs - script::pubkey::PubKey (line 13) ... ok
test chronik/bitcoinsuite-core/src/script/pubkey.rs - script::pubkey::PubKey::hex (line 57) ... ok
test chronik/bitcoinsuite-core/src/script/pubkey.rs - script::pubkey::PubKey::array (line 47) ... ok
test chronik/bitcoinsuite-core/src/script/pubkey.rs - script::pubkey::PubKey::as_slice (line 37) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::bytecode (line 126) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::p2pk (line 76) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::hex (line 148) ... ok
test chronik/bitcoinsuite-core/src/script/pubkey_variant.rs - script::pubkey_variant::PubKeyVariant (line 14) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::is_opreturn (line 159) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::iter_ops (line 174) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::p2pk_uncompressed (line 98) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::p2pkh (line 36) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::p2sh (line 56) ... ok
test chronik/bitcoinsuite-core/src/script/script_mut.rs - script::script_mut::ScriptMut::put_slp_pushdata (line 116) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::to_vec (line 137) ... ok
test chronik/bitcoinsuite-core/src/script/script_mut.rs - script::script_mut::ScriptMut::freeze (line 135) ... ok
test chronik/bitcoinsuite-core/src/script/script_mut.rs - script::script_mut::ScriptMut::put_opcodes (line 28) ... ok
test chronik/bitcoinsuite-core/src/script/script_mut.rs - script::script_mut::ScriptMut::put_bytecode (line 44) ... ok
test chronik/bitcoinsuite-core/src/script/script_mut.rs - script::script_mut::ScriptMut::with_capacity (line 17) ... ok
test chronik/bitcoinsuite-core/src/script/script.rs - script::script::Script::variant (line 223) ... ok
test chronik/bitcoinsuite-core/src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey::array (line 50) ... ok
test chronik/bitcoinsuite-core/src/script/script_mut.rs - script::script_mut::ScriptMut::put_pushdata (line 58) ... ok
test chronik/bitcoinsuite-core/src/tx/tx.rs - tx::tx::Tx (line 34) - compile fail ... ok
test chronik/bitcoinsuite-core/src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey (line 13) ... ok
test chronik/bitcoinsuite-core/src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey::as_slice (line 40) ... ok
test chronik/bitcoinsuite-core/src/script/variant.rs - script::variant::ScriptVariant::from_type_and_payload (line 94) ... ok
test chronik/bitcoinsuite-core/src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey::hex (line 60) ... ok
test chronik/bitcoinsuite-core/src/tx/txid.rs - tx::txid::TxId::new (line 47) ... ok
test chronik/bitcoinsuite-core/src/tx/tx.rs - tx::tx::Tx (line 14) ... ok
test chronik/bitcoinsuite-core/src/tx/txid.rs - tx::txid::TxId::to_vec (line 104) ... ok
test chronik/bitcoinsuite-core/src/tx/tx.rs - tx::tx::OutPoint::is_coinbase (line 125) ... ok
test chronik/bitcoinsuite-core/src/script/variant.rs - script::variant::ScriptVariant::to_script (line 108) ... ok
test chronik/bitcoinsuite-core/src/tx/txid.rs - tx::txid::TxId::to_bytes (line 74) ... ok
test chronik/bitcoinsuite-core/src/tx/txid.rs - tx::txid::TxId::as_bytes (line 89) ... ok
test chronik/bitcoinsuite-core/src/tx/txid.rs - tx::txid::TxId::from_tx (line 59) ... ok

test result: ok. 58 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.69s

   Doc-tests bitcoinsuite-slp

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1

rebase and fix another compiler warning

PiRK published this revision for review.Sep 17 2024, 11:45
tobias_ruck added inline comments.
chronik/chronik-indexer/src/indexer.rs
304 ↗(On Diff #49674)
chronik/chronik-indexer/src/query/blocks.rs
339–340 ↗(On Diff #49674)
382–383 ↗(On Diff #49674)

dito

385 ↗(On Diff #49674)

this seems to be identical to the header case, it should be possible to factor this into its own method

test/functional/chronik_block_header.py
40 ↗(On Diff #49674)

just out of curiosity, is this needed or just there for clarity?

130 ↗(On Diff #49674)

same here

This revision now requires changes to proceed.Sep 17 2024, 12:23
test/functional/chronik_block_header.py
40 ↗(On Diff #49674)

It is not needed, just something I added in the very first iteration when root and branch were always empty and I just wanted to demonstrate that the fields existed. We can probably remove it now that there are real tests below.

test/functional/chronik_block_header.py
40 ↗(On Diff #49674)

I think here and the other place would benefit from having it removed, but others are probably better without.

Also shows that this is a no-op for places where it's unused

test/functional/chronik_block_header.py
7 ↗(On Diff #49674)

also this should be undone

chronik/chronik-indexer/src/query/blocks.rs
360 ↗(On Diff #49678)

Note to myself: this needs to be benchmarked, and can maybe be optimized if necessary: ask the block merkle tree which range of blockhashes are unnecessary because they were already cached, then fetch in memory only the required hashes and change merkle_root_and_branch to accept a limited range of headers and a start_height param.

Not in this diff, though.

Tail of the build log:

   Compiling pyo3 v0.22.2
    Checking topo_sort v0.4.0
    Checking seahash v4.1.0
    Checking hyper v1.2.0
    Checking mime v0.3.17
    Checking sync_wrapper v0.1.2
    Checking winnow v0.6.13
    Checking axum-core v0.4.3
    Checking tokio-tungstenite v0.21.0
    Checking tower v0.4.13
    Checking memoffset v0.9.1
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking hyper-util v0.1.3
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking base64 v0.21.7
    Checking sync_wrapper v1.0.1
    Checking unicode-segmentation v1.11.0
    Checking matchit v0.7.3
    Checking unindent v0.2.3
    Checking tower-http v0.5.2
    Checking futures v0.3.30
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking convert_case v0.6.0
    Checking toml_edit v0.22.14
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
    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)
error: useless conversion to the same type: `query::blocks::QueryBlockError`
   --> chronik/chronik-indexer/src/query/blocks.rs:176:24
    |
176 |               return Err(InvalidCheckpointHeight(
    |  ________________________^
177 | |                 checkpoint_height,
178 | |                 block_height,
179 | |             )
180 | |             .into());
    | |___________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `-D clippy::useless-conversion` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]`
help: consider removing `.into()`
    |
176 ~             return Err(InvalidCheckpointHeight(
177 +                 checkpoint_height,
178 +                 block_height,
179 ~             ));
    |

error: could not compile `chronik-indexer` (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 serde_spanned v0.6.6
   Compiling pyo3 v0.22.2
    Checking seahash v4.1.0
    Checking winnow v0.6.13
    Checking sync_wrapper v0.1.2
    Checking topo_sort v0.4.0
    Checking mime v0.3.17
    Checking tokio-tungstenite v0.21.0
    Checking axum-core v0.4.3
    Checking tower v0.4.13
    Checking hyper-util v0.1.3
    Checking memoffset v0.9.1
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking unindent v0.2.3
    Checking unicode-segmentation v1.11.0
    Checking base64 v0.21.7
    Checking sync_wrapper v1.0.1
    Checking matchit v0.7.3
    Checking futures v0.3.30
    Checking tower-http v0.5.2
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking convert_case v0.6.0
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
    Checking toml_edit v0.22.14
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
    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)
error: useless conversion to the same type: `query::blocks::QueryBlockError`
   --> chronik/chronik-indexer/src/query/blocks.rs:176:24
    |
176 |               return Err(InvalidCheckpointHeight(
    |  ________________________^
177 | |                 checkpoint_height,
178 | |                 block_height,
179 | |             )
180 | |             .into());
    | |___________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `-D clippy::useless-conversion` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]`
help: consider removing `.into()`
    |
176 ~             return Err(InvalidCheckpointHeight(
177 +                 checkpoint_height,
178 +                 block_height,
179 ~             ));
    |

error: could not compile `chronik-indexer` (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

Tail of the build log:

   Compiling pyo3 v0.22.2
    Checking winnow v0.6.13
    Checking sync_wrapper v0.1.2
    Checking mime v0.3.17
    Checking hyper v1.2.0
    Checking topo_sort v0.4.0
    Checking seahash v4.1.0
    Checking tower v0.4.13
    Checking tokio-tungstenite v0.21.0
    Checking axum-core v0.4.3
    Checking memoffset v0.9.1
    Checking serde_json v1.0.115
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.30
    Checking serde_path_to_error v0.1.16
    Checking hyper-util v0.1.3
    Checking base64 v0.21.7
    Checking sync_wrapper v1.0.1
    Checking matchit v0.7.3
    Checking unindent v0.2.3
    Checking unicode-segmentation v1.11.0
    Checking futures v0.3.30
    Checking tower-http v0.5.2
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking convert_case v0.6.0
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
    Checking toml_edit v0.22.14
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.5
   Compiling pyo3-macros v0.22.2
    Checking toml v0.8.14
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
    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)
error: useless conversion to the same type: `query::blocks::QueryBlockError`
   --> chronik/chronik-indexer/src/query/blocks.rs:176:24
    |
176 |               return Err(InvalidCheckpointHeight(
    |  ________________________^
177 | |                 checkpoint_height,
178 | |                 block_height,
179 | |             )
180 | |             .into());
    | |___________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `-D clippy::useless-conversion` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]`
help: consider removing `.into()`
    |
176 ~             return Err(InvalidCheckpointHeight(
177 +                 checkpoint_height,
178 +                 block_height,
179 ~             ));
    |

error: could not compile `chronik-indexer` (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:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.35s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
tobias_ruck added inline comments.
chronik/chronik-indexer/src/query/blocks.rs
418 ↗(On Diff #49680)

let's use shadowing here, common to unwrap an Option into the same variable name

This revision is now accepted and ready to land.Sep 17 2024, 17:48
Fabien requested changes to this revision.Sep 17 2024, 19:14
Fabien added a subscriber: Fabien.
Fabien added inline comments.
chronik/chronik-bridge/src/ffi.rs
138 ↗(On Diff #49680)

It has nothing raw, it's just a BlockHash

test/functional/test_framework/chronik/client.py
361–364 ↗(On Diff #49680)

Otherwise your test is not checking what you expect when checkpoint_height=0. This solution lets you try both without query params and with checkpoint_height=0

370 ↗(On Diff #49680)

dito

This revision now requires changes to proceed.Sep 17 2024, 19:14
PiRK edited the summary of this revision. (Show Details)

feedback

This revision is now accepted and ready to land.Sep 19 2024, 11:44
PiRK added a task: Restricted Maniphest Task.Fri, Dec 13, 13:34