Page MenuHomePhabricator

[Chronik] Protobuf & HTTP error response handling
ClosedPublic

Authored by tobias_ruck on Feb 28 2023, 19:50.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC63ac8c5116e1: [Chronik] Protobuf & HTTP error response handling
Summary

Add two structs:

  1. Protobuf, an extractor and response type for specific protobuf messages.
  2. ReportError, a newtype around Report, which can be turned into an HTTP response.

Also add chronik.proto (currently containing only Error) + prost protobuf building using build.rs.

Depends on D13203.

Test Plan

cargo test

Diff Detail

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

Event Timeline

Add missing copyright notices

Add another missing copyright notice

Add rerun-if-changed directive in build.rs to rebuild proto when updated

Fabien requested changes to this revision.Mar 1 2023, 10:57

There are 2 missing test cases

chronik/chronik-http/build.rs
2 ↗(On Diff #38153)

It looks like it should rather be chronik/chronik-http/proto/chronik.proto ?

chronik/chronik-http/src/protobuf.rs
56 ↗(On Diff #38153)

This is untested

chronik/chronik-http/src/validation.rs
17 ↗(On Diff #38153)

This is untested

This revision now requires changes to proceed.Mar 1 2023, 10:57

Tail of the build log:

    Checking ryu v1.0.11
    Checking byteorder v1.4.3
    Checking form_urlencoded v1.1.0
    Checking want v0.3.0
    Checking spin v0.9.4
    Checking hash32 v0.2.1
    Checking httparse v1.8.0
    Checking bitflags v1.3.2
    Checking mime v0.3.16
    Checking http-range-header v0.3.0
    Checking httpdate v1.0.2
    Checking stable_deref_trait v1.2.0
   Compiling chronik-http v0.1.0 (/work/chronik/chronik-http)
    Checking sync_wrapper v0.1.1
    Checking matchit v0.6.0
    Checking cobs v0.2.3
    Checking bitcoinsuite-core v0.1.0 (/work/chronik/bitcoinsuite-core)
    Checking prost v0.11.8
   Compiling chronik-lib v0.1.0 (/work/chronik/chronik-lib)
    Checking http-body v0.4.5
    Checking socket2 v0.4.7
    Checking num_cpus v1.14.0
    Checking mio v0.8.5
    Checking librocksdb-sys v0.8.0+7.4.4
    Checking rocksdb v0.19.0
    Checking tokio v1.25.0
    Checking addr2line v0.17.0
    Checking chronik-util v0.1.0 (/work/chronik/chronik-util)
    Checking serde_path_to_error v0.1.8
    Checking serde_json v1.0.89
    Checking heapless v0.7.15
    Checking serde_urlencoded v0.7.1
    Checking backtrace v0.3.66
    Checking futures-executor v0.3.25
    Checking axum-core v0.3.0
    Checking futures v0.3.25
    Checking stable-eyre v0.2.2
    Checking abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
    Checking postcard v1.0.1
    Checking tower v0.4.13
    Checking hyper v0.14.23
    Checking chronik-db v0.1.0 (/work/chronik/chronik-db)
    Checking tower-http v0.3.4
    Checking chronik-indexer v0.1.0 (/work/chronik/chronik-indexer)
    Checking axum v0.6.0
    Finished dev [unoptimized + debuginfo] target(s) in 2m 08s
[6/6] cd /work && /usr/bin/cmake -E env CARGO_TARGET_DIR="/work/abc-ci-builds/build-chronik/cargo/build" CARGO_BUILD_RUSTC="/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/bin/rustc" CARGO_BUILD_RUSTDOC="/root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/bin/rustdoc" /root/.rustup/toolchains/1.67.1-x86_64-unknown-linux-gnu/bin/cargo clippy --package abc-rust-* -- -D warnings
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on build directory
    Checking memchr v2.5.0
    Checking libc v0.2.139
    Checking object v0.29.0
    Checking backtrace v0.3.66
    Checking stable-eyre v0.2.2
    Checking abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
    Finished dev [unoptimized + debuginfo] target(s) in 2m 09s
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1
This revision is now accepted and ready to land.Mar 1 2023, 12:39