Skip to content

Commit

Permalink
DO NOT MERGE: Add some fake objects at the start of the stream
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Sep 9, 2024
1 parent 983c7d9 commit 7d0ef9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 15 additions & 2 deletions crates/sc-consensus-subspace-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ use std::sync::{Arc, Weak};
use std::time::Duration;
use subspace_archiving::archiver::NewArchivedSegment;
use subspace_core_primitives::crypto::kzg::Kzg;
use subspace_core_primitives::objects::GlobalObjectMapping;
use subspace_core_primitives::objects::{GlobalObject, GlobalObjectMapping};
use subspace_core_primitives::{
Blake3Hash, Blake3HashHex, BlockHash, HistorySize, Piece, PieceIndex, PublicKey, SegmentHeader,
SegmentIndex, SlotNumber, Solution,
Expand Down Expand Up @@ -893,6 +893,13 @@ where
.ready_chunks(OBJECT_MAPPING_BATCH_SIZE)
.map(|objects| GlobalObjectMapping::V0 { objects });

// TESTING ONLY, DO NOT MERGE
let fake_mapping = vec![GlobalObject::default(); 3];
let mapping_stream = stream::iter(fake_mapping)
.ready_chunks(OBJECT_MAPPING_BATCH_SIZE)
.map(|objects| GlobalObjectMapping::V0 { objects })
.chain(mapping_stream);

self.subscription_executor.spawn(
"subspace-archived-object-mappings-subscription",
Some("rpc"),
Expand Down Expand Up @@ -940,7 +947,13 @@ where
.flat_map(move |archived_segment_notification| {
let objects = archived_segment_notification
.archived_segment
.global_object_mappings()
.global_object_mappings();

// TESTING ONLY, DO NOT MERGE
let fake_mapping = vec![GlobalObject::default(); 3];
let objects = objects.chain(fake_mapping);

let objects = objects
.filter(|object| hashes.remove(&object.hash))
.collect::<Vec<_>>();

Expand Down
4 changes: 3 additions & 1 deletion crates/subspace-core-primitives/src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ pub struct PieceObjectMapping {
}

/// Object stored in the history of the blockchain
#[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Encode, Decode, TypeInfo)]
#[derive(
Default, Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Encode, Decode, TypeInfo,
)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "serde",
Expand Down

0 comments on commit 7d0ef9c

Please sign in to comment.