Snowbridge Rococo deployment updates (#2792)

- Includes the introduction of the `fast-runtime` feature, which cleans
up our features
- Updates beacon client fork versions config to Sepolia's versions
- Cleanup of AgentIdOf

---------

Co-authored-by: Ron <yrong1997@gmail.com>
Co-authored-by: claravanstaden <Cats 4 life!>
This commit is contained in:
Clara van Staden
2024-01-09 17:37:46 +02:00
committed by GitHub
parent 69e2ae6df0
commit 3811629a69
26 changed files with 3551 additions and 1534 deletions
@@ -130,7 +130,7 @@ bridge-runtime-common = { path = "../../../../../bridges/bin/runtime-common", fe
sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
[features]
default = ["beacon-spec-mainnet", "std"]
default = ["std"]
std = [
"bp-asset-hub-rococo/std",
"bp-asset-hub-westend/std",
@@ -223,7 +223,6 @@ std = [
]
runtime-benchmarks = [
"beacon-spec-mainnet",
"bridge-hub-common/runtime-benchmarks",
"bridge-runtime-common/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
@@ -299,8 +298,8 @@ try-runtime = [
]
experimental = ["pallet-aura/experimental"]
beacon-spec-mainnet = [
"snowbridge-ethereum-beacon-client/beacon-spec-mainnet",
fast-runtime = [
"snowbridge-ethereum-beacon-client/beacon-spec-minimal",
]
# A feature that should be enabled when the runtime should be built for on-chain
@@ -14,10 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::{
xcm_config::{AgentIdOf, UniversalLocation},
Runtime,
};
use crate::{xcm_config::UniversalLocation, Runtime};
use snowbridge_rococo_common::EthereumNetwork;
use snowbridge_router_primitives::outbound::EthereumBlobExporter;
@@ -26,5 +23,5 @@ pub type SnowbridgeExporter = EthereumBlobExporter<
UniversalLocation,
EthereumNetwork,
snowbridge_outbound_queue::Pallet<Runtime>,
AgentIdOf,
snowbridge_core::AgentIdOf,
>;
@@ -99,6 +99,8 @@ use parachains_common::{
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use polkadot_runtime_common::prod_or_fast;
#[cfg(feature = "runtime-benchmarks")]
use crate::xcm_config::benchmark_helpers::DoNothingRouter;
#[cfg(feature = "runtime-benchmarks")]
@@ -209,7 +211,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("bridge-hub-rococo"),
impl_name: create_runtime_str!("bridge-hub-rococo"),
authoring_version: 1,
spec_version: 1_005_001,
spec_version: 1_005_002,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 4,
@@ -566,7 +568,7 @@ impl snowbridge_outbound_queue::Config for Runtime {
type Channels = EthereumSystem;
}
#[cfg(not(feature = "beacon-spec-mainnet"))]
#[cfg(feature = "fast-runtime")]
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
@@ -586,30 +588,32 @@ parameter_types! {
epoch: 0,
},
};
pub const MaxExecutionHeadersToKeep:u32 = 1000;
}
#[cfg(feature = "beacon-spec-mainnet")]
#[cfg(not(feature = "fast-runtime"))]
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: [0, 0, 16, 32], // 0x00001020
version: [144, 0, 0, 111], // 0x90000069
epoch: 0,
},
altair: Fork {
version: [1, 0, 16, 32], // 0x01001020
epoch: 36660,
version: [144, 0, 0, 112], // 0x90000070
epoch: 50,
},
bellatrix: Fork {
version: [2, 0, 16, 32], // 0x02001020
epoch: 112260,
version: [144, 0, 0, 113], // 0x90000071
epoch: 100,
},
capella: Fork {
version: [3, 0, 16, 32], // 0x03001020
epoch: 162304,
version: [144, 0, 0, 114], // 0x90000072
epoch: 56832,
},
};
pub const MaxExecutionHeadersToKeep:u32 = 8192 * 2;
}
parameter_types! {
pub const MaxExecutionHeadersToKeep: u32 = prod_or_fast!(8192 * 2, 1000);
}
impl snowbridge_ethereum_beacon_client::Config for Runtime {
@@ -630,7 +634,7 @@ impl snowbridge_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OutboundQueue = EthereumOutboundQueue;
type SiblingOrigin = EnsureXcm<AllowSiblingsOnly>;
type AgentIdOf = xcm_config::AgentIdOf;
type AgentIdOf = snowbridge_core::AgentIdOf;
type TreasuryAccount = TreasuryAccount;
type Token = Balances;
type WeightInfo = weights::snowbridge_system::WeightInfo<Runtime>;
@@ -47,10 +47,9 @@ use parachains_common::{
};
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use snowbridge_core::DescribeHere;
use snowbridge_rococo_common::EthereumNetwork;
use snowbridge_runtime_common::XcmExportFeeToSibling;
use sp_core::{Get, H256};
use sp_core::Get;
use sp_runtime::traits::AccountIdConversion;
use sp_std::marker::PhantomData;
use xcm::latest::prelude::*;
@@ -58,12 +57,11 @@ use xcm::latest::prelude::*;
use xcm_builder::{
deposit_or_burn_fee, AccountId32Aliases, AllowExplicitUnpaidExecutionFrom,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal,
DescribeFamily, EnsureXcmOrigin, HandleFee, HashedDescription, IsConcrete, ParentAsSuperuser,
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeToAccount,
CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, HandleFee,
IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeToAccount,
};
use xcm_executor::{
traits::{FeeManager, FeeReason, FeeReason::Export, TransactAsset, WithOriginFilter},
@@ -383,10 +381,6 @@ impl cumulus_pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>;
}
/// Creates an AgentId from a MultiLocation. An AgentId is a unique mapping to a Agent contract on
/// Ethereum which acts as the sovereign account for the MultiLocation.
pub type AgentIdOf = HashedDescription<H256, (DescribeHere, DescribeFamily<DescribeAllTerminal>)>;
/// A `HandleFee` implementation that simply deposits the fees for `ExportMessage` XCM instructions
/// into the accounts that are used for paying the relayer rewards.
/// Burns the fees in case of a failure.