Skip to content

Commit 1dbf1b3

Browse files
committed
chore: fix compile errors
1 parent e183794 commit 1dbf1b3

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

rust/src/code_hash.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ const CONTRACT_KEY_SIZE: usize = 32;
88

99
#[serde_as]
1010
#[derive(PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Hash)]
11-
#[cfg_attr(feature = "testing", derive(arbitrary::Arbitrary))]
11+
#[cfg_attr(
12+
any(feature = "testing", all(test, any(unix, windows))),
13+
derive(arbitrary::Arbitrary)
14+
)]
1215
pub struct CodeHash(#[serde_as(as = "[_; CONTRACT_KEY_SIZE]")] pub(crate) [u8; CONTRACT_KEY_SIZE]);
1316

1417
impl CodeHash {

rust/src/contract_interface.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,10 @@ pub trait ContractInterface {
472472
/// A complete contract specification requires a `parameters` section
473473
/// and a `contract` section.
474474
#[derive(Debug, Serialize, Deserialize, Clone)]
475-
#[cfg_attr(feature = "testing", derive(arbitrary::Arbitrary))]
475+
#[cfg_attr(
476+
any(feature = "testing", all(test, any(unix, windows))),
477+
derive(arbitrary::Arbitrary)
478+
)]
476479
pub struct Contract<'a> {
477480
#[serde(borrow)]
478481
pub parameters: Parameters<'a>,
@@ -778,7 +781,10 @@ impl DerefMut for StateSummary<'_> {
778781
/// and does not include any other metadata (like the parameters).
779782
#[serde_as]
780783
#[derive(Serialize, Deserialize, Clone)]
781-
#[cfg_attr(feature = "testing", derive(arbitrary::Arbitrary))]
784+
#[cfg_attr(
785+
any(feature = "testing", all(test, any(unix, windows))),
786+
derive(arbitrary::Arbitrary)
787+
)]
782788
pub struct ContractCode<'a> {
783789
// TODO: conver this to Arc<[u8]> instead
784790
#[serde_as(as = "serde_with::Bytes")]
@@ -911,7 +917,10 @@ impl std::fmt::Debug for ContractCode<'_> {
911917
/// The key representing the hash of the contract executable code hash and a set of `parameters`.
912918
#[serde_as]
913919
#[derive(PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Hash)]
914-
#[cfg_attr(feature = "testing", derive(arbitrary::Arbitrary))]
920+
#[cfg_attr(
921+
any(feature = "testing", all(test, any(unix, windows))),
922+
derive(arbitrary::Arbitrary)
923+
)]
915924
#[repr(transparent)]
916925
pub struct ContractInstanceId(#[serde_as(as = "[_; CONTRACT_KEY_SIZE]")] [u8; CONTRACT_KEY_SIZE]);
917926

@@ -989,7 +998,10 @@ impl std::fmt::Debug for ContractInstanceId {
989998
/// A complete key specification, that represents a cryptographic hash that identifies the contract.
990999
#[serde_as]
9911000
#[derive(Debug, Eq, Copy, Clone, Serialize, Deserialize)]
992-
#[cfg_attr(feature = "testing", derive(arbitrary::Arbitrary))]
1001+
#[cfg_attr(
1002+
any(feature = "testing", all(test, any(unix, windows))),
1003+
derive(arbitrary::Arbitrary)
1004+
)]
9931005
pub struct ContractKey {
9941006
instance: ContractInstanceId,
9951007
code: Option<CodeHash>,

rust/src/parameters.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ use serde_with::serde_as;
99
/// typically be used to configure a contract, much like the parameters of a constructor function.
1010
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
1111
#[serde_as]
12-
#[cfg_attr(feature = "testing", derive(arbitrary::Arbitrary))]
12+
#[cfg_attr(
13+
any(feature = "testing", all(test, any(unix, windows))),
14+
derive(arbitrary::Arbitrary)
15+
)]
1316
pub struct Parameters<'a>(
1417
// TODO: conver this to Arc<u8> instead
1518
#[serde_as(as = "serde_with::Bytes")]

0 commit comments

Comments
 (0)