From 44192b2eca9ea0461719eeab6e7cb95d9934c43c Mon Sep 17 00:00:00 2001 From: Lex Luthor Date: Wed, 24 Sep 2025 17:46:09 +0200 Subject: [PATCH 1/3] Included revive 0.7.0, pending to know if needed a new instance for pallet_assets::Instance3 as done in asset-hub-westend --- .rustfmt.toml | 2 +- Cargo.lock | 1 + Cargo.toml | 1 + runtime/kreivo/Cargo.toml | 26 +++++++++------- runtime/kreivo/src/config/mod.rs | 1 + runtime/kreivo/src/config/revive/mod.rs | 41 +++++++++++++++++++++++++ runtime/kreivo/src/lib.rs | 2 ++ 7 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 runtime/kreivo/src/config/revive/mod.rs diff --git a/.rustfmt.toml b/.rustfmt.toml index c820ac572..5ba7c78e7 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,4 +1,4 @@ reorder_imports = true hard_tabs = true max_width = 120 -wrap_comments = true +# wrap_comments = true diff --git a/Cargo.lock b/Cargo.lock index 8d7d4d33d..ac0efe922 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4945,6 +4945,7 @@ dependencies = [ "pallet-proxy", "pallet-ranked-collective", "pallet-referenda", + "pallet-revive", "pallet-scheduler", "pallet-session", "pallet-skip-feeless-payment", diff --git a/Cargo.toml b/Cargo.toml index dd446055e..440db04c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,6 +134,7 @@ pallet-transaction-payment-rpc-runtime-api = { version = "41.0.0", default-featu pallet-treasury = { version = "40.0.0", default-features = false } pallet-utility = { version = "41.0.0", default-features = false } pallet-vesting = { version = "41.0.0", default-features = false } +pallet-revive = {version = "=0.7.0", default-features = false } # Cumulus client dependencies cumulus-primitives-aura = { version = "0.18.0", default-features = false } diff --git a/runtime/kreivo/Cargo.toml b/runtime/kreivo/Cargo.toml index 301edc351..1682ecee5 100644 --- a/runtime/kreivo/Cargo.toml +++ b/runtime/kreivo/Cargo.toml @@ -60,6 +60,7 @@ pallet-preimage.workspace = true pallet-proxy.workspace = true pallet-ranked-collective.workspace = true pallet-referenda.workspace = true +pallet-revive.workspace = true pallet-scheduler.workspace = true pallet-session.workspace = true pallet-skip-feeless-payment.workspace = true @@ -170,6 +171,7 @@ std = [ "pallet-ranked-collective/std", "pallet-referenda/std", "pallet-referenda-tracks/std", + "pallet-revive/std", "pallet-scheduler/std", "pallet-session/std", "pallet-skip-feeless-payment/std", @@ -251,6 +253,7 @@ runtime-benchmarks = [ "pallet-ranked-collective/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-referenda-tracks/runtime-benchmarks", + "pallet-revive/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-skip-feeless-payment/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", @@ -282,6 +285,7 @@ runtime-benchmarks = [ ] try-runtime = [ + "assets-common/try-runtime", "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-xcm/try-runtime", @@ -291,19 +295,24 @@ try-runtime = [ "frame-support/try-runtime", "frame-try-runtime/try-runtime", "pallet-assets-freezer/try-runtime", + "pallet-assets-holder/try-runtime", "pallet-asset-tx-payment/try-runtime", "pallet-assets/try-runtime", "pallet-aura/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", + "pallet-black-hole/try-runtime", "pallet-contracts/try-runtime", + "pallet-contracts-store/try-runtime", "pallet-communities-manager/try-runtime", "pallet-communities/try-runtime", "pallet-collator-selection/try-runtime", "pallet-gas-transaction-payment/try-runtime", + "pallet-listings/try-runtime", "pallet-message-queue/try-runtime", "pallet-nfts/try-runtime", "pallet-multisig/try-runtime", + "pallet-orders/try-runtime", "pallet-pass/try-runtime", "pallet-payments/try-runtime", "pallet-preimage/try-runtime", @@ -311,6 +320,7 @@ try-runtime = [ "pallet-ranked-collective/try-runtime", "pallet-referenda/try-runtime", "pallet-referenda-tracks/try-runtime", + "pallet-revive/try-runtime", "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-skip-feeless-payment/try-runtime", @@ -319,19 +329,13 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", "pallet-xcm/try-runtime", - "pass-webauthn/try-runtime", + "parachains-common/try-runtime", "parachain-info/try-runtime", + "pass-substrate-keys/try-runtime", + "pass-webauthn/try-runtime", "polkadot-runtime-common/try-runtime", "runtime-common/try-runtime", - "sp-runtime/try-runtime", - "pallet-listings/try-runtime", - "pallet-vesting/try-runtime", - "pallet-assets-holder/try-runtime", - "pallet-orders/try-runtime", - "pallet-contracts-store/try-runtime", - "pass-substrate-keys/try-runtime", - "pallet-black-hole/try-runtime", - "assets-common/try-runtime", - "parachains-common/try-runtime" + "sp-runtime/try-runtime" ] diff --git a/runtime/kreivo/src/config/mod.rs b/runtime/kreivo/src/config/mod.rs index 402119e66..63c3366dd 100644 --- a/runtime/kreivo/src/config/mod.rs +++ b/runtime/kreivo/src/config/mod.rs @@ -15,6 +15,7 @@ pub mod governance; pub mod contracts; mod listings_orders; pub mod payments; +pub mod revive; pub use { collator_support::{ConsensusHook, SLOT_DURATION}, diff --git a/runtime/kreivo/src/config/revive/mod.rs b/runtime/kreivo/src/config/revive/mod.rs new file mode 100644 index 000000000..0e43c2dd8 --- /dev/null +++ b/runtime/kreivo/src/config/revive/mod.rs @@ -0,0 +1,41 @@ +use super::*; +use pallet_assets::precompiles::{InlineIdConfig, ERC20}; + +parameter_types! { + pub const DepositPerItem: Balance = deposit(1, 0); + pub const DepositPerByte: Balance = deposit(0, 1); + pub CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30); + pub const ChainId: u64 = 2281; +} + +pub type TrustBackedAssetsInstance = pallet_assets::Instance1; +// pub type PoolAssetsInstance = pallet_assets::Instance3; // Should be created a new instance for this (Instance3)? +pub type PoolAssetsInstance = pallet_assets::Instance1; +use frame_system::EnsureSigned; + +impl pallet_revive::Config for Runtime { + type Time = Timestamp; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type DepositPerItem = DepositPerItem; + type DepositPerByte = DepositPerByte; + type WeightPrice = pallet_transaction_payment::Pallet; + type WeightInfo = pallet_revive::weights::SubstrateWeight; + type Precompiles = ( + ERC20, TrustBackedAssetsInstance>, + ERC20, PoolAssetsInstance>, + ); + type AddressMapper = pallet_revive::AccountId32Mapper; + type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>; + type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>; + type UnsafeUnstableInterface = ConstBool; + type UploadOrigin = EnsureSigned; + type InstantiateOrigin = EnsureSigned; + type RuntimeHoldReason = RuntimeHoldReason; + type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; + type ChainId = ChainId; + type NativeToEthRatio = ConstU32<1_000_000>; // 10^(18 - 12) Eth is 10^18, Native is 10^12. + type EthGasEncoder = (); + type FindAuthor = ::FindAuthor; +} diff --git a/runtime/kreivo/src/lib.rs b/runtime/kreivo/src/lib.rs index b6b96fd48..f8b771aa9 100644 --- a/runtime/kreivo/src/lib.rs +++ b/runtime/kreivo/src/lib.rs @@ -293,6 +293,8 @@ mod runtime { pub type Contracts = pallet_contracts; #[runtime::pallet_index(81)] pub type ContractsStore = pallet_contracts_store; + #[runtime::pallet_index(90)] + pub type Revive = pallet_revive; } cumulus_pallet_parachain_system::register_validate_block! { From 4581a6eab9eecac9d45b7bcaac01fcc0c4e21aaa Mon Sep 17 00:00:00 2001 From: Lex Luthor Date: Wed, 24 Sep 2025 22:19:08 +0200 Subject: [PATCH 2/3] Requested changes applied --- runtime/kreivo/src/config/revive/mod.rs | 12 +++++------- runtime/kreivo/src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/runtime/kreivo/src/config/revive/mod.rs b/runtime/kreivo/src/config/revive/mod.rs index 0e43c2dd8..c5e762b0f 100644 --- a/runtime/kreivo/src/config/revive/mod.rs +++ b/runtime/kreivo/src/config/revive/mod.rs @@ -1,4 +1,5 @@ use super::*; +use frame_system::EnsureRootWithSuccess; use pallet_assets::precompiles::{InlineIdConfig, ERC20}; parameter_types! { @@ -8,10 +9,7 @@ parameter_types! { pub const ChainId: u64 = 2281; } -pub type TrustBackedAssetsInstance = pallet_assets::Instance1; -// pub type PoolAssetsInstance = pallet_assets::Instance3; // Should be created a new instance for this (Instance3)? pub type PoolAssetsInstance = pallet_assets::Instance1; -use frame_system::EnsureSigned; impl pallet_revive::Config for Runtime { type Time = Timestamp; @@ -23,15 +21,15 @@ impl pallet_revive::Config for Runtime { type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_revive::weights::SubstrateWeight; type Precompiles = ( - ERC20, TrustBackedAssetsInstance>, + ERC20, KreivoAssetsInstance>, ERC20, PoolAssetsInstance>, ); type AddressMapper = pallet_revive::AccountId32Mapper; type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>; type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>; - type UnsafeUnstableInterface = ConstBool; - type UploadOrigin = EnsureSigned; - type InstantiateOrigin = EnsureSigned; + type UnsafeUnstableInterface = ConstBool; + type UploadOrigin = EnsureRootWithSuccess; + type InstantiateOrigin = EnsureRootWithSuccess; type RuntimeHoldReason = RuntimeHoldReason; type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type ChainId = ChainId; diff --git a/runtime/kreivo/src/lib.rs b/runtime/kreivo/src/lib.rs index f8b771aa9..e5045c2e9 100644 --- a/runtime/kreivo/src/lib.rs +++ b/runtime/kreivo/src/lib.rs @@ -293,7 +293,7 @@ mod runtime { pub type Contracts = pallet_contracts; #[runtime::pallet_index(81)] pub type ContractsStore = pallet_contracts_store; - #[runtime::pallet_index(90)] + #[runtime::pallet_index(82)] pub type Revive = pallet_revive; } From 1bbc83ba4f65e530bf8badd3c8429436c47a757c Mon Sep 17 00:00:00 2001 From: Lex Luthor Date: Thu, 25 Sep 2025 12:53:05 +0200 Subject: [PATCH 3/3] Not included precompiles for this integration. --- runtime/kreivo/src/config/revive/mod.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/runtime/kreivo/src/config/revive/mod.rs b/runtime/kreivo/src/config/revive/mod.rs index c5e762b0f..18b89fdcd 100644 --- a/runtime/kreivo/src/config/revive/mod.rs +++ b/runtime/kreivo/src/config/revive/mod.rs @@ -1,6 +1,5 @@ use super::*; use frame_system::EnsureRootWithSuccess; -use pallet_assets::precompiles::{InlineIdConfig, ERC20}; parameter_types! { pub const DepositPerItem: Balance = deposit(1, 0); @@ -9,8 +8,6 @@ parameter_types! { pub const ChainId: u64 = 2281; } -pub type PoolAssetsInstance = pallet_assets::Instance1; - impl pallet_revive::Config for Runtime { type Time = Timestamp; type Currency = Balances; @@ -20,10 +17,7 @@ impl pallet_revive::Config for Runtime { type DepositPerByte = DepositPerByte; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_revive::weights::SubstrateWeight; - type Precompiles = ( - ERC20, KreivoAssetsInstance>, - ERC20, PoolAssetsInstance>, - ); + type Precompiles = (); type AddressMapper = pallet_revive::AccountId32Mapper; type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>; type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>;