From d781db9db22f23b15462c35d6b15862b24928f27 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Tue, 26 Nov 2024 16:46:18 +0100 Subject: [PATCH] wip: 'cluster_id' is added to fingerprint payload --- pallets/ddc-payouts/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pallets/ddc-payouts/src/lib.rs b/pallets/ddc-payouts/src/lib.rs index 213e28e0b..3f4cd5361 100644 --- a/pallets/ddc-payouts/src/lib.rs +++ b/pallets/ddc-payouts/src/lib.rs @@ -238,7 +238,7 @@ pub mod pallet { IncorrectClusterId, ClusterProtocolParamsNotSet, TotalStoredBytesLessThanZero, - FingerprintIsAlreadyCommited, + FingerprintIsAlreadyCommitted, } #[pallet::storage] @@ -314,6 +314,7 @@ pub mod pallet { #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] pub struct BillingReportFingerprint { + pub cluster_id: ClusterId, pub era_id: DdcEra, pub start_era: i64, pub end_era: i64, @@ -324,7 +325,8 @@ pub mod pallet { impl BillingReportFingerprint { fn selective_hash(&self) -> Fingerprint { - let mut data = self.era_id.encode(); + let mut data = self.cluster_id.encode(); + data.extend_from_slice(&self.era_id.encode()); data.extend_from_slice(&self.start_era.encode()); data.extend_from_slice(&self.end_era.encode()); data.extend_from_slice(&self.payers_merkle_root.encode()); @@ -605,6 +607,7 @@ pub mod pallet { ensure!(payees_merkle_root != Default::default(), Error::::BadRequest); let inited_fingerprint = BillingReportFingerprint:: { + cluster_id, era_id, start_era, end_era, @@ -622,7 +625,7 @@ pub mod pallet { ensure!( fingerprint.validators.insert(validator), - Error::::FingerprintIsAlreadyCommited + Error::::FingerprintIsAlreadyCommitted ); Fingerprints::::insert(hash, fingerprint);