* Global registration of type segmenters for event decoding
* Perform type sizes check when building client
* Introduce EventTypeRegistry for global runtime type sizes
* Fmt
* Register runtime type sizes on creation of EventTypeRegistry
* Register more default dispatch types
* Add missing type sizes
* fmt
* Fix up register_type_size builder method
* Update doc comments
* Make register_default_type_sizes public
* Don't allow duplicate registered types
* Remove call to supertraits type registration, done manually in Runtime
* Fix tests and warnings
* Fix duplicate type registration
* Fmt
* review: use is_empty()
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* Add panic docs
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* Refactor event type decoding hand declartion
Fixes#196, #181, #28
## Dyanmic sized types
Before this change, the event decoder assume all the event types
have fixed sizes. Some counterexamples are: Hashes, AuthorityList.
In this change, instead of decoding by skipping the fixed-length bytes,
we introduce `type_segmenter` registry which decodes the raw event
bytes with the actual scale codec. So variable length types can be
handled correctly.
## New attribute for pallet type definition
In the past, trait associated type is the only way to add types to
the EventsDecoder implementation of a pallet. But in reality it's
common that the events in a pallet references some types not defined
in the trait associated types. Some examples are: `IdentificationTuple`
and `SessionIndex` in Session pallet.
In this change, we introduce more attributes to add the types:
```rust
#[module]
trait Pallet: System {
#![event_type(SomeType)]
#![event_alias(TypeNameAlias = SomeType)]
#![event_alias(SomeOtherAlias = TypeWithAssociatedTypes<T>)]
}
```
## Tested
Compile with `nightly-2020-10-01`; smoke test to sync a full
Phala bockchain.
* Format code
* Make rustfmt::skip an outer attribute
* Ignore the sample code
* Alias the event segmenter closure
* Copy AuthorityList from sp_finality_grandpa
* Remove the unused static event type size
* Make segmenter as a trait, resue grandpa::Public
* Wrap PhantomData in struct TypeMarker
* Upgrade to substrate 2.0.0
* WIP implement Subcommand manually (see https://github.com/paritytech/substrate/pull/6894#issuecomment-676060197)
* Add pallet-staking/std to the std feature
* Sort out the subcommand impl
* Sort out the module index (ty @ascjones)
Sort out the RefCount type (ty @dvc94ch)
Random tweaks to make test-node more similar to the vanilla node-template
* obey the fmt
* Add changelog and bump versions
* Merge #165 and update CHANGELOG
* Update test-node/runtime/src/lib.rs
Co-authored-by: Demi Marie Obenour <demiobenour@gmail.com>
* Update CHANGELOG.md
Co-authored-by: Demi Marie Obenour <demiobenour@gmail.com>
Co-authored-by: Demi Marie Obenour <demiobenour@gmail.com>
* Upgrade to substrate 2.0.0
* WIP implement Subcommand manually (see https://github.com/paritytech/substrate/pull/6894#issuecomment-676060197)
* Add pallet-staking/std to the std feature
* Sort out the subcommand impl
* Sort out the module index (ty @ascjones)
Sort out the RefCount type (ty @dvc94ch)
Random tweaks to make test-node more similar to the vanilla node-template
* obey the fmt
* cleanup
* more cleanup
* Add example file
* Fmt
* Add KeyIter.
* Add iter method to store proc-macro.
* Fetch all values at once.
* Update docs.
* Run rustfmt.
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Document the `Call` derive macro
* Obey the fmt
* Update proc-macro/src/lib.rs
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Review feedback
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Make signing fallable and asynchronous
This is needed for hardware wallets, which require human confirmation to
sign transactions. Blocking on a human to sign transactions is not a
good idea, and the signing might fail for many reasons (device
unplugged, authorization not granted, etc).
* Reformat
* Refactor as suggested by Andrew Jones (@ascjones).
* Use future::ok
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Update to substrate alpha.7
* Remove gas limit from contracts put code
* Rename SystemEvent::ReapedAccount to KilledAccount
* Log debug event received before attempting to decode
* Temporary registration of Balance type before #102 merged
* Show contract test errors, increase instantiate gas_limit
* Support custom clients.
* Simplify trait bounds.
* Plain and double map storage support.
* Simplify more trait bounds.
* Add proc macro.
* Add Call, Event and Store traits.
* Update proc-macros.
* Add with_system for proc-macro.
* proc-macro: test: support signature and extra fields.
* proc-macro: test: support sharing state accross steps.
* proc-macro: test: fetch state sequentially.
* Elide lifetimes.
* Add test for plain storage.
* Run rustfmt.