Commit 2ec0f429 authored by Gav Wood's avatar Gav Wood Committed by GitHub
Browse files

Fix up session phase backport (#452)

* Fix up session phase.

* Version bump.

* Version fix

* Fix session rotation properly and add test

* Make contract a separate runtime module (#345)

* decl_module and extract runtime mod

* Invert dependency staking←→contract

* Remove CodeOf

* Remove StorageOf and move double_map

* Comment staking test

* Clean

* Add gas_price and gas_limit

* Commit.

* Renames

* Params

* WIP

* Rename transfer to call

* WIP

* Rebuild binaries.

* WIP

* Backport ctro changes

* Call wiring

* Commit overlay.

* Rename merge → commit, into_state → ..._change_set

* WIP

* Contract creation routines

* Set code of the created account.

* Fix the ID of `create` Call

* Fix most of the warning.

* Add the simplest test in the contract crate

* Transfers work!

* Add contract_create test.

* Clean

* Add top-level create test

* Clean a bit.

* Pass gas_limit and data via create.

* Introduce OnAccountKill callback in staking

* Hook up OnAccountKill

* Comments

* Pay for gas.

* Refund unused gas in call

* Tests for zero call and zero endownment.

* Add todo about rewriting docs

* Pay for gas in create transactions

* Fix refunds

* Clean unrelevant comments

* fixup! Fix refunds

* fixup! Clean unrelevant comments

* Move DetermineContractAddress to contract

Also restore account removal test

* fixup! Clean unrelevant comments

* Inline effect_transfer, remove effect_create

Remove account_db!

* Use own new_test_ext.

* Don't account for liability

* Add some docs

* Move contract_fee into contract module

* Take GasMeter in vm::execute

* Use GasMeter throughout contract module for meter

* gas module refactoring

* Clean

* Add base call fee

* note about gas price should be taken from storage

* Add base fee for create

* Rename send → call

* Clean

* Take fee expressed in dots in gas

* Add Checked{Add,Sub,Mul,Div} to SimpleArithmetic

* Make Gas generic

* Store {call,create}_base_fee in storage

* Clean

* Rename buy_gas

* Store gas_price in the storage

* Remove unneeded comment.

* Bail out if contract already has code.

* Todos

* Refund even if top-level contract fails.

* Fix error msg

* Fix caller issue

* Extract tests module

* Add max_depth var in storage

* Remove left over gas_left

* Refactor exec

* Add test oog test.

* set_free_balance_creating

* Docs and comments.

* Update storage roots because of ContractFee move

* Rebuild binaries.

* Simplify vm code.

* Wrapping.

* Refactor a bit.

* Typo

* UpdateBalanceOutcome enum

* Style grumbles.

* Rebuild binaries.

* Always consume the given amount of gas.

* [skip ci] endownment → endowment

* Rename `AccountId` generic in on_account_kill

* Fix Cargo.lock

* Refine docs for gas meter.

* [skip ci] Add comments for gas module

* Directly assign to `return_data` at declaration

* Use slices instead of vecs to pass the input data

* Add todo about passing return data without copy

* Use checked_add instead of add with overflow

* Use return_data directly.

* Rebuild binaries.

* Rebuild binaries.

* Docs
parent 2369ae0f
......@@ -110,7 +110,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: ver_str!("polkadot"),
impl_name: ver_str!("parity-polkadot"),
authoring_version: 1,
spec_version: 1,
spec_version: 2,
impl_version: 0,
};
......@@ -168,8 +168,8 @@ pub type Session = session::Module<Concrete>;
impl staking::Trait for Concrete {
type Balance = Balance;
type DetermineContractAddress = BlakeTwo256;
type AccountIndex = AccountIndex;
type OnAccountKill = ();
}
/// Staking module for this concrete runtime.
pub type Staking = staking::Module<Concrete>;
......
......@@ -516,16 +516,6 @@ dependencies = [
name = "pwasm-libc"
version = "0.1.0"
[[package]]
name = "pwasm-utils"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.6.3"
......@@ -759,17 +749,6 @@ dependencies = [
"substrate-runtime-system 0.1.0",
]
[[package]]
name = "substrate-runtime-contract"
version = "0.1.0"
dependencies = [
"parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"substrate-codec 0.1.0",
"substrate-runtime-sandbox 0.1.0",
"substrate-runtime-std 0.1.0",
]
[[package]]
name = "substrate-runtime-council"
version = "0.1.0"
......@@ -902,7 +881,6 @@ dependencies = [
"substrate-keyring 0.1.0",
"substrate-primitives 0.1.0",
"substrate-runtime-consensus 0.1.0",
"substrate-runtime-contract 0.1.0",
"substrate-runtime-io 0.1.0",
"substrate-runtime-primitives 0.1.0",
"substrate-runtime-sandbox 0.1.0",
......@@ -1215,7 +1193,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum proc-macro-hack 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ba8d4f9257b85eb6cdf13f055cea3190520aab1409ca2ab43493ea4820c25f0"
"checksum proc-macro-hack-impl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5cb6f960ad471404618e9817c0e5d10b1ae74cfdf01fab89ea0641fe7fb2892"
"checksum proc-macro2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1fa93823f53cfd0f5ac117b189aed6cfdfb2cfc0a9d82e956dd7927595ed7d46"
"checksum pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "efd695333cfae6e9dbe2703a6d040e252b57a6fc3b9a65c712615ac042b2e0c5"
"checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035"
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
......
......@@ -57,7 +57,6 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
existential_deposit: 500,
transfer_fee: 0,
creation_fee: 0,
contract_fee: 0,
reclaim_rebate: 0,
early_era_slash: 10000,
session_reward: 100,
......@@ -133,7 +132,6 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig {
existential_deposit: 500,
transfer_fee: 0,
creation_fee: 0,
contract_fee: 0,
reclaim_rebate: 0,
balances: endowed_accounts.iter().map(|&k|(k, (1u128 << 60))).collect(),
validator_count: 2,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment