From 05055009cf4bddc455d77fed0bc70be0cb72e20c Mon Sep 17 00:00:00 2001 From: Rares <6453351+raress96@users.noreply.github.com> Date: Wed, 27 Nov 2024 09:50:53 +0200 Subject: [PATCH] Change return type of usize to u32 for multiversx. --- ampd/src/mvx/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ampd/src/mvx/mod.rs b/ampd/src/mvx/mod.rs index 9bf5cb8bf..b322d858d 100644 --- a/ampd/src/mvx/mod.rs +++ b/ampd/src/mvx/mod.rs @@ -27,16 +27,16 @@ impl WeightedSigners { pub fn hash(&self) -> Hash { let mut encoded: Vec> = Vec::new(); - encoded.push(usize_to_u32(self.signers.len())); + encoded.push(usize_to_u32(self.signers.len()).to_vec()); for signer in self.signers.iter() { encoded.push(signer.signer.to_vec()); - encoded.push(usize_to_u32(signer.weight.len())); + encoded.push(usize_to_u32(signer.weight.len()).to_vec()); encoded.push(signer.weight.to_vec()); } - encoded.push(usize_to_u32(self.threshold.len())); + encoded.push(usize_to_u32(self.threshold.len()).to_vec()); encoded.push(self.threshold.to_vec()); encoded.push(self.nonce.to_vec()); @@ -82,8 +82,8 @@ fn uint256_to_compact_vec(value: Uint256) -> Vec { bytes[slice_from..].to_vec() } -fn usize_to_u32(value: usize) -> Vec { - (value as u32).to_be_bytes().to_vec() +fn usize_to_u32(value: usize) -> [u8; 4] { + (value as u32).to_be_bytes() } pub fn ed25519_key(pub_key: &PublicKey) -> Result<[u8; 32], Error> {