Skip to content

Commit

Permalink
Testnet Runtime Upgrade v136 (#106)
Browse files Browse the repository at this point in the history
* Update chain id

* Alling mainnet and develop (#102)

* Mainnet release v1.11.0 (#98)

* Add sudo for Devnet

* Dependency update to Polkadot v0.9.42

* Dependency update to Polkadot v0.9.43

* Dependency update to Polkadot v1.1.0

* Integrating metadata hash verification into runtime

* Dependency update to Polkadot v1.3.0

* Lift dependencies to the workspace

* Dependency update to Polkadot v1.5.0

* Add genesis builder

* Dependency update to Polkadot v1.9.0

* Setup chain id for evm

* Updated Devnet to Polkadot 1.9.0

* Fix chain id in chainspec

* Bump spec version

* Adjust base fee

* Adjust base fee

* Update ChainId

* Remove native executor

* Remove commented out code

* Update chain id

* Async backing phase 1 - runtime updates

* Plug new lookahead collator node

* Revert milisec per block

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

* Feature/polkadot v1.11.0 (#92)

* Update chain id

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Move polkadot-service to mooneam implementation (#94)

* Updates

* version bump

* version bump

* version for devnet

* update lock

* Update chainId for testnet

* Remove sudo for testnet

* Update chainId for mainnet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Mainnet v1.5.1 Async Backing (#100)

* Add sudo for Devnet

* Dependency update to Polkadot v0.9.42

* Dependency update to Polkadot v0.9.43

* Dependency update to Polkadot v1.1.0

* Integrating metadata hash verification into runtime

* Dependency update to Polkadot v1.3.0

* Lift dependencies to the workspace

* Dependency update to Polkadot v1.5.0

* Add genesis builder

* Dependency update to Polkadot v1.9.0

* Setup chain id for evm

* Updated Devnet to Polkadot 1.9.0

* Fix chain id in chainspec

* Bump spec version

* Adjust base fee

* Adjust base fee

* Update ChainId

* Remove native executor

* Remove commented out code

* Update chain id

* Async backing phase 1 - runtime updates

* Plug new lookahead collator node

* Revert milisec per block

* Phase 3 - Enable async backing in runtime

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

* Move polkadot-service to mooneam implementation (#94)

* Updates

* version bump

* version bump

* Enable AB

* Update spec version

* Testnet release v1.11.0 (#96)

* Add sudo for Devnet

* Setup chain id for evm

* Updated Devnet to Polkadot 1.9.0

* Adjust base fee

* Update chain id

* Async backing phase 1 - runtime updates

* Plug new lookahead collator node

* Revert milisec per block

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

* Feature/polkadot v1.11.0 (#92)

* Update chain id

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Move polkadot-service to mooneam implementation (#94)

* Updates

* version bump

* version bump

* version for devnet

* update lock

* Update chainId for testnet

* Remove sudo for testnet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Update chainId for testnet evm

* remove new line

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Remove try-runtime-cli

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Add metadata-hash feature to Cargo.toml (#104)

* Add metadata-hash feature to Cargo.toml

* Update spec_version

* Bugfix/gas limit estimation (#103)

* Mainnet release v1.11.0 (#98)

* Add sudo for Devnet

* Dependency update to Polkadot v0.9.42

* Dependency update to Polkadot v0.9.43

* Dependency update to Polkadot v1.1.0

* Integrating metadata hash verification into runtime

* Dependency update to Polkadot v1.3.0

* Lift dependencies to the workspace

* Dependency update to Polkadot v1.5.0

* Add genesis builder

* Dependency update to Polkadot v1.9.0

* Setup chain id for evm

* Updated Devnet to Polkadot 1.9.0

* Fix chain id in chainspec

* Bump spec version

* Adjust base fee

* Adjust base fee

* Update ChainId

* Remove native executor

* Remove commented out code

* Update chain id

* Async backing phase 1 - runtime updates

* Plug new lookahead collator node

* Revert milisec per block

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

* Feature/polkadot v1.11.0 (#92)

* Update chain id

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Move polkadot-service to mooneam implementation (#94)

* Updates

* version bump

* version bump

* version for devnet

* update lock

* Update chainId for testnet

* Remove sudo for testnet

* Update chainId for mainnet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Mainnet v1.5.1 Async Backing (#100)

* Add sudo for Devnet

* Dependency update to Polkadot v0.9.42

* Dependency update to Polkadot v0.9.43

* Dependency update to Polkadot v1.1.0

* Integrating metadata hash verification into runtime

* Dependency update to Polkadot v1.3.0

* Lift dependencies to the workspace

* Dependency update to Polkadot v1.5.0

* Add genesis builder

* Dependency update to Polkadot v1.9.0

* Setup chain id for evm

* Updated Devnet to Polkadot 1.9.0

* Fix chain id in chainspec

* Bump spec version

* Adjust base fee

* Adjust base fee

* Update ChainId

* Remove native executor

* Remove commented out code

* Update chain id

* Async backing phase 1 - runtime updates

* Plug new lookahead collator node

* Revert milisec per block

* Phase 3 - Enable async backing in runtime

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

* Move polkadot-service to mooneam implementation (#94)

* Updates

* version bump

* version bump

* Enable AB

* Update spec version

* Testnet release v1.11.0 (#96)

* Add sudo for Devnet

* Setup chain id for evm

* Updated Devnet to Polkadot 1.9.0

* Adjust base fee

* Update chain id

* Async backing phase 1 - runtime updates

* Plug new lookahead collator node

* Revert milisec per block

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

* Feature/polkadot v1.11.0 (#92)

* Update chain id

* Compiling

* rm .vscode

* Remove unused

* Remove comments and log file

* Add sudo pallet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Move polkadot-service to mooneam implementation (#94)

* Updates

* version bump

* version bump

* version for devnet

* update lock

* Update chainId for testnet

* Remove sudo for testnet

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Update chainId for testnet evm

* remove new line

---------

Co-authored-by: Nikola Todorovic <[email protected]>

* Updated call/create functions in the runtime apis

* Return is_transactional and validate vars

---------

Co-authored-by: Nikola Todorovic <[email protected]>
Co-authored-by: Mihajlo Pavlovic <[email protected]>
Co-authored-by: Mihajlo Pavlovic <[email protected]>

* Version bump (#105)

---------

Co-authored-by: Nikola Todorovic <[email protected]>
Co-authored-by: Uladzislau Hubar <[email protected]>
  • Loading branch information
3 people authored Sep 17, 2024
1 parent d408469 commit 3812511
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 72 deletions.
106 changes: 53 additions & 53 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ To run a full network with multiple NeuroWeb nodes (collators and non-collators)
#### Run A Relay Chain

To start a relay chain we recommend reading and following instructions in [Cumulus Workshop](https://docs.substrate.io/tutorials/build-a-parachain/prepare-a-local-relay-chain/).

NeuroWeb is currently compatible with Polkadot v1.11.0 version.

#### Parachain Nodes (Collators)
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neuroweb-node"
version = "1.5.1"
version = "1.5.0"
authors = ["TraceLabs"]
description = "NeuroWeb - Cumulus FRAME-based Substrate Node"
license = "GPL-3.0-only"
Expand Down
11 changes: 7 additions & 4 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neuroweb-runtime"
version = "1.5.1"
version = "1.5.2"
authors = ["TraceLabs"]
description = "NeuroWeb Runtime - Cumulus FRAME-based Substrate Runtime"
license = "GPL-3.0-only"
Expand All @@ -11,9 +11,6 @@ edition = "2021"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
substrate-wasm-builder = { workspace = true }

[dependencies]
codec = { workspace = true }
hex-literal = { workspace = true, optional = true }
Expand Down Expand Up @@ -101,6 +98,9 @@ pallet-democracy = { workspace = true }
pallet-identity = { workspace = true }
pallet-preimage = { workspace = true }

[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true }

[features]
default = ["std"]
std = [
Expand Down Expand Up @@ -166,6 +166,7 @@ std = [
"sp-session/std",
"sp-std/std",
"sp-transaction-pool/std",
"substrate-wasm-builder",
"sp-version/std",
"xcm-builder/std",
"xcm-executor/std",
Expand Down Expand Up @@ -232,3 +233,5 @@ try-runtime = [
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
]

metadata-hash = ["substrate-wasm-builder/metadata-hash"]
111 changes: 97 additions & 14 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: 135,
spec_version: 136,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -1456,6 +1456,8 @@ impl_runtime_apis! {
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
use pallet_evm::GasWeightMapping as _;

let config = if estimate {
let mut config = <Runtime as pallet_evm::Config>::config().clone();
config.estimate = true;
Expand All @@ -1464,8 +1466,49 @@ impl_runtime_apis! {
None
};

let is_transactional = false;
let is_transactional = false;
let validate = true;

// Estimated encoded transaction size must be based on the heaviest transaction
// type (EIP1559Transaction) to be compatible with all transaction types.
let mut estimated_transaction_len = data.len() +
// pallet ethereum index: 1
// transact call index: 1
// Transaction enum variant: 1
// chain_id 8 bytes
// nonce: 32
// max_priority_fee_per_gas: 32
// max_fee_per_gas: 32
// gas_limit: 32
// action: 21 (enum varianrt + call address)
// value: 32
// access_list: 1 (empty vec size)
// 65 bytes signature
258;

if access_list.is_some() {
estimated_transaction_len += access_list.encoded_size();
}


let gas_limit = if gas_limit > U256::from(u64::MAX) {
u64::MAX
} else {
gas_limit.low_u64()
};
let without_base_extrinsic_weight = true;

let (weight_limit, proof_size_base_cost) =
match <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
) {
weight_limit if weight_limit.proof_size() > 0 => {
(Some(weight_limit), Some(estimated_transaction_len as u64))
}
_ => (None, None),
};

<Runtime as pallet_evm::Config>::Runner::call(
from,
to,
Expand All @@ -1477,11 +1520,10 @@ impl_runtime_apis! {
nonce,
access_list.unwrap_or_default(),
is_transactional,
validate,
// TODO we probably want to support external cost recording in non-transactional calls
None,
None,
config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
validate,
weight_limit,
proof_size_base_cost,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}

Expand All @@ -1496,6 +1538,8 @@ impl_runtime_apis! {
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
use pallet_evm::GasWeightMapping as _;

let config = if estimate {
let mut config = <Runtime as pallet_evm::Config>::config().clone();
config.estimate = true;
Expand All @@ -1504,8 +1548,48 @@ impl_runtime_apis! {
None
};

let is_transactional = false;
let is_transactional = false;
let validate = true;

let mut estimated_transaction_len = data.len() +
// from: 20
// value: 32
// gas_limit: 32
// nonce: 32
// 1 byte transaction action variant
// chain id 8 bytes
// 65 bytes signature
190;

if max_fee_per_gas.is_some() {
estimated_transaction_len += 32;
}
if max_priority_fee_per_gas.is_some() {
estimated_transaction_len += 32;
}
if access_list.is_some() {
estimated_transaction_len += access_list.encoded_size();
}


let gas_limit = if gas_limit > U256::from(u64::MAX) {
u64::MAX
} else {
gas_limit.low_u64()
};
let without_base_extrinsic_weight = true;

let (weight_limit, proof_size_base_cost) =
match <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
) {
weight_limit if weight_limit.proof_size() > 0 => {
(Some(weight_limit), Some(estimated_transaction_len as u64))
}
_ => (None, None),
};

<Runtime as pallet_evm::Config>::Runner::create(
from,
data,
Expand All @@ -1515,12 +1599,11 @@ impl_runtime_apis! {
max_priority_fee_per_gas,
nonce,
access_list.unwrap_or_default(),
is_transactional,
is_transactional,
validate,
// TODO we probably want to support external cost recording in non-transactional calls
None,
None,
config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
weight_limit,
proof_size_base_cost,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}

Expand Down Expand Up @@ -1682,7 +1765,7 @@ impl_runtime_apis! {
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
Expand Down

0 comments on commit 3812511

Please sign in to comment.