Commit Graph

166 Commits

Author SHA1 Message Date
Sergey Pepyakin 45131e95f8 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.
2018-07-29 14:55:55 +01:00
Gav Wood ed4de54e95 Version bump (#450)
* Bump version

* Version bump.

* Version bump.
2018-07-29 14:55:06 +01:00
Pierre Krieger 63f11eec61 Fix the public key of bootnode 3 (#441) 2018-07-28 17:33:50 +02:00
Arkadiy Paronyan 9214f42a3b Exit signal gets its own trait (#433)
* Exit signal gets its own trait

* Typo

* Removed clone bounds
2018-07-28 08:31:16 +02:00
Arkadiy Paronyan e8777d9142 Prevent building invalid blocks (#430)
* Commit extrinsics changes

* Removed panic=abort

* Commit when needed

* Resotre default hook for the native call

* Revert test

* Proper test

* Sorted errors and fixed wasm build
2018-07-27 11:11:47 +02:00
Arkadiy Paronyan ed00e11188 Substrate CLI (#423)
* Moved chain ops to substrate-service

* moved RPC to susbstrate-service WIP

* Moved RPC to substrate-service

* Version

* Removed redundadnt messages

* substrate CLI

* Removed obsolete files

* Sorted out startup messages

* Pass executable name to CLI
2018-07-25 22:10:09 +02:00
Arkadiy Paronyan f8a85231f1 Revert chain command (#393)
* Revert chain command

* BLOCKS -> NUM

* Fixed warning
2018-07-24 15:54:34 +02:00
Chevdor 526de11fe8 WIP: Asciidoc (#407)
* Rename readme

* Add some Asciidoc demo

* Remove extra lines
2018-07-24 11:12:53 +02:00
Gav Wood a2dbc34ae2 Style fixes (#396)
* Fix p2p

* Cosmetic stuff

* More cosmetics

* Whitespace

* Whitespace

* Whitespace

* Renames

* Most cosmetics

* typo

* minor rename

* Remote-end disconnect message should be info!

* invalid tab

* Avoid ignoring sustained bad pings

* Remove workarounds.
2018-07-23 16:46:13 +02:00
Chevdor 4d5d6fd424 Fix export when starting from block 0 (#406)
* More explicit variable names

* Fix export when from block is 0

Fix #402
2018-07-23 13:49:01 +02:00
Chevdor 1b67cbc412 Add restrictions on node name length and content (#395) 2018-07-21 23:00:06 +02:00
Gav Wood 1aa2f0082a Refactor out disable/disconnect peer to make API more declarative (#394)
* Refactor out disable/disconnect peer to make API more declarative

* Minor fixes.

* rename `disconnect_peer` to `drop_peer` in low-level
2018-07-21 16:13:19 +02:00
Benjamin Kampmann 64ed1db60c Allow bootnodes as IP:PORT, query Peer-id (#386)
* Simplify cli parsing: remove unnecessary match for Version and help: e.exit() manages both for us already
* Allow passing of IP:PORT as bootnodes, then try to discover its PEER_ID
2018-07-20 00:43:31 +02:00
Chevdor e47e946e3a Add support for shell completion (#340)
* Add build script to generate completion scripts

* Add installation doc for the shell auto-completion
2018-07-19 17:20:11 +02:00
Maciej Hirsz 418adec5d8 Use SSL to submit Telemetry (#381)
* Fix deadlock for too-small heap

* Use SSL for submitting telemetry
2018-07-19 15:08:23 +02:00
Arkadiy Paronyan f7dc9f92b0 Panic hook (#379)
* Panic hook

* Abort on panic in release
2018-07-19 14:14:30 +02:00
Gav Wood bba7ea3415 Various small v0.2 improvements (#367)
* Make telemetry less susceptible to flakey wifi

* Update readme

* Staging shouldn't autoconnect to telemetry

* Don't try to output more than 1KB of hex to Display

* Better logging of transactions

* Grumbles

* off-by-one
2018-07-19 12:08:34 +02:00
Chevdor 6b6820e173 Use generated name if no name was provided (#377) 2018-07-19 11:26:52 +02:00
Robert Habermeier 5a09802e57 Collator-side of collator protocol (#351)
* skeleton of collators object

* awaiting and handling collations. rename `collators` to CollationPool

* add some tests

* add tests

* implement Collators trait for ConsensusNetwork

* plug collators into main polkadot-network

* ignore collator role message

* add a couple more tests

* garbage collection for collations

* extract session-key tracking from consensus

* add local_collations.rs

* finish polish of local_collations

* integrate local_collations into network layer

* introduce API for adding local collations

* mostly finish collator implementation pending service fix

* Specialized network()

* push collations to the network

* grumbles

* substrate-service has custom configuration

* initialize network in collator mode as necessary
2018-07-18 15:04:26 +02:00
Arkadiy Paronyan c28dd30461 Fixed block import (#368)
* Fixed decoding from file

* Increased progress frequency
2018-07-18 15:03:30 +02:00
Arkadiy Paronyan be1c0a2427 Gossip through all peers. (#359)
* Added some traces

* Gossip for all

* Fixed formatting
2018-07-18 12:07:05 +02:00
Tomasz Drwięga 14abd75369 Extrinsics PubSub (#349)
* Extrinsic subscriptions.

* Handle RPC errors better.

* Add tests for extrinsics and unignored others.

* Handle client errors.

* Fix compilation.
2018-07-17 23:57:08 +02:00
Sergey Pepyakin a649fee20a Use create instead of open for export blocks (#356) 2018-07-17 22:52:42 +02:00
Arkadiy Paronyan 7e6f3291f4 Specialized network() (#352) 2018-07-17 19:33:12 +02:00
Gav Wood d8791ac79e Final tweaks for PoC-2 runtime upgrade (#348)
* Final tweaks for PoC-2 runtime upgrade

* Address grumble

* Avoid slow wasm

* New poc-2-era bootnodes

* Fix warning

* Typo

* Fix for allocation in wasm

* Fix & runtimes.

* PoC-1 should be default.

* Name testnet Krumme Lanke, update README

* YML update

* Use the right port
2018-07-17 18:55:28 +02:00
Gav Wood 33ba137595 Remove old bootnodes (#341) 2018-07-17 10:10:22 +02:00
Gav Wood 2b1fc459c7 Adaptive heap size (#328)
* heap-size is a CLI arg, make it 512 by default

* Fix tests

* Adaptive heap size.

* Allow storage_exists
2018-07-16 20:59:10 +02:00
Robert Habermeier 90ea33c9fe hash random seed when using to choose round proposer (#336) 2018-07-16 18:17:52 +02:00
Arkadiy Paronyan 20f3e9f636 Use substrate codec for network messages (#333)
* Use substrate codec for network messages

* Version bump

* Removed redundant format
2018-07-16 14:28:31 +01:00
Gav Wood 0e40983f3b Ensure any call to disable peer has a reason (#321)
* Fix warnings in libp2p

* Force a reason when you use the fatalist disable_peer

* Print more information

* Slightly more concise ref-fu

* Tracing for figuring out what's going into genesis

* Merge

* Fxi test
2018-07-15 23:30:53 +02:00
Arkadiy Paronyan 1e1ddf61f2 Refactored Slicable (#324)
* Refactored Slicable

* Docs

* Wasm build

* Wasm build

* Renamed traits

* Review nits

* Renamed Slicable as well
2018-07-15 22:51:21 +02:00
Sergey Pepyakin e1c90b573b Use --export-table from the latest LLD [2] (#325)
* It turned out that "table" was renamed.

To `__indirect_function_table`.

* Rebuild binaries.
2018-07-15 20:12:34 +02:00
snd 1888adb98e Issue 279 - unique path for each chains db, network, keystore to prevent collisions (#322)
* make spec.name() part of database_path preventing collisions

resolves #279

* add `id` field to `ChainSpec`

* add blank line for readability

* dot/cli: use spec_id in db_path

* dot/cli: make spec_id part of keystore_path

* dot/cli: make spec_id part of network_path

* add id field to poc-1.json chain spec

* dot/cli: spec_id -> chain_id
2018-07-15 19:31:59 +02:00
Sergey Pepyakin 8cafabc4bd Use --export-table from the latest LLD (#316)
* Remove unused build.sh

* Don't use wasm-export-table anymore.

* Rebuild binaries.

* Fix build script.
2018-07-15 14:09:29 +02:00
Gav Wood 8a0eaf9146 Avoid accounts destroyed in payments from being aux (#318) 2018-07-15 14:04:26 +02:00
Gav Wood 257c6d240f Fix and cleanups (#314)
* Cleanups (remove genesis.wasm & nicer errors)

- Pretty errors for version mismatch
- Remove the need for genesis wasm

* Remove unneeded wasm files

* Improve code of conduct

* Leaner code

* Test fixes

* fix tests

* Fix consensus checking
2018-07-15 00:30:13 +02:00
Arkadiy Paronyan 161dce3699 Fixed a few authoring issues (#315) 2018-07-14 22:27:25 +02:00
Arkadiy Paronyan 16ff3579ef Split polkadot-service (#310)
* Substrate service

* Splitting polkadot service

* Specialised components

* Specialised components

* Docs and style

* Docs and style

* Final touches

* Added db key assertion
2018-07-14 18:07:11 +02:00
Gav Wood c2f78371f1 Dual execution (#311)
* Initial logic

* Remove accidental file

* Config

* Remove accidental

* Apply CLI config

* Additional work. Sadly pointless.

* Rearrange everything

* Loop into CLI param

* Implement dual execution

* typo

* fix tests.

* Better docs

* Fix bug

* Add some tests

* Report block information on consensus failure, tests

* Fix test
2018-07-14 16:10:20 +02:00
Arkadiy Paronyan b1327624cd Avoid serializing into json::Value (#313) 2018-07-14 15:54:48 +02:00
Gav Wood 0929e45320 More timely block import notifications (#306)
* More timely block import notifications

* Grumbles.

* More wrapping

* Fix build

* Fixes
2018-07-13 12:13:03 +02:00
Robert Habermeier 88c40c8fb4 Validator side of the collation protocol. (#295)
* skeleton of collators object

* awaiting and handling collations. rename `collators` to CollationPool

* add some tests

* add tests

* implement Collators trait for ConsensusNetwork

* plug collators into main polkadot-network

* ignore collator role message

* add a couple more tests

* garbage collection for collations

* ensure disconnected backup collator is removed from pool

* address other grumbles
2018-07-12 10:47:10 +02:00
Gav Wood 907eeef9dd Improve Wasm extern errors and increase heap (#299)
* Improve Wasm extern errors

* Increase heap size

* Update heap size further
2018-07-11 22:40:30 +02:00
snd 2963f6b911 Issue 212 - refactor Checkable trait to be more generic (#287)
* runtime: refactor Checkable and BlindCheckable traits

* fix impl BlindCheckable for Extrinsic

* fix impl Checkable for TestXt

* fix impl Checkable for UncheckedExtrinsic

* fix tabs

* add ::Address to system::Trait since its no longer in Checkable trait

* replace tab by space in comment

* replace occurences of Checkable::check with ::check_with

* tx-pool: replace CheckedIntrinsic type alias since it now would require type param

* make more uses of Checkable compile

* adapt Executive impl to new Checkable trait

* fix that CheckedExtrinsic takes AccountId not Address as first type param

* Checkable trait: return error again since it's required in some cases

* Checkable: improve docstrings

* consistent punctuation and capitalization in docstrings

* Ctx -> Context

addresses https://github.com/paritytech/polkadot/pull/287#discussion_r200956240

* reduce trait bounds for impl Checkable for TestXt

addresses https://github.com/paritytech/polkadot/pull/287#discussion_r200839303

* use <UncheckedExtrinsic as Checkable>::Checked

addresses https://github.com/paritytech/polkadot/pull/287#discussion_r200955165

* Revert "add ::Address to system::Trait since its no longer in Checkable trait"

This reverts commit 02eb103015b833c995c9f9067aac2542bb7ce5ea.

* runtime/executive: properly fix that Address no longer in Checkable

* return `Result<Self::Checked, &'static str>` from `Checkable::check`
2018-07-11 21:12:22 +02:00
Sergey Pepyakin 042ded7cc5 Fix for nightly 2018-07-10 (#296)
* Use [alloc_error_handler] instead of oom lang item

* Same fix for basic_add

* Drive by fix for duplicate generic parameter

* Rebuild binaries.
2018-07-11 15:40:33 +02:00
Gav Wood b239fe0acc PoC-2 tweaks (#293)
- Rename poc-2 to staging
- Make telemetry default for global chains
2018-07-11 12:01:16 +01:00
Benjamin Kampmann a876d656bd Rename Hashing Trait to Hash (#288) 2018-07-10 10:05:53 +02:00
Arkadiy Paronyan 9957d26967 Poc-1 backwards compatibility (#291) 2018-07-10 09:49:42 +02:00
Sergey Pepyakin f1834971a4 Update pwasm to the latest nightly (#290)
- Update parity-wasm to 0.31
- Update pwasm-utils to 0.3.1
- Update usages of btree map in runtime-std
2018-07-09 19:18:01 +02:00
Robert Habermeier 88dc3ad8da PoC-1 consensus extracted to "rhododendron" (#284) 2018-07-09 11:26:04 +02:00