From cd14ca0a508713157c3a1475caf87a585fe14ccc Mon Sep 17 00:00:00 2001 From: NZT48 Date: Tue, 30 Jul 2024 15:43:56 +0200 Subject: [PATCH 1/4] Adjust base fee --- Cargo.toml | 10 ++++------ runtime/src/lib.rs | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c8c00ba..987fb0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -116,12 +116,10 @@ pallet-vesting = { git = "https://github.com/paritytech/polkadot-sdk", default-f pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features = false } # EVM & Ethereum -evm = { git = "https://github.com/rust-blockchain/evm", rev = "13240a8a551586fdef0b5028ed73af80b248092a" } -evm-gasometer = { git = "https://github.com/rust-blockchain/evm", rev = "13240a8a551586fdef0b5028ed73af80b248092a", default-features = false } -evm-runtime = { git = "https://github.com/rust-blockchain/evm", rev = "13240a8a551586fdef0b5028ed73af80b248092a", default-features = false } -ethereum = { version = "0.14.0", default-features = false, features = [ - "with-codec", -] } +evm = { version = "0.41.1", default-features = false } +evm-gasometer = { version = "0.41.0", default-features = false } +evm-runtime = { version = "0.41.0", default-features = false } +ethereum = { version = "0.15.0", default-features = false } # Frontier pallet-base-fee = { git = "https://github.com/polkadot-evm/frontier", default-features = false, branch = "polkadot-v1.9.0" } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 223b2b5..2cdb58e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -141,7 +141,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("origintrail-parachain"), impl_name: create_runtime_str!("neuroweb"), authoring_version: 1, - spec_version: 131, + spec_version: 132, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -662,7 +662,7 @@ impl pallet_evm_accounts::Config for Runtime { } parameter_types! { - pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); + pub DefaultBaseFeePerGas: U256 = U256::from(16); pub DefaultElasticity: Permill = Permill::from_parts(125_000); } From e0cd94e02072c0d60777ea245241787b95fb3115 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Wed, 7 Aug 2024 13:40:37 +0000 Subject: [PATCH 2/4] Update ChainId --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 2cdb58e..765c210 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -756,7 +756,7 @@ impl> FindAuthor for FindAuthorTruncated { } parameter_types! { - pub const ChainId: u64 = 2043; + pub const ChainId: u64 = 20430; pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: FrontierPrecompiles = FrontierPrecompiles::<_>::new(); pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); From dde2118bea3975dbed32b14ec9d2e0d5b4f7906e Mon Sep 17 00:00:00 2001 From: NZT48 Date: Wed, 7 Aug 2024 14:44:55 +0000 Subject: [PATCH 3/4] Remove native executor --- Cargo.lock | 156 ++++++++++---------------------------------- node/src/service.rs | 52 ++++++++++----- runtime/src/lib.rs | 2 +- 3 files changed, 72 insertions(+), 138 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41439d1..d12c167 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -897,7 +897,7 @@ name = "binary-merkle-tree" version = "13.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185cacd79b0c6ac1263ae28613c9625e6b3" dependencies = [ - "hash-db 0.16.0", + "hash-db", "log", ] @@ -3013,24 +3013,6 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "ethereum" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89fb87a9e103f71b903b80b670200b54cc67a07578f070681f1fffb7396fb7" -dependencies = [ - "bytes", - "ethereum-types", - "hash-db 0.15.2", - "hash256-std-hasher", - "parity-scale-codec", - "rlp", - "scale-info", - "serde", - "sha3 0.10.8", - "triehash", -] - [[package]] name = "ethereum" version = "0.15.0" @@ -3039,7 +3021,7 @@ checksum = "2e04d24d20b8ff2235cffbf242d5092de3aa45f77c5270ddbfadd2778ca13fea" dependencies = [ "bytes", "ethereum-types", - "hash-db 0.16.0", + "hash-db", "hash256-std-hasher", "parity-scale-codec", "rlp", @@ -3103,26 +3085,6 @@ dependencies = [ "pin-project-lite 0.2.14", ] -[[package]] -name = "evm" -version = "0.36.0" -source = "git+https://github.com/rust-blockchain/evm?rev=13240a8a551586fdef0b5028ed73af80b248092a#13240a8a551586fdef0b5028ed73af80b248092a" -dependencies = [ - "auto_impl", - "environmental", - "ethereum 0.14.0", - "evm-core 0.36.0", - "evm-gasometer 0.36.0", - "evm-runtime 0.36.0", - "log", - "parity-scale-codec", - "primitive-types", - "rlp", - "scale-info", - "serde", - "sha3 0.10.8", -] - [[package]] name = "evm" version = "0.41.1" @@ -3131,10 +3093,10 @@ checksum = "767f43e9630cc36cf8ff2777cbb0121b055f0d1fd6eaaa13b46a1808f0d0e7e9" dependencies = [ "auto_impl", "environmental", - "ethereum 0.15.0", - "evm-core 0.41.0", - "evm-gasometer 0.41.0", - "evm-runtime 0.41.0", + "ethereum", + "evm-core", + "evm-gasometer", + "evm-runtime", "log", "parity-scale-codec", "primitive-types", @@ -3144,17 +3106,6 @@ dependencies = [ "sha3 0.10.8", ] -[[package]] -name = "evm-core" -version = "0.36.0" -source = "git+https://github.com/rust-blockchain/evm?rev=13240a8a551586fdef0b5028ed73af80b248092a#13240a8a551586fdef0b5028ed73af80b248092a" -dependencies = [ - "parity-scale-codec", - "primitive-types", - "scale-info", - "serde", -] - [[package]] name = "evm-core" version = "0.41.0" @@ -3167,17 +3118,6 @@ dependencies = [ "serde", ] -[[package]] -name = "evm-gasometer" -version = "0.36.0" -source = "git+https://github.com/rust-blockchain/evm?rev=13240a8a551586fdef0b5028ed73af80b248092a#13240a8a551586fdef0b5028ed73af80b248092a" -dependencies = [ - "environmental", - "evm-core 0.36.0", - "evm-runtime 0.36.0", - "primitive-types", -] - [[package]] name = "evm-gasometer" version = "0.41.0" @@ -3185,23 +3125,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dc0eb591abc5cd7b05bef6a036c2bb6c66ab6c5e0c5ce94bfe377ab670b1fd7" dependencies = [ "environmental", - "evm-core 0.41.0", - "evm-runtime 0.41.0", + "evm-core", + "evm-runtime", "primitive-types", ] -[[package]] -name = "evm-runtime" -version = "0.36.0" -source = "git+https://github.com/rust-blockchain/evm?rev=13240a8a551586fdef0b5028ed73af80b248092a#13240a8a551586fdef0b5028ed73af80b248092a" -dependencies = [ - "auto_impl", - "environmental", - "evm-core 0.36.0", - "primitive-types", - "sha3 0.10.8", -] - [[package]] name = "evm-runtime" version = "0.41.0" @@ -3210,7 +3138,7 @@ checksum = "84bbe09b64ae13a29514048c1bb6fda6374ac0b4f6a1f15a443348ab88ef42cd" dependencies = [ "auto_impl", "environmental", - "evm-core 0.41.0", + "evm-core", "primitive-types", "sha3 0.10.8", ] @@ -3368,9 +3296,9 @@ name = "fc-rpc" version = "2.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "ethereum-types", - "evm 0.41.1", + "evm", "fc-api", "fc-mapping-sync", "fc-rpc-core", @@ -3423,7 +3351,7 @@ name = "fc-rpc-core" version = "1.1.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "ethereum-types", "jsonrpsee", "rlp", @@ -3438,7 +3366,7 @@ name = "fc-storage" version = "1.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "ethereum-types", "fp-rpc", "fp-storage", @@ -3623,7 +3551,7 @@ name = "fp-consensus" version = "2.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "parity-scale-codec", "sp-core", "sp-runtime", @@ -3635,7 +3563,7 @@ name = "fp-ethereum" version = "1.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "ethereum-types", "fp-evm", "frame-support", @@ -3648,7 +3576,7 @@ name = "fp-evm" version = "3.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "evm 0.41.1", + "evm", "frame-support", "num_enum 0.7.2", "parity-scale-codec", @@ -3664,7 +3592,7 @@ name = "fp-rpc" version = "3.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "ethereum-types", "fp-evm", "parity-scale-codec", @@ -4358,12 +4286,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "hash-db" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" - [[package]] name = "hash-db" version = "0.16.0" @@ -5919,7 +5841,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" dependencies = [ - "hash-db 0.16.0", + "hash-db", ] [[package]] @@ -7231,9 +7153,9 @@ name = "pallet-ethereum" version = "4.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ - "ethereum 0.15.0", + "ethereum", "ethereum-types", - "evm 0.41.1", + "evm", "fp-consensus", "fp-ethereum", "fp-evm", @@ -7255,13 +7177,13 @@ version = "6.0.0-dev" source = "git+https://github.com/polkadot-evm/frontier?branch=polkadot-v1.9.0#f68f4c685ed0aed813dcfaac1a9f94fa33d83d5e" dependencies = [ "environmental", - "evm 0.41.1", + "evm", "fp-account", "fp-evm", "frame-benchmarking", "frame-support", "frame-system", - "hash-db 0.16.0", + "hash-db", "hex", "hex-literal 0.4.1", "impl-trait-for-tuples", @@ -7353,10 +7275,10 @@ dependencies = [ name = "pallet-evm-utility" version = "1.1.1" dependencies = [ - "ethereum 0.14.0", - "evm 0.36.0", - "evm-gasometer 0.36.0", - "evm-runtime 0.36.0", + "ethereum", + "evm", + "evm-gasometer", + "evm-runtime", "sha3 0.10.8", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0)", ] @@ -9679,7 +9601,7 @@ name = "precompile-utils" version = "1.1.1" dependencies = [ "assert_matches", - "evm 0.36.0", + "evm", "fp-evm", "frame-support", "frame-system", @@ -11014,7 +10936,7 @@ name = "sc-client-db" version = "0.35.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185cacd79b0c6ac1263ae28613c9625e6b3" dependencies = [ - "hash-db 0.16.0", + "hash-db", "kvdb", "kvdb-memorydb", "kvdb-rocksdb", @@ -12627,7 +12549,7 @@ name = "sp-api" version = "26.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185cacd79b0c6ac1263ae28613c9625e6b3" dependencies = [ - "hash-db 0.16.0", + "hash-db", "log", "parity-scale-codec", "scale-info", @@ -12861,7 +12783,7 @@ dependencies = [ "dyn-clonable", "ed25519-zebra 3.1.0", "futures", - "hash-db 0.16.0", + "hash-db", "hash256-std-hasher", "impl-serde", "itertools 0.10.5", @@ -13275,7 +13197,7 @@ name = "sp-state-machine" version = "0.35.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185cacd79b0c6ac1263ae28613c9625e6b3" dependencies = [ - "hash-db 0.16.0", + "hash-db", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -13417,7 +13339,7 @@ version = "29.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185cacd79b0c6ac1263ae28613c9625e6b3" dependencies = [ "ahash 0.8.11", - "hash-db 0.16.0", + "hash-db", "lazy_static", "memory-db", "nohash-hasher", @@ -14460,7 +14382,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff28e0f815c2fea41ebddf148e008b077d2faddb026c9555b29696114d602642" dependencies = [ - "hash-db 0.16.0", + "hash-db", "hashbrown 0.13.2", "log", "rustc-hex", @@ -14473,17 +14395,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" dependencies = [ - "hash-db 0.16.0", -] - -[[package]] -name = "triehash" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" -dependencies = [ - "hash-db 0.15.2", - "rlp", + "hash-db", ] [[package]] diff --git a/node/src/service.rs b/node/src/service.rs index 2748017..8b5a552 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -25,7 +25,7 @@ use polkadot_service::CollatorPair; // Substrate Imports use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; use sc_consensus::ImportQueue; -use sc_executor::NativeElseWasmExecutor; +use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; use sc_network::NetworkBlock; use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; @@ -50,24 +50,34 @@ pub type HostFunctions = ( cumulus_client_service::storage_proof_size::HostFunctions, ); -/// Native executor type. -pub struct ParachainNativeExecutor; +// /// Native executor type. +// pub struct ParachainNativeExecutor; -impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor { - type ExtendHostFunctions = HostFunctions; +// impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor { +// type ExtendHostFunctions = HostFunctions; - fn dispatch(method: &str, data: &[u8]) -> Option> { - neuroweb_runtime::api::dispatch(method, data) - } +// fn dispatch(method: &str, data: &[u8]) -> Option> { +// neuroweb_runtime::api::dispatch(method, data) +// } - fn native_version() -> sc_executor::NativeVersion { - neuroweb_runtime::native_version() - } -} +// fn native_version() -> sc_executor::NativeVersion { +// neuroweb_runtime::native_version() +// } +// } + +// type ParachainExecutor = NativeElseWasmExecutor; -type ParachainExecutor = NativeElseWasmExecutor; +// type ParachainClient = TFullClient; -type ParachainClient = TFullClient; +type ParachainClient = TFullClient< + Block, + RuntimeApi, + WasmExecutor<( + sp_io::SubstrateHostFunctions, + frame_benchmarking::benchmarking::HostFunctions, + cumulus_client_service::storage_proof_size::HostFunctions, + )>, +>; type ParachainBackend = TFullBackend; @@ -143,7 +153,19 @@ pub fn new_partial( }) .transpose()?; - let executor = sc_service::new_native_or_wasm_executor(&config); + let heap_pages = config + .default_heap_pages + .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { + extra_pages: h as _, + }); + + let executor = 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_record_import::( diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 765c210..4e504b4 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -141,7 +141,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("origintrail-parachain"), impl_name: create_runtime_str!("neuroweb"), authoring_version: 1, - spec_version: 132, + spec_version: 133, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 0c1e01056294ebec2d5bf2414be6446575736976 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Wed, 7 Aug 2024 14:46:35 +0000 Subject: [PATCH 4/4] Remove commented out code --- node/src/service.rs | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/node/src/service.rs b/node/src/service.rs index 8b5a552..797a170 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -37,38 +37,6 @@ use futures::StreamExt; use sc_client_api::BlockchainEvents; use fc_rpc_core::types::{FeeHistoryCache, FilterPool}; -/// Extra host functions -#[cfg(feature = "runtime-benchmarks")] -pub type HostFunctions = ( - frame_benchmarking::benchmarking::HostFunctions, - cumulus_client_service::storage_proof_size::HostFunctions, -); - -/// Extra host functions -#[cfg(not(feature = "runtime-benchmarks"))] -pub type HostFunctions = ( - cumulus_client_service::storage_proof_size::HostFunctions, -); - -// /// Native executor type. -// pub struct ParachainNativeExecutor; - -// impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor { -// type ExtendHostFunctions = HostFunctions; - -// fn dispatch(method: &str, data: &[u8]) -> Option> { -// neuroweb_runtime::api::dispatch(method, data) -// } - -// fn native_version() -> sc_executor::NativeVersion { -// neuroweb_runtime::native_version() -// } -// } - -// type ParachainExecutor = NativeElseWasmExecutor; - -// type ParachainClient = TFullClient; - type ParachainClient = TFullClient< Block, RuntimeApi,