Skip to content

Commit

Permalink
Fix evidence submission by using fix in custom branch tendermint-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Sep 14, 2023
1 parent 5c7e87a commit d1be35a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 29 deletions.
24 changes: 8 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ overflow-checks = true

[patch.crates-io]
ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", branch = "ccv-protos" }
# tendermint = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-light-client-verifier = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-light-client-detector = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint = { path = "../tendermint-rs/tendermint" }
# tendermint-rpc = { path = "../tendermint-rs/rpc" }
# tendermint-proto = { path = "../tendermint-rs/proto" }
# tendermint-light-client = { path = "../tendermint-rs/light-client" }
# tendermint-light-client-verifier = { path = "../tendermint-rs/light-client-verifier" }
# tendermint-light-client-detector = { path = "../tendermint-rs/light-client-detector" }
# tendermint-testgen = { path = "../tendermint-rs/testgen" }
tendermint = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
tendermint-light-client-verifier = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
tendermint-light-client-detector = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "fix-evidence" }
16 changes: 14 additions & 2 deletions ci/misbehaviour-ics/double_sign_test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash
# shellcheck disable=2086,2004

set -eux
set -eu

DEBUG=${DEBUG:-false}

if [ "$DEBUG" = true ]; then
set -x
fi

# User balance of stake tokens
USER_COINS="100000000000stake"
Expand All @@ -13,10 +19,16 @@ NODE_IP="127.0.0.1"
# Home directory
HOME_DIR="/tmp/hermes-ics-double-sign"

# Hermes debug
if [ "$DEBUG" = true ]; then
HERMES_DEBUG="--debug=rpc"
else
HERMES_DEBUG=""
fi
# Hermes config
HERMES_CONFIG="$HOME_DIR/hermes.toml"
# Hermes binary
HERMES_BIN="cargo run -q --bin hermes -- --config $HERMES_CONFIG"
HERMES_BIN="cargo run -q --bin hermes -- $HERMES_DEBUG --config $HERMES_CONFIG"

# Validator moniker
MONIKERS=("coordinator" "alice" "bob")
Expand Down
19 changes: 16 additions & 3 deletions ci/misbehaviour-ics/misbehaviour_test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash
# shellcheck disable=2086
set -eux

set -eu

DEBUG=${DEBUG:-false}

if [ "$DEBUG" = true ]; then
set -x
fi

diag() {
echo ">>
Expand All @@ -22,12 +28,19 @@ NODE_IP="127.0.0.1"
# Home directory
HOME_DIR="/tmp/hermes-ics-misbehaviour"

# Hermes debug
if [ "$DEBUG" = true ]; then
HERMES_DEBUG="--debug=rpc"
else
HERMES_DEBUG=""
fi

# Hermes config
HERMES_CONFIG="$HOME_DIR/hermes.toml"
HERMES_CONFIG_FORK="$HOME_DIR/hermes-fork.toml"
# Hermes binary
HERMES_BIN="cargo run -q --bin hermes -- --config $HERMES_CONFIG"
HERMES_BIN_FORK="cargo run -q --bin hermes -- --config $HERMES_CONFIG_FORK"
HERMES_BIN="cargo run -q --bin hermes -- $HERMES_DEBUG --config $HERMES_CONFIG"
HERMES_BIN_FORK="cargo run -q --bin hermes -- $HERMES_DEBUG --config $HERMES_CONFIG_FORK"

# Validator moniker
MONIKER="coordinator"
Expand Down
7 changes: 6 additions & 1 deletion crates/relayer/src/light_client/tendermint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,18 @@ impl super::LightClient<CosmosSdkChain> for LightClient {
challenging_block,
})) => {
warn!("misbehavior detected, reporting evidence to RPC witness node and primary chain");
debug!("evidence: {evidence:#?}");
debug!("challenging block: {challenging_block:#?}");

warn!("waiting 5 seconds before reporting evidence to RPC witness node");
std::thread::sleep(Duration::from_secs(5));

match detector::report_evidence(
self.io.rpc_client().clone(),
evidence.against_primary,
) {
Ok(hash) => warn!("evidence reported to RPC witness node with hash: {hash}"),
Err(e) => error!("failed to report evidence to RPC witness node: {}", e),
Err(e) => error!("failed to report evidence to RPC witness node: {e}"),
}

let target_block = self.fetch(update_header.height())?;
Expand Down

0 comments on commit d1be35a

Please sign in to comment.