Skip to content

Commit e61bdd4

Browse files
committed
refactor(add block types and cddl tests): verifcation and refactor
1 parent 6474854 commit e61bdd4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

rust/immutable-ledger/src/serialize.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,15 @@ impl Block {
158158
encoder.bytes(&sig)?;
159159
}
160160

161-
Ok([
161+
let signatures = encoder.writer().clone();
162+
163+
let block_encoding = [
162164
[encoded_block_hdr, self.block_data.0.clone()].concat(),
163-
encoder.writer().to_vec(),
165+
signatures,
164166
]
165-
.concat())
167+
.concat();
168+
169+
Ok(block_encoding)
166170
}
167171

168172
/// Decode block
@@ -480,7 +484,7 @@ impl BlockHeader {
480484
let metadata = cbor_decoder
481485
.bytes()
482486
.map_err(|e| anyhow::anyhow!(format!("Invalid cbor for metadata : {e}")))?
483-
.try_into()?;
487+
.into();
484488

485489
let block_header = BlockHeader {
486490
chain_id,
@@ -590,6 +594,8 @@ impl GenesisPreviousHash {
590594
}
591595

592596
#[cfg(test)]
597+
#[allow(clippy::zero_prefixed_literal)]
598+
#[allow(clippy::items_after_statements)]
593599
mod tests {
594600

595601
use ed25519_dalek::{SigningKey, SECRET_KEY_LENGTH};

0 commit comments

Comments
 (0)