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

Add teebag and bitacross to litentry runtime #2859

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

13 changes: 10 additions & 3 deletions node/src/chain_specs/litentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
use super::*;
use cumulus_primitives_core::ParaId;
use litentry_parachain_runtime::{
AccountId, AuraId, Balance, BalancesConfig, CouncilMembershipConfig, GenesisConfig,
ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, SessionConfig, SystemConfig,
TechnicalCommitteeMembershipConfig, UNIT, WASM_BINARY,
AccountId, AuraId, Balance, BalancesConfig, BitacrossConfig, CouncilMembershipConfig,
GenesisConfig, ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, SessionConfig,
SystemConfig, TechnicalCommitteeMembershipConfig, TeebagConfig, TeebagOperationalMode, UNIT,
WASM_BINARY,
};
use sc_service::ChainType;
use sc_telemetry::TelemetryEndpoints;
Expand Down Expand Up @@ -230,5 +231,11 @@ fn generate_genesis(
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
transaction_payment: Default::default(),
tokens: Default::default(),
teebag: TeebagConfig {
allow_sgx_debug_mode: true,
admin: None,
mode: TeebagOperationalMode::Development,
},
bitacross: BitacrossConfig { admin: None },
}
}
5 changes: 5 additions & 0 deletions runtime/litentry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ frame-system-benchmarking = { workspace = true, optional = true }
core-primitives = { workspace = true }
pallet-account-fix = { workspace = true }
pallet-asset-manager = { workspace = true }
pallet-bitacross = { workspace = true }
pallet-bridge = { workspace = true }
pallet-bridge-transfer = { workspace = true }
pallet-extrinsic-filter = { workspace = true }
pallet-parachain-staking = { workspace = true }
pallet-teebag = { workspace = true }
runtime-common = { workspace = true }

fp-rpc = { workspace = true }
Expand Down Expand Up @@ -124,6 +126,7 @@ runtime-benchmarks = [
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-teebag/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
Expand Down Expand Up @@ -208,6 +211,8 @@ std = [
"pallet-bridge/std",
"pallet-bridge-transfer/std",
"pallet-extrinsic-filter/std",
"pallet-bitacross/std",
"pallet-teebag/std",
"moonbeam-evm-tracer/std",
"moonbeam-rpc-primitives-debug/std",
"moonbeam-rpc-primitives-txpool/std",
Expand Down
33 changes: 30 additions & 3 deletions runtime/litentry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@ pub use core_primitives::{
opaque, AccountId, Amount, AssetId, Balance, BlockNumber, Hash, Header, Index, Signature, DAYS,
HOURS, MINUTES, SLOT_DURATION,
};
use pallet_ethereum::TransactionStatus;
pub use runtime_common::currency::*;
use runtime_common::{
impl_runtime_transaction_payment_fees, prod_or_fast, BlockHashCount, BlockLength,
CouncilInstance, CouncilMembershipInstance, EnsureRootOrAllCouncil,
CouncilInstance, CouncilMembershipInstance, EnsureEnclaveSigner, EnsureRootOrAllCouncil,
EnsureRootOrAllTechnicalCommittee, EnsureRootOrHalfCouncil, EnsureRootOrHalfTechnicalCommittee,
EnsureRootOrTwoThirdsCouncil, EnsureRootOrTwoThirdsTechnicalCommittee, NegativeImbalance,
RuntimeBlockWeights, SlowAdjustingFeeUpdate, TechnicalCommitteeInstance,
TechnicalCommitteeMembershipInstance, MAXIMUM_BLOCK_WEIGHT,
};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};

use pallet_ethereum::TransactionStatus;
// for TEE
pub use pallet_balances::Call as BalancesCall;
pub use pallet_teebag::{self, OperationalMode as TeebagOperationalMode};

// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
Expand Down Expand Up @@ -842,6 +846,23 @@ impl pallet_extrinsic_filter::Config for Runtime {
type WeightInfo = weights::pallet_extrinsic_filter::WeightInfo<Runtime>;
}

parameter_types! {
pub const MomentsPerDay: Moment = 86_400_000; // [ms/d]
}

impl pallet_teebag::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MomentsPerDay = MomentsPerDay;
type SetAdminOrigin = EnsureRootOrHalfCouncil;
type MaxEnclaveIdentifier = ConstU32<3>;
}

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

impl runtime_common::BaseRuntimeRequirements for Runtime {}

impl runtime_common::ParaRuntimeRequirements for Runtime {}
Expand Down Expand Up @@ -912,6 +933,8 @@ construct_runtime! {
BridgeTransfer: pallet_bridge_transfer = 61,
ExtrinsicFilter: pallet_extrinsic_filter = 63,
AssetManager: pallet_asset_manager = 64,
Teebag: pallet_teebag = 65,
Bitacross: pallet_bitacross = 66,

// TMP
AccountFix: pallet_account_fix = 254,
Expand Down Expand Up @@ -977,7 +1000,11 @@ impl Contains<RuntimeCall> for NormalModeFilter {
// Balance
RuntimeCall::Balances(_) |
// AccountFix
RuntimeCall::AccountFix(_)
RuntimeCall::AccountFix(_) |
// TEE enclave management
RuntimeCall::Teebag(_) |
// Bitacross
RuntimeCall::Bitacross(_)
)
}
}
Expand Down
Loading