Skip to content

Commit 3f9895e

Browse files
authored
Merge branch 'main' into sean/client-update-misbehaviour
2 parents 790553e + caee889 commit 3f9895e

File tree

49 files changed

+562
-526
lines changed

Some content is hidden

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

49 files changed

+562
-526
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- Merge client update time and height modification method pairs into
2+
one, that is replace
3+
a) client_update_{time,height} by update_meta,
4+
b) store_update_{time,height} by store_update_meta and
5+
c) delete_update_{time,height} by delete_update_meta.
6+
([\#972](https://github.com/cosmos/ibc-rs/pull/972))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [ibc-core-host] Add remaining storage paths.
2+
([\#1065](https://github.com/cosmos/ibc-rs/issues/1065))

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
name: Bug Report
2+
name: Bug Report
33
about: Create a report to help us squash bugs!
44

55
---
66

7-
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
8-
v ✰ Thanks for opening an issue! ✰
7+
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
8+
v ✰ Thanks for opening an issue! ✰
99
v Before smashing the submit button please review the template.
10-
v Please also ensure that this is not a duplicate issue :)
10+
v Please also ensure that this is not a duplicate issue :)
1111
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
1212

1313
## Bug Summary

.github/ISSUE_TEMPLATE/feature-request.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ about: Create a proposal to request a feature!
44

55
---
66

7-
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
8-
v ✰ Thanks for opening an issue! ✰
7+
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
8+
v ✰ Thanks for opening an issue! ✰
99
v Before smashing the submit button please review the template.
10-
v Word of caution: poorly thought-out proposals may be rejected
11-
v without deliberation
10+
v Word of caution: poorly thought-out proposals may be rejected
11+
v without deliberation
1212
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
1313

1414
## Feature Summary

.github/ISSUE_TEMPLATE/process-improvement.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ about: Create a proposal to suggest an improvement for `ibc-rs` operations!
55
---
66

77
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
8-
v ✰ Thanks for opening an issue! ✰
8+
v ✰ Thanks for opening an issue! ✰
99
v Before smashing the submit button please review the template.
1010
v Please also ensure that this is not a duplicate issue :)
1111
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
1212

1313
## Improvement Summary
1414

15-
<!-- Short description of the proposed improvement about the projects' processes -->
15+
<!-- Short description of the proposed improvement of the projects' processes -->
1616

1717
## Proposal
1818

19-
<!-- Describe your proposal for how some process of `ibc-rs` should be improved -->
19+
<!-- Describe your proposal for how some processes of `ibc-rs` should be improved -->
2020
<!-- What would be the benefits if we adopted the proposal?
2121
Are there any disadvantages? -->

.github/workflows/audit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Security Audit
22
on:
33
schedule:
4-
- cron: '0 0 * * *'
4+
- cron: "0 0 * * *"
55

66
jobs:
77
security_audit:

.github/workflows/code-quality.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Code Quality Checks
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
code-quality:
7+
runs-on: ubuntu-latest
8+
env:
9+
RIPGREP_VERSION: 14.1.0
10+
FD_VERSION: 9.0.0
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Whitestapace lints
16+
run: bash ci/code-quality/whitespace-lints.sh
17+
18+
- name: Spell Check with Typos
19+
uses: crate-ci/typos@master
20+
with:
21+
config: ./.github/typos.toml

.github/workflows/cw-check.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
tags:
99
- v[0-9]+.*
1010
branches:
11-
- 'release/*'
11+
- "release/*"
1212
- main
1313
paths:
1414
- .github/workflows/cw-check.yml
@@ -31,9 +31,7 @@ jobs:
3131
- uses: actions/checkout@v4
3232
- uses: DeterminateSystems/nix-installer-action@main
3333
- uses: DeterminateSystems/magic-nix-cache-action@main
34-
with:
35-
is_ci : true
3634
- name: Run cw-check
3735
run: |
3836
cd ci/cw-check
39-
nix-shell --run "cw-check"
37+
nix-shell --run "cw-check"

.github/workflows/markdown-link-check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check Markdown links
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
66

77
workflow_dispatch:
88

@@ -14,6 +14,6 @@ jobs:
1414
- name: markdown-link-check
1515
uses: gaurav-nelson/[email protected]
1616
with:
17-
config-file: '.github/markdown-link-check.json'
18-
use-quiet-mode: 'yes'
19-
use-verbose-mode: 'yes'
17+
config-file: ".github/markdown-link-check.json"
18+
use-quiet-mode: "yes"
19+
use-verbose-mode: "yes"

.github/workflows/release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Attempts to perform a release when a particular tag is pushed. This job uses
2-
# the `cargo release` command and assumes that the `CRATES_TOKEN`secret has
3-
# been set and contains an API token with which we can publish our crates to
1+
# Attempts to perform a release when a particular tag is pushed. This job uses
2+
# the `cargo release` command and assumes that the `CRATES_TOKEN`secret has
3+
# been set and contains an API token with which we can publish our crates to
44
# crates.io.
55
#
66
# The `ibc-derive` publishing process is managed manually since it's not
@@ -51,7 +51,7 @@ jobs:
5151
run: yes | cargo release --workspace --no-push --no-tag --exclude ibc-derive --allow-branch HEAD --execute
5252
env:
5353
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
54-
54+
5555
gh-release:
5656
if: github.ref_type == 'tag'
5757
name: Create GitHub release

.github/workflows/rust.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
- ibc-query/**
3030
- ibc-testkit/**
3131
- ibc-derive/**
32-
32+
3333
env:
3434
CARGO_INCREMENTAL: 0
3535
CARGO_PROFILE_DEV_DEBUG: 1
@@ -42,10 +42,10 @@ jobs:
4242
cleanup-runs:
4343
runs-on: ubuntu-latest
4444
steps:
45-
- uses: rokroskar/workflow-run-cleanup-action@master
46-
env:
47-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
48-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
45+
- uses: rokroskar/workflow-run-cleanup-action@master
46+
env:
47+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
48+
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
4949

5050
check-features:
5151
name: Check features
@@ -120,7 +120,7 @@ jobs:
120120
with:
121121
command: doc
122122
args: --all-features --release
123-
123+
124124
doc_no_default_features:
125125
runs-on: ubuntu-latest
126126
steps:

.github/workflows/typos.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

ci/code-quality/whitespace-lints.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# use ggrep for macOS, and grep for Linux
5+
case "$OSTYPE" in
6+
darwin*) GREP="ggrep" ;;
7+
linux-gnu*) GREP="grep" ;;
8+
*) echo "Unknown OS: $OSTYPE" && exit 1 ;;
9+
esac
10+
11+
check_binary() {
12+
# exactly one argument is passed
13+
if [ $# -ne 1 ] || [ "$1" = "" ]; then
14+
echo "Usage: check_binary <binary>"
15+
exit 1
16+
fi
17+
18+
if ! (type "$1" >/dev/null 2>&1); then
19+
echo "$1 is not present"
20+
exit 1
21+
fi
22+
}
23+
24+
check_binary "$GREP"
25+
check_binary find
26+
27+
check_code_quality() {
28+
# exactly three arguments are passed
29+
if [ $# -ne 3 ] || [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]; then
30+
echo "Usage: check_code_quality <option> <pattern> <message>"
31+
exit 1
32+
fi
33+
34+
if find . -type f -name "*.toml" -o -name "*.rs" \
35+
-not -path '*/.*' -not -path '*/target/*' \
36+
-exec "$GREP" "$1" "$2" {} \; | "$GREP" '.*'; then
37+
echo "$3"
38+
return 1
39+
else
40+
return 0
41+
fi
42+
}
43+
44+
exit_code=0
45+
46+
check_code_quality -nHIP "\s+$" "found: trailing whitespaces" || exit_code=1
47+
check_code_quality -nHIP $"\t" "found: tabs" || exit_code=1
48+
check_code_quality -zLIP ".*\n\Z" "found: no newline at EOF" || exit_code=1
49+
50+
if [ "$exit_code" -eq 0 ]; then
51+
echo "All code quality checks passed successfully."
52+
fi
53+
54+
exit "$exit_code"

ci/cw-check/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ debug-assertions = false
2222
opt-level = "s"
2323
overflow-checks = true
2424
panic = "abort"
25-
rpath = false
25+
rpath = false

docs/architecture/adr-005-handlers-redesign.md

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ function updateClient(
4040

4141
clientState.VerifyClientMessage(clientMessage)
4242
// Validation END
43-
43+
4444
// Execution START
4545
foundMisbehaviour := clientState.CheckForMisbehaviour(clientMessage)
4646
if foundMisbehaviour {
4747
clientState.UpdateStateOnMisbehaviour(clientMessage)
4848
}
49-
else {
50-
clientState.UpdateState(clientMessage)
49+
else {
50+
clientState.UpdateState(clientMessage)
5151
}
5252
// Execution END
5353
}
@@ -99,13 +99,13 @@ pub trait Host {
9999
/// An error type that can represent all host errors.
100100
type Error;
101101

102-
/// The Host's key-value store that must provide access to IBC paths.
102+
/// The Host's key-value store that must provide access to IBC paths.
103103
type KvStore: IbcStore<Self::Error>;
104104

105105
/// An event logging facility.
106106
type EventLogger: EventLogger<Event=Event<DefaultIbcTypes>>;
107107

108-
/// Methods to access the store (ro & rw).
108+
/// Methods to access the store (ro & rw).
109109
fn store(&self) -> &Self::KvStore;
110110
fn store_mut(&mut self) -> &mut Self::KvStore;
111111

@@ -373,11 +373,9 @@ trait ValidationContext {
373373
/// A hashing function for packet commitments
374374
fn hash(&self, value: Vec<u8>) -> Vec<u8>;
375375

376-
/// Returns the time when the client state for the given [`ClientId`] was updated with a header for the given [`Height`]
377-
fn client_update_time(&self, client_id: &ClientId, height: Height) -> Result<Timestamp, Error>;
378-
379-
/// Returns the height when the client state for the given [`ClientId`] was updated with a header for the given [`Height`]
380-
fn client_update_height(&self, client_id: &ClientId, height: Height) -> Result<Height, Error>;
376+
/// Returns the time and height when the client state for the
377+
/// given [`ClientId`] was updated with a header for the given [`Height`]
378+
fn update_meta(&self, client_id: &ClientId, height: Height) -> Result<(Timestamp, Height), Error>;
381379

382380
/// Returns a counter on the number of channel ids that have been created thus far.
383381
/// The value of this counter should increase only via method
@@ -427,22 +425,14 @@ trait ExecutionContext {
427425
fn increase_client_counter(&mut self);
428426

429427
/// Called upon successful client update.
430-
/// Implementations are expected to use this to record the specified time as the time at which
431-
/// this update (or header) was processed.
432-
fn store_update_time(
433-
&mut self,
434-
client_id: ClientId,
435-
height: Height,
436-
timestamp: Timestamp,
437-
) -> Result<(), Error>;
438-
439-
/// Called upon successful client update.
440-
/// Implementations are expected to use this to record the specified height as the height at
441-
/// at which this update (or header) was processed.
442-
fn store_update_height(
428+
///
429+
/// Implementations are expected to use this to record the specified time
430+
/// and height as the time at which this update (or header) was processed.
431+
fn store_update_meta(
443432
&mut self,
444433
client_id: ClientId,
445434
height: Height,
435+
host_timestamp: Timestamp,
446436
host_height: Height,
447437
) -> Result<(), Error>;
448438

@@ -550,16 +540,11 @@ pub trait Host {
550540

551541
/// Methods currently in `ClientKeeper`
552542
fn increase_client_counter(&mut self);
553-
fn store_update_time(
554-
&mut self,
555-
client_id: ClientId,
556-
height: Height,
557-
timestamp: Timestamp,
558-
) -> Result<(), Error>;
559-
fn store_update_height(
543+
fn store_update_meta(
560544
&mut self,
561545
client_id: ClientId,
562546
height: Height,
547+
host_timestamp: Timestamp,
563548
host_height: Height,
564549
) -> Result<(), Error>;
565550

@@ -574,8 +559,7 @@ pub trait Host {
574559
/// Methods currently in `ChannelReader`
575560
fn connection_channels(&self, cid: &ConnectionId) -> Result<Vec<(PortId, ChannelId)>, Error>;
576561
fn hash(&self, value: Vec<u8>) -> Vec<u8>;
577-
fn client_update_time(&self, client_id: &ClientId, height: Height) -> Result<Timestamp, Error>;
578-
fn client_update_height(&self, client_id: &ClientId, height: Height) -> Result<Height, Error>;
562+
fn update_meta(&self, client_id: &ClientId, height: Height) -> Result<(Timestamp, Height), Error>;
579563
fn channel_counter(&self) -> Result<u64, Error>;
580564
fn max_expected_time_per_block(&self) -> Duration;
581565
fn block_delay(&self, delay_period_time: Duration) -> u64;
@@ -626,7 +610,7 @@ pub trait StoreSerde {
626610
/// Serialize to canonical binary representation
627611
fn serialize(self) -> Vec<u8>;
628612

629-
/// Deserialize from bytes
613+
/// Deserialize from bytes
630614
fn deserialize(value: &[u8]) -> Self;
631615
}
632616

ibc-apps/ics20-transfer/types/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = { workspace = true }
99
keywords = ["blockchain", "cosmos", "ibc", "transfer", "ics20"]
1010
readme = "./../../README.md"
1111
description = """
12-
Maintained by `ibc-rs`, encapsulates essential ICS-20 Fungible Token Transfer data structures and
12+
Maintained by `ibc-rs`, encapsulates essential ICS-20 Fungible Token Transfer data structures and
1313
domain types, as specified in the Inter-Blockchain Communication (IBC) protocol. Designed for universal
1414
applicability to facilitate development and integration across diverse IBC-enabled projects.
1515
"""
@@ -58,7 +58,7 @@ serde = [
5858
schema = [
5959
"dep:schemars",
6060
"ibc-core/schema",
61-
"ibc-proto/json-schema",
61+
"ibc-proto/json-schema",
6262
"serde",
6363
"std"
6464
]

0 commit comments

Comments
 (0)