Skip to content

Commit

Permalink
Hotfix: TestNet - Substrate 0.9.36 - Preimage pallet (#239)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe what change this PR is implementing -->

### Types of Changes
<!--- What types of changes does your code introduce? -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Dependency upgrade (A change in substrate or any 3rd party crate
version)

### Migrations and Hooks
<!--- Check the following box with an x if the following applies: -->
- [ ] This change requires a runtime migration.
- [ ] Modifies `on_initialize`
- [ ] Modifies `on_finalize`

### Checklist
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Change has been tested locally.
- [ ] Change adds / updates tests.
- [x] Changelog doc updated.
  • Loading branch information
rakanalh authored Jan 23, 2024
1 parent 4dd7d26 commit 89a11e7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- [C,D] Updated Substrate to polkadot-v0.9.36
- [C] Added pallet-preimage to support democracy functionality.

## [4.8.4]

Expand Down
18 changes: 18 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions runtime/cere/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/su
pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.36" }
pallet-offences = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" }
pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36", default-features = false, optional = true }
pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" }
pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" }
pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" }
pallet-recovery = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.36" }
Expand Down Expand Up @@ -143,6 +144,7 @@ std = [
"node-primitives/std",
"pallet-offences/std",
"pallet-proxy/std",
"pallet-preimage/std",
"sp-core/std",
"pallet-randomness-collective-flip/std",
"sp-std/std",
Expand Down Expand Up @@ -212,6 +214,7 @@ runtime-benchmarks = [
"pallet-nomination-pools/runtime-benchmarks",
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
"pallet-offences-benchmarking/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
Expand Down
30 changes: 22 additions & 8 deletions runtime/cere/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 48501,
spec_version: 48503,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 10,
transaction_version: 11,
state_version: 0,
};

Expand Down Expand Up @@ -337,6 +337,21 @@ impl pallet_proxy::Config for Runtime {
type AnnouncementDepositFactor = AnnouncementDepositFactor;
}

parameter_types! {
pub const PreimageMaxSize: u32 = 4096 * 1024;
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
RuntimeBlockWeights::get().max_block;
Expand All @@ -352,7 +367,7 @@ impl pallet_scheduler::Config for Runtime {
type MaxScheduledPerBlock = ConstU32<512>;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type Preimages = ();
type Preimages = Preimage;
}

parameter_types! {
Expand Down Expand Up @@ -794,7 +809,7 @@ impl pallet_democracy::Config for Runtime {
type MaxVotes = ConstU32<100>;
type WeightInfo = pallet_democracy::weights::SubstrateWeight<Runtime>;
type MaxProposals = MaxProposals;
type Preimages = ();
type Preimages = Preimage;
type MaxDeposits = ConstU32<100>;
type MaxBlacklisted = ConstU32<100>;
}
Expand Down Expand Up @@ -1413,6 +1428,7 @@ construct_runtime!(
Society: pallet_society,
Recovery: pallet_recovery,
Vesting: pallet_vesting,
Preimage: pallet_preimage,
Scheduler: pallet_scheduler,
Proxy: pallet_proxy,
Multisig: pallet_multisig,
Expand Down Expand Up @@ -1480,10 +1496,7 @@ parameter_types! {
pub DummyPalletAccountId: AccountId = DummyPalletId::get().into_account_truncating();
}
/// Runtime migrations
type Migrations = (
pallet_balances::migration::MigrateToTrackInactive<Runtime, DummyPalletAccountId>,
pallet_contracts::Migration<Runtime>,
);
type Migrations = (pallet_preimage::migration::v1::Migration<Runtime>,);

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Expand Down Expand Up @@ -1528,6 +1541,7 @@ mod benches {
[pallet_multisig, Multisig]
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
[pallet_offences, OffencesBench::<Runtime>]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
[pallet_session, SessionBench::<Runtime>]
Expand Down

0 comments on commit 89a11e7

Please sign in to comment.