Commit Graph

29 Commits

Author SHA1 Message Date
Guanqun Lu 74a5ff7d0d State db random fixes (#802)
* state-db: typo fixes

* use fmt::Result for 'fmt'

* state-db: typo fixes

* state-db: use the same pattern to pass the parameter

* state-db: follow the same style
2018-09-26 11:15:56 +01:00
Sergey Pepyakin 98e0a3a55a Contracts: Add transfer event (#801) 2018-09-25 20:49:18 +01:00
Gav Wood 82d6ca3484 Switch to shiny new fast, RLP-less trie (#795)
* Bump codec

* Fix tests

* Patricia trie builds

* Introduce trie

* Some yak shaving.

* Some fixes

* Remove RLP ref

* Fixes

* It builds!

* Some tests fixed

* Another test fix

* Rejig more hashes

* substrate-trie::iterator_works test

* Update lock

* Polish

* Docs

* Undo incorrect "fix" for tests

* Fix nits
2018-09-25 16:32:22 +02:00
Sergey Pepyakin ef97973178 Contracts: clean (#788)
* Extract `runtime` module

* Restructure & comment code to avoid confusion
2018-09-24 13:31:00 +02:00
Gav Wood f71200ee3c Bump codec (#786)
* Bump codec

* Fix tests
2018-09-21 17:16:15 +02:00
Robert Habermeier b7d095a2e0 Introduce notion of finality to substrate (#760)
* finalization for in_mem

* fetch last finalized block

* pruning: use canonical term instead of final

* finalize blocks in full node

* begin to port light client DB

* add tree-route

* keep number index consistent in full nodes

* fix tests

* disable cache and finish porting light client

* add AsMut to system module

* final leaf is always best

* fix all tests

* Fix comment and trace

* removed unused Into call

* add comment on behavior of `finalize_block`
2018-09-21 15:56:21 +02:00
Sergey Pepyakin 28cc4d0fd6 Get rid of core::string in sr-std. (#783) 2018-09-21 14:45:04 +02:00
Gav Wood 25393abef8 Rewards & slashes proportional to the least-slashable validator (#781)
* Initial stuff

* Treasury now mints based on lowest staked.

* Tests build

* Fix tests

* Fix hashes

* Fix tests & grumble
2018-09-21 09:10:16 +02:00
Gav Wood ebb688f81f Address grumbles in eras PR (#782)
* Address grumbles

* Fix hash
2018-09-20 23:18:47 +02:00
Gav Wood 67bf1a6eaa Transaction eras (#758)
* Initial groundwork

* A mess.

* Integrate

* Fix tests

* Unit tests

* Tests for unchecked_extrisnic

* fix tab

* Improve binary format.

* fix tests

* Rename extrinsic-pool -> transaction-pool

Closes #770

* Implement unimplemented.

* typo
2018-09-20 14:01:01 +02:00
Bastian Köcher 5d64be26c3 Replace JSON metadata with custom metadata structures (#766)
* Move module metadata from json string to custom metadata

* Revisit the metadata structures

1. Move the structures into the metadata crate.
2. Switch to using Cow/MaybeOwnedArray to support Encode/Decode

* Adapt to new metadata structures

* Convert event json metadata to new metadata structures

* Convert storage json metadata to new metadata structures

* Convert runtime metadata from json to new metadata structs

* Implements new metadata structures in client and runtime

* Fixes errors on `no_std`

* Fixes errors after rebasing master

* Do not use `Cow` anymore in metadata

Also replace `String` with our own type definition `StringBuf`.
This fixes compilation on `no_std`.

* Wrap `RuntimeMetadata` in `RuntimeMetadataVersioned` to support versioning

* Move metadata into `srml` and make core unaware of the implementation
2018-09-20 07:35:32 +02:00
Svyatoslav Nikolsky 1e31b8d8ea log authorities change (#726) 2018-09-19 17:21:46 +02:00
Sergey Pepyakin 488830e81a Fix error handling in sandboxing/contracts modules (#744)
* Fix error handling in sandboxing/contracts modules

* Add some docs.

* Add some tests.

* grammar
2018-09-19 10:01:25 +02:00
Guanghua Guo 319549f563 Update lib.rs (#768) 2018-09-19 09:56:40 +02:00
Sergey Pepyakin e7d1933d25 Extract well known keys into a single place (#764)
* Extract well known keys into a single place

* Fixes.
2018-09-18 16:20:36 +02:00
Svyatoslav Nikolsky 7fa337afbc Light friendly storage tracking: changes trie + extending over ranges (#628)
* changes_trie

* changs_trie: continue

* changes_trie: adding tests

* fixed TODO

* removed obsolete ExtrinsicChanges

* encodable ChangesTrieConfiguration

* removed polkadot fle

* fixed grumbles

* ext_storage_changes_root returns u32

* moved changes trie root to digest

* removed commented code

* read storage values from native code

* fixed grumbles

* fixed grumbles

* missing comma
2018-09-18 09:14:41 +02:00
Gav Wood f10d8e177d Generalised Transaction Queue API (#741)
* First effort

* API versioning

* Introduce validate_transaction

* Introduce the API plus fixes.

* Docs

* Typo

* Add longevity parameter to transaction validity info.
2018-09-17 18:43:59 +02:00
Bastian Köcher 597ea41cd4 Implement construct_runtime! macro (#751)
* Make `system` module renamable in `impl_outer_event!`

* Implement `construct_runtime!` macro

This macro generates code for calling all the common `impl_outer_*` macros.

* Add documentation

* Fixes wrong declaration of `contract`

* Update dependencies to work on `no_std`

* One more `Cargo.lock` update

* Address comments
2018-09-17 17:27:22 +02:00
Sergey Pepyakin ea1b9bf026 SRML: fix OOB in srml_staking new_era. (#755) 2018-09-17 17:26:47 +02:00
Sergey Pepyakin dcd181f31e Contracts: return arbitrary sized buffers (#711)
* WIP

* Direct return of output data.

* Docs and renamings.

* Add get_storage test.

* Overwrite the scratch buffer.
2018-09-15 12:46:59 +02:00
Guanqun Lu b76660afd4 Sr treasury fix (#739)
* treasury: use 'mutate' and 'retain' to avoid creating a new vec

* treasury: check the underflow case
2018-09-14 09:50:22 +02:00
Gav Wood 3f96419665 Remove unneeded code (#737) 2018-09-13 18:08:45 +02:00
金XX(Aton) ca8f0d6625 bugfix: balances::transfer for new_account issue#722 (#731)
* bugfix: balances::transfer for new_account

issue:#722
would_create flag should depend on dest, not origin.
change 
```rust
let would_create = from_balance.is_zero();
```
to 
```rust
    let to_balance = Self::free_balance(&dest); 
    let would_create = to_balance.is_zero(); 
```
in the other hand, provide `fn new_test_ext2()` and let `transfer_fee=10`, `creation_fee=50` for test case

* Update lib.rs

* Update tests.rs

* Make `impl_outer_origin!` support generic `Origin`s (#732)

* Make `impl_outer_origin!` support generic `Origin`s

* Support empty outer origin

* Contracts: fix transfer function. (#733)

* Remove dependency on the parity repo (#734)

* Fix test

* Anothe fix
2018-09-13 15:54:56 +02:00
Sergey Pepyakin 88ef57e4bd Contracts: fix transfer function. (#733) 2018-09-13 14:25:20 +02:00
Bastian Köcher 72fb60cb49 Make impl_outer_origin! support generic Origins (#732)
* Make `impl_outer_origin!` support generic `Origin`s

* Support empty outer origin
2018-09-13 11:19:48 +02:00
Bastian Köcher 5bd0ecddd2 Make impl_outer_event! aware of required generic parameters (#729) 2018-09-12 19:12:28 +02:00
Bastian Köcher c5c5b35da3 Make decl_event! more ergonomic (#723)
* Improve and simplify `decl_event!`

- RawEvent is not required anymore to be written in the defintion
- Events with and without parameters are now supported everywhere

* Make `decl_event!` more flexible with the automatic naming of generic parameters

The macro will now automatically derive the name of a generic parameter
from the trait type name, if no explicit name is given.

`where Balance = <T as Trait>::Balance` can be simplified to
`where <T as Trait>::Balance`.

* Adapts to latest refactoring changes
2018-09-12 16:02:59 +02:00
Guanqun Lu 4685018991 enhance dispatch (#720)
* normalize decl_storage

* dispatch the function call

* add test case

* fix the root case

* add system

* fix the typo in unit test

* fix the doc generation for decl_module

* fix the unit test due to the interface change
2018-09-12 15:56:37 +02:00
Gav Wood 1e01162505 Phase 1 of repo reorg (#719)
* Remove unneeded script

* Rename Substrate Demo -> Substrate

* Rename demo -> node

* Build wasm from last rename.

* Merge ed25519 into substrate-primitives

* Minor tweak

* Rename substrate -> core

* Move substrate-runtime-support to core/runtime/support

* Rename/move substrate-runtime-version

* Move codec up a level

* Rename substrate-codec -> parity-codec

* Move environmental up a level

* Move pwasm-* up to top, ready for removal

* Remove requirement of s-r-support from s-r-primitives

* Move core/runtime/primitives into core/runtime-primitives

* Remove s-r-support dep from s-r-version

* Remove dep of s-r-support from bft

* Remove dep of s-r-support from node/consensus

* Sever all other core deps from s-r-support

* Forgot the no_std directive

* Rename non-SRML modules to sr-* to avoid match clashes

* Move runtime/* to srml/*

* Rename substrate-runtime-* -> srml-*

* Move srml to top-level
2018-09-12 11:13:31 +02:00