Commit Graph

4362 Commits

Author SHA1 Message Date
André Silva 05128c6acf docs: fix references to code of conduct document (#6879) 2020-08-11 21:21:45 +00:00
h4x3rotab 5a8644243b Add Phala Network SS58 address type (#6758) 2020-08-11 22:12:34 +02:00
André Silva 60bdece0a1 docs: convert code of conduct to markdown (#6878) 2020-08-11 19:55:15 +00:00
Kian Paimani bc2166404e Fix wrong staking doc about transaction payment. (#6873)
* Fx #4616

* Fix #4616
2020-08-11 17:07:17 +02:00
André Silva 7fa96261ba grandpa: change some logging from trace to debug (#6872)
* grandpa: change some logging from trace to debug

* grandpa: cleanup unused import
2020-08-11 15:05:59 +00:00
Nikolay Volf c347300e3e Move to upstream wasmtime, refactor globals snapshot (#6759)
* refactor globals snapshot

* ignore test

* update pwasm-utils ref

* line width

* add doc comment for internal struct

* add explanation for iteration

* Demote rustdoc to a comment

* use 0.14

Co-authored-by: Sergei Shulepov <sergei@parity.io>
2020-08-11 15:05:31 +00:00
Arkadiy Paronyan 58ebf50839 Block packet size limit (#6398)
* Block packet size limit

* Update client/network/src/protocol.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Add block response limit

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-08-11 16:12:30 +02:00
Kian Paimani b0342f0b12 state_getSize RPC for storage maps (#6847)
* Fancy compact encode/decode impl for compact solution

* Make it optional

* Remove extra file

* Update primitives/npos-elections/compact/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Final fixes.

* getSize rpc should work for maps as well

* Fix future types

* Remove minimum_validator_count stale const

* Update client/rpc/src/state/mod.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* "Optimize" `storage_size`

* Remove unused import

* Update doc

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
2020-08-11 12:09:52 +00:00
Kian Paimani 1519da95d7 Custom Codec Implenetation for NPoS Election (#6720)
* Fancy compact encode/decode impl for compact solution

* Make it optional

* Remove extra file

* Update primitives/npos-elections/compact/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Final fixes.

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2020-08-11 10:33:30 +00:00
André Silva 253f906a4d grandpa: log errors and grandpa unexpected conclusion (#6867) 2020-08-10 21:52:39 +00:00
Alexander Theißen 04b185e3d4 seal: Change prefix and module name from "ext_" to "seal_" for contract callable functions (#6798)
* seal: Change prefix "ext_" to "seal_" for contract callable functions

The word Ext is a overloaded term in the context of substrate. It usually
is a trait which abstracts away access to external resources usually in order
to mock them away for the purpose of tests. The contract module has its own
`Ext` trait in addition the the substrate `Ext` which makes things even more
confusing.

In order to differentiate the contract callable functions more clearly from
this `Ext` concept we rename them to use the "seal_" prefix instead.

This should change no behaviour at all. This is a pure renaming commit.

* seal: Rename import module from "env" to "seal0"

* seal: Fixup integration test

* seal: Add more tests for new import module names
2020-08-10 13:14:34 +00:00
Kian Paimani f9f8262303 Remove minimum_validator_count stale const (#6864) 2020-08-10 11:48:43 +00:00
Hernando Castano 433b7214f5 Add Subscription RPC for Grandpa Finality (#5732)
* Rough skeleton for what I think the RPC should look like

* Create channel for sending justifications

Sends finalized header and justification from Grandpa to the
client. This lays the groundwork for hooking into the RPC module.

* WIP: Add subscribers for justifications to Grandpa

Adds the Sender end of a channel into Grandpa, through which notifications
about block finality events can be sent.

* WIP: Add a struct for managing subscriptions

Slightly different approach from the last commit, but same
basic idea. Still a rough sketch, very much doesn't compile yet.

* Make naming more clear and lock data in Arc

* Rough idea of what RPC would look like

* Remove code from previous approach

* Missed some things

* Update client/rpc-api/src/chain/mod.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update client/rpc-api/src/chain/mod.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Split justification subscription into sender and receiver halves

* Replace RwLock with a Mutex

* Add sample usage from the Service's point of view

* Remove code that referred to "chain_" RPC

* Use the Justification sender/receivers from Grandpa LinkHalf

* Add some PubSub boilerplate

* Add guiding comments

* TMP: comment out to fix compilation

* Return MetaIoHandler from PubSubHandler in create_full

* Uncomment pubsub methods in rpc handler (fails to build)

* node/rpc: make Metadata concrete in create_full to fix compilation

* node: pass in SubscriptionManger to grandpa rpc handler

* grandpa-rpc: use SubscriptionManger to add subscriber

* grandpa-rpc: attempt at setting up the justification stream (fails to build)

* grandpa-rpc: fix compilation of connecting stream to sink

* grandpa-rpc: implement unsubscribe

* grandpa-rpc: update older tests

* grandpa-rpc: add full prefix to avoid confusing rust-analyzer

* grandpa-rpc: add test for pubsub not available

* grandpa-rpc: tidy up leftover code

* grandpa-rpc: add test for sub and unsub of justifications

* grandpa-rpc: minor stylistic changes

* grandpa-rpc: split unit test

* grandpa-rpc: minor stylistic changes in test

* grandpa-rpc: skip returning future when cancelling

* grandpa-rpc: reuse testing executor from sc-rpc

* grandpa-rpc: don't need to use PubSubHandler in tests

* node-rpc: use MetaIoHandler rather than PubSubHandler

* grandpa: log if getting header failed

* grandpa: move justification channel creation into factory function

* grandpa: make the justification sender optional

* grandpa: fix compilation warnings

* grandpa: move justification notification types to new file

* grandpa-rpc: move JustificationNotification to grandpa-rpc

* grandpa-rpc: move JustificationNotification to its own file

* grandpa: rename justification channel pairs

* grandpa: rename notifier types

* grandpa: pass justification as GrandpaJustification to the rpc module

* Move Metadata to sc-rpc-api

* grandpa-rpc: remove unsed error code

* grandpa: fix bug for checking if channel is closed before sendind

* grandpa-rpc: unit test for sending justifications

* grandpa-rpc: update comments for the pubsub test

* grandpa-rpc: update pubsub tests with more steps

* grandpa-rpc: fix pubsub test

* grandpa-rpc: minor indendation

* grandpa-rpc: decode instead of encode in test

* grandpa: fix review comments

* grandpa: remove unused serde dependency

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com>
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2020-08-10 10:31:36 +00:00
Joshy Orndorff a936771c0f Update pinned wasm-bindgen dependency (#6861)
* Update dependency.

* Update readme docs

* update python webserver command
2020-08-10 07:52:21 +00:00
Wei Tang 2804b40a1c pallet-evm: move gas price check to execute_evm (#6837) 2020-08-09 01:24:34 +02:00
Cecile Tonglet 6de543538c Fix wait_for_blocks counting blocks that didn't go through consensus (#6850)
* Initial commit

Forked at: cde60b871e
Parent branch: origin/master

* WIP

Forked at: cde60b871e
Parent branch: origin/master
2020-08-07 21:21:24 +02:00
Bastian Köcher cde60b871e Revalidate transactions only on latest best block (#6824)
* Revalidate transactions only on latest best block

We should revalidate transactions only on the latest best block and not
on any arbitrary block. The revalidation before failed when there were
multiple blocks on the height given to the revalidation function, but no
block was imported as best block.

* Update test-utils/runtime/transaction-pool/src/lib.rs

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Fix tests

* Only process best blocks in the transaction pool

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-08-07 13:58:51 +02:00
Cecile Tonglet 837c18ddfb Renamed add_children to add_child since it adds only one child (#6838) 2020-08-07 10:56:32 +02:00
André Silva cef250cbc6 grandpa: fix enacting forced changes with no delay (#6828)
* grandpa: fix enacting forced changes with no delay

* grandpa: fix formatting
2020-08-06 19:43:36 +00:00
Joshy Orndorff e4280858dc De-alias pallets in node template runtime (#6836)
* dealias pallets

* Restore accidentally deleted code blocks
2020-08-06 21:23:31 +02:00
Cecile Tonglet 4e03c87953 Allow task manager to have children (#6771)
* Initial commit

Forked at: 7df97abab4
Parent branch: origin/master

* WIP

Forked at: 7df97abab4
Parent branch: origin/master

* WIP

Forked at: 7df97abab4
Parent branch: origin/master

* WIP

Forked at: 7df97abab4
Parent branch: origin/master

* WIP

Forked at: 7df97abab4
Parent branch: origin/master

* WIP

Forked at: 7df97abab4
Parent branch: origin/master

* WIP

Forked at: 7df97abab4
Parent branch: origin/master

* changelog

* Remove Box

* Make future nicer

* Revert "Make future nicer"

This reverts commit 49fb8fb6f245c3ca2c384468df14b34f34616736.

* Simplify

* Additional check

* Simplify more

Co-authored-by: Bastian Köcher <git@kchr.de>
2020-08-06 21:20:46 +02:00
Joshy Orndorff 07c56a9be9 De-alias frame_system in node template runtime (#6829)
* de-alias frame_system in node template

* Fix line length

* Fix chainspec
2020-08-06 16:18:35 +00:00
Pierre Krieger dbc66479f3 Delay network startup to after complete initialization (#6833)
* Delay network startup to after complete initialization

* Update client/service/src/builder.rs

Co-authored-by: Ashley <ashley.ruglys@gmail.com>

Co-authored-by: Ashley <ashley.ruglys@gmail.com>
2020-08-06 12:46:34 +00:00
Hamza Tokuchi 9e438c2fc1 Add RPC Builder to Substrate Node Template (#6808)
* Pulled RPC from node and populated the node-template's RPC builder with one example implementation

* surpress build errror

* dead_code

* Fixed module usage, removed copyright, removed rpc builder for light client + some comments

* added a comment for rpc extension

* Update bin/node-template/node/src/rpc.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update rpc.rs

* fix spacing

* more space to tabs

* more space to tabs

* Documenation nitpick

* Documentation nitpick

* Documentation nitpick

* Documentation nitpick

* Documentation nitpick

* pre-format

* Updated transaction payment API implemented for node template

* fix space and commented code

* fix long line

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Dan Forbes <dan@danforbes.dev>
2020-08-06 10:31:03 +00:00
André Silva 886d79e0cb grandpa: never overwrite current rounds voter state (#6823)
* grandpa: never overwrite current rounds voter state

* grandpa: add test for voter state overwrite
2020-08-06 11:30:29 +02:00
Pierre Krieger ee35dc9415 Fix legacy substream fallback not working (#6826)
* Fix legacy substream fallback not working

* Make it nicer
2020-08-05 16:20:09 +00:00
André Silva 4a94fe860d service: remove collection of system/process metrics (#6822) 2020-08-05 15:58:07 +00:00
Shawn Tabrizi 97ac45c2f2 Successful note_imminent_preimage is free (#6793)
* Successful `note_imminent_preimage` is free

* update docs

* Add test for duplicate preimage
2020-08-05 16:22:21 +02:00
Guillaume Thiolliere 8a37f60844 Remove generation of instance trait by decl_storage. (#6812)
* remove generation of instance trait, no breaking change

* doc

* doc

* Update frame/support/src/traits.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update frame/support/procedural/src/storage/instance_trait.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-08-05 11:37:01 +00:00
Shawn Tabrizi e4e0e79ad7 Better default balances weights (#6813) 2020-08-05 09:40:31 +00:00
Pierre Krieger 840781cddb Fix warning being printed by authority-discovery (#6820) 2020-08-05 09:16:19 +00:00
ddorgan 0023111d9b Use DNS hostnames for flaming fir bootnodes (#6807)
* Use dns hostnames for flaming fir bootnodes

* Remove newline
2020-08-05 10:39:13 +02:00
Guillaume Thiolliere b6505d743f pallet-democracy use of weightinfo (#6783)
* democracy use of weightinfo

* fix some doc and benchs

* todo generate from parity machine

* factorize and add license

* use final weights

* add slightly more sensible default weight

* refactor

* rename benchmark to avoid confusion

* just make remove_other_vote benchmark being the worst case of the extrinsic
2020-08-04 17:58:03 +00:00
Shaopeng Wang 3a853d4dde Add mutate_exists to StorageDoubleMap. (#6704) 2020-08-04 10:02:24 +02:00
Alex Siman c7d6a11460 Add ss58 address for Subsocial (#6800) 2020-08-03 18:04:56 +03:00
Pierre Krieger e449330e27 Add details to legacy requests (#6747) 2020-08-03 14:55:32 +00:00
Ashley 07facb13c2 Convert spaces to tabs (#6799) 2020-08-03 15:48:32 +02:00
Kian Paimani 1a84ad87c0 Add integrity test for slash defer duration (#6782)
* Add integrity test for slash defer duration

* Wrap in externalities

* Update frame/staking/src/lib.rs
2020-08-03 13:26:09 +00:00
Shawn Tabrizi dd6ef0a3a5 Improve Benchmark Writer: Remove Unused Components, Remove Multiply by Zero, Files Split by Pallet (#6785)
* initial improvements

* better file management, ignore unused components

* Output warning when components unused

* update comment

* Write even when base weight is zero

* remove unwrap where possible

* Dont sort components to dedup

* undo delete

* improve clarity of unused components

* remove unused dep

* Update Process.json
2020-08-03 12:41:54 +00:00
Alexander Theißen 6671d017d6 seal: Fix and improve error reporting (#6773)
* seal: Rework ext_transfer, ext_instantiate, ext_call error handling

* Deny calling plain accounts (must use transfer now)
* Return proper module error rather than ad-hoc strings
* Return the correct error codes from call,instantiate (documentation was wrong)
* Make ext_transfer fallible again to make it consistent with ext_call

* seal: Improve error messages on memory access failures

* seal: Convert contract trapped to module error

* seal: Add additional tests for transfer, call, instantiate

These tests verify that those functions return the error types
which are declared in its docs.

* Make it more pronounced that to_execution_result handles trap_reason

* Improve ReturnCode docs

* Fix whitespace issues in wat files

* Improve ReturnCode doc

* Improve ErrorOrigin doc and variant naming

* Improve docs on ExecResult and ExecError

* Encode u32 sentinel value as hex

* with_nested_context no longer accepts an Option for trie

* Fix successful typo

* Rename InvalidContractCalled to NotCallable
2020-08-03 10:03:22 +00:00
Max Inden 0553dabe32 client/network: Fix wrong metric help text (#6794)
The `sub_libp2p_kademlia_query_duration` metric only has the dimension
`type` not `protocol`.
2020-08-03 09:08:06 +00:00
dependabot[bot] 5a81eb86c4 Bump elliptic from 6.5.2 to 6.5.3 in /.maintain/chaostest (#6791)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-03 10:52:43 +02:00
Bastian Köcher 02c879ec49 Fix transaction payment runtime api (#6792)
The transaction payment runtime api used its own extrinsic generic
parameter. This is wrong, because this resulted in using always the
native extrinsic. If there was a runtime upgrade that changed the
extrinsic in some way, it would result in the api breaking. The correct
way is to use the `Extrinsic` from the `Block` parameter. This is on the
node side the opaque extrinsic and on the runtime side the real extrinsic.
2020-08-03 08:46:53 +00:00
Max Inden 1365eef4c1 client/network: Expose DHT query duration to Prometheus (#6784)
Expose duration of DHT put and get request as a Prometheus histogram.
2020-08-03 08:30:06 +00:00
Pierre Krieger a1786a92ec Don't close inbound notifications substreams immediately (#6781)
* Don't close inbound notifications substreams immediately

* Fix not closing in return to node A closing
2020-07-31 14:42:53 +00:00
Bastian Köcher 9ca2300b05 Order delta before calculating the storage root (#6780)
We need to order the delta before calculating the storage root, because
the order is important if the storage root is calculated using a storage
proof. The problem is arises when the delta is different than at the
time the storage root was recorded, because we may require a different
node that is not part of the proof and so, the storage root can not be
calculated. The problem is solved by always order the delta to use the
same order when calculating the storage root while recording the
stroage proof and when calculating the storage root using
the storage proof.

To prevent this bug in future again, a regression test is added.

Fixes: https://github.com/paritytech/cumulus/issues/146
2020-07-31 14:58:38 +02:00
Wei Tang 3c5cbb00aa Allow blacklisting blocks from being finalized again after block revert (#6301)
* Allow blacklisting blocks from being finalized again after block revert

* Use BlockRules for storing unfinalized and add have_state_at in revert

* Move finalization_check in finalize_block upward

* Directly mark finalization blacklist as badblocks

* Remove obselete comment
2020-07-31 14:32:13 +02:00
Guillaume Thiolliere 7db19db948 Fix link (#6775) 2020-07-31 10:29:39 +02:00
Cecile Tonglet 3d42e2c7eb Fix graceful shutdown skipped if future ends with error (#6769)
* Initial commit

Forked at: 5060324b91
Parent branch: origin/master

* Fix graceful shutdown skipped if future ends with error

* apply suggestion
2020-07-30 15:59:07 +00:00
Shawn Tabrizi 01d0d13fad Update Balances Pallet to use WeightInfo (#6610)
* Update balance benchmarks

* Update weight functions

* Remove user component

* make componentless

* Add support for `#[extra]` tag on benchmarks

* Update balances completely

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Fix some tests

* Maybe fix to test. Need approval from @tomusdrw this is okay

* Make test better

* keep weights conservative

* Update macro for merge master

* Add headers

* Apply suggestions from code review

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
2020-07-30 17:08:23 +02:00