Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
598 changes: 341 additions & 257 deletions Cargo.lock

Large diffs are not rendered by default.

130 changes: 65 additions & 65 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

:chains: Toolkit for maintaining and securing [Substrate](https://polkadot.com/) based blockchains with the Cardano ecosystem

![polkadot-sdk](https://img.shields.io/badge/polkadot--sdk-stable2512-blue)
![polkadot-sdk](https://img.shields.io/badge/polkadot--sdk-stable2603-blue)
[![language](https://img.shields.io/badge/language-Rust-239120)]()
[![OS](https://img.shields.io/badge/OS-linux%2C%20macOS-0078D4)]()
[![CPU](https://img.shields.io/badge/CPU-x64%2C%20ARM64-FF8C00)]()
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This changelog is based on [Keep A Changelog](https://keepachangelog.com/en/1.1.
## Changed

* Updated polkadot-sdk dependency to polkadot-stable2512-3.
* Updated polkadot-sdk dependency to polkadot-stable2503.

## Removed

Expand Down
12 changes: 9 additions & 3 deletions demo/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use partner_chains_db_sync_data_sources::register_metrics_warn_errors;
use partner_chains_demo_runtime::{self, RuntimeApi, opaque::Block};
use sc_client_api::BlockBackend;
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_consensus_grandpa::SharedVoterState;
use sc_consensus_grandpa::{GrandpaPruningFilter, SharedVoterState};
pub use sc_executor::WasmExecutor;
use sc_partner_chains_consensus_aura::import_queue as partner_chains_aura_import_queue;
use sc_service::{Configuration, TaskManager, WarpSyncConfig, error::Error as ServiceError};
Expand Down Expand Up @@ -50,8 +50,12 @@ pub fn new_pc_command_deps(
.block_on(crate::data_sources::create_cached_data_sources(None))
})?;
let executor = sc_service::new_wasm_executor(&config.executor);
let (client, _, _, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(config, None, executor)?;
let (client, _, _, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
None,
executor,
vec![Arc::new(GrandpaPruningFilter)],
)?;
let client = Arc::new(client);
Ok((client, task_manager, data_sources.authority_selection))
}
Expand Down Expand Up @@ -106,6 +110,7 @@ pub fn new_partial(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
vec![Arc::new(GrandpaPruningFilter)],
)?;
let client = Arc::new(client);

Expand Down Expand Up @@ -246,6 +251,7 @@ pub async fn new_full_base<Network: sc_network::NetworkBackend<Block, <Block as
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
spawn_essential_handle: task_manager.spawn_essential_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync_config: Some(WarpSyncConfig::WithProvider(warp_sync)),
Expand Down
9 changes: 6 additions & 3 deletions demo/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,13 @@ impl_runtime_apis! {
}

impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
fn generate_session_keys(
owner: Vec<u8>,
seed: Option<Vec<u8>>,
) -> sp_session::OpaqueGeneratedSessionKeys {
// despite being named "generate" this function also adds generated keys to local keystore
opaque::CrossChainKey::generate(seed.clone());
opaque::SessionKeys::generate(seed)
let _ = opaque::CrossChainKey::generate(&owner, seed.clone());
opaque::SessionKeys::generate(&owner, seed).into()
}

fn decode_session_keys(
Expand Down
36 changes: 12 additions & 24 deletions substrate-extensions/aura/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,18 +379,14 @@ mod tests {
use sc_keystore::LocalKeystore;
use sc_network_test::{Block as TestBlock, *};
use sp_application_crypto::{AppCrypto, key_types::AURA};
use sp_consensus::{DisableProofRecording, NoNetwork as DummyOracle, Proposal};
use sp_consensus::{NoNetwork as DummyOracle, Proposal, ProposeArgs};
use sp_consensus_aura::SlotDuration;
use sp_consensus_aura::inherents::InherentDataProvider;
use sp_consensus_aura::sr25519::AuthorityPair;
use sp_inherents::InherentData;
use sp_keyring::sr25519::Keyring;
use sp_keystore::Keystore;
use sp_partner_chains_consensus_aura::CurrentSlotProvider;
use sp_runtime::{
Digest,
traits::{Block as BlockT, Header as _},
};
use sp_runtime::traits::{Block as BlockT, Header as _};
use sp_timestamp::Timestamp;
use std::{
task::Poll,
Expand Down Expand Up @@ -420,17 +416,10 @@ mod tests {

impl Proposer<TestBlock> for DummyProposer {
type Error = Error;
type Proposal = future::Ready<Result<Proposal<TestBlock, ()>, Error>>;
type ProofRecording = DisableProofRecording;
type Proof = ();

fn propose(
self,
_: InherentData,
digests: Digest,
_: Duration,
_: Option<usize>,
) -> Self::Proposal {
type Proposal = future::Ready<Result<Proposal<TestBlock>, Error>>;

fn propose(self, args: ProposeArgs<TestBlock>) -> Self::Proposal {
let ProposeArgs { inherent_digests: digests, .. } = args;
let r = BlockBuilderBuilder::new(&*self.0)
.on_parent_block(self.0.chain_info().best_hash)
.fetch_parent_block_number(&*self.0)
Expand All @@ -440,11 +429,9 @@ mod tests {
.unwrap()
.build();

future::ready(r.map(|b| Proposal {
block: b.block,
proof: (),
storage_changes: b.storage_changes,
}))
future::ready(
r.map(|b| Proposal { block: b.block, storage_changes: b.storage_changes }),
)
}
}

Expand Down Expand Up @@ -697,19 +684,20 @@ mod tests {

let head = client.expect_header(client.info().genesis_hash).unwrap();

let res = worker
let block = worker
.on_slot(SlotInfo {
slot: 0.into(),
ends_at: Instant::now() + Duration::from_secs(100),
create_inherent_data: Box::new(()),
duration: Duration::from_millis(1000),
chain_head: head,
block_size_limit: None,
storage_proof_recorder: None,
})
.await
.unwrap();

// The returned block should be imported and we should be able to get its header by now.
assert!(client.header(res.block.hash()).unwrap().is_some());
assert!(client.header(block.hash()).unwrap().is_some());
}
}
61 changes: 32 additions & 29 deletions substrate-extensions/aura/primitives/src/block_proposal.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use crate::InherentDigest;
use futures::FutureExt;
use sp_consensus::{Environment, Proposer};
use sp_inherents::InherentData;
use sp_consensus::{Environment, ProposeArgs, Proposer};
use sp_runtime::traits::Block as BlockT;
use sp_runtime::{Digest, DigestItem};
use std::future::Future;
use std::marker::PhantomData;
use std::time;

/// Proposer factory for PartnerChainsProposer. Allows passing ID: InherentDigest type parameter.
pub struct PartnerChainsProposerFactory<B: BlockT, E: Environment<B>, ID> {
Expand Down Expand Up @@ -52,23 +50,29 @@ impl<B: BlockT, P: Proposer<B>, ID: InherentDigest> Proposer<B>
{
type Error = <P as Proposer<B>>::Error;
type Proposal = <P as Proposer<B>>::Proposal;
type ProofRecording = <P as Proposer<B>>::ProofRecording;
type Proof = <P as Proposer<B>>::Proof;

fn propose(
self,
inherent_data: InherentData,
inherent_digests: Digest,
max_duration: time::Duration,
block_size_limit: Option<usize>,
) -> Self::Proposal {

fn propose(self, args: ProposeArgs<B>) -> Self::Proposal {
let ProposeArgs {
inherent_data,
inherent_digests,
max_duration,
block_size_limit,
storage_proof_recorder,
extra_extensions,
} = args;
let mut logs: Vec<DigestItem> = Vec::from(inherent_digests.logs());
// It is a programmatic error to try to propose a block that has inherent data from which declared InherentDigest cannot be created.
let mut inherent_logs = ID::from_inherent_data(&inherent_data)
.expect("InherentDigest can be created from inherent data");
logs.append(&mut inherent_logs);
self.proposer
.propose(inherent_data, Digest { logs }, max_duration, block_size_limit)
self.proposer.propose(ProposeArgs {
inherent_data,
inherent_digests: Digest { logs },
max_duration,
block_size_limit,
storage_proof_recorder,
extra_extensions,
})
}
}

Expand All @@ -77,7 +81,7 @@ mod tests {
use crate::InherentDigest;
use crate::block_proposal::PartnerChainsProposer;
use futures::future;
use sp_consensus::{DisableProofRecording, Proposal, Proposer};
use sp_consensus::{Proposal, ProposeArgs, Proposer};
use sp_inherents::InherentData;
use sp_runtime::generic::Header;
use sp_runtime::traits::BlakeTwo256;
Expand Down Expand Up @@ -118,17 +122,10 @@ mod tests {

impl Proposer<Block> for TestProposer {
type Error = sp_blockchain::Error;
type Proposal = future::Ready<Result<Proposal<Block, ()>, sp_blockchain::Error>>;
type ProofRecording = DisableProofRecording;
type Proof = ();

fn propose(
self,
_inherent_data: InherentData,
inherent_digests: Digest,
_max_duration: std::time::Duration,
_block_size_limit: Option<usize>,
) -> Self::Proposal {
type Proposal = future::Ready<Result<Proposal<Block>, sp_blockchain::Error>>;

fn propose(self, args: ProposeArgs<Block>) -> Self::Proposal {
let inherent_digests = args.inherent_digests;
let result = if inherent_digests != self.expected_digest {
Err(sp_blockchain::Error::Application(
"Inherent digest does not match expected digest".into(),
Expand All @@ -144,7 +141,7 @@ mod tests {
},
extrinsics: Default::default(),
};
Ok(Proposal { block, proof: (), storage_changes: Default::default() })
Ok(Proposal { block, storage_changes: Default::default() })
};
futures::future::ready(result)
}
Expand All @@ -159,7 +156,13 @@ mod tests {
let proposer: PartnerChainsProposer<Block, TestProposer, TestInherentDigest> =
PartnerChainsProposer::new(test_proposer);
let proposal = proposer
.propose(inherent_data, inherent_digests, std::time::Duration::from_secs(0), None)
.propose(ProposeArgs {
inherent_data,
inherent_digests,
max_duration: std::time::Duration::from_secs(0),
block_size_limit: None,
..Default::default()
})
.into_inner();
assert!(proposal.is_ok());
}
Expand Down
5 changes: 1 addition & 4 deletions toolkit/block-participation/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ impl<BlockProducerId, DelegatorId> BlockProductionData<BlockProducerId, Delegato
/// Error type returned by the Block Participation pallet's inherent
#[derive(Encode, PartialEq)]
#[cfg_attr(not(feature = "std"), derive(Debug))]
#[cfg_attr(
feature = "std",
derive(Decode, DecodeWithMemTracking, thiserror::Error, sp_runtime::RuntimeDebug)
)]
#[cfg_attr(feature = "std", derive(Debug, Decode, DecodeWithMemTracking, thiserror::Error))]
pub enum InherentError {
/// Indicates that inherent was not produced when expected
#[cfg_attr(feature = "std", error("Block participation inherent not produced when expected"))]
Expand Down
2 changes: 1 addition & 1 deletion toolkit/block-production-log/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"blprdlog";
/// Error type used for failing calls of the block production log feature's inherent.
#[derive(Encode, PartialEq)]
#[cfg_attr(not(feature = "std"), derive(Debug))]
#[cfg_attr(feature = "std", derive(Decode, thiserror::Error, sp_runtime::RuntimeDebug))]
#[cfg_attr(feature = "std", derive(Debug, Decode, thiserror::Error))]
pub enum InherentError {
/// Inherent was not produced when expected
#[cfg_attr(
Expand Down
2 changes: 1 addition & 1 deletion toolkit/committee-selection/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use sp_inherents::{InherentIdentifier, IsFatalError};
/// Inherent identifier used by the Committee Selection pallet
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"/ariadne";

#[derive(Encode, sp_runtime::RuntimeDebug, PartialEq, Eq)]
#[derive(Debug, Encode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Decode, thiserror::Error))]
/// Error type used for failing calls of the Committee Selection inherent.
pub enum InherentError {
Expand Down
4 changes: 2 additions & 2 deletions toolkit/sidechain/domain/src/mainchain_epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ fn default_slot_duration() -> Duration {
}

/// Error type returned by calculations related to Cardano epochs and slots
#[derive(Encode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Decode, thiserror::Error, sp_core::RuntimeDebug))]
#[derive(Debug, Encode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Decode, thiserror::Error))]
pub enum EpochDerivationError {
/// Signals that a function was passed a timestamp before the first Shelley era
#[cfg_attr(feature = "std", error("Timestamp before first Mainchain Epoch"))]
Expand Down
Loading