Skip to content

Commit

Permalink
Merge branch 'dev' into p-1240-implement-access-control-for-accountst…
Browse files Browse the repository at this point in the history
…ore-members-in-the
  • Loading branch information
BillyWooo authored Dec 18, 2024
2 parents 77b71a5 + 07a5a23 commit 35786aa
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 8 deletions.
1 change: 1 addition & 0 deletions common/primitives/core/src/teebag/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub enum AttestationType {
pub enum WorkerType {
#[default]
Identity,
BitAcross,
OmniExecutor,
}

Expand Down
17 changes: 17 additions & 0 deletions parachain/Cargo.lock

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

4 changes: 3 additions & 1 deletion parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
'node',
'pallets/account-fix',
'pallets/bitacross',
'pallets/bridge/assets-handler',
'pallets/bridge/chain-bridge',
'pallets/bridge/bridge-transfer',
Expand Down Expand Up @@ -167,11 +168,11 @@ sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "sta
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }

substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }

# wasm
Expand Down Expand Up @@ -273,6 +274,7 @@ paseo-parachain-runtime = { path = "runtime/paseo", default-features = false }
pallet-account-fix = { path = "pallets/account-fix", default-features = false }
pallet-asset-manager = { path = "pallets/xcm-asset-manager", default-features = false }
pallet-assets-handler = { path = "pallets/bridge/assets-handler", default-features = false }
pallet-bitacross = { path = "pallets/bitacross", default-features = false }
pallet-chain-bridge = { path = "pallets/bridge/chain-bridge", default-features = false }
pallet-bridge-common = { path = "pallets/bridge/common", default-features = false }
pallet-bridge-transfer = { path = "pallets/bridge/bridge-transfer", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion parachain/node/src/chain_specs/paseo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::*;
use core_primitives::PASEO_PARA_ID;
use cumulus_primitives_core::ParaId;
use paseo_parachain_runtime::{
AccountId, AuraId, Balance, BalancesConfig, CouncilMembershipConfig,
AccountId, AuraId, Balance, BalancesConfig, BitacrossConfig, CouncilMembershipConfig,
DeveloperCommitteeMembershipConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, RuntimeGenesisConfig, SessionConfig, SudoConfig,
TechnicalCommitteeMembershipConfig, TeebagConfig, TeebagOperationalMode, VCManagementConfig,
Expand Down Expand Up @@ -227,6 +227,7 @@ fn generate_genesis(
admin: Some(root_key.clone()),
mode: TeebagOperationalMode::Development,
},
bitacross: BitacrossConfig { admin: Some(root_key) },
score_staking: Default::default(),
};

Expand Down
100 changes: 100 additions & 0 deletions parachain/node/src/custom_txpool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
use futures::Future;
use sc_transaction_pool_api::{
ImportNotificationStream, PoolFuture, PoolStatus, ReadyTransactions, TransactionFor,
TransactionPool, TransactionSource, TransactionStatusStreamFor, TxHash,
};
use sp_runtime::traits::{Block as BlockT, NumberFor};
use std::{collections::HashMap, pin::Pin, sync::Arc};

pub struct CustomPool<I> {
inner_pool: Arc<I>,
}

impl<I> CustomPool<I> {
pub fn new(inner_pool: Arc<I>) -> Self {
Self { inner_pool }
}
}

impl<I> TransactionPool for CustomPool<I>
where
I: TransactionPool,
{
type Block = I::Block;
type Hash = I::Hash;
type InPoolTransaction = I::InPoolTransaction;
type Error = I::Error;

fn submit_at(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xts: Vec<TransactionFor<Self>>,
) -> PoolFuture<Vec<Result<TxHash<Self>, Self::Error>>, Self::Error> {
self.inner_pool.submit_at(at, source, xts)
}

fn submit_one(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xt: TransactionFor<Self>,
) -> PoolFuture<TxHash<Self>, Self::Error> {
self.inner_pool.submit_one(at, source, xt)
}

fn submit_and_watch(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xt: TransactionFor<Self>,
) -> PoolFuture<Pin<Box<TransactionStatusStreamFor<Self>>>, Self::Error> {
self.inner_pool.submit_and_watch(at, source, xt)
}

fn remove_invalid(&self, _: &[TxHash<Self>]) -> Vec<Arc<Self::InPoolTransaction>> {
// Don't do anything on purpose.
Vec::new()
}

fn status(&self) -> PoolStatus {
self.inner_pool.status()
}

fn import_notification_stream(&self) -> ImportNotificationStream<TxHash<Self>> {
self.inner_pool.import_notification_stream()
}

fn hash_of(&self, xt: &TransactionFor<Self>) -> TxHash<Self> {
self.inner_pool.hash_of(xt)
}

fn on_broadcasted(&self, propagations: HashMap<TxHash<Self>, Vec<String>>) {
self.inner_pool.on_broadcasted(propagations)
}

fn ready_transaction(&self, hash: &TxHash<Self>) -> Option<Arc<Self::InPoolTransaction>> {
self.inner_pool.ready_transaction(hash)
}

fn ready_at(
&self,
at: NumberFor<Self::Block>,
) -> Pin<
Box<
dyn Future<
Output = Box<dyn ReadyTransactions<Item = Arc<Self::InPoolTransaction>> + Send>,
> + Send,
>,
> {
self.inner_pool.ready_at(at)
}

fn ready(&self) -> Box<dyn ReadyTransactions<Item = Arc<Self::InPoolTransaction>> + Send> {
self.inner_pool.ready()
}

fn futures(&self) -> Vec<Self::InPoolTransaction> {
self.inner_pool.futures()
}
}
1 change: 1 addition & 0 deletions parachain/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
mod chain_specs;
mod cli;
mod command;
mod custom_txpool;
mod evm_tracing_types;
mod rpc;
mod service;
Expand Down
16 changes: 14 additions & 2 deletions parachain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,11 +749,17 @@ where
let select_chain = maybe_select_chain
.expect("In `standalone` mode, `new_partial` will return some `select_chain`; qed");

// TODO: use fork-aware txpool when paritytech/polkadot-sdk#4639 is included in a stable release
// presumably in stable2412
// This is a workaround mentioned in https://github.com/paritytech/polkadot-sdk/issues/1202
let custom_txpool =
std::sync::Arc::new(crate::custom_txpool::CustomPool::new(transaction_pool.clone()));

if role.is_authority() {
let proposer_factory = sc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool.clone(),
custom_txpool,
None,
None,
);
Expand Down Expand Up @@ -1059,10 +1065,16 @@ where
+ cumulus_primitives_aura::AuraUnincludedSegmentApi<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block>,
{
// TODO: use fork-aware txpool when paritytech/polkadot-sdk#4639 is included in a stable release
// presumably in stable2412
// This is a workaround mentioned in https://github.com/paritytech/polkadot-sdk/issues/1202
let custom_txpool =
std::sync::Arc::new(crate::custom_txpool::CustomPool::new(transaction_pool.clone()));

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
custom_txpool,
prometheus_registry,
telemetry.clone(),
);
Expand Down
4 changes: 4 additions & 0 deletions parachain/runtime/paseo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ pallet-account-fix = { workspace = true }
pallet-asset-manager = { workspace = true }
pallet-assets = { workspace = true }
pallet-assets-handler = { workspace = true }
pallet-bitacross = { workspace = true }
pallet-bridge-transfer = { workspace = true }
pallet-chain-bridge = { workspace = true }
pallet-evm-assertions = { workspace = true }
Expand Down Expand Up @@ -165,6 +166,7 @@ runtime-benchmarks = [
"pallet-asset-manager/runtime-benchmarks",
"pallet-assets-handler/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-bitacross/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-bounties/runtime-benchmarks",
"pallet-bridge-transfer/runtime-benchmarks",
Expand Down Expand Up @@ -252,6 +254,7 @@ std = [
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-bitacross/std",
"pallet-bounties/std",
"pallet-bridge-transfer/std",
"pallet-chain-bridge/std",
Expand Down Expand Up @@ -358,6 +361,7 @@ try-runtime = [
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-bitacross/try-runtime",
"pallet-bounties/try-runtime",
"pallet-bridge-transfer/try-runtime",
"pallet-chain-bridge/try-runtime",
Expand Down
10 changes: 9 additions & 1 deletion parachain/runtime/paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_name: create_runtime_str!("paseo-parachain"),
authoring_version: 1,
// same versioning-mechanism as polkadot: use last digit for minor updates
spec_version: 9220,
spec_version: 9221,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -1253,6 +1253,12 @@ impl pallet_omni_account::Config for Runtime {
type Permission = OmniAccountPermission;
}

impl pallet_bitacross::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type TEECallOrigin = EnsureEnclaveSigner<Runtime>;
type SetAdminOrigin = EnsureRootOrAllCouncil;
}

impl pallet_evm_assertions::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AssertionId = H160;
Expand Down Expand Up @@ -1454,6 +1460,7 @@ construct_runtime! {
VCManagement: pallet_vc_management = 66,
IMPExtrinsicWhitelist: pallet_group::<Instance1> = 67,
VCMPExtrinsicWhitelist: pallet_group::<Instance2> = 68,
Bitacross: pallet_bitacross = 70,
EvmAssertions: pallet_evm_assertions = 71,

// Developer council
Expand Down Expand Up @@ -1583,6 +1590,7 @@ impl Contains<RuntimeCall> for NormalModeFilter {
// AccountFix
RuntimeCall::AccountFix(_) |
RuntimeCall::AssetsHandler(_) |
RuntimeCall::Bitacross(_) |
RuntimeCall::EvmAssertions(_) |
RuntimeCall::ScoreStaking(_) |
RuntimeCall::OmniAccount(_) |
Expand Down
1 change: 0 additions & 1 deletion parachain/zombienet/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ args = [
"--force-authoring",
"--enable-evm-rpc",
"--state-pruning=archive",
"--delayed-best-block",
"-l=parachain=debug,txpool=trace"
]
ws_port = {{COLLATOR_WS_PORT}}
4 changes: 4 additions & 0 deletions tee-worker/identity/client-api/parachain-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.21-next.0] - 2024-12-17

- Update for version [parachain-release v0.9.21-01](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.21-01)

## Added

- Type definitions for the new OmniAccount Pallet under the name of `omniAccount`.
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/identity/client-api/parachain-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/src/index.js",
"module": "dist/src/index.js",
"sideEffects": false,
"version": "0.9.20-next.10",
"version": "0.9.21-next.0",
"scripts": {
"clean": "rm -rf dist build node_modules",
"update-metadata": "curl -s -H \"Content-Type: application/json\" -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9944 > prepare-build/litentry-parachain-metadata.json",
Expand Down
4 changes: 4 additions & 0 deletions tee-worker/identity/client-api/sidechain-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.21-next.0] - 2024-12-17

- Update for version [parachain-release v0.9.21-01](https://github.com/litentry/litentry-parachain/releases/tag/v0.9.21-01)

## Added

- Type definitions for the new OmniAccount Pallet.
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/identity/client-api/sidechain-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/src/index.js",
"module": "dist/src/index.js",
"sideEffects": false,
"version": "0.9.20-next.8",
"version": "0.9.21-next.0",
"scripts": {
"clean": "rm -rf dist build node_modules",
"update-metadata": "../../bin/litentry-cli print-sgx-metadata-raw > prepare-build/litentry-sidechain-metadata.json",
Expand Down

0 comments on commit 35786aa

Please sign in to comment.