Page MenuHomePhabricator

[chronik] Add more data to the blocks ws message
ClosedPublic

Authored by Fabien on Sep 24 2024, 09:24.

Details

Reviewers
tobias_ruck
Group Reviewers
Restricted Project
Commits
rABCaec2ac03c242: [chronik] Add more data to the blocks ws message
Summary

This especially makes disconnected blocks debugging easier, where this data cannot be retrieved after the ws message like it is upon connection or finalization because the block is parked and Chronik only indexes the active chain.

Because timestamp can be used for every message at low cost, it's included unconditionally.

Depends on D16803.

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Sep 24 2024, 09:24

Tail of the build log:

    Checking url v2.5.0
    Checking rand v0.8.5
    Checking tracing v0.1.40
    Checking http-body-util v0.1.1
    Checking chronik-util v0.1.0 (/work/chronik/chronik-util)
    Checking sha1 v0.10.6
    Checking data-encoding v2.5.0
    Checking httpdate v1.0.3
    Checking cobs v0.2.3
    Checking ryu v1.0.17
    Checking embedded-io v0.4.0
    Checking smallvec v1.13.2
    Checking utf-8 v0.7.6
    Checking postcard v1.0.8
    Checking chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
    Checking tungstenite v0.21.0
    Checking pin-project v1.1.5
   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 topo_sort v0.4.0
    Checking hyper v1.2.0
    Checking seahash v4.1.0
    Checking sync_wrapper v0.1.2
    Checking winnow v0.6.13
    Checking mime v0.3.17
    Checking tokio-tungstenite v0.21.0
    Checking axum-core v0.4.3
    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 matchit v0.7.3
    Checking base64 v0.21.7
    Checking sync_wrapper v1.0.1
    Checking unicode-segmentation v1.11.0
    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
   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
   Compiling pyo3-macros v0.22.2
    Checking axum v0.7.5
    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)
    Finished dev [unoptimized + debuginfo] target(s) in 4m 30s
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

test ser::tests::test_roundtrip ... ok
test ser::tests::test_roundtrip_vec ... ok
test ser::tests::test_serialize_err ... ok
test io::token::tests::test_batch_vault::test_batch_vault ... ok
test io::token::tests::test_batch_nft::test_batch_slp_nft1 ... ok
test io::token::tests::test_batch_unknown::test_batch_unknown ... ok
test mem::tokens::tests::test_mempool_tokens ... ok
test io::merge::tests::test_catch_merge ... ok
test reverse_lookup::tests::test_reverse_lookup ... ok
test plugins::io::tests::test_plugin_metas ... 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.62s

     Running unittests src/lib.rs (abc-ci-builds/build-chronik-plugins/cargo/build/debug/deps/chronik_http-a6e83e97563d5f6f)

running 2 tests
test error::tests::test_report_error ... ok
test protobuf::tests::test_protobuf ... ok

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

     Running unittests src/lib.rs (abc-ci-builds/build-chronik-plugins/cargo/build/debug/deps/chronik_indexer-49736bf92fe6acc5)

running 8 tests
test merkle::tests::test_calc_branch_len ... ok
test merkle::tests::test_calc_branch_len_0_panics - should panic ... ok
test merkle::tests::test_branches ... ok
test merkle::tests::test_cache_levels ... ok
test merkle::tests::test_roots ... ok
test indexer::tests::test_plugin_versions ... ok
test indexer::tests::test_indexer ... FAILED
test indexer::tests::test_schema_version ... ok

failures:

---- indexer::tests::test_indexer stdout ----
Opening Chronik at /tmp/chronik-indexer--indexer.XpLTj9pLozUo/regtest/indexes/chronik

Chronik has version 12, initialized DB with that version

Warning: Wiping existing token index, since -chroniktokenindex=0

You will need to -reindex/-chronikreindex to restore

thread 'indexer::tests::test_indexer' panicked at chronik/chronik-indexer/src/indexer.rs:730:40:
index out of bounds: the len is 0 but the index is 0


failures:
    indexer::tests::test_indexer

test result: FAILED. 7 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.34s

error: test failed, to rerun pass `-p chronik-indexer --lib`
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
Fabien planned changes to this revision.Sep 24 2024, 09:39
tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
chronik/chronik-http/src/ws.rs
349–351 ↗(On Diff #49791)
chronik/chronik-indexer/src/indexer.rs
730 ↗(On Diff #49791)
794 ↗(On Diff #49791)
chronik/chronik-indexer/src/subs.rs
33–35 ↗(On Diff #49791)

better to always put it

might make sense to split it out of this diff as it would touch a few tests

chronik/chronik-proto/proto/chronik.proto
527–529 ↗(On Diff #49791)
530–535 ↗(On Diff #49791)

Better to move this into its own message

message CoinbaseData {
    ... that stuff
}

this also makes the nullability much clearer (it's automatically Option<CoinbaseData> in the generated MsgBlock)

Fabien retitled this revision from [chronik] Add more data to disconnected and invalidated blocks ws to [chronik] Add more data to the blocks ws message.Sep 24 2024, 10:58
Fabien edited the summary of this revision. (Show Details)

One nit

chronik/chronik-proto/proto/chronik.proto
537 ↗(On Diff #49793)
This revision is now accepted and ready to land.Sep 24 2024, 23:12