Skip to content

Commit

Permalink
Clean up comments, todos
Browse files Browse the repository at this point in the history
  • Loading branch information
dastansam committed May 3, 2024
1 parent c89e29b commit 144afed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
2 changes: 1 addition & 1 deletion crates/subspace-fake-runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "subspace-fake-runtime-api"
version = "0.1.0"
authors = ["Subspace Labs <https://subspace.network>"]
description = "Fake subspace runtime."
description = "Fake subspace runtime API."
edition = "2021"
license = "GPL-3.0-or-later"
homepage = "https://subspace.network"
Expand Down
33 changes: 2 additions & 31 deletions crates/subspace-fake-runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Provides "fake" runtime API and `RuntimeGenesisConfig` implementations as a workaround for compile-time checks.
//!
//! These are used to provide a type that implements these runtime apis without requiring to import the native runtimes.
//! Provides "fake" runtime API implementation as a workaround for compile-time checks.

use domain_runtime_primitives::opaque::Header as DomainHeader;
use domain_runtime_primitives::{BlockNumber as DomainNumber, Hash as DomainHash};
Expand Down Expand Up @@ -51,18 +49,10 @@ mod mmr {
pub use pallet_mmr::primitives::*;
use sp_core::H256;
// Full type for this is actually `<<Runtime as pallet_mmr::Config>::Hashing as sp_runtime::traits::Hash>::Output`
// but since we don't really want to impl pallet for the test runtime, we just use the `Keccak256::Output = H256`
// but since we don't really want to impl pallet for the fake runtime, we just use the `Keccak256::Output = H256`
pub type Hash = H256;
}

sp_api::decl_runtime_apis! {
/// This runtime api is only implemented for the test runtime!
pub trait GetLastTimestamp {
/// Returns the last timestamp of a runtime.
fn get_last_timestamp() -> u64;
}
}

struct Runtime;

sp_api::impl_runtime_apis! {
Expand Down Expand Up @@ -137,7 +127,6 @@ sp_api::impl_runtime_apis! {
}

fn validated_object_call_hashes() -> Vec<Hash> {
// No pallets produce objects right now
unreachable!()
}
}
Expand All @@ -164,8 +153,6 @@ sp_api::impl_runtime_apis! {
}

fn is_in_block_list(_farmer_public_key: &FarmerPublicKey) -> bool {
// TODO: Either check tx pool too for pending equivocations or replace equivocation
// mechanism with an alternative one, so that blocking happens faster
unreachable!()
}

Expand Down Expand Up @@ -462,20 +449,4 @@ sp_api::impl_runtime_apis! {
unreachable!()
}
}

#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(_extra: bool) -> (
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
) {
unreachable!()
}

fn dispatch_benchmark(
_config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
unreachable!()
}
}
}
2 changes: 1 addition & 1 deletion crates/subspace-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/subspac
runtime-benchmarks = [
"dep:frame-benchmarking",
"sc-domains/runtime-benchmarks",
]
]

0 comments on commit 144afed

Please sign in to comment.