Commit Graph

1871 Commits

Author SHA1 Message Date
Andronik Ordian e1be821fe1 change ActiveLeaves to contain at most one activated (#3525)
* change ActiveLeaves to contain at most one activated

* fix test
2021-07-27 16:45:15 +02:00
Bernhard Schuster 6519ba987c integrate dispute finality (#3484)
* finality_target adjustments

* fn finality_target

* partially address review comments

* fixins

* more rustic if condition

* fix tests

* fixins

* Update node/core/approval-voting/src/lib.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

* Update node/core/approval-voting/src/lib.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* review comments part one

* rename candidates -> block_descriptions

* testing outline (incomplete, WIP)

* test foo

* split RelayChainSelection into RelayChainSelection{,WithFallback}, introduce HeaderProvider{,Provider}

* make some stuff public (revert this soon™)

* some test improvements

* slips of pens

* test fixins

* add another trait abstraction

* pending edge case tests + warnings fixes

* more test cases

* fin

* chore fmt

* fix cargo.lock

* Undo obsolete changes

* // comments

* make mod pub(crate)

* fix

* minimize static bounds

* resolve number() as before

* fmt

* post merge fix

* address some nits

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
2021-07-26 17:54:50 +02:00
Andronik Ordian bd9b743872 enable disputes (#3478)
* initial integration and migration code

* fix tests

* fix counting test

* assume the current version on missing file

* use SelectRelayChain

* remove duplicate metric

* Update node/service/src/lib.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* remove ApprovalCheckingVotingRule

* address my concern

* never mode for StagnantCheckInterval

* REVERTME: some logs

* w00t

* it's ugly but it works

* Revert "REVERTME: some logs"

This reverts commit e210505a2e83e31c381394924500b69277bb042e.

* it's handle, not handler

* fix a few typos

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
2021-07-26 14:46:31 +02:00
Koute 8fbd3a4f62 Do not leak active head data in statement distribution (#3519) 2021-07-26 13:58:24 +02:00
Lldenaurois 1858ff57fc Dispute coordinator - Recover disputes on startup (#3481)
* node/dispute-coordinator: Introduce resume capability

This commit introduces a resume capability for the
dispute coordinator subsystem. Specifically, this will allow
to recover data for disputes for which we have no local statements.

* node/dispute-coordinator: Add resume function to TestState and modify Harness

This commit modifies the TestHarness to return a TestState. We subsequently
define a resume function on TestState that allows to interrupt the test and
test specifically for behavior on startup of the subsystem.

* node/dispute-coordinator: Implement resume functionality

This commit implements the resume functionality for the subsystem.
In addition, we will forward any DisputeParticipation::Participate
message in order to ensure that disputes for which we do not have
local statements may be recovered in due time.

* Address Feedback

* Modify to run handle_leaf on first import

* Modify missing_local_statement logic

* node/dispute-coordinator: Add simple test to ensure we adequately
handle local_statements that are not missing.

* Add missing keystore tests
2021-07-21 16:36:43 -05:00
Andreas Doerr 310aa6f321 Add wococo-local chain spec (#3509) 2021-07-21 22:19:26 +02:00
dependabot[bot] 1fd956079a Bump indexmap from 1.6.1 to 1.7.0 (#3497)
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.6.1...1.7.0)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-21 10:56:14 +00:00
Xiliang Chen 88a4fd0351 Companion for substrate #9315 (#3477)
* fix

* update
2021-07-20 20:59:54 +00:00
dependabot[bot] d3adc575a6 Bump libc from 0.2.91 to 0.2.98 (#3496)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.91 to 0.2.98.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.91...0.2.98)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-19 19:31:55 +00:00
dependabot[bot] 4636daa7ce Bump async-process from 1.0.1 to 1.1.0 (#3122)
Bumps [async-process](https://github.com/smol-rs/async-process) from 1.0.1 to 1.1.0.
- [Release notes](https://github.com/smol-rs/async-process/releases)
- [Changelog](https://github.com/smol-rs/async-process/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/async-process/compare/v1.0.1...v1.1.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-19 11:27:15 -05:00
Seun Lanlege 2c53f686f2 more verbose asserts (#3476)
Co-authored-by: CI system <>
2021-07-15 21:12:15 +01:00
Bernhard Schuster c30774a264 overseer gen minor chore fixes (#3479) 2021-07-15 16:51:04 +02:00
Denis Pisarev fc253e6e4d WIP: CI: add spellcheck (#3421)
* CI: add spellcheck

* revert me

* CI: explicit command for spellchecker

* spellcheck: edit misspells

* CI: run spellcheck on diff

* spellcheck: edits

* spellcheck: edit misspells

* spellcheck: add rules

* spellcheck: mv configs

* spellcheck: more edits

* spellcheck: chore

* spellcheck: one more thing

* spellcheck: and another one

* spellcheck: seems like it doesn't get to an end

* spellcheck: new words after rebase

* spellcheck: new words appearing out of nowhere

* chore

* review edits

* more review edits

* more edits

* wonky behavior

* wonky behavior 2

* wonky behavior 3

* change git behavior

* spellcheck: another bunch of new edits

* spellcheck: new words are koming out of nowhere

* CI: finding the master

* CI: fetching master implicitly

* CI: undebug

* new errors

* a bunch of new edits

* and some more

* Update node/core/approval-voting/src/approval_db/v1/mod.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

* Update xcm/xcm-executor/src/assets.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

* Apply suggestions from code review

Co-authored-by: Andronik Ordian <write@reusable.software>

* Suggestions from the code review

* CI: scan only changed files

Co-authored-by: Andronik Ordian <write@reusable.software>
2021-07-14 19:22:58 +02:00
Seun Lanlege ab9c86d5e7 Introduce test runner biolerplate (#2609)
* adds test-runner boilerplate

* revert to master

* Update node/test/runtime/Cargo.toml

Co-authored-by: Andronik Ordian <write@reusable.software>

* fix warning

* use polkadot_development_config

* remove vestigial code

* ...

* remove unused dependencies

* adds simnet binary

* adds simnet binary

* merged with remote

* dummy to check pipeline

* add 2 docker files and a build cmd

* adds logging

* atempt to use binary from build host

* fix simnet-binary

* fix docker commands

* switch branches

* ...

* update docker file

* update the dockerfile 2

* add some message in the cheatsheet

* add repo to chaches stage also

* update paths

* do only 1 stage build

* add time when build cmd started

* remove debugg commands

* polkadot-simnet-substrate-working-version-v1

* reduce size of polkadot-simnet image

* update test runner api

* update test-runner

* ...

* revert to master

* Merge branch 'master' of github.com:paritytech/polkadot into substrate-test-runner

* bump impl version

* remove unused imports, fix test

* was_binary.to_vec()

* Apply suggestions from code review

Co-authored-by: Andronik Ordian <write@reusable.software>

* ...

* remove unused import

* remove unused import

* adds post upgrade test

* dry code

* revert spec_version

* update Cargo.lock

* tested and it works

* compare runtime spec version

* fix spaces, remove docker files

* replace spaces with tabs

* Update runtime/polkadot/src/lib.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

* ...

* revert Cargo.lock

* bump cargo.lock

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: radupopa2010 <radupopa2010@yahoo.com>
Co-authored-by: CI system <>
2021-07-13 16:45:27 +01:00
Lldenaurois dc0927787e Dispute coordinator overlay (#3462)
* node/dispute-coordinator: Modify db to return SubsystemResult.

In preparation of moving to the overlayed backend pattern, this commit
moves the db to return SubsystemResult values.

* node/dispute-coordinator: Add the Backend and OverlayedBackend.

This commit adds the backend and overlayed backend structs to the
dispute-coordinator subsystem.

* node/dispute-coordinator: Implement backend and overlayed-backend.

This commit finalizes the move from the previous transactional model
to the common overlay pattern in subsystem persistency. This can be
observed in the ApprovalVoting and ChainSelection subsystems.

* Add module docs + license

* Touchup merge
2021-07-12 23:42:51 -04:00
Lldenaurois 2d66b8f256 Dispute Coordinator: Batch queries (#3459)
* disputes: Allow batch queries in dispute-coordinator

This commit moves to batch queries when responding to QueryCandidateVotes
messages. This simplifies the code in the provisioner and dispute-coordinator
by no longer requiring to make use of a FuturesOrdered when awaiting multiple
quries. Instead, the provisioner need only request the batch itself.

* node/approval-voting: Address Feedback to fail on query element missing.

* Address feedback

* Fix implementer's guide
2021-07-12 20:06:14 -05:00
Andronik Ordian 73ed24f772 more fine grained runtime api caching + a fix for av-store (#3457)
* finer grained runtime-api caching

* fix av-store

* simplify a request

* remove unused imports

* fix tests
2021-07-12 18:14:43 +02:00
Robert Klotzner 6994682a86 DoS protection on the collator protocol (#3446)
* Move on to next validator after timeout.

* Better naming.

* Wrong implementation of validator fetch timeouts.

* Validator side: Move on to next collator

if download takes too long.

* Drop multiple requests from same validator.

* Add test that next response is sent after timeout.

* Multiple requests by same validator should get dropped.

* Test that another collator is tried

after exclusive download time.

* Add dep.

* Cleanup.

* Merge fix.

* Review remarks.

* Fixes.

* Add log targets to trace logs

Co-authored-by: Andronik Ordian <write@reusable.software>
2021-07-12 13:01:17 +02:00
Robert Habermeier e512222749 Wire up candidate backing, approval-voting to disputes (#3348)
* add a from_backing_statement to SignedDisputeStatement

* inform dispute coordinator of all backing statements

* add dispute coordinator message to backing tests

* send positive dispute statement with every approval

* issue disputes when encountering invalid candidates.

* try to fix flaky test for CI (passed locally)

* guide: keep track of concluded-positive disputes until pruned

* guide: block implications

* guide: new dispute inherent flow

* mostly implement recency changes for dispute coordinator

* add a clock to dispute coordinator

* adjust DB tests

* fix and add new dispute coordinator tests

* provisioner: select disputes

* import all validators' approvals

* address nit: refactor backing statement submission

* gracefully handle disconnected dispute coordinator

* remove `review` comment

* fix up old_tests

* fix approval-voting compilation

* fix backing compilation

* use known-leaves in WaitForActivation

* follow-up test fixing

* add back allow(dead_code)
2021-07-09 21:15:51 +00:00
Kian Paimani d53ec86bbe Companion for substrate/pull/9286 (#3443)
* Fix weights

* try something to unbreak companion

* update Substrate

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: parity-processbot <>
2021-07-09 20:25:13 +00:00
Bernhard Schuster d76560fea2 thiserror annotations + spelling (#3452)
* remove duplicate thiserror annotations

* chore: cargo spellcheck
2021-07-09 12:31:52 +00:00
Robert Klotzner b5257b2407 Dispute distribution implementation (#3282)
* Dispute protocol.

* Dispute distribution protocol.

* Get network requests routed.

* WIP: Basic dispute sender logic.

* Basic validator determination logic.

* WIP: Getting things to typecheck.

* Slightly larger timeout.

* More typechecking stuff.

* Cleanup.

* Finished most of the sending logic.

* Handle active leaves updates

- Cleanup dead disputes
- Update sends for new sessions
- Retry on errors

* Pass sessions in already.

* Startup dispute sending.

* Provide incoming decoding facilities

and use them in statement-distribution.

* Relaxed runtime util requirements.

We only need a `SubsystemSender` not a full `SubsystemContext`.

* Better usability of incoming requests.

Make it possible to consume stuff without clones.

* Add basic receiver functionality.

* Cleanup + fixes for sender.

* One more sender fix.

* Start receiver.

* Make sure to send responses back.

* WIP: Exposed authority discovery

* Make tests pass.

* Fully featured receiver.

* Decrease cost of `NotAValidator`.

* Make `RuntimeInfo` LRU cache size configurable.

* Cache more sessions.

* Fix collator protocol.

* Disable metrics for now.

* Make dispute-distribution a proper subsystem.

* Fix naming.

* Code style fixes.

* Factored out 4x copied mock function.

* WIP: Tests.

* Whitespace cleanup.

* Accessor functions.

* More testing.

* More Debug instances.

* Fix busy loop.

* Working tests.

* More tests.

* Cleanup.

* Fix build.

* Basic receiving test.

* Non validator message gets dropped.

* More receiving tests.

* Test nested and subsequent imports.

* Fix spaces.

* Better formatted imports.

* Import cleanup.

* Metrics.

* Message -> MuxedMessage

* Message -> MuxedMessage

* More review remarks.

* Add missing metrics.rs.

* Fix flaky test.

* Dispute coordinator - deliver confirmations.

* Send out `DisputeMessage` on issue local statement.

* Unwire dispute distribution.

* Review remarks.

* Review remarks.

* Better docs.
2021-07-09 04:29:53 +02:00
Bernhard Schuster 3c9104daff refactor overseer into proc-macro based pattern (#2962) 2021-07-08 21:09:26 +02:00
Lldenaurois 2510bfc5d7 Approval voting full subsystem tests (#3391)
* node/approval-voting: Introduce Backend trait and Overlaybackend

This commit introduces a Backend trait and attempts to move away
from the Action model via an OverlayBackend as in the ChainSelection
subsystem.

* node/approval-voting: Add WriteOps for StoredBlockRange and BlocksAtHeight

* node/approval-voting: Add load_all_blocks to overlay

* node/approval-voting: Get all module tests to pass.

This commit modifies all tests to ensure tests are passing.

* node/approval-voting: Address oversights in the previous commit

This commit addresses some oversights in the prior commit.

1. Inner errors in backend.write were swallowed
2. One-off write functions removed to avoid useless abstraction
3. Touch-ups in general

* node/approval-voting: Move from TestDB to dyn KeyValueDB

This commit removes the TestDB from tests.rs and replaces it with
an in-memory kvdb.

* node/approval-voting: Address feedback

* node/approval-voting: Add license to ops.rs

* node/approval-voting: Address second-pass feedback

* Add TODO

* node/approval-voting: Bump spec_version

* node/approval-voting: Address final comments.

* node/approval-voting: Introduce framework for full subsystem tests

* node/approval-voting: Introduce basic tests to attempt to provide
coverage via full subsystem tests

* node/approval-voting: Introduce Chainbuilder
2021-07-08 12:30:12 -04:00
Lldenaurois 7313e485d0 Approval voting overlay db (#3366)
* node/approval-voting: Introduce Backend trait and Overlaybackend

This commit introduces a Backend trait and attempts to move away
from the Action model via an OverlayBackend as in the ChainSelection
subsystem.

* node/approval-voting: Add WriteOps for StoredBlockRange and BlocksAtHeight

* node/approval-voting: Add load_all_blocks to overlay

* node/approval-voting: Get all module tests to pass.

This commit modifies all tests to ensure tests are passing.

* node/approval-voting: Address oversights in the previous commit

This commit addresses some oversights in the prior commit.

1. Inner errors in backend.write were swallowed
2. One-off write functions removed to avoid useless abstraction
3. Touch-ups in general

* node/approval-voting: Move from TestDB to dyn KeyValueDB

This commit removes the TestDB from tests.rs and replaces it with
an in-memory kvdb.

* node/approval-voting: Address feedback

* node/approval-voting: Add license to ops.rs

* node/approval-voting: Address second-pass feedback

* Add TODO

* node/approval-voting: Bump spec_version

* node/approval-voting: Address final comments.
2021-07-08 15:00:57 +00:00
Shawn Tabrizi 0e7217b4da Companion for #9090 (include storage info) (#3424)
* update benchmark

* add host function

* update Substrate

* fix unused

Co-authored-by: parity-processbot <>
2021-07-07 23:01:00 +00:00
Sergei Shulepov 8d77738cfd pvf: Enable stack depth metering & NaN canonicalization (#3373)
* Add `canonicalize_nans` and enable `stack_depth_metering`

* Update to the latest change in the substrate PR

* Explain why the numbers are what they are.

* Update Substrate to the latest master

Co-authored-by: parity-processbot <>
2021-07-07 12:55:00 +03:00
Sergei Shulepov b7b2276555 PVF: unresponsive worker doesn't mean the candidate is bad (#3418)
* PVF: unresponsive worker doesn't mean the candidate is bad

* s/if let Some/.is_some
2021-07-07 11:28:07 +03:00
cheme b71ec24815 Companion for #9100 (Paged keys rpc for child storage.) (#3258)
* patch branch

* patch bis

* Add missing client method.

* unpatch

* update Substrate

Co-authored-by: parity-processbot <>
2021-07-07 07:53:33 +00:00
Robert Habermeier f69c175119 Chain Selection: Follow-ups (#3328)
* DB skeleton

* key formats

* lexicographic test

* custom types for DB

* implement backend for db-v1

* remove VoidBackend and integrate with real DbBackend

* detect stagnant blocks on in interval

* fix tests

* add tests for stagnant

* send ChainSelectionMessage::Approved

* tests for DB backend

* unused import

* upgrade kvdb-memorydb

Co-authored-by: Andronik Ordian <write@reusable.software>
2021-07-06 16:00:52 -05:00
Svyatoslav Nikolsky 04ac35e127 Enable over-bridge-messaging in Rococo/Wococo runtime (#3377)
* bridges in W<>R

* fix node compilation

* Update runtime/rococo/src/bridge_messages.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update runtime/rococo/src/bridge_messages.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update runtime/rococo/src/bridge_messages.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update runtime/rococo/src/bridge_messages.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* long line fix

* comment/remove -> comment/#[ignore]

* explicit instances

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2021-07-06 10:03:12 +00:00
ferrell-code 39969ca536 paras.rs to FRAME V2 (#3403)
* to v2 macro

* line width

* fix mock

* actually compile moxk

* compile tests

* add hooks

* origin back in mocks

* assimilate_storage

* add generic

* maybe mock compiles now

* origin between parachain and system causing problem

* change origin

* type alias as origin

* keep origin

* add aliases to tests

* remove unnecessary imports

* Parachain -> Paras

* paras test

* nvm

* use genesis build in mock
2021-07-06 00:24:27 +00:00
Andronik Ordian e80475ce4e bump a bunch of deps in parity-common (#3402)
* bump a bunch of deps in parity-common

* update Substrate

* fix browser check

Co-authored-by: parity-processbot <>
2021-07-05 21:45:51 +02:00
Robert Klotzner 378905df9d Warn on low connectivity. (#3408)
* Warn on low connectivity.

* Better timeout and docs.

* Review remarks.
2021-07-05 21:22:03 +02:00
Bastian Köcher c4d45c97dd Enable logging in the puppet worker (#3411)
This is useful for tests where something is failing :D
2021-07-05 14:18:20 +02:00
Andronik Ordian 373a545118 make it easier to dbg stalls (#3351)
* make it easier to dbg

* revert channel sizes

* BAnon
2021-07-02 21:09:18 +02:00
Andronik Ordian 7b054b3c77 cleanup stream polls (#3397)
* metered-channel: remove dead code

* we don't need no fuse

* even more
2021-07-02 10:23:26 +02:00
Kian Paimani 505145efd3 Staking Miner (#3141)
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
Co-authored-by: Peter Goodspeed-Niklaus <peter.r.goodspeedniklaus@gmail.com>
2021-07-01 20:22:35 +01:00
Martin Pugh cfbfefc972 Bump version, specs & substrate in prep for v0.9.8 (#3387)
* bump version

* bump substrate

* bump spec_versions
2021-07-01 12:09:41 +02:00
Robert Klotzner f293fb1025 Fix busy loops. (#3392) 2021-07-01 08:44:13 +02:00
Guillaume Thiolliere 0b10a24cd2 Minor refactor (#3386)
* minro refactor

* Update node/core/runtime-api/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update node/core/runtime-api/src/lib.rs

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

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-06-30 11:11:43 +00:00
Bastian Köcher e8d7e9f0dc Ensure that we fetch another collation if the first collation was invalid (#3362)
* Ensure that we fetch another collation if the first collation was invalid

* Feedback
2021-06-28 14:28:58 +02:00
Bastian Köcher 2ea1587e8d Only send one collation per relay parent at a time to validators (#3360)
* Only send one collation per relay parent at a time to validators

This changes the way we are sending collations to validators. Before we
answered every collation request immediatley. Now we only answer one
pov request at a time per relay parent. This should bring down the
bandwidth requirements and should help parachains to include bigger
blocks more easily.

* Guide updates

* Review feedback.
2021-06-28 11:07:44 +00:00
Andronik Ordian 30ebd26558 disable approval-checking-grandpa on dev chain (#3364) 2021-06-28 11:57:14 +02:00
Squirrel dcb08fd533 Use associated constant for max (#3375) 2021-06-28 11:32:33 +02:00
Bastian Köcher ab6c79ecb6 Use wasm-builder from git (#3354)
* Use wasm-builder from git

This brings new features like compressed runtimes out of the box.

* chore: update wasm builder dep. from 3.0.0 to master

* Fix tests

* Update node/core/pvf/tests/it/main.rs

Co-authored-by: Sergei Shulepov <sergei@parity.io>

Co-authored-by: chevdor <chevdor@gmail.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
2021-06-28 10:34:47 +02:00
Martin Pugh 022e8bc11c Bump versions & spec_versions (#3368)
* bump versions & spec_versions

* bump Cargo.lock
2021-06-25 12:59:14 +02:00
Andronik Ordian 3827f6e6f8 av-store: use determine_new_blocks (#3356)
* av-store: use determine_new_blocks

* fix tests

* update the guide

* rename KnownBlocks

* fix iteration order

* add a test
2021-06-23 23:26:33 +02:00
Robert Habermeier b57b9cf7dc SelectChain implementation for relay chains (#3341)
* stubbed SelectRelayChain

* disconnected overseer handlers

* add is_disconnected

* add fallback in case overseer is disconnected

* fall back on fallback

* fetch leaves by calling into chain-selection subsystem

* implement best_chain

* mostly implement finality_target

* chain constrain

* metrics and maximum safeguard

* remove review comment after review
2021-06-22 18:41:54 -05:00
Lldenaurois 777499dc69 Approval Checking: Avoid redundant checks (#3306)
* node/approval-voting: Introduce LruCache for pending Approval work

This commit adds an LruCache that is intended to track the approval work
submitted as background tasks in order to ensure that the validator needn't
launch duplicate approval work for the same candidate across multiple blocks.
A simple state machine is also introduced in order to differentiate pending
and completed tasks. In addition, this LruCache will retain ValidationResults
from the completed approval work once the task has completed. As per LruCache
implementation, the oldest tasks will get evicted as new approval work is
submitted to this cache.

* node/approval-voting: Revert changes to master

This commit reverts changes from the previous commit in order
to simplify addressing the architecture discussion raised in the PR.

* node/approval-voting: remove background task mpsc construct

This diff removes the mpsc construct for background tasks in preparation
for a move to leveraging RemoteHandles to launch approvals, rather than
passing ApprovalRequests to a mpsc channel and handling the ApprovalRequests
in the main subsystem task.

* node/approval-voting: Introduce LRU Cache

This commit introduces an LRU Cache but does not yet make use of it.

* node/approval-voting: Remove BackgroundTasksMap and memoize currently_checking

This commit removes the BackgroundTasksMap in the main subsystem task
and introduces a method to keep track of RemoteHandles in such a way that
we can ensure that a task is spawned once for a CandidateHash and
relay parent tuple.

* node/approval-voting: Remove BackgroundTasksMap and memoize currently_checking

This commit removes the BackgroundTasksMap in the main subsystem task
and introduces a map of FuturesUnordered per BlockNumber. In addition,
a FusedFuture is generated by iterating across all FuturesUnordered for
the BlockNumbers for which at least one candidate has approvals work
running in the subsystem.

* node/approval-voting: Address Rob's comments

This diff removes the prior HashMap<BlockNumber, FuturesUnordered>
construction and instead moves to a simple FuturesUnordered where
all the work is await with Timeout.

* node/approval-voting: Update Cargo.lock

Due to a mismatch in rustc versions

* node/approval-voting: Make use of actions when issuing_approval

This commit fixes a small oversight in the logic of the prior commit.

* node/approval-voting: Address Rob's feedback

* node/approval-voting: Introduce lazy launch_approval evaluation

* node/approval-voting: Send DistibruteApproval message on every LaunchApproval

In addition to fixed the DistributeApproval bug, this commit also
increases the size of the approvals cache and ensures the StaleGuard
is removed when the advantageous approval state is reached.

* node/approval-voting: Address final comments

This commit removes the CandidateIndex from the ApprovalVoteRequest.
Instead, the launch_approval function will compute the candidate_index
from the block entry.

In addition, a comment has been added explaining the difficulty of
issuing approvals in the handle_actions function.

* node/approval-voting: Set timeout to be 120s rather than 2s

* Update Cargo.lock
2021-06-22 23:24:28 +00:00