Skip to content

Commit

Permalink
remove Hash impl for WriteSet family
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse committed Nov 6, 2024
1 parent c14b4e9 commit 6772752
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion types/src/transaction/change_set.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
use crate::{contract_event::ContractEvent, write_set::WriteSet};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct ChangeSet {
write_set: WriteSet,
events: Vec<ContractEvent>,
2 changes: 1 addition & 1 deletion types/src/transaction/mod.rs
Original file line number Diff line number Diff line change
@@ -433,7 +433,7 @@ impl TransactionPayload {
}

/// Two different kinds of WriteSet transactions.
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum WriteSetPayload {
/// Directly passing in the WriteSet.
Direct(ChangeSet),
10 changes: 4 additions & 6 deletions types/src/write_set.rs
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ impl PersistedWriteOp {
}
}

#[derive(Clone, Eq, Hash, PartialEq)]
#[derive(Clone, Eq, PartialEq)]
pub enum WriteOp {
Creation {
data: Bytes,
@@ -442,9 +442,7 @@ impl std::fmt::Debug for WriteOp {
}
}

#[derive(
BCSCryptoHash, Clone, CryptoHasher, Debug, Eq, Hash, PartialEq, Serialize, Deserialize,
)]
#[derive(BCSCryptoHash, Clone, CryptoHasher, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum WriteSet {
V0(WriteSetV0),
}
@@ -485,7 +483,7 @@ impl DerefMut for WriteSet {
/// where `Value(val)` means that serialized representation should be updated to `val`, and
/// `Deletion` means that we are going to delete this access path.
#[derive(
BCSCryptoHash, Clone, CryptoHasher, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize,
BCSCryptoHash, Clone, CryptoHasher, Debug, Default, Eq, PartialEq, Serialize, Deserialize,
)]
pub struct WriteSetV0(WriteSetMut);

@@ -532,7 +530,7 @@ impl WriteSetV0 {
/// A mutable version of `WriteSet`.
///
/// This is separate because it goes through validation before becoming an immutable `WriteSet`.
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct WriteSetMut {
// TODO: Change to HashMap with a stable iterator for serialization.
write_set: BTreeMap<StateKey, WriteOp>,

0 comments on commit 6772752

Please sign in to comment.