Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c1310a6
proto: 🧶 add `tendermint-rpc` dependency
cratelyn May 22, 2024
8bbc455
proto: ⏰ add `chrono` dependency
cratelyn May 22, 2024
5805e38
proto: 🤯 add `thiserror` dependency
cratelyn May 22, 2024
b60798f
proto: ⏰ add `tendermint-proto` dependency
cratelyn May 23, 2024
34045a5
tendermint-proxy: 🧼 inherit workspace settings, tidy manifest
cratelyn May 22, 2024
bf68922
tendermint-proxy: 📕 add brief crate-level documentation
cratelyn May 22, 2024
36e6acb
tendermint-proxy: 🚰 add `tap` dependency
cratelyn May 22, 2024
3704858
tendermint-proxy: 🎈 hoist `TendermintProxy` to `lib.rs`
cratelyn May 22, 2024
b732e37
tendermint-proxy: 🔭 instrument `TendermintProxyService` methods
cratelyn May 22, 2024
0f74311
tendermint-proxy: 😬 fix comment typo
cratelyn May 22, 2024
86b9007
tendermint-proxy: ❔ decompose `TendermintProxyService::get_tx(..)` co…
cratelyn May 22, 2024
c211299
tendermint-proxy: ❔ decompose `TendermintProxyService::broadcast_tx_a…
cratelyn May 22, 2024
36f7c5a
tendermint-proxy: ❔ decompose `TendermintProxyService::broadcast_tx_s…
cratelyn May 22, 2024
c18ef1f
tendermint-proxy: ❔ decompose `TendermintProxyService::get_status(..)…
cratelyn May 22, 2024
81cc837
tendermint-proxy: ❔ decompose `TendermintProxyService::abci_query(..)…
cratelyn May 22, 2024
b0d7655
tendermint-proxy: ❔ decompose `TendermintProxyService::get_block_by_h…
cratelyn May 23, 2024
de9f6a9
tendermint-proxy: ❕ move conversions into submodule
cratelyn May 23, 2024
e0d0443
proto: 🚪 feature gate tendermint compatibility
cratelyn May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tendermint-proxy: 🎈 hoist TendermintProxy to lib.rs
there are only two files in this library. rather than reëxporting the
type in the `lib.rs`, just define it there and import it where we use
it.

this puts the important, core type provided by the library right at the
top of the reader's entrypoint.
  • Loading branch information
cratelyn committed May 23, 2024
commit 3704858f7678bd754d1b4befa54fe1b3ca25f76d
18 changes: 17 additions & 1 deletion crates/util/tendermint-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,20 @@
//! [proxy-proto]: https://buf.build/penumbra-zone/penumbra/docs/main:penumbra.util.tendermint_proxy.v1

mod tendermint_proxy;
pub use tendermint_proxy::TendermintProxy;

/// Implements service traits for Tonic gRPC services.
///
/// The fields of this struct are the configuration and data
/// necessary to the gRPC services.
#[derive(Clone, Debug)]
pub struct TendermintProxy {
/// Address of upstream Tendermint server to proxy requests to.
tendermint_url: url::Url,
}

impl TendermintProxy {
/// Returns a new [`TendermintProxy`].
pub fn new(tendermint_url: url::Url) -> Self {
Self { tendermint_url }
}
}
36 changes: 12 additions & 24 deletions crates/util/tendermint-proxy/src/tendermint_proxy.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
use crate::TendermintProxy;
use chrono::DateTime;
use penumbra_proto::{self as proto, DomainType, Message};
use penumbra_transaction::Transaction;
use proto::util::tendermint_proxy::v1::{
tendermint_proxy_service_server::TendermintProxyService, AbciQueryRequest, AbciQueryResponse,
BroadcastTxAsyncRequest, BroadcastTxAsyncResponse, BroadcastTxSyncRequest,
BroadcastTxSyncResponse, GetBlockByHeightRequest, GetBlockByHeightResponse, GetStatusRequest,
GetStatusResponse, GetTxRequest, GetTxResponse, SyncInfo, Tag, TxResult,
use penumbra_proto::{
self as proto,
util::tendermint_proxy::v1::{
tendermint_proxy_service_server::TendermintProxyService, AbciQueryRequest,
AbciQueryResponse, BroadcastTxAsyncRequest, BroadcastTxAsyncResponse,
BroadcastTxSyncRequest, BroadcastTxSyncResponse, GetBlockByHeightRequest,
GetBlockByHeightResponse, GetStatusRequest, GetStatusResponse, GetTxRequest, GetTxResponse,
SyncInfo, Tag, TxResult,
},
DomainType, Message,
};
use penumbra_transaction::Transaction;
use std::ops::Deref;
use tendermint::{abci::Code, block::Height};
use tendermint_rpc::{Client, HttpClient};
use tonic::Status;

/// Implements service traits for Tonic gRPC services.
///
/// The fields of this struct are the configuration and data
/// necessary to the gRPC services.
#[derive(Clone, Debug)]
pub struct TendermintProxy {
/// Address of upstream Tendermint server to proxy requests to.
tendermint_url: url::Url,
}

impl TendermintProxy {
/// Returns a new [`TendermintProxy`].
pub fn new(tendermint_url: url::Url) -> Self {
Self { tendermint_url }
}
}

#[tonic::async_trait]
impl TendermintProxyService for TendermintProxy {
// Note: the conversions that take place in here could be moved to
Expand Down