Skip to content

Commit

Permalink
Merge branch 'main' into sean/consensus-state-pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchen1991 authored Oct 19, 2023
2 parents 1bd8588 + fa07561 commit 1496c42
Show file tree
Hide file tree
Showing 20 changed files with 579 additions and 103 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add test for expired client status.
([\#538](https://github.com/cosmos/ibc-rs/issues/538))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Fix compilation issue with Wasm envs because of floats
- Use `serde-json-wasm` dependency instead of `serde-json` for no-floats support
- Add CI test to include CosmWasm compilation check
([/#850](https://github.com/cosmos/ibc-rs/issues/850))
([\#850](https://github.com/cosmos/ibc-rs/issues/850))
9 changes: 9 additions & 0 deletions .changelog/unreleased/improvements/926_mocks_implies_std.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- Change `mocks` feature to imply `std` since it requires
Timestamp::now to work.
([\#926](https://github.com/cosmos/ibc-rs/pull/926))

<!--
Add your entry's details here (in Markdown format).
If you don't change this message, or if this file is empty, the entry will
not be created. -->
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/929-remove-anyschema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Remove `AnySchema` as `JsonSchema` derive on `Any` now accessible through
`ibc-proto-rs` ([#929](https://github.com/cosmos/ibc-rs/issues/929))
2 changes: 0 additions & 2 deletions .github/workflows/cw-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
paths:
- .github/workflows/cw-check.yml
- ci/cw-check/**

on:
push:
tags:
- v[0-9]+.*
Expand Down
17 changes: 8 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@ We welcome bug reports, feature requests, and other contributions to our project

3. **Provide detailed information**: In the issue description, clearly state the purpose of the issue and follow the guidelines of the issue template

4. A maintainer will take care of assigning the appropriate labels to your issue.
Note: A maintainer will take care of assigning the appropriate labels to your issue with the following convention:

We use the following convention for issue label names:
- (WHY) The purpose or objective of this issue with Objective-level "O" labels like `O: security`, `O: new-feature`, etc.
- (WHICH) The part of the system this issue relates to using:
- External-level "E" labels if the issue fall outside the current scope of the system and is related to external dependencies or projects like `E: non-cosmos`, `E: no-std` etc.
- or "Internal-level "I" labels for anything related to the current scope of the product like `I: errors`, `I: documentation`, etc.
- (HOW) If any administrative considerations should be taken into account use Administrative-level "A" labels like `A: help-wanted`, `A: critical`, etc.
- Objective-level (WHY): conveys the overarching purpose or objective of the issue by labels starting with "O" like `O: security`, `O: new-feature`, etc.

- Scope-level (WHICH): specifies the part of the system that the issue pertains to and labels starting with "S" like `S: non-cosmos`, `S: no-std`, etc.

- Admin-level (HOW) includes relevant administrative considerations on how best handling the issue and labels starting with "A" like `A: help-wanted`, `A: critical`, etc.

## Pull Requests

Expand Down Expand Up @@ -256,7 +255,7 @@ Our release process is as follows:
2. Publish `ibc-derive` with `cargo publish -p ibc-derive`
4. Bump the versions of relevant crates (`ibc` and `ibc-query`) in their
`Cargo.toml` to the new version, and push these changes to the release PR.
+ If you released a new version of `ibc-derive` in step 3, make sure to update that dependency.
- If you released a new version of `ibc-derive` in step 3, make sure to update that dependency.
5. Run `cargo doc -p ibc --all-features --open` locally to double-check that all the
documentation compiles and seems up-to-date and coherent. Fix any potential
issues here and push them to the release PR.
Expand All @@ -268,7 +267,7 @@ Our release process is as follows:
10. Create a signed tag and push it to GitHub: `git tag -s -a vX.Y.Z`. In the
tag message, write the version and the link to the corresponding section of
the changelog.
+ Push the tag with `git push --tags`
- Push the tag with `git push --tags`
11. Once the tag is pushed, create a GitHub release and append
`[📖CHANGELOG](https://github.com/cosmos/ibc-rs/blob/main/CHANGELOG.md#vXYZ)`
to the release description.
Expand Down
12 changes: 6 additions & 6 deletions crates/ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ default = ["std"]
std = [
"ibc-proto/std",
"ics23/std",
"serde/std",
"serde/std",
"tracing/std",
"prost/std",
"bytes/std",
Expand All @@ -42,15 +42,15 @@ borsh = ["dep:borsh", "ibc-proto/borsh"]
serde = ["dep:serde", "dep:serde_derive", "serde_json", "ibc-proto/serde", "ics23/serde"]

# CosmWasm message API generator compatible, should not be inside on chain code
schema = ["dep:schemars", "serde", "std"]
schema = ["dep:schemars", "ibc-proto/json-schema", "serde", "std"]

# This feature grants access to development-time mocking libraries, such as `MockContext` or `MockHeader`.
# Depends on the `testgen` suite for generating Tendermint light blocks.
mocks = ["tendermint-testgen", "tendermint/clock", "parking_lot"]
mocks = ["tendermint-testgen", "parking_lot", "typed-builder", "std"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.37.1", default-features = false, features = ["serde"] }
ibc-proto = { version = "0.37.1", default-features = false }
ics23 = { version = "0.11", default-features = false, features = ["host-functions"] }
time = { version = ">=0.3.0, <0.3.30", default-features = false }
serde_derive = { version = "1.0.104", default-features = false, optional = true }
Expand All @@ -73,6 +73,7 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
## for borsh encode or decode
borsh = {version = "0.10", default-features = false, optional = true }
parking_lot = { version = "0.12.1", default-features = false, optional = true }
typed-builder = { version = "0.17.0", optional = true }

ibc-derive = { version ="0.3.0", path = "../ibc-derive" }

Expand Down Expand Up @@ -102,5 +103,4 @@ rstest = "0.18.1"
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
test-log = { version = "0.2.10", features = ["trace"] }
tendermint-rpc = { version = "0.34", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.34" } # Needed for generating (synthetic) light blocks.
parking_lot = { version = "0.12.1" }
ibc = { path = ".", features = ["mocks"] }
41 changes: 40 additions & 1 deletion crates/ibc/src/clients/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,8 @@ pub mod test_util {
use tendermint::block::Header;

use crate::clients::ics07_tendermint::client_state::{AllowUpdate, ClientState};
use crate::clients::ics07_tendermint::error::Error;
use crate::clients::ics07_tendermint::error::{Error as ClientError, Error};
use crate::clients::ics07_tendermint::trust_threshold::TrustThreshold;
use crate::core::ics02_client::height::Height;
use crate::core::ics23_commitment::specs::ProofSpecs;
use crate::core::ics24_host::identifier::ChainId;
Expand Down Expand Up @@ -1188,4 +1189,42 @@ pub mod test_util {
allow_update_after_misbehaviour: false,
}
}

#[derive(typed_builder::TypedBuilder, Debug)]
pub struct ClientStateConfig {
pub chain_id: ChainId,
#[builder(default)]
pub trust_level: TrustThreshold,
#[builder(default = Duration::from_secs(64000))]
pub trusting_period: Duration,
#[builder(default = Duration::from_secs(128000))]
pub unbonding_period: Duration,
#[builder(default = Duration::from_millis(3000))]
max_clock_drift: Duration,
pub latest_height: Height,
#[builder(default)]
pub proof_specs: ProofSpecs,
#[builder(default)]
pub upgrade_path: Vec<String>,
#[builder(default = AllowUpdate { after_expiry: false, after_misbehaviour: false })]
allow_update: AllowUpdate,
}

impl TryFrom<ClientStateConfig> for ClientState {
type Error = ClientError;

fn try_from(config: ClientStateConfig) -> Result<Self, Self::Error> {
ClientState::new(
config.chain_id,
config.trust_level,
config.trusting_period,
config.unbonding_period,
config.max_clock_drift,
config.latest_height,
config.proof_specs,
config.upgrade_path,
config.allow_update,
)
}
}
}
3 changes: 2 additions & 1 deletion crates/ibc/src/clients/ics07_tendermint/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,14 @@ pub mod test_util {
fn from(light_block: SyntheticTmBlock) -> Self {
let SyntheticTmBlock {
trusted_height,
trusted_next_validators,
light_block,
} = light_block;
Self {
signed_header: light_block.signed_header,
validator_set: light_block.validators,
trusted_height,
trusted_next_validator_set: light_block.next_validators,
trusted_next_validator_set: trusted_next_validators,
}
}
}
Expand Down
Loading

0 comments on commit 1496c42

Please sign in to comment.