Skip to content

Commit 8772410

Browse files
progress
1 parent 899d02f commit 8772410

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

chain/src/actors/syncer/actor.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ use crate::{
1313
},
1414
Indexer,
1515
};
16-
use alto_types::{Block, Finalization, Finalized, Notarized};
16+
use alto_types::{Block, Finalized, Notarized};
1717
use bytes::Bytes;
18-
use commonware_cryptography::{bls12381, ed25519::PublicKey, sha256::Digest};
18+
use commonware_codec::{Decode, DecodeExt};
19+
use commonware_consensus::threshold_simplex::types::Finalization;
20+
use commonware_cryptography::{bls12381, ed25519::PublicKey, sha256::Digest, Digestible};
1921
use commonware_macros::select;
2022
use commonware_p2p::{utils::requester, Receiver, Recipients, Sender};
2123
use commonware_resolver::{p2p, Resolver};
22-
use commonware_runtime::{Blob, Clock, Handle, Metrics, Spawner, Storage};
24+
use commonware_runtime::{Clock, Handle, Metrics, Spawner, Storage};
2325
use commonware_storage::{
24-
archive::{
25-
self,
26-
translator::{EightCap, TwoCap},
27-
Archive, Identifier,
28-
},
26+
archive::{self, Archive, Identifier},
27+
index::translator::{EightCap, TwoCap},
2928
journal::{self, variable::Journal},
3029
metadata::{self, Metadata},
3130
};
@@ -46,7 +45,7 @@ use std::{
4645
use tracing::{debug, info, warn};
4746

4847
/// Application actor.
49-
pub struct Actor<B: Blob, R: Rng + Spawner + Metrics + Clock + GClock + Storage<B>, I: Indexer> {
48+
pub struct Actor<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> {
5049
context: R,
5150
public_key: PublicKey,
5251
public: bls12381::PublicKey,
@@ -58,27 +57,27 @@ pub struct Actor<B: Blob, R: Rng + Spawner + Metrics + Clock + GClock + Storage<
5857
indexer: Option<I>,
5958

6059
// Blocks verified stored by view<>digest
61-
verified: Archive<TwoCap, Digest, B, R>,
60+
verified: Archive<TwoCap, Digest, R>,
6261
// Blocks notarized stored by view<>digest
63-
notarized: Archive<TwoCap, Digest, B, R>,
62+
notarized: Archive<TwoCap, Digest, R>,
6463

6564
// Finalizations stored by height
66-
finalized: Archive<EightCap, Digest, B, R>,
65+
finalized: Archive<EightCap, Digest, R>,
6766
// Blocks finalized stored by height
6867
//
6968
// We store this separately because we may not have the finalization for a block
70-
blocks: Archive<EightCap, Digest, B, R>,
69+
blocks: Archive<EightCap, Digest, R>,
7170

7271
// Finalizer storage
73-
finalizer: Metadata<B, R, FixedBytes<1>>,
72+
finalizer: Metadata<R, FixedBytes<1>>,
7473

7574
// Latest height metric
7675
finalized_height: Gauge,
7776
// Indexed height metric
7877
contiguous_height: Gauge,
7978
}
8079

81-
impl<B: Blob, R: Rng + Spawner + Metrics + Clock + GClock + Storage<B>, I: Indexer> Actor<B, R, I> {
80+
impl<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> Actor<R, I> {
8281
/// Create a new application actor.
8382
pub async fn init(context: R, config: Config<I>) -> (Self, Mailbox) {
8483
// Initialize verified blocks
@@ -326,7 +325,7 @@ impl<B: Blob, R: Rng + Spawner + Metrics + Clock + GClock + Storage<B>, I: Index
326325
.cancel(MultiIndex::new(Value::Finalized(next)))
327326
.await;
328327
let block =
329-
Block::deserialize(&block).expect("Failed to deserialize block");
328+
Block::decode(block.as_ref()).expect("Failed to deserialize block");
330329
resolver
331330
.cancel(MultiIndex::new(Value::Digest(block.digest())))
332331
.await;

chain/src/actors/syncer/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alto_types::Block;
2-
use commonware_cryptography::{ed25519::PublicKey, sha256::Digest};
2+
use commonware_cryptography::{ed25519::PublicKey, sha256::Digest, Digestible};
33
use std::collections::{HashMap, VecDeque};
44

55
pub struct Buffer {

0 commit comments

Comments
 (0)