Commit Graph

28 Commits

Author SHA1 Message Date
Gav a5042dd9ae Introduce substrate-demo 2018-02-20 15:53:55 +01:00
Robert Habermeier 03a51a0db8 Split BFT into substrate-bft and runtime-specific proposer logic (#72)
* reshuffle consensus libraries

* polkadot-useful type definitions for statement table

* begin BftService

* primary selection logic

* bft service implementation without I/O

* extract out `BlockImport` trait

* allow bft primitives to compile on wasm

* take polkadot-consensus down to the core.

* test for preemption

* fix test build
2018-02-15 14:20:18 +01:00
Gav Wood f344e15bf8 Additional runtime tests for the test-runtime (#69)
* Remove rustc dependency from ed25519 and refactor a little.

* Runtime support provides more extensive test-key functionality.

* Additional APIs for ed25519 stuff.

* Extensive test for test-runtime.

* Fixes for the new test key API.

* Additional convenience for tests

* Take advantage of more convenient API.

* Redo formating.

* Remove old test identities.

* Remove boilerplate, add test.

* Refactor out unneeded code.

* Clean up algo for determining authorities.

* Remove unneeded API.

* Make `to_*` consume

* Only export keyring when testing

* Fix build & warning

* Extract Keyring into separate library.

* Add tests for Keyring and a trait-based API.

* Address grumbles.
2018-02-12 15:30:38 +01:00
Gav Wood dec6e82387 Introduce toy runtime for testing inside substrate. (#66)
* Introduce simple blockchain runtime for substrate tests.

* Remove bad files.

* Add needed wasm binaries.

* Refactoring.

- Repot files in test-runtime.
- Rename troublesome `Joiner::join` to `Joiner::and`.
- Rework `Slicable` to dedup code.

* More fixes and refactoring

* Rebuild substrate test wasm.

* Fix merge errors.

* Rename the disasterously named `to_vec` to `encode`.

Also rename `as_slice_then` to `with_encoded`.

* Tests for toy runtime.

* Fix doc nit
2018-02-09 13:24:30 +01:00
Robert Habermeier a00d0e75fd Re-introduce zero copy codec and add minimal polkadot client API which uses linked native runtime (#65)
* client-api type and move duty roster types to primitives

* tuple implementation for slicable

* mild cleanup of deserialization code

* stubs which handle encoding and decoding themselves

* fancier impl_stubs macro

* zero-copy slicable API

* minimal polkadot-client API

* fix WASM API generation

* move native environment stuff to substrate executor

* fix warnings and grumbles
2018-02-08 19:20:34 +01:00
Arkadiy Paronyan f2b3bab61e Networking tests and fixes (#61)
* BlockId in client interface

* Sync fixes and tests

* Updated to latest primitives

* Updated dependencies

* Updated for new (old) primitives

* Network as workspace member

* substrate-network

* Removed obsolete file

* begin_transaction on hash
2018-02-08 17:49:55 +01:00
Gav 4582038b3d Fix warning and directory restructure. 2018-02-08 14:29:30 +01:00
Gav 5c842f77bc Many renames.
- Everything polkadot becomes polkadot-.
- Wasm (substrate) executor tests split from Wasm (Polkadot) runtime and
built independently.
2018-02-07 23:36:34 +01:00
Gav 692770e03f Split up substrate-executor into polkadot-executor. 2018-02-07 18:44:00 +01:00
Gav 9fe85fc9f4 Split out substrate-primitives from polkadot-primitives.
Bottom half minus tests builds.
2018-02-07 15:24:54 +01:00
Gav 26b4b56402 Remove CallData/OutData. 2018-02-07 13:02:57 +01:00
Gav 1b7f34bef2 Refactor primitives. 2018-02-07 11:03:43 +01:00
Robert Habermeier 29c3a585a1 Merge branch 'master' into author-relay-block 2018-01-31 18:11:30 +01:00
Robert Habermeier 4b2bd5ec72 fully refactor runtime-std to use conditional compilation 2018-01-30 23:47:29 +01:00
Robert Habermeier 2c39e247d6 clean up workspaces a little 2018-01-30 19:35:09 +01:00
Robert Habermeier a68b187f4d extract out runtime-codec to a separate crate 2018-01-30 18:51:12 +01:00
Arkadiy Paronyan 44499550d9 Networking and in-memory client (#38)
* Networking crate draft

* Started work on syncing algo

* Fixed query range

* BlockCollection tests

* In-mem client backend

* Fixed tests

* Renamed Transaction

* Removed stray println

* Docs
2018-01-30 18:49:52 +01:00
Gav Wood 3402f169a7 Introduce basic skeleton for Polkadot runtime. (#32)
* Introduce basic skeleton for Polkador runtime.

* Clean up the runtime skeleton.

* Make initial runtime skeleton compile.

* Compile polkadot-runtime both for Wasm ad native, allowing for testing and direct usage.

* More fleshing out on runtime.

* Update native support.

* Fix warning.

* Update gitignore

* Update path.

* Fix path.

* Remove accidentally committed files.

* Add wasm binaries.

* Fix test.

* Native storage support API.

* Add environmental module

* Add native environment to make native source-code compatible with wasm.

Also tests.

* Finish up & polish environment stuff.

* Avoid using reentrancy issues.

* Add some docs and a test.

* Remove unneeded function.

* Documentation

* Tweak docs

* Remove TODOs.

* Balance transfers + util methods.

* Rejig tests and ensure authorities are addressed consistently.

* Add marshaller for xfer function

* Transaction dispatch test.

* Minor fix.

* Add test for ser/de transaction.

* Add ser/de for header.

* Add tests for header ser/de

* Introduce basic block decoding/execution framework.

* Introduce block decoding/execution framework (p2)

* Big refactor.

* Split out joiner.

* Hide away support modules.

* Fix up wasm runtime.

* use externalities for chain_id

* Clean up (Test)Externalities.

* Repot and introduce keccak-256 external.

* Signing with crypto.

* fix unsafety hole in environmental using function

* Introduce Ed25519 crypto.

* Repotting.

* Add ed25519_verify external.

* Introduce Ed25519 verify as an external.

* fix unsafety hole around unwinding

* Compile fixes.

* use new environmental API

* Tests for ed25519 verify.

* Polish

* Introduce UncheckedTransaction & test.

* Implement basic block and tx processing

* Introduce static hex and valid signature for block test.

* Repot session.

* comments.

* Refactor and timestamp test

* Remove fluff

* Remove fluff.

* Staking eras and tests.

* Implement sessions.

* Polish

* Test sessions.

* Introduce better hashing.

- Blake2 for secure hashing
- XX for fast hashing

* Fix tests.

* Introduce staking.

* Tests for simple staking system.

* Build fix for wasm.

* Fix tests.

* Repotting and docs.

* Docs and licence.

* Documentation.

* Remove superfluous code.

* Remove dummy key.

* Remove other superfluous file.

* Optimise with swap_remove
2018-01-23 15:24:17 +01:00
Gav Wood a670208a33 Introduce first groundwork for Wasm executor (#27)
* Introduce first groundwork for Wasm executor.

* Remove old Rust-runtime code.

* Avoid commiting compled files.

* Add runtime precompile.

* Rename so module makes more sense.

* Further renaming.

* Ensure tests work.

* Allow bringing in of externalities.

- Add util functions/macros.
- Add uncompacted runtime.
- Add some external crates from pwasm-std for managing allocs/memory
stuff.

* Nice macros for imports.

* Allow passing in of data through allocators.

Make memcpy and malloc work.
Basic allocator.

* Can now pass in bytes to WasmExecutor.

* Additional cleanup.

* Switch usages of `OutData` to `u64`

No need to be able to return bytes anymore.

* convert to safe but extremely verbose type conversion.

@rphmeier any more concise way of doing this?

* Remove StaticExternalities distinction.

* Remove another unused use.

* Refactor wasm utils out

* Remove extraneous copies that weren't really testing anything.

* Try to use wasm 0.15

* Make it work!

* Call-time externalities working.

* Add basic externalities.

* Fix grumbles and note unwraps to be sorted.

* Test storage externality.

Unforunately had to change signatures of externalities to avoid
immutable function returning a reference. Not sure what to do about
this...

* Fix nits.

* Compile collation logic.

* Move back to refs. Yey.

* Remove "object" id for storage access.

* Fix test.

* Fix up rest of tests.

* remove unwrap.

* Expose set/get code in externalities

Also improve tests and add nice wrappers in rust-wasm.

* Add validator set.

* Introduce validator set into externalities and test.

* Add another external function.

* Remove code and validators; use storage for everything.

* Introduce validators function.

* Tests (and a fix) for the validators getter.

* Allow calls into runtime to return data.

* Remove unneeded trace.

* Make runtime printing a bit nicer.

* Create separate runtimes for testing and polkadot.

* Remove commented code.

* Use new path.

* Refactor into shared support module.

* Fix warning.

* Remove unwraps.

* Make macro a little less unhygenic.

* Add wasm files.
2018-01-08 16:48:45 +01:00
Robert Habermeier 45c3e40a62 Candidate Agreement + Consensus (#29)
* candidate statement importing

* import votes on validity

* import availability votes

* candidate receipt type

* make table mod public

* test context for table

* add harness for tests

* some tests for misbehavior

* produce proposal from table

* count candidate issuance as implicit vote

* keep track of messages known by validators

* fix primitives compilation

* simple BFT agreement

* kill unused macro_use annotation

* tests for BFT agreement

* test for not concluding on different prepares

* return summary upon statement import

* accept bft agreement on proposal not locally submitted

* check justification set for BFT

* BFT rewrite: vote accumulator with tests

* squash some warnings

* a few more tests for the accumulator

* add sender to table's signed statement

* implement honest node strategy for BFT

* inex -> index

* import and broadcast lock proofs

* poll repeatedly when state changes

* don't broadcast advance vote immediately if locked

* do not check validity of locked candidate

* basic tests for the strategy

* remove unused context trait and fix warning

* address some review grumbles

* address some more review nits

* fix lock import logic and add a test

* fix spaces

* fix a couple more style grumbles

* more type-safe justifications

* rename Communication enum variants

* improve some panic guard proofs

* add trailing comma
2018-01-03 15:50:05 +01:00
Robert Habermeier 9612e1d7c1 Minimal collation work-flow and necessary traits (#25)
* collator crate skeleton and description

* parachain primitives: proof -> witness and egress format

* collation of ingress queues through trait

* add ingress collation test

* structure for collated ingress

* add collated ingress to proposal

* witness -> proof

* ingress collation and candidate creation + code cleanup

* update collator lib to new definitions

* address formatting grumble
2017-12-13 15:04:58 +01:00
Tomasz Drwięga db78e5fb4c RPC & Client (#21)
* Initial version of http server.

* Refactor the structure.

* add unassigned ports info.

* Rename servers to match conventions.

* Add client crate and some proper RPC implementations.

* Style & docs.
2017-11-15 19:29:14 +01:00
Tomasz Drwięga 2fa0239dab State machine crate and rust impl of executor (#17)
* Executor.

* Rust contracts implementation.

* Add documentation and fix transfer data.

* Fix auth contract interface.

* Add some executor tests.

* Validator set contract.
2017-11-12 16:53:11 +01:00
Tomasz Drwięga e9177294f6 Initial validator trait. (#14)
* Initial validator trait.

* Add missing docs warning.

* Fix formatting.

* Fix validator output and serialization.

* Get rid of redundant ValidationCode type.
2017-11-12 16:48:35 +01:00
Tomasz Drwięga 799d03254f Serialization with serde. 2017-11-10 21:31:48 +01:00
Tomasz Drwięga dbb123d09c Uint & Hash types. (#10)
* Uint & Hash types.

* Fix author

* Rename crate to primitives.
2017-11-10 13:34:36 +01:00
Tomasz Drwięga 5c57479348 CLI crate. 2017-11-10 12:19:47 +01:00
Robert Habermeier 72dba98250 initial commit 2017-11-07 19:15:12 +01:00