Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
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
7 changes: 4 additions & 3 deletions demo/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ mod tests {
council: Some(Default::default()),
timestamp: Some(Default::default()),
treasury: Some(Default::default()),
contract: Some(Default::default()),
}.build_storage().unwrap().into()
}

Expand All @@ -262,7 +263,7 @@ mod tests {
construct_block(
1,
[69u8; 32].into(),
hex!("c2fcc528c92b3c958b0e0914f26e05f151903ed43c87f29b20f9c8f0450d7484").into(),
hex!("1f058f699ad3187bcf7e9ed8e44464d7a5added0cd912d2679b9dab2e7a04053").into(),
vec![
CheckedExtrinsic {
signed: None,
Expand All @@ -282,7 +283,7 @@ mod tests {
construct_block(
2,
block1().1,
hex!("62e5879f10338fa6136161c60ae0ffc35936f7b8c3fdb38095ddd0e044309762").into(),
hex!("29fa1d0aa83662c571315af54b106c73823a31f759793803bf8929960b67b138").into(),
vec![
CheckedExtrinsic {
signed: None,
Expand All @@ -307,7 +308,7 @@ mod tests {
construct_block(
1,
[69u8; 32].into(),
hex!("789b19bc7beaa83ae70412f65ad0ac02435fd79e0226ba3394865a052e56fbd8").into(),
hex!("fe0e07c7b054fe186387461d455d536860e9c71d6979fd9dbf755e96ce070d04").into(),
vec![
CheckedExtrinsic {
signed: None,
Expand Down
1 change: 1 addition & 0 deletions demo/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ impl_outer_config! {
pub struct GenesisConfig for Runtime {
SystemConfig => system,
ConsensusConfig => consensus,
ContractConfig => contract,
BalancesConfig => balances,
TimestampConfig => timestamp,
SessionConfig => session,
Expand Down
19 changes: 18 additions & 1 deletion demo/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
use ed25519;
use primitives::AuthorityId;
use demo_runtime::{GenesisConfig, ConsensusConfig, CouncilConfig, DemocracyConfig,
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, TreasuryConfig, Permill};
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, TreasuryConfig,
ContractConfig, Permill};
use service::ChainSpec;

const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
Expand Down Expand Up @@ -98,6 +99,14 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
spend_period: 12 * 60 * 24,
burn: Permill::from_percent(50),
}),
contract: Some(ContractConfig {
contract_fee: 21,
call_base_fee: 135,
create_base_fee: 175,
gas_price: 1,
max_depth: 1024,
block_gas_limit: 10_000_000,
}),
}
}

Expand Down Expand Up @@ -183,6 +192,14 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig {
spend_period: 12 * 60 * 24,
burn: Permill::from_percent(50),
}),
contract: Some(ContractConfig {
contract_fee: 21,
call_base_fee: 135,
create_base_fee: 175,
gas_price: 1,
max_depth: 1024,
block_gas_limit: 10_000_000,
}),
}
}

Expand Down
14 changes: 14 additions & 0 deletions substrate/runtime/contract/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use {Trait, ContractFee, CallBaseFee, CreateBaseFee, GasPrice, MaxDepth, BlockGasLimit};

use runtime_primitives;
use runtime_primitives::traits::As;
use runtime_io::{self, twox_128};
use runtime_support::StorageValue;
use codec::Encode;
Expand All @@ -39,6 +40,19 @@ pub struct GenesisConfig<T: Trait> {
pub block_gas_limit: T::Gas,
}

impl<T: Trait> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig {
contract_fee: T::Balance::sa(21),
call_base_fee: T::Gas::sa(135),
create_base_fee: T::Gas::sa(175),
gas_price: T::Balance::sa(1),
max_depth: 100,
block_gas_limit: T::Gas::sa(1_000_000),
}
}
}

impl<T: Trait> runtime_primitives::BuildStorage for GenesisConfig<T> {
fn build_storage(self) -> ::std::result::Result<HashMap<Vec<u8>, Vec<u8>>, String> {
let r: runtime_io::TestExternalities<Blake2Hasher> = map![
Expand Down