Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor container chain spawning logic to not need require embeded node outside of collation #627

Merged
merged 13 commits into from
Jul 23, 2024
Merged
110 changes: 56 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ tanssi-relay-encoder = { path = "runtime/relay-encoder", default-features = fals
tanssi-relay-service = { path = "solo-chains/node/tanssi-relay-service", default-features = false }
tanssi-runtime-common = { path = "runtime/common", default-features = false }
tc-consensus = { path = "client/consensus" }
tc-orchestrator-chain-rpc-interface = { path = "client/orchestrator-chain-rpc-interface" }
tp-author-noting-inherent = { path = "primitives/author-noting-inherent", default-features = false }
tp-container-chain-genesis-data = { path = "primitives/container-chain-genesis-data", default-features = false }
tp-fungibles-ext = { path = "primitives/fungibles-ext", default-features = false }
tp-maths = { path = "primitives/maths", default-features = false }
tp-traits = { path = "primitives/traits", default-features = false }
Expand All @@ -108,9 +108,11 @@ pallet-cc-authorities-noting = { git = "https://github.com/moondance-labs/dancek
pallet-xcm-executor-utils = { git = "https://github.com/moondance-labs/dancekit", branch = "tanssi-polkadot-v1.11.0", default-features = false }
test-relay-sproof-builder = { git = "https://github.com/moondance-labs/dancekit", branch = "tanssi-polkadot-v1.11.0", default-features = false }

# dp-container-chain-genesis-data = { git = "https://github.com/moondance-labs/dancekit", branch = "tanssi-polkadot-v1.11.0", default-features = false}
dp-container-chain-genesis-data = { path = "/home/nanocryk/Documents/Tanssi/dancekit/primitives/container-chain-genesis-data", default-features = false }
nanocryk marked this conversation as resolved.
Show resolved Hide resolved

# Dancekit (client)
dc-orchestrator-chain-interface = { git = "https://github.com/moondance-labs/dancekit", branch = "tanssi-polkadot-v1.11.0" }
dc-orchestrator-chain-rpc-interface = { git = "https://github.com/moondance-labs/dancekit", branch = "tanssi-polkadot-v1.11.0" }

# Moonkit (wasm)
async-backing-primitives = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.11.0", default-features = false }
Expand Down Expand Up @@ -205,6 +207,7 @@ sc-network-test = { git = "https://github.com/moondance-labs/polkadot-sdk", bran
sc-network-transactions = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0" }
sc-offchain = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0" }
sc-rpc = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0" }
sc-rpc-api = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0", default-features = false }
sc-service = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0" }
sc-sysinfo = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0" }
sc-telemetry = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.11.0" }
Expand Down Expand Up @@ -341,6 +344,7 @@ similar-asserts = "1.1.0"
tempfile = "3.1.0"
thiserror = { version = "1.0.48" }
tokio = { version = "1.32.0", default-features = false }
tokio-stream = "0.1.15"
tokio-util = { version = "0.7.10", default-features = false }
tracing = { version = "0.1.37", default-features = false }
tracing-subscriber = { version = "0.3.18" }
Expand Down
5 changes: 2 additions & 3 deletions client/consensus/src/collators/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>.

use crate::collators::ClaimMode;
use {
crate::{
collators as collator_util, consensus_orchestrator::RetrieveAuthoritiesFromOrchestrator,
OrchestratorAuraWorkerAuxData,
collators as collator_util, collators::ClaimMode,
consensus_orchestrator::RetrieveAuthoritiesFromOrchestrator, OrchestratorAuraWorkerAuxData,
},
cumulus_client_collator::{
relay_chain_driven::CollationRequest, service::ServiceInterface as CollatorServiceInterface,
Expand Down
24 changes: 11 additions & 13 deletions client/consensus/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,9 @@
//! The main limitation is block propagation time - i.e. the new blocks created by an author
//! must be propagated to the next author before their turn.

use crate::collators::ClaimMode;
use nimbus_primitives::NimbusId;
use pallet_xcm_core_buyer_runtime_api::{BuyingError, XCMCoreBuyerApi};
use sp_api::ApiError;
use sp_blockchain::HeaderMetadata;
use sp_runtime::traits::BlockIdTo;
use sp_runtime::transaction_validity::TransactionSource;
use sp_transaction_pool::runtime_api::TaggedTransactionQueue;
use tp_xcm_core_buyer::{BuyCollatorProofCreationError, BuyCoreCollatorProof};
use {
crate::{
collators::{self as collator_util, tanssi_claim_slot, SlotClaim},
collators::{self as collator_util, tanssi_claim_slot, ClaimMode, SlotClaim},
consensus_orchestrator::RetrieveAuthoritiesFromOrchestrator,
OrchestratorAuraWorkerAuxData,
},
Expand All @@ -59,6 +50,8 @@ use {
},
cumulus_relay_chain_interface::RelayChainInterface,
futures::{channel::oneshot, prelude::*},
nimbus_primitives::NimbusId,
pallet_xcm_core_buyer_runtime_api::{BuyingError, XCMCoreBuyerApi},
parity_scale_codec::{Codec, Encode},
polkadot_node_primitives::SubmitCollationParams,
polkadot_node_subsystem::messages::{
Expand All @@ -70,17 +63,22 @@ use {
sc_consensus::BlockImport,
sc_consensus_slots::InherentDataProviderExt,
sc_transaction_pool_api::TransactionPool,
sp_api::ProvideRuntimeApi,
sp_blockchain::HeaderBackend,
sp_api::{ApiError, ProvideRuntimeApi},
sp_blockchain::{HeaderBackend, HeaderMetadata},
sp_consensus::SyncOracle,
sp_consensus_aura::{Slot, SlotDuration},
sp_core::crypto::Pair,
sp_inherents::CreateInherentDataProviders,
sp_keystore::KeystorePtr,
sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member},
sp_runtime::{
traits::{Block as BlockT, BlockIdTo, Header as HeaderT, Member},
transaction_validity::TransactionSource,
},
sp_transaction_pool::runtime_api::TaggedTransactionQueue,
std::{convert::TryFrom, error::Error, sync::Arc, time::Duration},
tokio::select,
tokio_util::sync::CancellationToken,
tp_xcm_core_buyer::{BuyCollatorProofCreationError, BuyCoreCollatorProof},
};

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/src/consensus_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
//! It is identical to AuraWorker and AuraConsensus, except for the fact that we re-implement
//! the ParachainConsensus trait to access the orchestrator-dicated authorities, and further
//! it implements the TanssiWorker to TanssiOnSlot trait. This trait is
use tp_traits::SlotFrequency;
use {
crate::{AuthorityId, Pair},
sp_runtime::traits::Block as BlockT,
tp_traits::SlotFrequency,
};

#[async_trait::async_trait]
Expand Down
6 changes: 4 additions & 2 deletions client/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ where
slot_frequency
}

use nimbus_primitives::{NimbusId, NimbusPair, NIMBUS_KEY_ID};
use tp_traits::SlotFrequency;
use {
nimbus_primitives::{NimbusId, NimbusPair, NIMBUS_KEY_ID},
tp_traits::SlotFrequency,
};

/// Grab the first eligible nimbus key from the keystore
/// If multiple keys are eligible this function still only returns one
Expand Down
5 changes: 2 additions & 3 deletions client/consensus/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
// This tests have been greatly influenced by
// https://github.com/paritytech/substrate/blob/master/client/consensus/aura/src/lib.rs#L832
// Most of the items hereby added are intended to make it work with our current consensus mechanism
use crate::collators::ClaimMode;
use tp_traits::SlotFrequency;
use {
crate::{
collators::{tanssi_claim_slot, Collator, Params as CollatorParams},
collators::{tanssi_claim_slot, ClaimMode, Collator, Params as CollatorParams},
OrchestratorAuraWorkerAuxData,
},
async_trait::async_trait,
Expand Down Expand Up @@ -73,6 +71,7 @@ use {
time::Duration,
},
substrate_test_runtime_client::TestClient,
tp_traits::SlotFrequency,
};

// Duration of slot time
Expand Down
39 changes: 39 additions & 0 deletions client/orchestrator-chain-rpc-interface/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "tc-orchestrator-chain-rpc-interface"
authors = { workspace = true }
edition = "2021"
license = "GPL-3.0-only"
version = "0.1.0"

[dependencies]
async-io = { workspace = true }
async-trait = { workspace = true }
futures = { workspace = true }
jsonrpsee = { workspace = true, features = [ "ws-client" ] }
schnellru = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = [ "sync" ] }
tokio-stream = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }

# Dancekit
dc-orchestrator-chain-interface = { workspace = true }
dp-container-chain-genesis-data = { workspace = true }
dp-core = { workspace = true }

# Substrate
parity-scale-codec = { workspace = true }
sc-client-api = { workspace = true }
sc-rpc-api = { workspace = true }
sc-service = { workspace = true }
sp-api = { workspace = true, features = [ "std" ] }
sp-blockchain = { workspace = true }
sp-core = { workspace = true }
sp-state-machine = { workspace = true, features = [ "std" ] }
sp-storage = { workspace = true }

# Polkadot
polkadot-overseer = { workspace = true }
Loading
Loading