Skip to content

Commit

Permalink
ci(release): enforce acyclic dep order during release (#1200)
Browse files Browse the repository at this point in the history
* mv tendermint client cw tests to testkit

this is to remove ibc-testkit dev-dependency

* note for acyclic release order

* test proto::Any json ser-der

* nit

* fix unused imports

* cargo format

* update releases process

* Add more instructions on how to deal with cyclic dependencies

---------

Co-authored-by: Sean Chen <[email protected]>
  • Loading branch information
rnbguy and seanchen1991 authored Apr 30, 2024
1 parent 67d0735 commit ed4f8cd
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 29 deletions.
19 changes: 18 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ Our release process is as follows:
the root `Cargo.toml` as well, 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.
- Verify that there is no dev-dependency among the workspace crates,
except `ibc-testkit`. This is important, as `cargo-release` ignores
dev-dependency edges. You may use `cargo-depgraph`:
```sh
cargo depgraph --all-features --workspace-only --dev-deps | dot -Tpng > graph.png
```
The command will generate a graph similar to this:
![alt test](docs/dev-deps-graph.png)
The blue lines indicate dev dependencies; there should only be one blue line
referring to the `ibc-testkit` dependency. So the above example would result
in an unsuccessful release.
- In order to resolve such a situation, the dev dependencies other than `ibc-testkit`
can be manually released to crates.io first so that the subsequent crates that
depend on them can then be released via the release process. For instructions
on how to release a crate on crates.io, refer [here](https://doc.rust-lang.org/cargo/reference/publishing.html).
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 @@ -41,7 +56,9 @@ Our release process is as follows:
1. In case of intermittent problems with the registry, try `cargo release`
locally to publish any missing crates from this release. This step
requires the appropriate privileges to push crates to [crates.io].
2. In case the problems arise from the source files, fix them, bump a new
2. If there is any new crate published locally, add
[ibcbot](https://crates.io/users/ibcbot) to its owners list.
3. In case problems arise from the source files, fix them, bump a new
patch version (e.g. `v0.48.1`) and repeat the process with its
corresponding new tag.
10. Once the tag is pushed, wait for the CI bot to create a GitHub release,
Expand Down
Binary file added docs/dev-deps-graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions ibc-clients/ics07-tendermint/cw-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ ibc-client-tendermint = { workspace = true }
# cosmwasm dependencies
cosmwasm-std = { workspace = true }

[dev-dependencies]
cosmwasm-vm = { workspace = true }
hex = { version = "0.4.2" }
ibc-testkit = { workspace = true }
ibc-client-tendermint = { workspace = true }
tendermint = { workspace = true }
tendermint-testgen = { workspace = true }

[features]
default = ["std"]
std = [
Expand Down
3 changes: 0 additions & 3 deletions ibc-clients/ics07-tendermint/cw-contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@

pub mod client_type;
pub mod entrypoint;

#[cfg(test)]
pub mod tests;
13 changes: 9 additions & 4 deletions ibc-testkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@ tracing = { version = "0.1.40", default-features = false }
typed-builder = { version = "0.18.0" }

# ibc dependencies
ibc = { workspace = true, features = ["std"] }
ibc-proto = { workspace = true }
ibc = { workspace = true, features = ["std"] }
ibc-proto = { workspace = true }
ibc-client-cw = { workspace = true }
ibc-client-tendermint-cw = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
tendermint-testgen = { workspace = true }

[dev-dependencies]
env_logger = "0.11.0"
rstest = { workspace = true }
env_logger = { version = "0.11.0" }
tracing-subscriber = { version = "0.3.17", features = ["fmt", "env-filter", "json"] }
test-log = { version = "0.2.13", features = ["trace"] }
hex = { version = "0.4.2" }
rstest = { workspace = true }
cosmwasm-vm = { workspace = true }
cosmwasm-std = { workspace = true }

[features]
default = ["std"]
Expand Down
19 changes: 19 additions & 0 deletions ibc-testkit/src/testapp/ibc/clients/mock/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,22 @@ impl From<MockConsensusState> for MockClientState {
Self::new(cs.header)
}
}

#[cfg(test)]
mod test {
#[cfg(feature = "serde")]
#[test]
fn test_any_client_state_to_json() {
use ibc::primitives::proto::Any;

use super::{MockClientState, MockHeader};

let client_state = MockClientState::new(MockHeader::default());
let expected = r#"{"typeUrl":"/ibc.mock.ClientState","value":"CgQKAhABEIDIr6Al"}"#;
let json = serde_json::to_string(&Any::from(client_state)).unwrap();
assert_eq!(json, expected);

let proto_any = serde_json::from_str::<Any>(expected).unwrap();
assert_eq!(proto_any, Any::from(client_state));
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
use std::time::Duration;

use cosmwasm_std::{from_json, Deps, DepsMut, Empty, Response, StdError, StdResult};
use ibc::clients::tendermint::client_state::ClientState as TmClientState;
use ibc::clients::tendermint::consensus_state::ConsensusState as TmConsensusState;
use ibc::clients::tendermint::types::Header;
use ibc::core::client::types::{Height, Status};
use ibc::core::host::types::identifiers::ChainId;
use ibc::core::primitives::Timestamp;
use ibc_client_cw::types::{
CheckForMisbehaviourMsgRaw, ContractError, ExportMetadataMsg, GenesisMetadata, InstantiateMsg,
MigrationPrefix, QueryMsg, QueryResponse, StatusMsg, UpdateStateMsgRaw,
UpdateStateOnMisbehaviourMsgRaw, VerifyClientMessageRaw,
};
use ibc_client_cw::utils::AnyCodec;
use ibc_client_tendermint::client_state::ClientState as TmClientState;
use ibc_client_tendermint::consensus_state::ConsensusState as TmConsensusState;
use ibc_client_tendermint::types::Header;
use ibc_core::client::types::{Height, Status};
use ibc_core::host::types::identifiers::ChainId;
use ibc_core::primitives::Timestamp;
use ibc_client_tendermint_cw::entrypoint::TendermintContext;
use ibc_testkit::fixtures::clients::tendermint::ClientStateConfig;
use tendermint::Time;
use tendermint_testgen::{Generator, Validator};

use super::helper::{dummy_checksum, dummy_sov_consensus_state, mock_env_with_timestamp_now};
use crate::entrypoint::TendermintContext;

/// Test fixture
#[derive(Clone, Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::str::FromStr;

use cosmwasm_std::testing::{mock_env, mock_info};
use cosmwasm_std::{coins, Env, MessageInfo, Timestamp as CwTimestamp};
use ibc_client_tendermint::types::ConsensusState;
use ibc_core::primitives::Timestamp as IbcTimestamp;
use ibc::clients::tendermint::types::ConsensusState;
use ibc::core::primitives::Timestamp as IbcTimestamp;
use tendermint::Hash;

pub fn dummy_msg_info() -> MessageInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ use std::time::Duration;

use cosmwasm_std::from_json;
use cosmwasm_std::testing::{mock_dependencies, mock_env};
use fixture::Fixture;
use ibc::core::client::types::{Height, Status};
use ibc_client_cw::types::{
ContractResult, MigrateClientStoreMsg, MigrationPrefix, VerifyClientMessageRaw,
};
use ibc_core::client::types::{Height, Status};

use crate::entrypoint::sudo;
use crate::tests::fixture::Fixture;
use ibc_client_tendermint_cw::entrypoint::sudo;

#[test]
fn test_cw_create_client_ok() {
Expand Down
1 change: 1 addition & 0 deletions ibc-testkit/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
)]
pub mod applications;
pub mod core;
pub mod cosmwasm;

0 comments on commit ed4f8cd

Please sign in to comment.