From 0ec815596720f0ced1ebd8ab0bb3811570b9d15f Mon Sep 17 00:00:00 2001 From: tolak Date: Tue, 16 May 2023 15:26:35 +0800 Subject: [PATCH 1/6] enable sygma bridge in khala&phala --- Cargo.lock | 16 +++++- runtime/khala/Cargo.toml | 25 +++++++-- runtime/khala/src/lib.rs | 109 ++++++++++++++++++++++++++++++++++++--- runtime/phala/Cargo.toml | 25 +++++++-- runtime/phala/src/lib.rs | 109 ++++++++++++++++++++++++++++++++++++--- 5 files changed, 262 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 251fcbf5..538341f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4410,7 +4410,8 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.4.1", + "hex", + "hex-literal", "log", "pallet-assets", "pallet-aura", @@ -4454,6 +4455,7 @@ dependencies = [ "phala-types", "polkadot-parachain", "polkadot-runtime-common", + "primitive-types", "rmrk-traits", "scale-info", "serde", @@ -4473,6 +4475,10 @@ dependencies = [ "static_assertions", "subbridge-pallets", "substrate-wasm-builder", + "sygma-access-segregator", + "sygma-basic-feehandler", + "sygma-bridge", + "sygma-fee-handler-router", "sygma-runtime-api", "sygma-traits", "xcm", @@ -7604,7 +7610,8 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.4.1", + "hex", + "hex-literal", "log", "pallet-assets", "pallet-aura", @@ -7647,6 +7654,7 @@ dependencies = [ "phala-types", "polkadot-parachain", "polkadot-runtime-common", + "primitive-types", "rmrk-traits", "scale-info", "serde", @@ -7666,6 +7674,10 @@ dependencies = [ "static_assertions", "subbridge-pallets", "substrate-wasm-builder", + "sygma-access-segregator", + "sygma-basic-feehandler", + "sygma-bridge", + "sygma-fee-handler-router", "sygma-runtime-api", "sygma-traits", "xcm", diff --git a/runtime/khala/Cargo.toml b/runtime/khala/Cargo.toml index 250f1dd8..b95a205c 100644 --- a/runtime/khala/Cargo.toml +++ b/runtime/khala/Cargo.toml @@ -13,6 +13,9 @@ serde = { version = "1.0.132", optional = true, features = ["derive"] } smallvec = "1.6.1" static_assertions = "1.1.0" +primitive-types = { version = "0.12", default-features = false, features = ["scale-info", "serde_no_std"] } +hex = { version = "0.4.3", default-features = false } + phala-types = { path = "../../crates/phala-types", default-features = false } parachains-common = { path = "../../parachains-common", default-features = false } @@ -92,9 +95,13 @@ pallet-rmrk-market = { git = "https://github.com/Phala-Network/rmrk-substrate", rmrk-traits = { git = "https://github.com/Phala-Network/rmrk-substrate", branch = "polkadot-v0.9.42", default-features = false } pallet-rmrk-rpc-runtime-api = { git = "https://github.com/Phala-Network/rmrk-substrate", branch = "polkadot-v0.9.42", default-features = false } -# Sygma -sygma-traits = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-runtime-api = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +# Sygma dependencies +sygma-traits = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-basic-feehandler = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-bridge = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-access-segregator = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-fee-handler-router = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-runtime-api = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } # Local dependencies assets-registry = { path = "../../pallets/assets-registry", default-features = false } @@ -219,8 +226,14 @@ std = [ "rmrk-traits/std", "pallet-rmrk-rpc-runtime-api/std", "pallet-phala-world/std", - "sygma-runtime-api/std", "pallet-index/std", + "sygma-basic-feehandler/std", + "sygma-traits/std", + "sygma-bridge/std", + "sygma-access-segregator/std", + "sygma-fee-handler-router/std", + "sygma-runtime-api/std", + "primitive-types/std", ] try-runtime = [ @@ -270,6 +283,10 @@ try-runtime = [ "assets-registry/try-runtime", "phala-pallets/try-runtime", "pallet-index/try-runtime", + "sygma-basic-feehandler/try-runtime", + "sygma-bridge/try-runtime", + "sygma-access-segregator/try-runtime", + "sygma-fee-handler-router/try-runtime", ] # A feature that should be enabled when the runtime should be build for on-chain diff --git a/runtime/khala/src/lib.rs b/runtime/khala/src/lib.rs index f72c2e77..9d190b16 100644 --- a/runtime/khala/src/lib.rs +++ b/runtime/khala/src/lib.rs @@ -49,6 +49,7 @@ mod msg_routing; use codec::{Decode, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; +use primitive_types::U256; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ @@ -132,9 +133,9 @@ pub use phala_pallets::{ pub use sp_runtime::BuildStorage; pub use subbridge_pallets::{ chainbridge, dynamic_trader::DynamicWeightTrader, fungible_adapter::XTransferAdapter, helper, - xcmbridge, xtransfer, + sygma_wrapper, xcmbridge, xtransfer, }; -use sygma_traits::{DepositNonce, DomainID}; +use sygma_traits::{ChainID as SygmaChainID, DepositNonce, DomainID, VerifyingContractAddress}; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -309,7 +310,12 @@ construct_runtime! { PWIncubation: pallet_pw_incubation::{Pallet, Call, Storage, Event} = 106, PWMarketplace: pallet_pw_marketplace::{Pallet, Call, Event} = 107, - // 11x kept for Sygma bridge + // Sygma bridge + SygmaAccessSegregator: sygma_access_segregator::{Pallet, Call, Storage, Event} = 111, + SygmaBasicFeeHandler: sygma_basic_feehandler::{Pallet, Call, Storage, Event} = 112, + SygmaBridge: sygma_bridge::{Pallet, Call, Storage, Event} = 113, + SygmaFeeHandlerRouter: sygma_fee_handler_router::{Pallet, Call, Storage, Event} = 114, + SygmaWrapper: sygma_wrapper::{Pallet, Storage, Event} = 115, // inDEX PalletIndex: pallet_index::{Pallet, Call, Storage, Event} = 121, @@ -390,6 +396,10 @@ impl Contains for BaseCallFilter { // Monetary RuntimeCall::Balances { .. } | RuntimeCall::ChainBridge { .. } | + RuntimeCall::SygmaAccessSegregator { .. } | + RuntimeCall::SygmaBasicFeeHandler { .. } | + RuntimeCall::SygmaFeeHandlerRouter { .. } | + RuntimeCall::SygmaBridge { .. } | RuntimeCall::XTransfer { .. } | // Collator RuntimeCall::CollatorSelection(_) | RuntimeCall::Session(_) | @@ -1221,7 +1231,7 @@ impl xcmbridge::Config for Runtime { parameter_types! { pub PHALocation: MultiLocation = MultiLocation::here(); - pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000000001"); + pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000001000"); } impl assets_registry::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -1589,9 +1599,97 @@ impl chainbridge::Config for Runtime { type ResourceIdGenerationSalt = ResourceIdGenerationSalt; } +// This address is provided by Sygma bridge +const DEST_VERIFYING_CONTRACT_ADDRESS: &str = "6CdE2Cd82a4F8B74693Ff5e194c19CA08c2d1c68"; +parameter_types! { + // Make sure put same value with `construct_runtime` + pub const SygmaAccessSegregatorPalletIndex: u8 = 111; + pub const SygmaBasicFeeHandlerPalletIndex: u8 = 112; + pub const SygmaBridgePalletIndex: u8 = 113; + pub const SygmaFeeHandlerRouterPalletIndex: u8 = 114; + // RegisteredExtrinsics here registers all valid (pallet index, extrinsic_name) paris + // make sure to update this when adding new access control extrinsic + pub RegisteredExtrinsics: Vec<(u8, Vec)> = [ + (SygmaAccessSegregatorPalletIndex::get(), b"grant_access".to_vec()), + (SygmaBasicFeeHandlerPalletIndex::get(), b"set_fee".to_vec()), + (SygmaBridgePalletIndex::get(), b"set_mpc_address".to_vec()), + (SygmaBridgePalletIndex::get(), b"pause_bridge".to_vec()), + (SygmaBridgePalletIndex::get(), b"unpause_bridge".to_vec()), + (SygmaBridgePalletIndex::get(), b"register_domain".to_vec()), + (SygmaBridgePalletIndex::get(), b"unregister_domain".to_vec()), + (SygmaBridgePalletIndex::get(), b"retry".to_vec()), + (SygmaFeeHandlerRouterPalletIndex::get(), b"set_fee_handler".to_vec()), + ].to_vec(); + pub const SygmaBridgePalletId: PalletId = PalletId(*b"sygma/01"); + // SygmaBridgeAccount is an account for holding transferred asset collection + // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e + pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); + // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); + pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); + // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain + pub EIP712ChainID: SygmaChainID = U256::from(5231); + // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data + // When relayers signing, this address will be included in the EIP712Domain + // As long as the relayer and pallet configured with the same address, EIP712Domain should be recognized properly. + pub DestVerifyingContractAddress: VerifyingContractAddress = primitive_types::H160::from_slice(hex::decode(DEST_VERIFYING_CONTRACT_ADDRESS).ok().unwrap().as_slice()); +} + +impl sygma_access_segregator::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type PalletIndex = SygmaAccessSegregatorPalletIndex; + type Extrinsics = RegisteredExtrinsics; +} + +impl sygma_basic_feehandler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type PalletIndex = SygmaBasicFeeHandlerPalletIndex; +} + +impl sygma_fee_handler_router::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type BasicFeeHandler = SygmaBasicFeeHandler; + type DynamicFeeHandler = (); + type PalletIndex = SygmaFeeHandlerRouterPalletIndex; +} + +impl sygma_bridge::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type TransferReserveAccount = SygmaBridgeAccount; + type FeeReserveAccount = SygmaBridgeFeeAccount; + type EIP712ChainID = EIP712ChainID; + type DestVerifyingContractAddress = DestVerifyingContractAddress; + type FeeHandler = SygmaFeeHandlerRouter; + type AssetTransactor = XTransferAdapter< + CurrencyTransactor, + FungiblesTransactor, + XTransfer, + assets_registry::NativeAssetFilter, + assets_registry::ReserveAssetFilter< + ParachainInfo, + assets_registry::NativeAssetFilter, + >, + >; + type ResourcePairs = AssetsRegistry; + type IsReserve = assets_registry::SygmaAssetReserveChecker; + type ExtractDestData = SygmaWrapper; + type PalletId = SygmaBridgePalletId; + type PalletIndex = SygmaBridgePalletIndex; + type DecimalConverter = assets_registry::SygmaDecimalConverter; +} + +impl sygma_wrapper::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} + impl xtransfer::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Bridge = ( + sygma_wrapper::BridgeTransactImpl, xcmbridge::BridgeTransactImpl, chainbridge::BridgeTransactImpl, ); @@ -2012,8 +2110,7 @@ impl_runtime_apis! { impl sygma_runtime_api::SygmaBridgeApi for Runtime { fn is_proposal_executed(nonce: DepositNonce, domain_id: DomainID) -> bool { - // TODO: enable Sygma - false + SygmaBridge::is_proposal_executed(nonce, domain_id) } } diff --git a/runtime/phala/Cargo.toml b/runtime/phala/Cargo.toml index fe5f5921..d2ae610d 100644 --- a/runtime/phala/Cargo.toml +++ b/runtime/phala/Cargo.toml @@ -13,6 +13,9 @@ hex-literal = "0.4.1" smallvec = "1.6.1" static_assertions = "1.1.0" +primitive-types = { version = "0.12", default-features = false, features = ["scale-info", "serde_no_std"] } +hex = { version = "0.4.3", default-features = false } + phala-types = { path = "../../crates/phala-types", default-features = false } parachains-common = { path = "../../parachains-common", default-features = false } @@ -92,9 +95,13 @@ pallet-rmrk-market = { git = "https://github.com/Phala-Network/rmrk-substrate", rmrk-traits = { git = "https://github.com/Phala-Network/rmrk-substrate", branch = "polkadot-v0.9.42", default-features = false } pallet-rmrk-rpc-runtime-api = { git = "https://github.com/Phala-Network/rmrk-substrate", branch = "polkadot-v0.9.42", default-features = false } -# Sygma -sygma-traits = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-runtime-api = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +# Sygma dependencies +sygma-traits = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-basic-feehandler = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-bridge = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-access-segregator = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-fee-handler-router = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-runtime-api = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } # Local dependencies assets-registry = { path = "../../pallets/assets-registry", default-features = false } @@ -212,13 +219,19 @@ std = [ "pallet-mq-runtime-api/std", "assets-registry/std", "subbridge-pallets/std", - "sygma-runtime-api/std", "pallet-rmrk-core/std", "pallet-rmrk-market/std", "pallet-rmrk-equip/std", "rmrk-traits/std", "pallet-rmrk-rpc-runtime-api/std", "pallet-index/std", + "sygma-basic-feehandler/std", + "sygma-traits/std", + "sygma-bridge/std", + "sygma-access-segregator/std", + "sygma-fee-handler-router/std", + "sygma-runtime-api/std", + "primitive-types/std", ] try-runtime = [ @@ -267,6 +280,10 @@ try-runtime = [ "assets-registry/try-runtime", "phala-pallets/try-runtime", "pallet-index/try-runtime", + "sygma-basic-feehandler/try-runtime", + "sygma-bridge/try-runtime", + "sygma-access-segregator/try-runtime", + "sygma-fee-handler-router/try-runtime", ] # A feature that should be enabled when the runtime should be build for on-chain diff --git a/runtime/phala/src/lib.rs b/runtime/phala/src/lib.rs index 5ecc75cb..2d3f73af 100644 --- a/runtime/phala/src/lib.rs +++ b/runtime/phala/src/lib.rs @@ -49,6 +49,7 @@ mod msg_routing; use codec::{Decode, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; +use primitive_types::U256; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ @@ -108,9 +109,9 @@ use xcm_executor::{Config, XcmExecutor, traits::WithOriginFilter}; pub use subbridge_pallets::{ chainbridge, dynamic_trader::DynamicWeightTrader, fungible_adapter::XTransferAdapter, helper, - xcmbridge, xtransfer, + sygma_wrapper, xcmbridge, xtransfer, }; -use sygma_traits::{DepositNonce, DomainID}; +use sygma_traits::{ChainID as SygmaChainID, DepositNonce, DomainID, VerifyingContractAddress}; use pallet_rmrk_core::{CollectionInfoOf, InstanceInfoOf, PropertyInfoOf, ResourceInfoOf}; use pallet_rmrk_equip::{BaseInfoOf, BoundedThemeOf, PartTypeOf}; @@ -304,7 +305,12 @@ construct_runtime! { RmrkEquip: pallet_rmrk_equip::{Pallet, Call, Event, Storage} = 103, RmrkMarket: pallet_rmrk_market::{Pallet, Call, Storage, Event} = 104, - // 11x kept for Sygma bridge + // Sygma bridge + SygmaAccessSegregator: sygma_access_segregator::{Pallet, Call, Storage, Event} = 111, + SygmaBasicFeeHandler: sygma_basic_feehandler::{Pallet, Call, Storage, Event} = 112, + SygmaBridge: sygma_bridge::{Pallet, Call, Storage, Event} = 113, + SygmaFeeHandlerRouter: sygma_fee_handler_router::{Pallet, Call, Storage, Event} = 114, + SygmaWrapper: sygma_wrapper::{Pallet, Storage, Event} = 115, // inDEX PalletIndex: pallet_index::{Pallet, Call, Storage, Event} = 121, @@ -385,6 +391,10 @@ impl Contains for BaseCallFilter { // Monetary RuntimeCall::Balances { .. } | RuntimeCall::ChainBridge { .. } | + RuntimeCall::SygmaAccessSegregator { .. } | + RuntimeCall::SygmaBasicFeeHandler { .. } | + RuntimeCall::SygmaFeeHandlerRouter { .. } | + RuntimeCall::SygmaBridge { .. } | RuntimeCall::XTransfer { .. } | // Collator RuntimeCall::CollatorSelection(_) | RuntimeCall::Session(_) | @@ -1497,7 +1507,7 @@ impl xcmbridge::Config for Runtime { parameter_types! { pub PHALocation: MultiLocation = MultiLocation::here(); - pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000000001"); + pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000001000"); } impl assets_registry::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -1547,9 +1557,97 @@ impl chainbridge::Config for Runtime { type ResourceIdGenerationSalt = ResourceIdGenerationSalt; } +// This address is provided by Sygma bridge +const DEST_VERIFYING_CONTRACT_ADDRESS: &str = "6CdE2Cd82a4F8B74693Ff5e194c19CA08c2d1c68"; +parameter_types! { + // Make sure put same value with `construct_runtime` + pub const SygmaAccessSegregatorPalletIndex: u8 = 111; + pub const SygmaBasicFeeHandlerPalletIndex: u8 = 112; + pub const SygmaBridgePalletIndex: u8 = 113; + pub const SygmaFeeHandlerRouterPalletIndex: u8 = 114; + // RegisteredExtrinsics here registers all valid (pallet index, extrinsic_name) paris + // make sure to update this when adding new access control extrinsic + pub RegisteredExtrinsics: Vec<(u8, Vec)> = [ + (SygmaAccessSegregatorPalletIndex::get(), b"grant_access".to_vec()), + (SygmaBasicFeeHandlerPalletIndex::get(), b"set_fee".to_vec()), + (SygmaBridgePalletIndex::get(), b"set_mpc_address".to_vec()), + (SygmaBridgePalletIndex::get(), b"pause_bridge".to_vec()), + (SygmaBridgePalletIndex::get(), b"unpause_bridge".to_vec()), + (SygmaBridgePalletIndex::get(), b"register_domain".to_vec()), + (SygmaBridgePalletIndex::get(), b"unregister_domain".to_vec()), + (SygmaBridgePalletIndex::get(), b"retry".to_vec()), + (SygmaFeeHandlerRouterPalletIndex::get(), b"set_fee_handler".to_vec()), + ].to_vec(); + pub const SygmaBridgePalletId: PalletId = PalletId(*b"sygma/01"); + // SygmaBridgeAccount is an account for holding transferred asset collection + // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e + pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); + // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); + pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); + // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain + pub EIP712ChainID: SygmaChainID = U256::from(5231); + // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data + // When relayers signing, this address will be included in the EIP712Domain + // As long as the relayer and pallet configured with the same address, EIP712Domain should be recognized properly. + pub DestVerifyingContractAddress: VerifyingContractAddress = primitive_types::H160::from_slice(hex::decode(DEST_VERIFYING_CONTRACT_ADDRESS).ok().unwrap().as_slice()); +} + +impl sygma_access_segregator::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type PalletIndex = SygmaAccessSegregatorPalletIndex; + type Extrinsics = RegisteredExtrinsics; +} + +impl sygma_basic_feehandler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type PalletIndex = SygmaBasicFeeHandlerPalletIndex; +} + +impl sygma_fee_handler_router::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type BasicFeeHandler = SygmaBasicFeeHandler; + type DynamicFeeHandler = (); + type PalletIndex = SygmaFeeHandlerRouterPalletIndex; +} + +impl sygma_bridge::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type TransferReserveAccount = SygmaBridgeAccount; + type FeeReserveAccount = SygmaBridgeFeeAccount; + type EIP712ChainID = EIP712ChainID; + type DestVerifyingContractAddress = DestVerifyingContractAddress; + type FeeHandler = SygmaFeeHandlerRouter; + type AssetTransactor = XTransferAdapter< + CurrencyTransactor, + FungiblesTransactor, + XTransfer, + assets_registry::NativeAssetFilter, + assets_registry::ReserveAssetFilter< + ParachainInfo, + assets_registry::NativeAssetFilter, + >, + >; + type ResourcePairs = AssetsRegistry; + type IsReserve = assets_registry::SygmaAssetReserveChecker; + type ExtractDestData = SygmaWrapper; + type PalletId = SygmaBridgePalletId; + type PalletIndex = SygmaBridgePalletIndex; + type DecimalConverter = assets_registry::SygmaDecimalConverter; +} + +impl sygma_wrapper::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} + impl xtransfer::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Bridge = ( + sygma_wrapper::BridgeTransactImpl, xcmbridge::BridgeTransactImpl, chainbridge::BridgeTransactImpl, ); @@ -1971,8 +2069,7 @@ impl_runtime_apis! { impl sygma_runtime_api::SygmaBridgeApi for Runtime { fn is_proposal_executed(nonce: DepositNonce, domain_id: DomainID) -> bool { - // TODO: enable Sygma - false + SygmaBridge::is_proposal_executed(nonce, domain_id) } } From bbaab72adcfa026557c1a7315ae8b6ea85dd2bbd Mon Sep 17 00:00:00 2001 From: Wenfeng Wang Date: Thu, 1 Jun 2023 14:30:06 +0000 Subject: [PATCH 2/6] rebase main --- Cargo.lock | 4 ++-- runtime/khala/Cargo.toml | 12 ++++++------ runtime/khala/src/lib.rs | 7 ++++--- runtime/phala/Cargo.toml | 12 ++++++------ runtime/phala/src/lib.rs | 7 ++++--- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 538341f0..68bb40f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4411,7 +4411,7 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-assets", "pallet-aura", @@ -7611,7 +7611,7 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-assets", "pallet-aura", diff --git a/runtime/khala/Cargo.toml b/runtime/khala/Cargo.toml index b95a205c..e054abb1 100644 --- a/runtime/khala/Cargo.toml +++ b/runtime/khala/Cargo.toml @@ -96,12 +96,12 @@ rmrk-traits = { git = "https://github.com/Phala-Network/rmrk-substrate", branch pallet-rmrk-rpc-runtime-api = { git = "https://github.com/Phala-Network/rmrk-substrate", branch = "polkadot-v0.9.42", default-features = false } # Sygma dependencies -sygma-traits = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-basic-feehandler = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-bridge = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-access-segregator = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-fee-handler-router = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-runtime-api = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-traits = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-basic-feehandler = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-bridge = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-access-segregator = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-fee-handler-router = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-runtime-api = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } # Local dependencies assets-registry = { path = "../../pallets/assets-registry", default-features = false } diff --git a/runtime/khala/src/lib.rs b/runtime/khala/src/lib.rs index 9d190b16..c9a794a0 100644 --- a/runtime/khala/src/lib.rs +++ b/runtime/khala/src/lib.rs @@ -1640,25 +1640,25 @@ impl sygma_access_segregator::Config for Runtime { type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type PalletIndex = SygmaAccessSegregatorPalletIndex; type Extrinsics = RegisteredExtrinsics; + type WeightInfo = sygma_access_segregator::weights::SygmaWeightInfo; } impl sygma_basic_feehandler::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type PalletIndex = SygmaBasicFeeHandlerPalletIndex; + type WeightInfo = sygma_basic_feehandler::weights::SygmaWeightInfo; } impl sygma_fee_handler_router::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type BasicFeeHandler = SygmaBasicFeeHandler; type DynamicFeeHandler = (); type PalletIndex = SygmaFeeHandlerRouterPalletIndex; + type WeightInfo = sygma_fee_handler_router::weights::SygmaWeightInfo; } impl sygma_bridge::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type TransferReserveAccount = SygmaBridgeAccount; type FeeReserveAccount = SygmaBridgeFeeAccount; type EIP712ChainID = EIP712ChainID; @@ -1680,6 +1680,7 @@ impl sygma_bridge::Config for Runtime { type PalletId = SygmaBridgePalletId; type PalletIndex = SygmaBridgePalletIndex; type DecimalConverter = assets_registry::SygmaDecimalConverter; + type WeightInfo = sygma_bridge::weights::SygmaWeightInfo; } impl sygma_wrapper::Config for Runtime { diff --git a/runtime/phala/Cargo.toml b/runtime/phala/Cargo.toml index d2ae610d..ada3e85a 100644 --- a/runtime/phala/Cargo.toml +++ b/runtime/phala/Cargo.toml @@ -96,12 +96,12 @@ rmrk-traits = { git = "https://github.com/Phala-Network/rmrk-substrate", branch pallet-rmrk-rpc-runtime-api = { git = "https://github.com/Phala-Network/rmrk-substrate", branch = "polkadot-v0.9.42", default-features = false } # Sygma dependencies -sygma-traits = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-basic-feehandler = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-bridge = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-access-segregator = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-fee-handler-router = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } -sygma-runtime-api = { git = "https://github.com/Phala-Network/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-traits = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-basic-feehandler = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-bridge = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-access-segregator = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-fee-handler-router = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } +sygma-runtime-api = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "polkadot-v0.9.42", default-features = false } # Local dependencies assets-registry = { path = "../../pallets/assets-registry", default-features = false } diff --git a/runtime/phala/src/lib.rs b/runtime/phala/src/lib.rs index 2d3f73af..9785852e 100644 --- a/runtime/phala/src/lib.rs +++ b/runtime/phala/src/lib.rs @@ -1598,25 +1598,25 @@ impl sygma_access_segregator::Config for Runtime { type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type PalletIndex = SygmaAccessSegregatorPalletIndex; type Extrinsics = RegisteredExtrinsics; + type WeightInfo = sygma_access_segregator::weights::SygmaWeightInfo; } impl sygma_basic_feehandler::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type PalletIndex = SygmaBasicFeeHandlerPalletIndex; + type WeightInfo = sygma_basic_feehandler::weights::SygmaWeightInfo; } impl sygma_fee_handler_router::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type BasicFeeHandler = SygmaBasicFeeHandler; type DynamicFeeHandler = (); type PalletIndex = SygmaFeeHandlerRouterPalletIndex; + type WeightInfo = sygma_fee_handler_router::weights::SygmaWeightInfo; } impl sygma_bridge::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; type TransferReserveAccount = SygmaBridgeAccount; type FeeReserveAccount = SygmaBridgeFeeAccount; type EIP712ChainID = EIP712ChainID; @@ -1638,6 +1638,7 @@ impl sygma_bridge::Config for Runtime { type PalletId = SygmaBridgePalletId; type PalletIndex = SygmaBridgePalletIndex; type DecimalConverter = assets_registry::SygmaDecimalConverter; + type WeightInfo = sygma_bridge::weights::SygmaWeightInfo; } impl sygma_wrapper::Config for Runtime { From 1be9f957b4fa430e38a1d2b56561bcc54b507e55 Mon Sep 17 00:00:00 2001 From: Wenfeng Wang Date: Mon, 5 Jun 2023 05:55:26 +0000 Subject: [PATCH 3/6] set sygma multi-sig account --- runtime/khala/src/lib.rs | 12 +++++++++++- runtime/phala/src/lib.rs | 12 +++++++++++- runtime/rhala/src/lib.rs | 12 +++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/runtime/khala/src/lib.rs b/runtime/khala/src/lib.rs index c9a794a0..88227c2f 100644 --- a/runtime/khala/src/lib.rs +++ b/runtime/khala/src/lib.rs @@ -1627,6 +1627,9 @@ parameter_types! { // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); + // SygmaBridgeAdminAccountKey Address: 43CLf23S1KsVhDn56SQfaAC8dbbnM24qS5A8jnbBixxqu3Cg + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9").unwrap().try_into().unwrap(); + pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data @@ -1635,9 +1638,16 @@ parameter_types! { pub DestVerifyingContractAddress: VerifyingContractAddress = primitive_types::H160::from_slice(hex::decode(DEST_VERIFYING_CONTRACT_ADDRESS).ok().unwrap().as_slice()); } +pub struct SygmaAdminMembers; +impl SortedMembers for SygmaAdminMembers { + fn sorted_members() -> Vec { + [SygmaBridgeAdminAccount::get()].to_vec() + } +} + impl sygma_access_segregator::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type BridgeCommitteeOrigin = EnsureSignedBy; type PalletIndex = SygmaAccessSegregatorPalletIndex; type Extrinsics = RegisteredExtrinsics; type WeightInfo = sygma_access_segregator::weights::SygmaWeightInfo; diff --git a/runtime/phala/src/lib.rs b/runtime/phala/src/lib.rs index 9785852e..9df5daff 100644 --- a/runtime/phala/src/lib.rs +++ b/runtime/phala/src/lib.rs @@ -1585,6 +1585,9 @@ parameter_types! { // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); + // SygmaBridgeAdminAccountKey Address: 43CLf23S1KsVhDn56SQfaAC8dbbnM24qS5A8jnbBixxqu3Cg + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9").unwrap().try_into().unwrap(); + pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data @@ -1593,9 +1596,16 @@ parameter_types! { pub DestVerifyingContractAddress: VerifyingContractAddress = primitive_types::H160::from_slice(hex::decode(DEST_VERIFYING_CONTRACT_ADDRESS).ok().unwrap().as_slice()); } +pub struct SygmaAdminMembers; +impl SortedMembers for SygmaAdminMembers { + fn sorted_members() -> Vec { + [SygmaBridgeAdminAccount::get()].to_vec() + } +} + impl sygma_access_segregator::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type BridgeCommitteeOrigin = EnsureSignedBy; type PalletIndex = SygmaAccessSegregatorPalletIndex; type Extrinsics = RegisteredExtrinsics; type WeightInfo = sygma_access_segregator::weights::SygmaWeightInfo; diff --git a/runtime/rhala/src/lib.rs b/runtime/rhala/src/lib.rs index 85d59b95..6372b676 100644 --- a/runtime/rhala/src/lib.rs +++ b/runtime/rhala/src/lib.rs @@ -1633,6 +1633,9 @@ parameter_types! { // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); + // SygmaBridgeAdminAccountKey Address: 43CLf23S1KsVhDn56SQfaAC8dbbnM24qS5A8jnbBixxqu3Cg + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9").unwrap().try_into().unwrap(); + pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data @@ -1641,9 +1644,16 @@ parameter_types! { pub DestVerifyingContractAddress: VerifyingContractAddress = primitive_types::H160::from_slice(hex::decode(DEST_VERIFYING_CONTRACT_ADDRESS).ok().unwrap().as_slice()); } +pub struct SygmaAdminMembers; +impl SortedMembers for SygmaAdminMembers { + fn sorted_members() -> Vec { + [SygmaBridgeAdminAccount::get()].to_vec() + } +} + impl sygma_access_segregator::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BridgeCommitteeOrigin = EnsureRootOrHalfCouncil; + type BridgeCommitteeOrigin = EnsureSignedBy; type PalletIndex = SygmaAccessSegregatorPalletIndex; type Extrinsics = RegisteredExtrinsics; type WeightInfo = sygma_access_segregator::weights::SygmaWeightInfo; From 5c9ad4fa526fe098c509b887a121ae706da00b82 Mon Sep 17 00:00:00 2001 From: Wenfeng Wang Date: Mon, 19 Jun 2023 03:11:51 +0000 Subject: [PATCH 4/6] update sygma config value --- runtime/khala/src/lib.rs | 10 +++++----- runtime/phala/src/lib.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/khala/src/lib.rs b/runtime/khala/src/lib.rs index 88227c2f..0beebf7f 100644 --- a/runtime/khala/src/lib.rs +++ b/runtime/khala/src/lib.rs @@ -1231,7 +1231,7 @@ impl xcmbridge::Config for Runtime { parameter_types! { pub PHALocation: MultiLocation = MultiLocation::here(); - pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000001000"); + pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000000001"); } impl assets_registry::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -1624,11 +1624,11 @@ parameter_types! { // SygmaBridgeAccount is an account for holding transferred asset collection // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); - // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 - pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); + // SygmaBridgeFeeAccountKey Address: 44bdQyeqk5oJzxbZH9xMcovmj3oAxqzSjKujaVhHaZxZuTBH + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889").unwrap().try_into().unwrap(); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); - // SygmaBridgeAdminAccountKey Address: 43CLf23S1KsVhDn56SQfaAC8dbbnM24qS5A8jnbBixxqu3Cg - pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9").unwrap().try_into().unwrap(); + // SygmaBridgeAdminAccountKey Address: 44bdQyeqk5oJzxbZH9xMcovmj3oAxqzSjKujaVhHaZxZuTBH + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889").unwrap().try_into().unwrap(); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); diff --git a/runtime/phala/src/lib.rs b/runtime/phala/src/lib.rs index 9df5daff..206c4de0 100644 --- a/runtime/phala/src/lib.rs +++ b/runtime/phala/src/lib.rs @@ -1507,7 +1507,7 @@ impl xcmbridge::Config for Runtime { parameter_types! { pub PHALocation: MultiLocation = MultiLocation::here(); - pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000001000"); + pub PHASygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000000001"); } impl assets_registry::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -1582,11 +1582,11 @@ parameter_types! { // SygmaBridgeAccount is an account for holding transferred asset collection // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); - // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 - pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); + // SygmaBridgeFeeAccountKey Address: 44NmbpHjqbz9FcXfVzFUbMFJh5q7qsKAcSTJvFAdYPqQ62Qv + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c").unwrap().try_into().unwrap(); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); - // SygmaBridgeAdminAccountKey Address: 43CLf23S1KsVhDn56SQfaAC8dbbnM24qS5A8jnbBixxqu3Cg - pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9").unwrap().try_into().unwrap(); + // SygmaBridgeAdminAccountKey Address: 44NmbpHjqbz9FcXfVzFUbMFJh5q7qsKAcSTJvFAdYPqQ62Qv + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c").unwrap().try_into().unwrap(); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); From 17258e512e0d469deeefe8f6a6ca4270661f6cad Mon Sep 17 00:00:00 2001 From: Wenfeng Wang Date: Mon, 19 Jun 2023 10:19:47 +0000 Subject: [PATCH 5/6] trivial --- runtime/khala/src/lib.rs | 4 ++-- runtime/phala/src/lib.rs | 4 ++-- runtime/rhala/src/lib.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/khala/src/lib.rs b/runtime/khala/src/lib.rs index 0beebf7f..87479804 100644 --- a/runtime/khala/src/lib.rs +++ b/runtime/khala/src/lib.rs @@ -1625,10 +1625,10 @@ parameter_types! { // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); // SygmaBridgeFeeAccountKey Address: 44bdQyeqk5oJzxbZH9xMcovmj3oAxqzSjKujaVhHaZxZuTBH - pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889").unwrap().try_into().unwrap(); + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex_literal::hex!("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889"); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); // SygmaBridgeAdminAccountKey Address: 44bdQyeqk5oJzxbZH9xMcovmj3oAxqzSjKujaVhHaZxZuTBH - pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889").unwrap().try_into().unwrap(); + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889"); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); diff --git a/runtime/phala/src/lib.rs b/runtime/phala/src/lib.rs index 206c4de0..a1435e4c 100644 --- a/runtime/phala/src/lib.rs +++ b/runtime/phala/src/lib.rs @@ -1583,10 +1583,10 @@ parameter_types! { // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); // SygmaBridgeFeeAccountKey Address: 44NmbpHjqbz9FcXfVzFUbMFJh5q7qsKAcSTJvFAdYPqQ62Qv - pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c").unwrap().try_into().unwrap(); + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex_literal::hex!("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c"); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); // SygmaBridgeAdminAccountKey Address: 44NmbpHjqbz9FcXfVzFUbMFJh5q7qsKAcSTJvFAdYPqQ62Qv - pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c").unwrap().try_into().unwrap(); + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c"); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); diff --git a/runtime/rhala/src/lib.rs b/runtime/rhala/src/lib.rs index 6372b676..685586a4 100644 --- a/runtime/rhala/src/lib.rs +++ b/runtime/rhala/src/lib.rs @@ -1631,10 +1631,10 @@ parameter_types! { // SygmaBridgeAccount address: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e pub SygmaBridgeAccount: AccountId = SygmaBridgePalletId::get().into_account_truncating(); // SygmaBridgeFeeAccountKey Address: 5FbR7ZkYSgsFsBMmqsdEpgAU7DkMdKpkGWSBZdhn6LAdesQ6 - pub SygmaBridgeFeeAccountKey: [u8; 32] = hex::decode("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042").unwrap().try_into().unwrap(); + pub SygmaBridgeFeeAccountKey: [u8; 32] = hex_literal::hex!("9c20f205595671c6f121b9d9bbfb9caa66380f8f3ad8d47d901b84b7fb757042"); pub SygmaBridgeFeeAccount: AccountId = SygmaBridgeFeeAccountKey::get().into(); // SygmaBridgeAdminAccountKey Address: 43CLf23S1KsVhDn56SQfaAC8dbbnM24qS5A8jnbBixxqu3Cg - pub SygmaBridgeAdminAccountKey: [u8; 32] = hex::decode("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9").unwrap().try_into().unwrap(); + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("720ef4138de57eff791ccfc14c249e58aa7718e71700892c2c59cec28a3900b9"); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain pub EIP712ChainID: SygmaChainID = U256::from(5231); From 61dabc8e6e3d95028262c280c3bcbb7836ef9cb6 Mon Sep 17 00:00:00 2001 From: Wenfeng Wang Date: Mon, 19 Jun 2023 10:20:52 +0000 Subject: [PATCH 6/6] fix EIP712 chainid --- runtime/khala/src/lib.rs | 2 +- runtime/phala/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/khala/src/lib.rs b/runtime/khala/src/lib.rs index 87479804..644cdef8 100644 --- a/runtime/khala/src/lib.rs +++ b/runtime/khala/src/lib.rs @@ -1631,7 +1631,7 @@ parameter_types! { pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("b00e3e4afb5a9c54036ec6c1775881031fb26b72427a10724c4d8b91099ee889"); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain - pub EIP712ChainID: SygmaChainID = U256::from(5231); + pub EIP712ChainID: SygmaChainID = U256::from(5232); // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data // When relayers signing, this address will be included in the EIP712Domain // As long as the relayer and pallet configured with the same address, EIP712Domain should be recognized properly. diff --git a/runtime/phala/src/lib.rs b/runtime/phala/src/lib.rs index a1435e4c..2b8cbde1 100644 --- a/runtime/phala/src/lib.rs +++ b/runtime/phala/src/lib.rs @@ -1589,7 +1589,7 @@ parameter_types! { pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("a63f9ccf857e1ab9e806366e3c46ae650de853503d772a987197ab7e22c8f88c"); pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain - pub EIP712ChainID: SygmaChainID = U256::from(5231); + pub EIP712ChainID: SygmaChainID = U256::from(5233); // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data // When relayers signing, this address will be included in the EIP712Domain // As long as the relayer and pallet configured with the same address, EIP712Domain should be recognized properly.