Skip to content

Commit db50666

Browse files
romacancazamfirljoss17dependabot[bot]seanchen1991
authored
Add evidence command for monitoring and reporting misbehavior evidence to counterparty clients (#3456)
* evidence worker PoC for testing * Cleanup * Use ibc-proto branch with new provider message * Add `MsgSubmitIcsConsumerMisbehaviour` domain type from `anca/ics-misbehaviour-handling` branch * Report misbehavior evidence to all counterparty clients of the misbehaving chain * Cleanup * Submit CCV misbehaviour if needed * Cleanup * Check if counterparty is CCV provider * Cleanup * Add comment * Set proposer address in header2 * Prepend client updates - work in progress * Increase the timeout on CI (#3436) * Improve some messages in `config auto` (#3438) * Update Data-Requirements.md Signed-off-by: Romain Ruetschi <[email protected]> * Update Data-Requirements.md Signed-off-by: Romain Ruetschi <[email protected]> * Add CCV chain bootstrap to CI with Neutron and Gaia (#3451) * Bump serde from 1.0.164 to 1.0.166 (#3458) * Bump async-trait from 0.1.68 to 0.1.69 (#3459) * Bump erased-serde from 0.3.25 to 0.3.26 (#3460) * Document clock drift parameters in guide (#3420) * Add clock-drift.md file to guide * Add section on mis-configuring clock drift * Update guide/src/advanced/troubleshooting/clock-drift.md Co-authored-by: Anca Zamfir <[email protected]> Signed-off-by: Sean Chen <[email protected]> * Update guide/src/advanced/troubleshooting/clock-drift.md Co-authored-by: Anca Zamfir <[email protected]> Signed-off-by: Sean Chen <[email protected]> * Remove redundant section * Update guide/src/advanced/troubleshooting/clock-drift.md Co-authored-by: Anca Zamfir <[email protected]> Signed-off-by: Sean Chen <[email protected]> * Update guide/src/advanced/troubleshooting/clock-drift.md Co-authored-by: Anca Zamfir <[email protected]> Signed-off-by: Sean Chen <[email protected]> * Explain what `C` constant represents * Add reference to forward lunatic attack --------- Signed-off-by: Sean Chen <[email protected]> Co-authored-by: Anca Zamfir <[email protected]> * Bump uuid from 1.3.3 to 1.4.0 (#3461) Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.3.3 to 1.4.0. - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](uuid-rs/uuid@1.3.3...1.4.0) --- updated-dependencies: - dependency-name: uuid dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix wrong sequence number in `MsgTimeoutOnClose` (#3440) The MsgTimeoutOnClose requires sequence of dstchannel.NextRecv in ordered channels, rather than packet.Sequence. The code above resolve the sequence for ordered and unordered, just while creating msg it is ignored. Signed-off-by: Puneet <[email protected]> * Include client updates for supporting messages when assembling messages to relay from the operational data (#3468) * Include client updates for supporting messages when assembling messages to relay from the operational data * Add changelog entry * Use `max_expected_time_per_block` value for the `max_block_time` (#3467) * Use max_block_time queried from /genesis * Clean solution * Add unclog entry * Remove serde-with dependency * `config auto` now generates a config file even when it encounters an error (#3466) * Stub out code flow * Stub out code flow * Change return type of `hermes_cofig` fn * Define ConfigAutoError type * Add some printlns * Change `get_configs` return type * Change AutoCmd::run * Get it to compile * Fix false reporting of missing chain configs * Change get_data_from_handles * Get it working * Remove some debugging code * Cargo fmt * Update `get_configs` doc comment * Update gas price warning in guide * Cargo fmt * Build client update for header at common height * Add forking script * Check for misbehavior in the last 100 blocks * Add ICS misbehaviour test * Add interchain-security to flake.nix * Use cosmos.nix branch with proper version of interchain-security * Remove test script * Update guide templates * Post-merge fixes * Update deps * Use latest ICS protos * Adapt to change of `MsgSubmitIcsConsumerMisbehaviour::misbehaviour` to `Any` in upstream protos * Submit both ICS and standard misbehaviour messages to provider chains * Fix bug where update client message was dropped * Revert changes of misbehaviour field to Any * Submit consumer double voting evidence to the provider * Formatting * Fix clippy warnings * Update guide templates * fix: send evidences with non-empty infraction block header (#3578) * try to fill infraction header in double voting msg * reformat * fix nit * fmt * Formatting * Make infraction block header required * Stop after submitting double voting evidence to the provider * Force refresh of account before sending a tx * Revert refresh on every call * Remove hermes binary at root * Send ICS misbehaviour for CCV consumer chain in misbehaviour worker * Make the evidence command resilient to error, eg. because a client was already frozen * Improve logging * Go back to refreshing the account everytime * Improve CI test script * Improve logs * Add `key-name` and `check-past-blocks` arguments to `evidence` command (#3603) * Add `key-name` and `check-past-blocks` arguments to `evidence` command * Update templates * Better logs * Update nix flake * Patch check-guide tool with CCV protos * Do not refresh account everytime * Fix for zero height * Update ICS misbehaviour test to use a different wallet for the `evidence` command * Remove double sign script --------- Co-authored-by: Romain Ruetschi <[email protected]> * Fix post-merge conflict * Better light client attack misbehaviour test * Improve logs in fishy error cases * Better error messages when client state is of unexpected type * Gracefully handle unsupported client types * WIP: Add double sign test * Add test for consumer chain double signing * Gracefully handle unsupported client types in `query connnections` * Update flake lockfile * Better logs in evidence command * Rename jobs and script * Fix evidence submission (#3612) * Fix evidence submission by using fix in custom branch tendermint-rs * Check that evidence command saw the evidence in the block * Skip submitting evidence if client is already frozen or expired * Skip frozen clients * Add more delay in standard misbehaviour test * Use latest tendermint-rs * Properly compute the trusted validator set * Cleanup * Remove sleeps in double sign test * Update ibc-proto * Update ibc-proto to v0.36.0 * Do not panic when unable to find the chain * Throttle the requests made to the chain while checking past blocks * Add changelog entries * Show logs on failure * Update ibc-proto to v0.36.1 * Update `ibc-proto` to v0.38.0-pre.1 which includes the required CCV protos * Improve logs * Check for successful submission in the integration test * Fix CI script for the case where the client is already frozen * Submit the ICS misbehaviour for LCA and double signing even if client is frozen. * Fix clippy warning * Avoid sending client updates without the misbehavior * Include proposer in validator set * Only submit ICS evidence when provider has a consensus state at the common height * Update flake * WIP: Use Rust light client to report evidence * WIP: Use Go light client to detect misbehaviour * Issue error when evidence is emitted at forked height * Detect and report misbehaviour using the CometBFT light client to avoid freezing the client too early * Add test for when the client is frozen already by the relayer * Only send the ICS misbehaviour message when the provider client is already frozen * Better cache frozen status of client * Never send IBC message if client is already frozen Co-authored-by: Anca Zamfir <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> * No need to submit client update if provider chain already has common consensus state * Abort early if there are no messages to send * Update comment * Update double sign test * Skip UpdateClient message if counterparty has consensus state at common height, whether or not it is a provider chain * Improve logs a little bit * Small refactor * Check that counterparty client id matches the CCV client id on the provider * Create a dummy connection to exercise the provider detection code --------- Signed-off-by: Romain Ruetschi <[email protected]> Signed-off-by: Sean Chen <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Puneet <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> Co-authored-by: Anca Zamfir <[email protected]> Co-authored-by: Luca Joss <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sean Chen <[email protected]> Co-authored-by: Anca Zamfir <[email protected]> Co-authored-by: Puneet <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]>
1 parent 7688db7 commit db50666

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3901
-852
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- Add a new `evidence` command for monitoring the blocks emitted
2+
by a chain for the presence of a misbehaviour evidence, and
3+
report that evidence to all counteparty clients of that chain.
4+
([\#3456](https://github.com/informalsystems/hermes/pull/3456))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- When Hermes detects a misbehaviour on a chain that is CCV
2+
consumer, it will now send the misbehaviour evidence to the
3+
provider chain using the new `IcsConsumerMisbehaviour` message.
4+
([\#3219](https://github.com/informalsystems/hermes/issues/3219))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- When Hermes detects a misbehaviour from a on-chain client, eg. a light
2+
client attack or a double-sign, it will now submit the misbehaviour
3+
evidence to all counterparty clients of the misbehaving chain
4+
instead of to the counterparty client of the misbehaving client only.
5+
([\#3223](https://github.com/informalsystems/hermes/issues/3223))

.github/workflows/misbehaviour.yml

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ concurrency:
3636
cancel-in-progress: true
3737

3838
jobs:
39-
misbehaviour:
39+
light-client-attack:
4040
runs-on: ubuntu-20.04
4141
timeout-minutes: 20
4242
strategy:
@@ -91,3 +91,166 @@ jobs:
9191
run: |
9292
nix shell .#${{ matrix.chain.package }} -c bash misbehaviour_test.sh
9393
94+
ics-light-client-attack:
95+
runs-on: ubuntu-20.04
96+
timeout-minutes: 20
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
chain:
101+
- package: interchain-security
102+
account_prefix: cosmos
103+
steps:
104+
- uses: actions/checkout@v3
105+
- name: Install Nix
106+
uses: cachix/install-nix-action@v22
107+
with:
108+
extra_nix_config: |
109+
experimental-features = nix-command flakes
110+
- name: Use cachix cache
111+
uses: cachix/cachix-action@v12
112+
with:
113+
name: cosmos
114+
- name: Install sconfig
115+
uses: jaxxstorm/[email protected]
116+
with:
117+
repo: freshautomations/sconfig
118+
platform: linux
119+
arch: amd64
120+
extension-matching: disable
121+
rename-to: sconfig
122+
chmod: 0755
123+
- name: Install stoml
124+
uses: jaxxstorm/[email protected]
125+
with:
126+
repo: freshautomations/stoml
127+
platform: linux
128+
arch: amd64
129+
extension-matching: disable
130+
rename-to: stoml
131+
chmod: 0755
132+
- name: Install Rust
133+
uses: actions-rs/toolchain@v1
134+
with:
135+
toolchain: stable
136+
override: true
137+
- name: Use Rust cache
138+
uses: Swatinem/rust-cache@v1
139+
- name: Build Hermes
140+
uses: actions-rs/cargo@v1
141+
with:
142+
command: build
143+
- name: Run test
144+
working-directory: ci/misbehaviour-ics
145+
run: |
146+
nix shell .#cometbft .#${{ matrix.chain.package }} -c bash light_client_attack_test.sh
147+
148+
ics-light-client-attack-freeze:
149+
runs-on: ubuntu-20.04
150+
timeout-minutes: 20
151+
strategy:
152+
fail-fast: false
153+
matrix:
154+
chain:
155+
- package: interchain-security
156+
account_prefix: cosmos
157+
steps:
158+
- uses: actions/checkout@v3
159+
- name: Install Nix
160+
uses: cachix/install-nix-action@v22
161+
with:
162+
extra_nix_config: |
163+
experimental-features = nix-command flakes
164+
- name: Use cachix cache
165+
uses: cachix/cachix-action@v12
166+
with:
167+
name: cosmos
168+
- name: Install sconfig
169+
uses: jaxxstorm/[email protected]
170+
with:
171+
repo: freshautomations/sconfig
172+
platform: linux
173+
arch: amd64
174+
extension-matching: disable
175+
rename-to: sconfig
176+
chmod: 0755
177+
- name: Install stoml
178+
uses: jaxxstorm/[email protected]
179+
with:
180+
repo: freshautomations/stoml
181+
platform: linux
182+
arch: amd64
183+
extension-matching: disable
184+
rename-to: stoml
185+
chmod: 0755
186+
- name: Install Rust
187+
uses: actions-rs/toolchain@v1
188+
with:
189+
toolchain: stable
190+
override: true
191+
- name: Use Rust cache
192+
uses: Swatinem/rust-cache@v1
193+
- name: Build Hermes
194+
uses: actions-rs/cargo@v1
195+
with:
196+
command: build
197+
- name: Run test
198+
working-directory: ci/misbehaviour-ics
199+
run: |
200+
nix shell .#${{ matrix.chain.package }} -c bash light_client_attack_freeze_test.sh
201+
202+
203+
ics-double-sign:
204+
runs-on: ubuntu-20.04
205+
timeout-minutes: 20
206+
strategy:
207+
fail-fast: false
208+
matrix:
209+
chain:
210+
- package: interchain-security
211+
account_prefix: cosmos
212+
steps:
213+
- uses: actions/checkout@v3
214+
- name: Install Nix
215+
uses: cachix/install-nix-action@v22
216+
with:
217+
extra_nix_config: |
218+
experimental-features = nix-command flakes
219+
- name: Use cachix cache
220+
uses: cachix/cachix-action@v12
221+
with:
222+
name: cosmos
223+
- name: Install sconfig
224+
uses: jaxxstorm/[email protected]
225+
with:
226+
repo: freshautomations/sconfig
227+
platform: linux
228+
arch: amd64
229+
extension-matching: disable
230+
rename-to: sconfig
231+
chmod: 0755
232+
- name: Install stoml
233+
uses: jaxxstorm/[email protected]
234+
with:
235+
repo: freshautomations/stoml
236+
platform: linux
237+
arch: amd64
238+
extension-matching: disable
239+
rename-to: stoml
240+
chmod: 0755
241+
- name: Install Rust
242+
uses: actions-rs/toolchain@v1
243+
with:
244+
toolchain: stable
245+
override: true
246+
- name: Use Rust cache
247+
uses: Swatinem/rust-cache@v1
248+
- name: Build Hermes
249+
uses: actions-rs/cargo@v1
250+
with:
251+
command: build
252+
- name: Run test
253+
working-directory: ci/misbehaviour-ics
254+
run: |
255+
nix shell .#${{ matrix.chain.package }} -c bash double_sign_test.sh
256+

0 commit comments

Comments
 (0)