Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Side-by-side support for Tendermint 0.34 and 0.37 #1193

Merged
merged 88 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
d37f063
proto-compiler: Improve error reporting
mzabaluev Sep 5, 2022
ce68dbd
Generate proto from tendermint 0.37.0-alpha.1
mzabaluev Sep 5, 2022
95b962a
proto: sort includes in generated tendermint.rs
mzabaluev Sep 6, 2022
c6807d2
proto: generate structs for 0.34 and 0.37
mzabaluev Sep 8, 2022
df05a47
tendermint: Remove Evidence::ConflictingHeaders
mzabaluev Oct 19, 2022
eb160fb
Add serializers::allow_null
mzabaluev Oct 20, 2022
8e04a06
Adapt domain types to v0.37 and add multi-version conversions.
mzabaluev Sep 27, 2022
d33945a
Multi-version protobuf support for request types
mzabaluev Oct 21, 2022
7414aa9
Add ABCI response types for PrepareProposal, ProcessProposal
mzabaluev Oct 21, 2022
30408ed
Multi-version protobuf conversions for response types
mzabaluev Oct 24, 2022
df28559
Fix conversion from account::Id to Bytes
mzabaluev Oct 24, 2022
ca50ce4
Fix compiler warnings
mzabaluev Oct 24, 2022
3277ac3
light-client: Restore Supervisor::report_evidence
mzabaluev Oct 25, 2022
47e285b
Restore serialization of Block and Evidence
mzabaluev Oct 25, 2022
53a546c
Fix clippy lints
mzabaluev Oct 27, 2022
9b7089c
proto-compiler: Improve copying of generated files
mzabaluev Oct 27, 2022
f40b6f4
proto: Regenerate v0_34 with v0.34.22
mzabaluev Oct 27, 2022
276bc6d
Add domain type for RemoteSignerError
mzabaluev Nov 9, 2022
18f51e4
Define more multi-protocol conversions
mzabaluev Nov 9, 2022
b18264e
p2p: version-qualify dependencies on protobuf
mzabaluev Nov 14, 2022
d1a76a9
Make clippy happy
mzabaluev Nov 14, 2022
d397090
Derive Eq where clippy suggests
mzabaluev Nov 16, 2022
4796bc4
tendermint: version-specific Request and Response
mzabaluev Nov 21, 2022
9730636
Remove last version aliases of Request, Response
mzabaluev Nov 28, 2022
1aa5fee
Merge branch 'main' into mikhail/multi-tc-version-support
mzabaluev Dec 18, 2022
d7ee353
Re-generate protos with prost-build 0.11.4
mzabaluev Dec 18, 2022
0bea5cf
rpc: add endpoints header and header_by_hash
mzabaluev Dec 19, 2022
d7e7100
rpc: Separate Client traits for v0.34 and v0.37
mzabaluev Dec 19, 2022
6a24461
rpc: feature-gate the Client traits
mzabaluev Dec 19, 2022
a00a69d
xla/multi-tc-versionsupport/fix (#1254)
xla Dec 24, 2022
14b3080
Merge branch 'main' into mikhail/multi-tc-version-support
mzabaluev Jan 10, 2023
08702c5
tendermint: post-merge fix
mzabaluev Jan 10, 2023
011dc7b
Add missing ConsensusRequest and ConsensusResponse mappings.
aakoshh Jan 12, 2023
e6fdbcd
Merge branch 'mikhail/multi-tc-version-support' of github.com:aakoshh…
mzabaluev Jan 16, 2023
1f782ea
rpc: clean up change noise
mzabaluev Jan 16, 2023
c2f06e3
Changelog entries for #1193
mzabaluev Jan 16, 2023
c2fa95a
Revert "rpc: clean up change noise"
mzabaluev Jan 16, 2023
620aa99
abci: change serialization to unsigned varint
mzabaluev Jan 18, 2023
483be77
abci: changelog notice about varint encoding
mzabaluev Jan 18, 2023
0af8aba
rpc: multi-version support through generics
mzabaluev Jan 30, 2023
0695093
Merge branch 'main' into mikhail/multi-tc-version-support
mzabaluev Jan 31, 2023
91b984d
rpc: remove generic default from request::Wrapper
mzabaluev Jan 31, 2023
6054e3e
Implement both Client dialect traits for websocket
mzabaluev Feb 1, 2023
ab16785
Rework Event serialization with helper types
mzabaluev Feb 1, 2023
03eda10
rpc: Refactor subscriptions to support dialects
mzabaluev Feb 1, 2023
6beba5f
rpc: fix the fixture tests
mzabaluev Feb 1, 2023
d708fd0
rpc: fix websocket tests
mzabaluev Feb 1, 2023
251ff89
Merge branch 'main' into mikhail/multi-tc-version-support
mzabaluev Feb 1, 2023
580b367
tendermint: Fix test_sign_bytes_compatibility
mzabaluev Feb 2, 2023
0305ba8
Versioned type aliases for WebSocketClient
mzabaluev Feb 2, 2023
75c212f
Fix tools build
mzabaluev Feb 2, 2023
546170e
Remove dialect parameter for SubscriptionClient
mzabaluev Feb 2, 2023
52197f0
Derive PartialEq, Eq on ProdCommitValidator
mzabaluev Feb 3, 2023
1610120
tendermint: restore Serialize impl on Event
mzabaluev Feb 6, 2023
2d864bb
rpc: de-genericized result types
mzabaluev Feb 6, 2023
504bbe7
rpc: make the client module public
mzabaluev Feb 13, 2023
e81f7bf
Remove WebSocketClient::*_with_dialect
mzabaluev Feb 14, 2023
064534b
rpc: rename DefaultDialect to LatestDialect
mzabaluev Feb 16, 2023
fca0f1a
rpc: dynamic compat mode for HttpClient
mzabaluev Feb 17, 2023
31cf889
rpc: eliminate dialect Client traits
mzabaluev Feb 20, 2023
1c1432e
rpc: Add client::compat::discover
mzabaluev Feb 20, 2023
b587e6e
rpc: unit test for CompatMode version parsing
mzabaluev Feb 20, 2023
7691ba0
rpc: make WebSocketConfig struct more usable
mzabaluev Feb 20, 2023
3866d0e
rpc: expose CompatMode::from_version
mzabaluev Feb 20, 2023
62f6e5d
rpc: make mod client::compat private
mzabaluev Feb 20, 2023
4c55808
rpc: account for "v" prefixing Tendermint version
mzabaluev Feb 20, 2023
b526b2a
rpc: fix websocket tests
mzabaluev Feb 21, 2023
c6c5aa6
rpc: debug received events in WebSocketTransport
mzabaluev Feb 23, 2023
f0d9e6a
Quick fix for running `rpc-probe` against a Comet 0.37 node
romac Feb 23, 2023
4f8f122
Fix doc for overriding env variable in rpc-probe README
romac Feb 23, 2023
4deecf4
Merge branch 'main' into mikhail/multi-tc-version-support
mzabaluev Feb 24, 2023
ab8b54e
rpc: added kvstore test fixtures for 0.37
mzabaluev Feb 24, 2023
bacb64b
rpc: adjust some v0_37 tests to match fixtures
mzabaluev Feb 27, 2023
6946849
rpc: fudge data in subscribe_newblock_1
mzabaluev Feb 27, 2023
295ef2a
rpc: adjust kvstore_fixtures tests for v0_37
mzabaluev Feb 27, 2023
7fedc09
rpc: fixed and expanded unit tests using fixtures
mzabaluev Feb 27, 2023
7e79039
abci: more sensible default impl of ABCI++ methods
mzabaluev Feb 27, 2023
0fe73a1
abci: overflow-proof impl of prepare_proposal
mzabaluev Feb 27, 2023
9e25f3f
Update #1193 changelog for tendermint-rpc changes
mzabaluev Feb 27, 2023
74b8793
Fill out .changelog entry for #1193
mzabaluev Feb 28, 2023
f3e161e
rpc: improve CompatMode enum
mzabaluev Feb 28, 2023
84d9cad
rpc: builder API for clients
mzabaluev Mar 1, 2023
7d9572c
Update #1193 changelog about RPC client builders
mzabaluev Mar 1, 2023
679eba1
Change CompatMode::LATEST to a const fn
romac Mar 1, 2023
11c2c82
Add missing serde bounds on WebSocketClientUrl
romac Mar 1, 2023
e68643b
Add missing Display impl to WebSocketClientUrl
romac Mar 1, 2023
fe4c0ab
Change to self-consuming builder API
romac Mar 1, 2023
2d4a333
rpc: do version discovery in CLI
mzabaluev Mar 1, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- [`tendermint`] Version-specific definitions for ABCI `Request` and `Response`
enums under `v0_34::abci` and `v0_37::abci`, containing only the method variants
present in each of the respective protocol versions.
`Request` and `Response` defined under `v0_37` are re-exported under
the non-versioned `abci` module name, but the `SetOption` variant is not present
in these latest versions of the enums.
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193))
- [`tendermint-abci`] Change the frame length encoding in the ABCI wire protocol
to unsigned varint, to correspond to the changes in Tendermint Core 0.37.
No compatibility with 0.34 is provided at the moment.
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193)).
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- [`tendermint-proto`] Generate prost bindings for Tendermint 0.34 and 0.37 side by side.
The version-specific structs are placed under the `tendermint::v0_34` and
`tendermint::v0_37` module namespaces, respectively. The names under
`tendermint::v0_37` are also re-exported under `tendermint`.
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193))
- [`tendermint`] New and updated ABCI domain types for Tendermint Core v0.37
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193)).
- [`tendermint`] Protobuf conversions provided for both `v0_34` and `v0_37`
versions of the generated [`tendermint-proto`] structs, where applicable.
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193)).
- [`tendermint-rpc`] Provide separate `Client` traits for Tendermint Core 0.34
and 0.37, placed under the `v0_34::client` and `v0_37::client` modules.
The latest version is re-exported as `crate::Client`.
The websocket and HTTP client implement both traits, it's up to the
application which one to import for use.
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193))
- [`tendermint-abci`] Port ABCI application support to 0.37 Tendermint Core API.
No legacy support for 0.34 is provided at the moment.
([#1193](https://github.com/informalsystems/tendermint-rs/pull/1193)).
25 changes: 19 additions & 6 deletions abci/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ pub mod echo;
#[cfg(feature = "kvstore-app")]
pub mod kvstore;

use tendermint_proto::abci::{
use tendermint_proto::v0_37::abci::{
request::Value, response, Request, RequestApplySnapshotChunk, RequestBeginBlock,
RequestCheckTx, RequestDeliverTx, RequestEcho, RequestEndBlock, RequestInfo, RequestInitChain,
RequestLoadSnapshotChunk, RequestOfferSnapshot, RequestQuery, Response,
ResponseApplySnapshotChunk, ResponseBeginBlock, ResponseCheckTx, ResponseCommit,
ResponseDeliverTx, ResponseEcho, ResponseEndBlock, ResponseFlush, ResponseInfo,
RequestLoadSnapshotChunk, RequestOfferSnapshot, RequestPrepareProposal, RequestProcessProposal,
RequestQuery, Response, ResponseApplySnapshotChunk, ResponseBeginBlock, ResponseCheckTx,
ResponseCommit, ResponseDeliverTx, ResponseEcho, ResponseEndBlock, ResponseFlush, ResponseInfo,
ResponseInitChain, ResponseListSnapshots, ResponseLoadSnapshotChunk, ResponseOfferSnapshot,
ResponseQuery,
ResponsePrepareProposal, ResponseProcessProposal, ResponseQuery,
};

/// An ABCI application.
Expand Down Expand Up @@ -98,6 +98,14 @@ pub trait Application: Send + Clone + 'static {
) -> ResponseApplySnapshotChunk {
Default::default()
}

fn prepare_proposal(&self, _request: RequestPrepareProposal) -> ResponsePrepareProposal {
Default::default()
}

fn process_proposal(&self, _request: RequestProcessProposal) -> ResponseProcessProposal {
Default::default()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note that the defaults will probably not work (they will propose empty blocks and think reject all proposals). The spec has instructions for adaptation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right; sorry about this, tendermint-abci has not been my top priority for updating to 0.37. Will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, this whole default implementation only provides the most trivial default responses.
It's up to the application to fill the methods in where necessary.

Copy link
Contributor

@aakoshh aakoshh Jan 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree; what I'm trying to say is that by leaving it on defaults, filling in these methods will always be necessary.

I can't vouch for all the other cases, but I would expect for those methods the default values represent an acceptable behaviour, like check_tx not finding any error, or end_block not changing the power table.

But with these two new methods, the defaults are not accepted by Tendermint:

  • If we return default from prepare_proposal, that effectively will remove all transactions Tendermint wanted to propose, resulting in an empty block instead. This is accepted but breaks the examples that use broadcast_tx_commit, and the following error is logged by Tendermint: Error on broadcastTxCommit module=rpc err="timed out waiting for tx to be included in a block"
  • If then we return ProcessProposal::Unknown (which is the default, although it could be Accept) instead of ProcessProposal::Accept, we get the following error: CONSENSUS FAILURE!!! module=consensus err="ProcessProposal responded with status UNKNOWN". That is because Tendermint now considers us insane: we just asked it to propose a block we ourselves do not accept.

So, if we want to have a transition to v0.37 where users of the Application trait don't have to override unless they have something to change from the default behaviour, and they expect Tendermint to just work, then the default method implementations have a bit more work to do than usual.

(NB the specs explicitly say that TC may pass more transactions in PrepareProposal than what fits into the maximum size; otherwise the implementation would be a trivial copy).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points! Let's remove the default implementations of these methods then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the default implementations of these methods then.

This will be a breaking change for all the Application users.

Can the library crate assume these behaviours are sensible on behalf of the applications, unless overridden:

  • copy all txs unchanged in prepare_proposal;
  • return Accept in process_proposal?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aakoshh Would that work for you or would you rather leave out the default impls?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for asking @romac, my vote goes for having a default implementation that copies transactions and accepts proposals, unless overridden, like @mzabaluev said. This is so people don't have to come up with boilerplate to do this every time they implement the trait, similar to how they don't have to override check_tx unless they want to actually perform some logic.

For example I forked tower-abci to point it at this branch of tendermint-rs and had to implement this logic for the kvstore example, where it seems a bit accidental among all the other Default::default()s. After that I took inspiration from the Application trait in tendermint-rs and provided an async version which takes care of these defaults, so I think it's the sensible thing to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @aakoshh for your feedback.
The more elaborate (but still very naive) default behaviours have now been implemented in 7e79039

}

/// Provides a mechanism for the [`Server`] to execute incoming requests while
Expand Down Expand Up @@ -134,7 +142,12 @@ impl<A: Application> RequestDispatcher for A {
Value::ApplySnapshotChunk(req) => {
response::Value::ApplySnapshotChunk(self.apply_snapshot_chunk(req))
},
Value::SetOption(_) => response::Value::SetOption(Default::default()),
Value::PrepareProposal(req) => {
response::Value::PrepareProposal(self.prepare_proposal(req))
},
Value::ProcessProposal(req) => {
response::Value::ProcessProposal(self.process_proposal(req))
},
}),
}
}
Expand Down
14 changes: 7 additions & 7 deletions abci/src/application/kvstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
};

use bytes::BytesMut;
use tendermint_proto::abci::{
use tendermint_proto::v0_37::abci::{
Event, EventAttribute, RequestCheckTx, RequestDeliverTx, RequestInfo, RequestQuery,
ResponseCheckTx, ResponseCommit, ResponseDeliverTx, ResponseInfo, ResponseQuery,
};
Expand Down Expand Up @@ -199,18 +199,18 @@ impl Application for KeyValueStoreApp {
r#type: "app".to_string(),
attributes: vec![
EventAttribute {
key: "key".to_string().into_bytes().into(),
value: key.to_string().into_bytes().into(),
key: "key".to_owned(),
value: key.to_owned(),
index: true,
},
EventAttribute {
key: "index_key".to_string().into_bytes().into(),
value: "index is working".to_string().into_bytes().into(),
key: "index_key".to_owned(),
value: "index is working".to_owned(),
index: true,
},
EventAttribute {
key: "noindex_key".to_string().into_bytes().into(),
value: "index is working".to_string().into_bytes().into(),
key: "noindex_key".to_owned(),
value: "index is working".to_owned(),
index: false,
},
],
Expand Down
19 changes: 5 additions & 14 deletions abci/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

use std::net::{TcpStream, ToSocketAddrs};

use tendermint_proto::abci::{
use tendermint_proto::v0_37::abci::{
request, response, Request, RequestApplySnapshotChunk, RequestBeginBlock, RequestCheckTx,
RequestCommit, RequestDeliverTx, RequestEcho, RequestEndBlock, RequestFlush, RequestInfo,
RequestInitChain, RequestListSnapshots, RequestLoadSnapshotChunk, RequestOfferSnapshot,
RequestQuery, RequestSetOption, ResponseApplySnapshotChunk, ResponseBeginBlock,
ResponseCheckTx, ResponseCommit, ResponseDeliverTx, ResponseEcho, ResponseEndBlock,
ResponseFlush, ResponseInfo, ResponseInitChain, ResponseListSnapshots,
ResponseLoadSnapshotChunk, ResponseOfferSnapshot, ResponseQuery, ResponseSetOption,
RequestQuery, ResponseApplySnapshotChunk, ResponseBeginBlock, ResponseCheckTx, ResponseCommit,
ResponseDeliverTx, ResponseEcho, ResponseEndBlock, ResponseFlush, ResponseInfo,
ResponseInitChain, ResponseListSnapshots, ResponseLoadSnapshotChunk, ResponseOfferSnapshot,
ResponseQuery,
};

use crate::{codec::ClientCodec, Error};
Expand Down Expand Up @@ -113,15 +113,6 @@ impl Client {
perform!(self, Commit, RequestCommit {})
}

/// Request that the application set an option to a particular value.
///
/// This request lacks specification and should not be used.
/// It will be removed in Tendermint Core v0.37.
#[deprecated(note = "The set_option ABCI method will be removed in Tendermint Core v0.37")]
pub fn set_option(&mut self, req: RequestSetOption) -> Result<ResponseSetOption, Error> {
perform!(self, SetOption, req)
}

/// Used during state sync to discover available snapshots on peers.
pub fn list_snapshots(&mut self) -> Result<ResponseListSnapshots, Error> {
perform!(self, ListSnapshots, RequestListSnapshots {})
Expand Down
19 changes: 4 additions & 15 deletions abci/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{

use bytes::{Buf, BufMut, BytesMut};
use prost::Message;
use tendermint_proto::abci::{Request, Response};
use tendermint_proto::v0_37::abci::{Request, Response};

use crate::error::Error;

Expand Down Expand Up @@ -130,7 +130,7 @@ where
message.encode(&mut buf).map_err(Error::encode)?;

let buf = buf.freeze();
encode_varint(buf.len() as u64, &mut dst);
prost::encoding::encode_varint(buf.len() as u64, &mut dst);
dst.put(buf);
Ok(())
}
Expand All @@ -142,11 +142,11 @@ where
{
let src_len = src.len();
let mut tmp = src.clone().freeze();
let encoded_len = match decode_varint(&mut tmp) {
let encoded_len = match prost::encoding::decode_varint(&mut tmp) {
Ok(len) => len,
// We've potentially only received a partial length delimiter
Err(_) if src_len <= MAX_VARINT_LENGTH => return Ok(None),
Err(e) => return Err(e),
Err(e) => return Err(Error::decode(e)),
};
let remaining = tmp.remaining() as u64;
if remaining < encoded_len {
Expand All @@ -164,14 +164,3 @@ where
Ok(Some(res))
}
}

// encode_varint and decode_varint will be removed once
// https://github.com/tendermint/tendermint/issues/5783 lands in Tendermint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this landed in 0.34?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a breaking change from 0.34. It was originally supposed to be included in 0.35. I don't know if it's slated for inclusion in 0.37.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The encoding has changed in 0.37, and in this PR, tendermint-abci is converted completely to 0.37 with no compatibility support. We can revert all of this and declare tendermint-abci at end of life if that's better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also choose to commit to multi-version support here as well, but this will require more work.

pub fn encode_varint<B: BufMut>(val: u64, mut buf: &mut B) {
prost::encoding::encode_varint(val << 1, &mut buf);
}

pub fn decode_varint<B: Buf>(mut buf: &mut B) -> Result<u64, Error> {
let len = prost::encoding::decode_varint(&mut buf).map_err(Error::decode)?;
Ok(len >> 1)
}
2 changes: 1 addition & 1 deletion abci/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! tendermint-abci errors

use flex_error::{define_error, DisplayError};
use tendermint_proto::abci::response::Value;
use tendermint_proto::v0_37::abci::response::Value;

define_error! {
Error {
Expand Down
2 changes: 1 addition & 1 deletion abci/tests/echo_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#[cfg(all(feature = "client", feature = "echo-app"))]
mod echo_app_integration {
use tendermint_abci::{ClientBuilder, EchoApp, ServerBuilder};
use tendermint_proto::abci::RequestEcho;
use tendermint_proto::v0_37::abci::RequestEcho;

#[test]
fn echo() {
Expand Down
2 changes: 1 addition & 1 deletion abci/tests/kvstore_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod kvstore_app_integration {
use std::thread;

use tendermint_abci::{ClientBuilder, KeyValueStoreApp, ServerBuilder};
use tendermint_proto::abci::{RequestDeliverTx, RequestEcho, RequestQuery};
use tendermint_proto::v0_37::abci::{RequestDeliverTx, RequestEcho, RequestQuery};

#[test]
fn happy_path() {
Expand Down
2 changes: 1 addition & 1 deletion light-client-verifier/src/operations/commit_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub trait CommitValidator: Send + Sync {
}

/// Production-ready implementation of a commit validator.
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
pub struct ProdCommitValidator;

impl CommitValidator for ProdCommitValidator {}
6 changes: 6 additions & 0 deletions light-client-verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ mod tests {
Verdict, Verifier,
};

#[cfg(feature = "rust-crypto")]
#[derive(Clone, Debug, PartialEq, Eq)]
struct ProdVerifierSupportsCommonDerivedTraits {
verifier: ProdVerifier,
}

#[test]
fn test_verification_failure_on_chain_id_mismatch() {
let now = Time::now();
Expand Down
14 changes: 5 additions & 9 deletions light-client/src/supervisor.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Supervisor and Handle implementation.

use crossbeam_channel as channel;
use tendermint::evidence::{ConflictingHeadersEvidence, Evidence};
use tendermint::evidence::Evidence;

use crate::{
errors::Error,
Expand Down Expand Up @@ -284,19 +284,15 @@ impl Supervisor {
}

/// Report the given evidence of a fork.
// TODO: rework to supply LightClientAttackEvidence data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In progress in my branch romac/1219-light-client-detect-attack

fn report_evidence(
&mut self,
provider: PeerId,
primary: &LightBlock,
witness: &LightBlock,
_primary: &LightBlock,
_witness: &LightBlock,
) -> Result<(), Error> {
let evidence = ConflictingHeadersEvidence::new(
primary.signed_header.clone(),
witness.signed_header.clone(),
);

self.evidence_reporter
.report(Evidence::ConflictingHeaders(Box::new(evidence)), provider)
.report(Evidence::LightClientAttackEvidence, provider)
.map_err(Error::io)?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/secret_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use chacha20poly1305::{
use merlin::Transcript;
use rand_core::OsRng;
use subtle::ConstantTimeEq;
use tendermint_proto as proto;
use tendermint_proto::v0_37 as proto;
use tendermint_std_ext::TryClone;
use x25519_dalek::{EphemeralSecret, PublicKey as EphemeralPublic};

Expand Down
4 changes: 2 additions & 2 deletions p2p/src/secret_connection/amino_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use core::convert::TryFrom;
use prost_derive::Message;
use tendermint_proto as proto;
use tendermint_proto::v0_37 as proto;

use crate::error::Error;

Expand Down Expand Up @@ -36,7 +36,7 @@ impl AuthSigMessage {
}
}

impl TryFrom<AuthSigMessage> for tendermint_proto::p2p::AuthSigMessage {
impl TryFrom<AuthSigMessage> for proto::p2p::AuthSigMessage {
type Error = Error;

fn try_from(amino_msg: AuthSigMessage) -> Result<Self, Error> {
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/secret_connection/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::convert::TryInto;

use prost::Message as _;
use tendermint_proto as proto;
use tendermint_proto::v0_37 as proto;
use x25519_dalek::PublicKey as EphemeralPublic;

#[cfg(feature = "amino")]
Expand Down
Loading