Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(devnet): remove pallet-contracts remnants #346

Draft
wants to merge 2 commits into
base: sub0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

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

4 changes: 0 additions & 4 deletions runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pallet-assets.workspace = true
pallet-aura.workspace = true
pallet-authorship.workspace = true
pallet-balances.workspace = true
pallet-contracts.workspace = true
pallet-message-queue.workspace = true
pallet-multisig.workspace = true
pallet-nft-fractionalization.workspace = true
Expand Down Expand Up @@ -138,7 +137,6 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-contracts/std",
"pallet-ismp-runtime-api/std",
"pallet-ismp/std",
"pallet-message-queue/std",
Expand Down Expand Up @@ -197,7 +195,6 @@ runtime-benchmarks = [
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nft-fractionalization/runtime-benchmarks",
Expand Down Expand Up @@ -236,7 +233,6 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-contracts/try-runtime",
"pallet-ismp/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-multisig/try-runtime",
Expand Down
4 changes: 2 additions & 2 deletions runtime/devnet/src/config/api/versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ impl From<DispatchError> for V0Error {
Module(error) => {
// Note: message not used
let ModuleError { index, error, message: _message } = error;
// Map `pallet-contracts::Error::DecodingFailed` to `Error::DecodingFailed`
// Map `pallet-revive::Error::DecodingFailed` to `Error::DecodingFailed`
if index as usize ==
<crate::Revive as frame_support::traits::PalletInfoAccess>::index() &&
<crate::Contracts as frame_support::traits::PalletInfoAccess>::index() &&
error == DECODING_FAILED_ERROR
{
Error::DecodingFailed
Expand Down
9 changes: 0 additions & 9 deletions runtime/devnet/src/config/revive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ use frame_support::{
traits::{ConstBool, ConstU32, ConstU64, Nothing},
};
use frame_system::EnsureSigned;
use pallet_api::Extension;
use pallet_revive::{
chain_extension::{
ChainExtension, Environment, Ext, RegisteredChainExtension, Result as ExtensionResult,
RetVal, ReturnFlags,
},
wasm::Memory,
};
use sp_std::vec;

use super::api::{self, Config};
use crate::{
Expand Down
32 changes: 13 additions & 19 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

// Public due to integration tests crate.
pub mod config;

Check warning on line 10 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a module

warning: missing documentation for a module --> runtime/devnet/src/lib.rs:10:1 | 10 | pub mod config; | ^^^^^^^^^^^^^^
mod weights;

// ISMP imports
Expand Down Expand Up @@ -176,7 +176,7 @@
}

#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {

Check warning on line 179 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a constant

warning: missing documentation for a constant --> runtime/devnet/src/lib.rs:179:1 | 179 | pub const VERSION: RuntimeVersion = RuntimeVersion { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec_name: create_runtime_str!("pop"),
impl_name: create_runtime_str!("pop"),
authoring_version: 1,
Expand All @@ -193,12 +193,10 @@
<Runtime as frame_system::Config>::Hash,
>;

// Prints debug output of the `contracts` pallet to stdout if the node is
// started with `-lruntime::contracts=debug`.
const CONTRACTS_DEBUG_OUTPUT: pallet_contracts::DebugInfo =
pallet_contracts::DebugInfo::UnsafeDebug;
const CONTRACTS_EVENTS: pallet_contracts::CollectEvents =
pallet_contracts::CollectEvents::UnsafeCollect;
// Prints debug output of the `revive` pallet to stdout if the node is
// started with `-lruntime::revive=debug`.
const CONTRACTS_DEBUG_OUTPUT: pallet_revive::DebugInfo = pallet_revive::DebugInfo::UnsafeDebug;
const CONTRACTS_EVENTS: pallet_revive::CollectEvents = pallet_revive::CollectEvents::UnsafeCollect;

/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
Expand Down Expand Up @@ -538,7 +536,7 @@
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
}

#[frame_support::runtime]

Check warning on line 539 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for an associated function

warning: missing documentation for an associated function --> runtime/devnet/src/lib.rs:539:1 | 539 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 539 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a type alias

warning: missing documentation for a type alias --> runtime/devnet/src/lib.rs:539:1 | 539 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 539 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a struct field

warning: missing documentation for a struct field --> runtime/devnet/src/lib.rs:539:1 | 539 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 539 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> runtime/devnet/src/lib.rs:539:1 | 539 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 539 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for an enum

warning: missing documentation for an enum --> runtime/devnet/src/lib.rs:539:1 | 539 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 539 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a struct

warning: missing documentation for a struct --> runtime/devnet/src/lib.rs:539:1 | 539 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
mod runtime {
// Create the runtime by composing the FRAME pallets that were previously configured.
#[runtime::runtime]
Expand Down Expand Up @@ -609,9 +607,9 @@
#[runtime::pallet_index(39)]
pub type IsmpParachain = ismp_parachain::Pallet<Runtime>;

// Contracts
// #[runtime::pallet_index(40)]
// pub type Contracts = pallet_contracts::Pallet<Runtime>;
// Contracts via Revive
#[runtime::pallet_index(40)]
pub type Contracts = pallet_revive::Pallet<Runtime>;

// Proxy
#[runtime::pallet_index(41)]
Expand All @@ -634,10 +632,6 @@
// Pop API
#[runtime::pallet_index(150)]
pub type Fungibles = fungibles::Pallet<Runtime>;

// Revive
#[runtime::pallet_index(255)]
pub type Revive = pallet_revive::Pallet<Runtime>;
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -806,15 +800,15 @@
storage_deposit_limit: Option<Balance>,
input_data: Vec<u8>,
) -> pallet_revive::ContractExecResult<Balance, EventRecord> {
Revive::bare_call(
Contracts::bare_call(
RuntimeOrigin::signed(origin),
dest,
value,
gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block),
storage_deposit_limit.unwrap_or(u128::MAX),
input_data,
pallet_revive::DebugInfo::UnsafeDebug,
pallet_revive::CollectEvents::UnsafeCollect,
CONTRACTS_DEBUG_OUTPUT,
CONTRACTS_EVENTS,
)
}

Expand All @@ -828,7 +822,7 @@
salt: Option<[u8; 32]>,
) -> pallet_revive::ContractInstantiateResult<Balance, EventRecord>
{
Revive::bare_instantiate(
Contracts::bare_instantiate(
RuntimeOrigin::signed(origin),
value,
gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block),
Expand All @@ -847,7 +841,7 @@
storage_deposit_limit: Option<Balance>,
) -> pallet_revive::CodeUploadResult<Balance>
{
Revive::bare_upload_code(
Contracts::bare_upload_code(
RuntimeOrigin::signed(origin),
code,
storage_deposit_limit.unwrap_or(u128::MAX),
Expand All @@ -858,7 +852,7 @@
address: H160,
key: [u8; 32],
) -> pallet_revive::GetStorageResult {
Revive::get_storage(
Contracts::get_storage(
address,
key
)
Expand Down
Loading