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

chore: cleanup unused and deprecated code #1152

Merged
merged 1 commit into from
Aug 4, 2023
Merged
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
5 changes: 2 additions & 3 deletions parachain/runtime/kintsugi/src/contracts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::{BaseCallFilter, NativeCurrency, Runtime, RuntimeCall, RuntimeEvent, Timestamp, Weight};
use bitcoin::types::{MerkleProof, Transaction};
use crate::{NativeCurrency, Runtime, RuntimeCall, RuntimeEvent, Timestamp, Weight};
use btc_relay::FullTransactionProof;
use codec::{Decode, Encode};
use frame_support::{
Expand Down Expand Up @@ -36,7 +35,7 @@ impl Convert<Weight, Balance> for DummyWeightPrice {
// contracts
parameter_types! {
pub const DeletionQueueDepth: u32 = 10;
pub const DeletionWeightLimit: Weight = Weight::from_ref_time(100000000 as u64);
pub const DeletionWeightLimit: Weight = Weight::from_parts(100000000, 0);
pub const DepositPerByte: Balance = 1;
pub const DepositPerItem: Balance = 1;
pub const MaxCodeLen: u32 = 123 * 1024;
Expand Down
21 changes: 15 additions & 6 deletions parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use polkadot_service::CollatorPair;
use primitives::*;
use sc_client_api::{HeaderBackend, StateBackendFor};
use sc_consensus::{ImportQueue, LongestChain};
use sc_executor::NativeElseWasmExecutor;
use sc_executor::{HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, RpcHandlers, TFullBackend, TFullClient, TaskManager};
Expand Down Expand Up @@ -254,11 +254,20 @@ where
})
.transpose()?;

let executor = NativeElseWasmExecutor::<Executor>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
let heap_pages = config
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
extra_pages: h as _,
});

let executor = NativeElseWasmExecutor::<Executor>::new_with_wasm_executor(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the native executor is soon going to be deprecated, I saw some other projects such as Acala and Bifrost only use the WASM executor now so we may also consider following suit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a source on this? The native executor is a lot more efficient so isn't it preferable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I saw someone commented on the PR which deprecates the new constructor here but then I found this issue with a more detailed explanation. Statemint has also already switched to wasm runtime only, see this PR.

WasmExecutor::builder()
.with_execution_method(config.wasm_method)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(config.max_runtime_instances)
.with_runtime_cache_size(config.runtime_cache_size)
.build(),
);

let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, _>(
Expand Down
Loading