Skip to content

Commit

Permalink
Add pallet-omni-bridge to litentry runtime (#3229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kailai-Wang authored Jan 13, 2025
1 parent 638b2f1 commit 342f535
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 44 deletions.
24 changes: 1 addition & 23 deletions parachain/Cargo.lock

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

8 changes: 5 additions & 3 deletions parachain/node/src/chain_specs/litentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ use super::*;
use cumulus_primitives_core::ParaId;
use litentry_parachain_runtime::{
AccountId, AuraId, Balance, BalancesConfig, CouncilMembershipConfig,
DeveloperCommitteeMembershipConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, RuntimeGenesisConfig, SessionConfig, TechnicalCommitteeMembershipConfig,
TeebagConfig, TeebagOperationalMode, VCManagementConfig, WASM_BINARY,
DeveloperCommitteeMembershipConfig, OmniBridgeConfig, ParachainInfoConfig,
ParachainStakingConfig, PolkadotXcmConfig, RuntimeGenesisConfig, SessionConfig,
TechnicalCommitteeMembershipConfig, TeebagConfig, TeebagOperationalMode, VCManagementConfig,
WASM_BINARY,
};
use sc_service::ChainType;
use sc_telemetry::TelemetryEndpoints;
Expand Down Expand Up @@ -239,6 +240,7 @@ fn generate_genesis(
mode: TeebagOperationalMode::Development,
},
score_staking: Default::default(),
omni_bridge: OmniBridgeConfig { admin: None, default_relayers: Default::default() },
};

serde_json::to_value(&config).expect("Could not build genesis config")
Expand Down
3 changes: 3 additions & 0 deletions parachain/runtime/litentry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pallet-group = { workspace = true }
pallet-identity-management = { workspace = true }
pallet-omni-account = { workspace = true }
pallet-omni-account-runtime-api = { workspace = true }
pallet-omni-bridge = { workspace = true }
pallet-parachain-staking = { workspace = true }
pallet-score-staking = { workspace = true }
pallet-teebag = { workspace = true }
Expand Down Expand Up @@ -167,6 +168,7 @@ runtime-benchmarks = [
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-omni-account/runtime-benchmarks",
"pallet-omni-bridge/runtime-benchmarks",
"pallet-parachain-staking/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
Expand Down Expand Up @@ -253,6 +255,7 @@ std = [
"pallet-multisig/std",
"pallet-omni-account-runtime-api/std",
"pallet-omni-account/std",
"pallet-omni-bridge/std",
"pallet-parachain-staking/std",
"pallet-preimage/std",
"pallet-proxy/std",
Expand Down
21 changes: 9 additions & 12 deletions parachain/runtime/litentry/src/asset_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.

use super::{weights, AccountId, AssetId, Balance, Balances, Runtime, RuntimeEvent};
use super::{
weights, AccountId, AssetId, Balance, Balances, EnsureRootOrAllTechnicalCommittee, Runtime,
RuntimeEvent,
};
use crate::{
constants::currency::deposit, precompiles::ASSET_PRECOMPILE_ADDRESS_PREFIX, Decode, Encode,
};
use frame_support::{
parameter_types,
traits::{AsEnsureOriginWithArg, ConstU32, NeverEnsureOrigin},
};
use frame_system::EnsureRoot;
use pallet_evm_precompile_assets_erc20::AddressToAssetId;
use parity_scale_codec::Compact;
use runtime_common::{
currency::{DOLLARS, EXISTENTIAL_DEPOSIT},
EnsureRootOrHalfCouncil,
};
use runtime_common::currency::{DOLLARS, EXISTENTIAL_DEPOSIT};
use scale_info::TypeInfo;
use sp_core::{ConstU128, H160};
use sp_std::prelude::*;
Expand Down Expand Up @@ -83,10 +82,8 @@ impl pallet_assets::Config for Runtime {
type Balance = Balance;
type AssetId = AssetId;
type Currency = Balances;
// We do not allow creating by regular users
// CollabAI derivative token do not want it that way
type CreateOrigin = AsEnsureOriginWithArg<NeverEnsureOrigin<AccountId>>;
type ForceOrigin = EnsureRoot<AccountId>;
type CreateOrigin = AsEnsureOriginWithArg<NeverEnsureOrigin<AccountId>>; // will be created internally for now
type ForceOrigin = EnsureRootOrAllTechnicalCommittee;
type AssetDeposit = AssetDeposit;
type MetadataDepositBase = MetadataDepositBase;
type MetadataDepositPerByte = MetadataDepositPerByte;
Expand All @@ -95,7 +92,7 @@ impl pallet_assets::Config for Runtime {
type StringLimit = AssetsStringLimit;
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
type WeightInfo = ();
type RemoveItemsLimit = ConstU32<1000>;
type AssetIdParameter = Compact<AssetId>;
type CallbackHandle = ();
Expand All @@ -113,7 +110,7 @@ impl pallet_asset_manager::Config for Runtime {
type Balance = Balance;
type AssetId = AssetId;
type ForeignAssetType = ForeignAssetType; // TODO
type ForeignAssetModifierOrigin = EnsureRootOrHalfCouncil;
type ForeignAssetModifierOrigin = EnsureRootOrAllTechnicalCommittee;
type Currency = Balances;
type WeightInfo = weights::pallet_asset_manager::WeightInfo<Runtime>;
}
18 changes: 15 additions & 3 deletions parachain/runtime/litentry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use frame_support::{
genesis_builder_helper::{build_state, get_preset},
parameter_types,
traits::{
fungible::{Balanced, Credit, HoldConsideration},
fungible::{self, Balanced, Credit, HoldConsideration, NativeFromLeft, NativeOrWithId},
tokens::imbalance::ResolveTo,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, Contains, EnsureOrigin, Everything,
Expand Down Expand Up @@ -711,7 +711,7 @@ impl pallet_treasury::Config for Runtime {
type BurnDestination = ();
type SpendFunds = Bounties;
type MaxApprovals = ConstU32<64>;
type AssetKind = (); // Only native asset is supported
type AssetKind = (); // Only native asset is supported - TODO: expand it to MultiAssets when required
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
Expand Down Expand Up @@ -1210,6 +1210,16 @@ impl pallet_omni_account::Config for Runtime {
type Permission = OmniAccountPermission;
}

impl pallet_omni_bridge::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetKind = NativeOrWithId<AssetId>; // No XCM assets for now
type Assets =
fungible::UnionOf<Balances, Assets, NativeFromLeft, NativeOrWithId<AssetId>, AccountId>;
type TreasuryAccount = TreasuryAccount;
type SetAdminOrigin = EnsureRootOrHalfCouncil;
}

impl pallet_evm_assertions::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AssertionId = H160;
Expand Down Expand Up @@ -1340,6 +1350,7 @@ construct_runtime! {
IMPExtrinsicWhitelist: pallet_group::<Instance1> = 82,
VCMPExtrinsicWhitelist: pallet_group::<Instance2> = 83,
OmniAccount: pallet_omni_account = 84,
OmniBridge: pallet_omni_bridge = 85,

// Frontier
EVM: pallet_evm = 120,
Expand Down Expand Up @@ -1433,7 +1444,8 @@ impl Contains<RuntimeCall> for NormalModeFilter {
RuntimeCall::AssetsHandler(_) |
RuntimeCall::EvmAssertions(_) |
RuntimeCall::ScoreStaking(_) |
RuntimeCall::OmniAccount(_)
RuntimeCall::OmniAccount(_) |
RuntimeCall::OmniBridge(_)
)
}
}
Expand Down
3 changes: 0 additions & 3 deletions parachain/runtime/paseo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pallet-utility = { workspace = true }
pallet-vesting = { workspace = true }
pallet-whitelist = { workspace = true }

assets-common = { workspace = true }
cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-dmp-queue = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true }
Expand Down Expand Up @@ -221,10 +220,8 @@ runtime-benchmarks = [
"pallet-investing-pool/runtime-benchmarks",
"pallet-pool-proposal/runtime-benchmarks",
"pallet-omni-bridge/runtime-benchmarks",
"assets-common/runtime-benchmarks",
]
std = [
"assets-common/std",
"core-primitives/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
Expand Down

0 comments on commit 342f535

Please sign in to comment.