Skip to content

Commit

Permalink
Reinstate confio/ics23 dependency (#842)
Browse files Browse the repository at this point in the history
* Reinstating dep ics23. Remove audit ignore exception from CI.

* Disable cron schedule

* Added dev branch for CI trigger

* Remove dev branch trigger.

* Bump up cargo-audit version to 0.14

* Revert "Bump up cargo-audit version to 0.14"

This reverts commit c195571.
I mistakenly took the "11.2" in the CI key name to mean the
version of cargo audit being used. This wasn't the case
so reverting the change.

* Adding back the scheduled job to ensure daily audits.

* Bump audit-check version

* Added new type ProofSpecs. Proof spec for cosmos imported from crate ics23.

* Added GH issue

* changelog

* Fix unwrap

* Safety note for conversion

* Propagate Protobuf decoding error in `convert_tm_to_ics_merkle_proof`

Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
adizere and romac authored Apr 27, 2021
1 parent 2497f87 commit 615649a
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 121 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-audit-v0.11.2
- uses: actions-rs/audit-check@v1
- uses: actions-rs/audit-check@v1.2.0
with:
args: --ignore RUSTSEC-2019-0031
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
### IMPROVEMENTS

- [ibc]
- Reinstated `ics23` dependency ([#854])
- [ibc-relayer]
- Change the default for client creation to allow governance recovery in case of expiration or misbehaviour. ([#785])

Expand All @@ -20,6 +22,7 @@

[#785]: https://github.com/informalsystems/ibc-rs/issues/785
[#811]: https://github.com/informalsystems/ibc-rs/issues/811
[#854]: https://github.com/informalsystems/ibc-rs/issues/854
[#851]: https://github.com/informalsystems/ibc-rs/issues/851


Expand Down
109 changes: 75 additions & 34 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mocks = [ "tendermint-testgen", "sha2" ]
[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.8.0", path = "../proto" }
ics23 = "0.6.5"
anomaly = "0.2.0"
chrono = "0.4"
thiserror = "1.0.24"
Expand Down
6 changes: 3 additions & 3 deletions modules/src/ics02_client/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anomaly::{BoxError, Context};
use thiserror::Error;

use crate::ics02_client::client_type::ClientType;
use crate::ics23_commitment::error::Kind as Ics23Kind;
use crate::ics23_commitment::error::Error as Ics23Error;
use crate::ics24_host::error::ValidationKind;
use crate::ics24_host::identifier::ClientId;
use crate::Height;
Expand Down Expand Up @@ -78,10 +78,10 @@ pub enum Kind {
InvalidAddress,

#[error("invalid proof for the upgraded client state")]
InvalidUpgradeClientProof(Ics23Kind),
InvalidUpgradeClientProof(Ics23Error),

#[error("invalid proof for the upgraded consensus state")]
InvalidUpgradeConsensusStateProof(Ics23Kind),
InvalidUpgradeConsensusStateProof(Ics23Error),

#[error("mismatch between client and arguments types, expected: {0:?}")]
ClientArgsTypeMismatch(ClientType),
Expand Down
4 changes: 2 additions & 2 deletions modules/src/ics02_client/msgs/upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ impl TryFrom<RawMsgUpgradeClient> for MsgUpgradeAnyClient {
consensus_state: AnyConsensusState::try_from(raw_consensus_state)
.map_err(|_| Kind::InvalidRawConsensusState)?,
proof_upgrade_client: MerkleProof::try_from(c_bytes)
.map_err(|e| Kind::InvalidUpgradeClientProof(e.kind().clone()))?,
.map_err(Kind::InvalidUpgradeClientProof)?,
proof_upgrade_consensus_state: MerkleProof::try_from(cs_bytes)
.map_err(|e| Kind::InvalidUpgradeConsensusStateProof(e.kind().clone()))?,
.map_err(Kind::InvalidUpgradeConsensusStateProof)?,
signer: proto_msg.signer.into(),
})
}
Expand Down
6 changes: 3 additions & 3 deletions modules/src/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::convert::{TryFrom, TryInto};
use std::str::FromStr;
use std::time::Duration;

use serde::Serialize;
Expand All @@ -13,10 +14,9 @@ use crate::ics02_client::client_state::AnyClientState;
use crate::ics02_client::client_type::ClientType;
use crate::ics07_tendermint::error::{Error, Kind};
use crate::ics07_tendermint::header::Header;
use crate::ics23_commitment::merkle::cosmos_specs;
use crate::ics23_commitment::specs::ProofSpecs;
use crate::ics24_host::identifier::ChainId;
use crate::Height;
use std::str::FromStr;

#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
pub struct ClientState {
Expand Down Expand Up @@ -212,7 +212,7 @@ impl From<ClientState> for RawClientState {
max_clock_drift: Some(value.max_clock_drift.into()),
frozen_height: Some(value.frozen_height.into()),
latest_height: Some(value.latest_height.into()),
proof_specs: cosmos_specs(),
proof_specs: ProofSpecs::cosmos().into(),
allow_update_after_expiry: false,
allow_update_after_misbehaviour: false,
upgrade_path: value.upgrade_path,
Expand Down
6 changes: 3 additions & 3 deletions modules/src/ics23_commitment/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use subtle_encoding::{Encoding, Hex};

use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof;

use crate::ics23_commitment::error::{Error, Kind};
use crate::ics23_commitment::error::Error;

#[derive(Clone, PartialEq, Eq, Serialize)]
#[serde(transparent)]
Expand Down Expand Up @@ -92,8 +92,8 @@ impl TryFrom<CommitmentProofBytes> for RawMerkleProof {

fn try_from(value: CommitmentProofBytes) -> Result<Self, Self::Error> {
let value: Vec<u8> = value.into();
let res: RawMerkleProof = prost::Message::decode(value.as_ref())
.map_err(|e| Kind::InvalidRawMerkleProof.context(e))?;
let res: RawMerkleProof =
prost::Message::decode(value.as_ref()).map_err(Error::InvalidRawMerkleProof)?;
Ok(res)
}
}
Expand Down
Loading

0 comments on commit 615649a

Please sign in to comment.