Skip to content

Commit

Permalink
add: ares sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
TomatoAres committed Jan 21, 2025
1 parent d59e3e1 commit 2cd6270
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 41 deletions.
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.

221 changes: 180 additions & 41 deletions integration-tests/bridges/sudo-relay.patch
Original file line number Diff line number Diff line change
@@ -1,49 +1,189 @@
diff --git a/Cargo.lock b/Cargo.lock
index 0ccf9de0a..e33f5da78 100644
index bb752b2ce..84b78f93d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10024,6 +10024,7 @@ dependencies = [
@@ -10094,6 +10094,7 @@ dependencies = [
"pallet-staking-reward-fn",
"pallet-staking-runtime-api",
"pallet-state-trie-migration",
+ "pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
@@ -14334,6 +14335,7 @@ dependencies = [
@@ -14441,6 +14442,7 @@ dependencies = [
"pallet-society",
"pallet-staking",
"pallet-staking-runtime-api",
+ "pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
diff --git a/integration-tests/bridges/sudo-relay.patch b/integration-tests/bridges/sudo-relay.patch
index 8edade4dc..e69de29bb 100644
--- a/integration-tests/bridges/sudo-relay.patch
+++ b/integration-tests/bridges/sudo-relay.patch
@@ -1,136 +0,0 @@
-diff --git a/Cargo.lock b/Cargo.lock
-index 0ccf9de0a..e33f5da78 100644
---- a/Cargo.lock
-+++ b/Cargo.lock
-@@ -10024,6 +10024,7 @@ dependencies = [
- "pallet-staking-reward-fn",
- "pallet-staking-runtime-api",
- "pallet-state-trie-migration",
-+ "pallet-sudo",
- "pallet-timestamp",
- "pallet-transaction-payment",
- "pallet-transaction-payment-rpc-runtime-api",
-@@ -14334,6 +14335,7 @@ dependencies = [
- "pallet-society",
- "pallet-staking",
- "pallet-staking-runtime-api",
-+ "pallet-sudo",
- "pallet-timestamp",
- "pallet-transaction-payment",
- "pallet-transaction-payment-rpc-runtime-api",
-diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml
-index 5a600a1d3..4db7ea092 100644
---- a/relay/kusama/Cargo.toml
-+++ b/relay/kusama/Cargo.toml
-@@ -106,6 +106,8 @@ xcm-runtime-apis = { workspace = true }
-
- sp-debug-derive = { workspace = true }
-
-+pallet-sudo = { workspace = true }
-+
- [dev-dependencies]
- sp-keyring = { workspace = true }
- sp-trie = { workspace = true }
-@@ -175,6 +177,7 @@ std = [
- "pallet-society/std",
- "pallet-staking-runtime-api/std",
- "pallet-staking/std",
-+ "pallet-sudo/std",
- "pallet-timestamp/std",
- "pallet-transaction-payment-rpc-runtime-api/std",
- "pallet-transaction-payment/std",
-diff --git a/relay/kusama/src/genesis_config_presets.rs b/relay/kusama/src/genesis_config_presets.rs
-index dda349608..4714ecd51 100644
---- a/relay/kusama/src/genesis_config_presets.rs
-+++ b/relay/kusama/src/genesis_config_presets.rs
-@@ -188,6 +188,9 @@ fn kusama_testnet_genesis(
- "forceEra": Forcing::NotForcing,
- "slashRewardFraction": Perbill::from_percent(10),
- },
-+ "sudo": {
-+ "key": Some(_root_key),
-+ },
- "babe": {
- "epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG),
- },
-diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs
-index bb31116d0..0075f394a 100644
---- a/relay/kusama/src/lib.rs
-+++ b/relay/kusama/src/lib.rs
-@@ -1657,9 +1657,18 @@ construct_runtime! {
- // refer to block<N>. See issue #160 for details.
- Mmr: pallet_mmr = 201,
- BeefyMmrLeaf: pallet_beefy_mmr = 202,
-+
-+ // Sudo.
-+ Sudo: pallet_sudo = 255,
- }
- }
-
-+impl pallet_sudo::Config for Runtime {
-+ type RuntimeEvent = RuntimeEvent;
-+ type RuntimeCall = RuntimeCall;
-+ type WeightInfo = ();
-+}
-+
- /// The address format for describing accounts.
- pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
- /// Block header type as expected by this runtime.
-diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml
-index c8a5404fa..8c3c3404b 100644
---- a/relay/polkadot/Cargo.toml
-+++ b/relay/polkadot/Cargo.toml
-@@ -103,6 +103,8 @@ xcm-runtime-apis = { workspace = true }
-
- sp-debug-derive = { workspace = true }
-
-+pallet-sudo = { workspace = true }
-+
- [dev-dependencies]
- sp-keyring = { workspace = true }
- sp-trie = { workspace = true }
-@@ -169,6 +171,7 @@ std = [
- "pallet-staking-runtime-api/std",
- "pallet-staking/std",
- "pallet-state-trie-migration/std",
-+ "pallet-sudo/std",
- "pallet-timestamp/std",
- "pallet-transaction-payment-rpc-runtime-api/std",
- "pallet-transaction-payment/std",
-diff --git a/relay/polkadot/src/genesis_config_presets.rs b/relay/polkadot/src/genesis_config_presets.rs
-index 38abd8e48..127813f1c 100644
---- a/relay/polkadot/src/genesis_config_presets.rs
-+++ b/relay/polkadot/src/genesis_config_presets.rs
-@@ -188,6 +188,9 @@ fn polkadot_testnet_genesis(
- "forceEra": Forcing::NotForcing,
- "slashRewardFraction": Perbill::from_percent(10),
- },
-+ "sudo": {
-+ "key": Some(_root_key),
-+ },
- "babe": {
- "epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG),
- },
-diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs
-index 1e44c81fc..f0cf68788 100644
---- a/relay/polkadot/src/lib.rs
-+++ b/relay/polkadot/src/lib.rs
-@@ -1680,9 +1680,18 @@ construct_runtime! {
- // refer to block<N>. See issue #160 for details.
- Mmr: pallet_mmr = 201,
- BeefyMmrLeaf: pallet_beefy_mmr = 202,
-+
-+ // Sudo.
-+ Sudo: pallet_sudo = 255,
- }
- }
-
-+impl pallet_sudo::Config for Runtime {
-+ type RuntimeEvent = RuntimeEvent;
-+ type RuntimeCall = RuntimeCall;
-+ type WeightInfo = ();
-+}
-+
- /// The address format for describing accounts.
- pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
- /// Block header type as expected by this runtime.
diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml
index 5a600a1d3..4db7ea092 100644
index bbb220140..f4dc93f31 100644
--- a/relay/kusama/Cargo.toml
+++ b/relay/kusama/Cargo.toml
@@ -106,6 +106,8 @@ xcm-runtime-apis = { workspace = true }

sp-debug-derive = { workspace = true }
@@ -87,6 +87,7 @@ pallet-xcm-benchmarks = { optional = true, workspace = true }
frame-election-provider-support = { workspace = true }
pallet-parameters = { workspace = true }

+pallet-sudo = { workspace = true }
+
[dev-dependencies]
sp-keyring = { workspace = true }
sp-trie = { workspace = true }
@@ -175,6 +177,7 @@ std = [
"pallet-society/std",
"pallet-staking-runtime-api/std",
"pallet-staking/std",
frame-benchmarking = { optional = true, workspace = true }
frame-try-runtime = { optional = true, workspace = true }
pallet-offences-benchmarking = { optional = true, workspace = true }
@@ -218,6 +219,7 @@ std = [
"xcm-executor/std",
"xcm-runtime-apis/std",
"xcm/std",
+ "pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
diff --git a/relay/kusama/src/genesis_config_presets.rs b/relay/kusama/src/genesis_config_presets.rs
index dda349608..4714ecd51 100644
index 3baaea570..0c49d1a17 100644
--- a/relay/kusama/src/genesis_config_presets.rs
+++ b/relay/kusama/src/genesis_config_presets.rs
@@ -188,6 +188,9 @@ fn kusama_testnet_genesis(
@@ -189,6 +189,9 @@ fn kusama_testnet_genesis(
"forceEra": Forcing::NotForcing,
"slashRewardFraction": Perbill::from_percent(10),
},
Expand All @@ -54,10 +194,10 @@ index dda349608..4714ecd51 100644
"epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG),
},
diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs
index bb31116d0..0075f394a 100644
index 042162caf..01dee7ea2 100644
--- a/relay/kusama/src/lib.rs
+++ b/relay/kusama/src/lib.rs
@@ -1657,9 +1657,18 @@ construct_runtime! {
@@ -1862,9 +1862,18 @@ construct_runtime! {
// refer to block<N>. See issue #160 for details.
Mmr: pallet_mmr = 201,
BeefyMmrLeaf: pallet_beefy_mmr = 202,
Expand All @@ -77,31 +217,30 @@ index bb31116d0..0075f394a 100644
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml
index c8a5404fa..8c3c3404b 100644
index 823bcf41a..9152ff35b 100644
--- a/relay/polkadot/Cargo.toml
+++ b/relay/polkadot/Cargo.toml
@@ -103,6 +103,8 @@ xcm-runtime-apis = { workspace = true }

sp-debug-derive = { workspace = true }
@@ -85,6 +85,7 @@ frame-election-provider-support = { workspace = true }
pallet-xcm = { workspace = true }
pallet-xcm-benchmarks = { optional = true, workspace = true }

+pallet-sudo = { workspace = true }
+
[dev-dependencies]
sp-keyring = { workspace = true }
sp-trie = { workspace = true }
@@ -169,6 +171,7 @@ std = [
"pallet-staking-runtime-api/std",
"pallet-staking/std",
"pallet-state-trie-migration/std",
frame-benchmarking = { optional = true, workspace = true }
frame-try-runtime = { optional = true, workspace = true }
frame-system-benchmarking = { optional = true, workspace = true }
@@ -220,6 +221,7 @@ std = [
"xcm-executor/std",
"xcm-runtime-apis/std",
"xcm/std",
+ "pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
diff --git a/relay/polkadot/src/genesis_config_presets.rs b/relay/polkadot/src/genesis_config_presets.rs
index 38abd8e48..127813f1c 100644
index 63717f69e..a47debfe6 100644
--- a/relay/polkadot/src/genesis_config_presets.rs
+++ b/relay/polkadot/src/genesis_config_presets.rs
@@ -188,6 +188,9 @@ fn polkadot_testnet_genesis(
@@ -189,6 +189,9 @@ fn polkadot_testnet_genesis(
"forceEra": Forcing::NotForcing,
"slashRewardFraction": Perbill::from_percent(10),
},
Expand All @@ -112,10 +251,10 @@ index 38abd8e48..127813f1c 100644
"epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG),
},
diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs
index 1e44c81fc..f0cf68788 100644
index dbff93b79..4d85c8ee7 100644
--- a/relay/polkadot/src/lib.rs
+++ b/relay/polkadot/src/lib.rs
@@ -1680,9 +1680,18 @@ construct_runtime! {
@@ -1672,9 +1672,18 @@ construct_runtime! {
// refer to block<N>. See issue #160 for details.
Mmr: pallet_mmr = 201,
BeefyMmrLeaf: pallet_beefy_mmr = 202,
Expand Down
2 changes: 2 additions & 0 deletions relay/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pallet-xcm-benchmarks = { optional = true, workspace = true }
frame-election-provider-support = { workspace = true }
pallet-parameters = { workspace = true }

pallet-sudo = { workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-try-runtime = { optional = true, workspace = true }
pallet-offences-benchmarking = { optional = true, workspace = true }
Expand Down Expand Up @@ -218,6 +219,7 @@ std = [
"xcm-executor/std",
"xcm-runtime-apis/std",
"xcm/std",
"pallet-sudo/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
3 changes: 3 additions & 0 deletions relay/kusama/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ fn kusama_testnet_genesis(
"forceEra": Forcing::NotForcing,
"slashRewardFraction": Perbill::from_percent(10),
},
"sudo": {
"key": Some(_root_key),
},
"babe": {
"epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG),
},
Expand Down
9 changes: 9 additions & 0 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1862,9 +1862,18 @@ construct_runtime! {
// refer to block<N>. See issue #160 for details.
Mmr: pallet_mmr = 201,
BeefyMmrLeaf: pallet_beefy_mmr = 202,

// Sudo.
Sudo: pallet_sudo = 255,
}
}

impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}

/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
Expand Down
2 changes: 2 additions & 0 deletions relay/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ frame-election-provider-support = { workspace = true }
pallet-xcm = { workspace = true }
pallet-xcm-benchmarks = { optional = true, workspace = true }

pallet-sudo = { workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-try-runtime = { optional = true, workspace = true }
frame-system-benchmarking = { optional = true, workspace = true }
Expand Down Expand Up @@ -220,6 +221,7 @@ std = [
"xcm-executor/std",
"xcm-runtime-apis/std",
"xcm/std",
"pallet-sudo/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
3 changes: 3 additions & 0 deletions relay/polkadot/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ fn polkadot_testnet_genesis(
"forceEra": Forcing::NotForcing,
"slashRewardFraction": Perbill::from_percent(10),
},
"sudo": {
"key": Some(_root_key),
},
"babe": {
"epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG),
},
Expand Down
9 changes: 9 additions & 0 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1672,9 +1672,18 @@ construct_runtime! {
// refer to block<N>. See issue #160 for details.
Mmr: pallet_mmr = 201,
BeefyMmrLeaf: pallet_beefy_mmr = 202,

// Sudo.
Sudo: pallet_sudo = 255,
}
}

impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}

/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
Expand Down

0 comments on commit 2cd6270

Please sign in to comment.