Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add optional arbitrary impls #1390

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ authors = [ "Informal Systems <[email protected]>" ]

[workspace.dependencies]
# external dependencies
arbitrary = { version = "1.4", features = [ "derive" ] }
base64 = { version = "0.22", default-features = false }
borsh = { version = "1", default-features = false, features = [ "derive" ] }
displaydoc = { version = "0.2.5", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ parity-scale-codec = [
nft-transfer = [
"ibc-app-nft-transfer",
]
arbitrary = [ "ibc-app-transfer/arbitrary", "ibc-app-nft-transfer/arbitrary" ]
1 change: 1 addition & 0 deletions ibc-apps/ics20-transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ parity-scale-codec = [
"ibc-app-transfer-types/parity-scale-codec",
"ibc-core/parity-scale-codec",
]
arbitrary = [ "ibc-app-transfer-types/arbitrary" ]
2 changes: 2 additions & 0 deletions ibc-apps/ics20-transfer/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ all-features = true

[dependencies]
# external dependencies
arbitrary = { workspace = true, optional = true }
borsh = { workspace = true, optional = true }
derive_more = { workspace = true }
displaydoc = { workspace = true }
Expand Down Expand Up @@ -74,3 +75,4 @@ parity-scale-codec = [
"ibc-core/parity-scale-codec",
"ibc-proto/parity-scale-codec",
]
arbitrary = [ "dep:arbitrary", "ibc-core/arbitrary" ]
8 changes: 8 additions & 0 deletions ibc-apps/ics20-transfer/types/src/amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
use primitive_types::U256;

/// A type for representing token transfer amounts.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 13 in ibc-apps/ics20-transfer/types/src/amount.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/amount.rs#L13

Added line #L13 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Display, From, Into)]
pub struct Amount(
#[cfg_attr(feature = "arbitrary", arbitrary(with = arb_u256))]
#[cfg_attr(feature = "schema", schemars(with = "String"))]
#[cfg_attr(feature = "serde", serde(serialize_with = "serializers::serialize"))]
#[cfg_attr(feature = "serde", serde(deserialize_with = "deserialize"))]
Expand Down Expand Up @@ -129,6 +131,12 @@
.map_err(serde::de::Error::custom)
}

#[cfg(feature = "arbitrary")]
fn arb_u256(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<U256> {
let parts: [u8; 32] = arbitrary::Arbitrary::arbitrary(u)?;
Ok(U256::from_big_endian(&parts))
}

Check warning on line 138 in ibc-apps/ics20-transfer/types/src/amount.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/amount.rs#L135-L138

Added lines #L135 - L138 were not covered by tests

#[cfg(test)]
mod tests {
use super::Amount;
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics20-transfer/types/src/coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
const VALID_DENOM_CHARACTERS: &str = "/:._-";

/// Coin defines a token with a denomination and an amount.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 24 in ibc-apps/ics20-transfer/types/src/coin.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/coin.rs#L24

Added line #L24 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(
Expand Down
4 changes: 4 additions & 0 deletions ibc-apps/ics20-transfer/types/src/denom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
///
/// For example, given the token `my_port-1/my_channel-1/my_port-2/my_channel-2/base_denom`,
/// `base_denom` is the "base" of the denomination
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 17 in ibc-apps/ics20-transfer/types/src/denom.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/denom.rs#L17

Added line #L17 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(
Expand Down Expand Up @@ -55,6 +56,7 @@
/// For example, given the token `my_port-1/my_channel-1/my_port-2/my_channel-2/base_denom`,
/// `my_port-1/my_channel-1` is a trace prefix, and `my_port-2/my_channel-2` is another one.
/// See [TracePath] which stitches trace prefixes together.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 59 in ibc-apps/ics20-transfer/types/src/denom.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/denom.rs#L59

Added line #L59 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down Expand Up @@ -122,6 +124,7 @@
/// Internally, the `TracePath` is modelled as a `Vec<TracePrefix>` but with the order reversed, i.e.
/// "transfer/channel-0/transfer/channel-1/uatom" => `["transfer/channel-1", "transfer/channel-0"]`
/// This is done for ease of addition/removal of prefixes.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 127 in ibc-apps/ics20-transfer/types/src/denom.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/denom.rs#L127

Added line #L127 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down Expand Up @@ -236,6 +239,7 @@
}

/// A type that contains the base denomination for ICS20 and the source tracing information path.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 242 in ibc-apps/ics20-transfer/types/src/denom.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/denom.rs#L242

Added line #L242 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics20-transfer/types/src/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ibc_core::primitives::prelude::*;

/// Represents the token transfer memo
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 13 in ibc-apps/ics20-transfer/types/src/memo.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/memo.rs#L13

Added line #L13 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics20-transfer/types/src/msgs/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/// have to specify the information related to the transfer of the token, and
/// let the library figure out how to build the packet properly.
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 23 in ibc-apps/ics20-transfer/types/src/msgs/transfer.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/msgs/transfer.rs#L23

Added line #L23 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "parity-scale-codec",
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics20-transfer/types/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use super::{Amount, Memo, PrefixedCoin, PrefixedDenom};

/// Defines the structure of token transfers' packet bytes
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 13 in ibc-apps/ics20-transfer/types/src/packet.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/types/src/packet.rs#L13

Added line #L13 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "serde",
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics721-nft-transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ parity-scale-codec = [
"ibc-app-nft-transfer-types/parity-scale-codec",
"ibc-core/parity-scale-codec",
]
arbitrary = [ "ibc-app-nft-transfer-types/arbitrary" ]
2 changes: 2 additions & 0 deletions ibc-apps/ics721-nft-transfer/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ all-features = true

[dependencies]
# external dependencies
arbitrary = { workspace = true, optional = true }
borsh = { workspace = true, optional = true }
base64 = { workspace = true, features = [ "alloc" ] }
derive_more = { workspace = true }
Expand Down Expand Up @@ -81,3 +82,4 @@ parity-scale-codec = [
"ibc-proto/parity-scale-codec",
"ibc-app-transfer-types/parity-scale-codec",
]
arbitrary = [ "dep:arbitrary", "ibc-core/arbitrary" ]
5 changes: 5 additions & 0 deletions ibc-apps/ics721-nft-transfer/types/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use crate::data::Data;

/// Class ID for an NFT
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 17 in ibc-apps/ics721-nft-transfer/types/src/class.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/class.rs#L17

Added line #L17 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down Expand Up @@ -56,6 +57,7 @@
}

/// Prefixed class to trace sources like ICS-20 PrefixedDenom
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 60 in ibc-apps/ics721-nft-transfer/types/src/class.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/class.rs#L60

Added line #L60 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(
Expand Down Expand Up @@ -180,10 +182,12 @@
}

/// Class URI for an NFT
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 185 in ibc-apps/ics721-nft-transfer/types/src/class.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/class.rs#L185

Added line #L185 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ClassUri(
#[cfg_attr(feature = "arbitrary", arbitrary(with = crate::arb_uri))]
#[cfg_attr(feature = "serde", serde(with = "serializers"))]
#[cfg_attr(feature = "schema", schemars(with = "String"))]
Uri,
Expand Down Expand Up @@ -253,6 +257,7 @@
}

/// Class data for an NFT
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 260 in ibc-apps/ics721-nft-transfer/types/src/class.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/class.rs#L260

Added line #L260 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics721-nft-transfer/types/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ibc_core::primitives::prelude::*;
use mime::Mime;

#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 13 in ibc-apps/ics721-nft-transfer/types/src/data.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/data.rs#L13

Added line #L13 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down
6 changes: 6 additions & 0 deletions ibc-apps/ics721-nft-transfer/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@
pub fn ack_success_b64() -> StatusValue {
StatusValue::new(ACK_SUCCESS_B64).expect("ack status value is never supposed to be empty")
}

#[cfg(feature = "arbitrary")]
fn arb_uri(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<http::Uri> {
let raw: std::string::String = arbitrary::Arbitrary::arbitrary(u)?;
http::Uri::try_from(&raw).map_err(|_| arbitrary::Error::IncorrectFormat)
}

Check warning on line 63 in ibc-apps/ics721-nft-transfer/types/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/lib.rs#L60-L63

Added lines #L60 - L63 were not covered by tests
1 change: 1 addition & 0 deletions ibc-apps/ics721-nft-transfer/types/src/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ibc_core::primitives::prelude::*;

/// Represents the token transfer memo
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 13 in ibc-apps/ics721-nft-transfer/types/src/memo.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/memo.rs#L13

Added line #L13 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics721-nft-transfer/types/src/msgs/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/// have to specify the information related to the transfer of the token, and
/// let the library figure out how to build the packet properly.
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 23 in ibc-apps/ics721-nft-transfer/types/src/msgs/transfer.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/msgs/transfer.rs#L23

Added line #L23 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "parity-scale-codec",
Expand Down
1 change: 1 addition & 0 deletions ibc-apps/ics721-nft-transfer/types/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use crate::token::{TokenData, TokenIds, TokenUri};

/// Defines the structure of token transfers' packet bytes
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 18 in ibc-apps/ics721-nft-transfer/types/src/packet.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/packet.rs#L18

Added line #L18 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
Expand Down
5 changes: 5 additions & 0 deletions ibc-apps/ics721-nft-transfer/types/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use crate::data::Data;

/// Token ID for an NFT
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 14 in ibc-apps/ics721-nft-transfer/types/src/token.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/token.rs#L14

Added line #L14 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down Expand Up @@ -52,6 +53,7 @@
}
}

#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 56 in ibc-apps/ics721-nft-transfer/types/src/token.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/token.rs#L56

Added line #L56 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down Expand Up @@ -116,10 +118,12 @@
}

/// Token URI for an NFT
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 121 in ibc-apps/ics721-nft-transfer/types/src/token.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/token.rs#L121

Added line #L121 was not covered by tests
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TokenUri(
#[cfg_attr(feature = "arbitrary", arbitrary(with = crate::arb_uri))]
#[cfg_attr(feature = "serde", serde(with = "serializers"))]
#[cfg_attr(feature = "schema", schemars(with = "String"))]
Uri,
Expand Down Expand Up @@ -187,6 +191,7 @@
}

/// Token data for an NFT
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 194 in ibc-apps/ics721-nft-transfer/types/src/token.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/token.rs#L194

Added line #L194 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down
8 changes: 8 additions & 0 deletions ibc-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ parity-scale-codec = [
"ibc-core-handler/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
arbitrary = [
"ibc-core-client/arbitrary",
"ibc-core-connection/arbitrary",
"ibc-core-commitment-types/arbitrary",
"ibc-core-host/arbitrary",
"ibc-core-handler/arbitrary",
"ibc-primitives/arbitrary",
]
1 change: 1 addition & 0 deletions ibc-core/ics02-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ parity-scale-codec = [
"ibc-core-handler-types/parity-scale-codec",
"ibc-primitives/parity-scale-codec",
]
arbitrary = [ "ibc-core-client-types/arbitrary" ]
2 changes: 2 additions & 0 deletions ibc-core/ics02-client/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ all-features = true

[dependencies]
# external dependencies
arbitrary = { workspace = true, optional = true }
borsh = { workspace = true, optional = true }
derive_more = { workspace = true }
displaydoc = { workspace = true }
Expand Down Expand Up @@ -86,3 +87,4 @@ parity-scale-codec = [
"ibc-primitives/parity-scale-codec",
"ibc-proto/parity-scale-codec",
]
arbitrary = [ "dep:arbitrary", "ibc-primitives/arbitrary" ]
1 change: 1 addition & 0 deletions ibc-core/ics02-client/types/src/height.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/// The core IBC height type, which represents the height of a chain,
/// which typically is the number of blocks since genesis
/// (or more generally, since the last revision/hard upgrade).
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 16 in ibc-core/ics02-client/types/src/height.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/height.rs#L16

Added line #L16 was not covered by tests
#[cfg_attr(
feature = "parity-scale-codec",
derive(
Expand Down
3 changes: 3 additions & 0 deletions ibc-core/ics02-client/types/src/msgs/create_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
pub const CREATE_CLIENT_TYPE_URL: &str = "/ibc.core.client.v1.MsgCreateClient";

/// A type of message that triggers the creation of a new on-chain (IBC) client.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 13 in ibc-core/ics02-client/types/src/msgs/create_client.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/msgs/create_client.rs#L13

Added line #L13 was not covered by tests
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct MsgCreateClient {
#[cfg_attr(feature = "arbitrary", arbitrary(with = ibc_primitives::arb_protobuf_any))]
pub client_state: Any,
#[cfg_attr(feature = "arbitrary", arbitrary(with = ibc_primitives::arb_protobuf_any))]
pub consensus_state: Any,
pub signer: Signer,
}
Expand Down
2 changes: 2 additions & 0 deletions ibc-core/ics02-client/types/src/msgs/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
///
/// Deprecated since v0.51.0. Misbehaviour reports should be submitted via the `MsgUpdateClient`
/// type through its `client_message` field.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 17 in ibc-core/ics02-client/types/src/msgs/misbehaviour.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/msgs/misbehaviour.rs#L17

Added line #L17 was not covered by tests
#[deprecated(
since = "0.51.0",
note = "Misbehaviour reports should be submitted via `MsgUpdateClient` through its `client_message` field"
Expand All @@ -28,6 +29,7 @@
/// client unique identifier
pub client_id: ClientId,
/// misbehaviour, used for freezing the light client
#[cfg_attr(feature = "arbitrary", arbitrary(with = ibc_primitives::arb_protobuf_any))]
pub misbehaviour: ProtoAny,
/// signer address
pub signer: Signer,
Expand Down
1 change: 1 addition & 0 deletions ibc-core/ics02-client/types/src/msgs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/// Encodes all the different client messages
#[allow(dead_code)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 24 in ibc-core/ics02-client/types/src/msgs/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/msgs/mod.rs#L24

Added line #L24 was not covered by tests
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
Expand Down
1 change: 1 addition & 0 deletions ibc-core/ics02-client/types/src/msgs/recover_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/// client recovery functionality is not part of ibc-rs's public API. The
/// intended usage of this message type is to be integrated with hosts'
/// governance modules, not to be called directly via `dispatch`.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 20 in ibc-core/ics02-client/types/src/msgs/recover_client.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/msgs/recover_client.rs#L20

Added line #L20 was not covered by tests
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
Expand Down
2 changes: 2 additions & 0 deletions ibc-core/ics02-client/types/src/msgs/update_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/// either with new headers, or evidence of misbehaviour.
/// Note that some types of misbehaviour can be detected when the headers
/// are updated (`UpdateKind::UpdateClient`).
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 17 in ibc-core/ics02-client/types/src/msgs/update_client.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/msgs/update_client.rs#L17

Added line #L17 was not covered by tests
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
Expand All @@ -22,6 +23,7 @@
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct MsgUpdateClient {
pub client_id: ClientId,
#[cfg_attr(feature = "arbitrary", arbitrary(with = ibc_primitives::arb_protobuf_any))]
pub client_message: Any,
pub signer: Signer,
}
Expand Down
3 changes: 3 additions & 0 deletions ibc-core/ics02-client/types/src/msgs/upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
pub const UPGRADE_CLIENT_TYPE_URL: &str = "/ibc.core.client.v1.MsgUpgradeClient";

/// A type of message that triggers the upgrade of an on-chain (IBC) client.
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

Check warning on line 17 in ibc-core/ics02-client/types/src/msgs/upgrade_client.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics02-client/types/src/msgs/upgrade_client.rs#L17

Added line #L17 was not covered by tests
#[cfg_attr(
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
Expand All @@ -24,9 +25,11 @@
// client unique identifier
pub client_id: ClientId,
// Upgraded client state
#[cfg_attr(feature = "arbitrary", arbitrary(with = ibc_primitives::arb_protobuf_any))]
pub upgraded_client_state: Any,
// Upgraded consensus state, only contains enough information
// to serve as a basis of trust in update logic
#[cfg_attr(feature = "arbitrary", arbitrary(with = ibc_primitives::arb_protobuf_any))]
pub upgraded_consensus_state: Any,
// proof that old chain committed to new client
pub proof_upgrade_client: CommitmentProofBytes,
Expand Down
1 change: 1 addition & 0 deletions ibc-core/ics03-connection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ wasm-client = [
"dep:ibc-client-wasm-types",
"dep:prost",
]
arbitrary = [ "ibc-core-connection-types/arbitrary" ]
Loading
Loading