Michal Kucharczyk
548955a73f
BlockId removal: refactor: HeaderBackend::header (#12874 )
...
* BlockId removal: refactor: HeaderBackend::header
It changes the arguments of:
- `HeaderBackend::header`,
- `Client::header`,
- `PeersClient::header`
- `ChainApi::block_header`
methods from: `BlockId<Block>` to: `Block::Hash`
This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292 )
* non-trivial usages of haeder(block_id) refactored
This may required introduction of dedicated function:
header_for_block_num
* fmt
* fix
* doc fixed
* ".git/.scripts/fmt.sh"
* BlockId removal: refactor: HeaderBackend::expect_header
It changes the arguments of `HeaderBackend::expect_header` method from: `BlockId<Block>` to: `Block::Hash`
* ".git/.scripts/fmt.sh"
* readme updated
* ".git/.scripts/fmt.sh"
* fix
Co-authored-by: parity-processbot <>
2022-12-20 09:43:31 +00:00
Michal Kucharczyk
1ed70004e7
BlockId removal: &Hash to Hash ( #12626 )
...
It changes &Block::Hash argument to Block::Hash.
This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292 )
2022-11-07 21:42:16 +00:00
Michal Kucharczyk
76bcbd09a5
BlockId removal: refactor: Backend::body ( #12587 )
...
It changes the arguments of `Backend::body` method from: `BlockId<Block>` to: `&Block::Hash`
This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292 )
Co-authored-by: parity-processbot <>
2022-11-01 16:24:09 +00:00
Michal Kucharczyk
62bca87f3a
Finalized block event triggers tx maintanance ( #12305 )
...
* finalized block event triggers tx maintanance
* tx-pool: enactment helper introduced
* tx-pool: ChainApi: added tree_route method
* enactment logic implemented + tests
Signed-off-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com >
* Some additional tests
* minor improvements
* trigger CI job
* fix compilation errors
ChainApi::tree_route return type changed to Result<Option<..>>, as some
implementations (tests) are not required to provide this tree route.
* formatting
* trait removed
* implementation slightly simplified
(thanks to @koute)
* get rid of Arc<> in EnactmentState return value
* minor improvement
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com >
* Apply suggestions from code review
* comment updated + formatting
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com >
Co-authored-by: Davide Galassi <davxy@datawok.net >
* formatting
* finalization notification bug fix
+ new test case
+ log::warn message when finalized block is being retracted by new event
* added error message on tree_route failure
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de >
* use provided tree_route in Finalized event
* Option removed from ChainApi::tree_route
* doc added, test and logs improved
* handle_enactment aligned with original implementation
* use async-await
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com >
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de >
* formatting + warn->debug
* compilation error fix
* enactment_state initializers added
* enactment_state: Option removed
* manual-seal: compilation & tests fix
* manual-seal: tests fixed
* tests cleanup
* another compilation error fixed
* TreeRoute::new added
* get rid of pub hack
* one more test added
* formatting
* TreeRoute::new doc added + formatting
* Apply suggestions from code review
Co-authored-by: Davide Galassi <davxy@datawok.net >
* (bool,Option) simplified to Option
* log message improved
* yet another review suggestions applied
* get rid of hash in handle_enactment
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de >
* Update client/transaction-pool/src/lib.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* minor corrections
* EnactmentState moved to new file
* File header corrected
* error formatting aligned with codebase
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de >
* remove commented code
* small nits
Signed-off-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com >
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com >
Co-authored-by: Davide Galassi <davxy@datawok.net >
Co-authored-by: Bastian Köcher <git@kchr.de >
Co-authored-by: André Silva <andrerfosilva@gmail.com >
2022-10-11 20:20:13 +00:00
Qinxuan Chen
e956c2e1c7
use thiserror instead of derive_more for error handling ( #10696 )
...
* use thiserror instead of derive_more for error handling
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
* Update utils/prometheus/src/lib.rs
* Update utils/prometheus/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2022-01-25 19:48:46 +00:00
Nazar Mokrynskyi
0bca06a483
Minor tweaks suggested by clippy ( #10673 )
...
* Minor tweaks suggested by clippy
* Fix typo caused by last commit
* Apply review suggestions
2022-01-15 21:00:12 +01:00
Bastian Köcher
424ddf33ee
Remove transaction-pool test-helpers feature ( #10571 )
...
* Remove transaction-pool `test-helpers` feature
`test-helpers` feature is a bad idea in general, because once the feature is enabled somewhere in
the workspace, it is enabled anywhere. While removing the feature, the tests were also rewritten to
get rid off other "only test" related code.
Contributes towards: https://github.com/paritytech/substrate/issues/9727
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com >
* Fix benches
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com >
2022-01-03 15:08:42 +00:00
Bastian Köcher
f3662b4bba
Happy new year 2022 ( #10573 )
2022-01-03 09:22:14 +01:00
Gavin Wood
1e24e45ea1
Remove Default bound for AccountId ( #10403 )
...
* Remove Default for AccountId
* More removals of default
* Update frame/authorship/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/authorship/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/authorship/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/authorship/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* More work
* More work
* Remove old code
* More work
* pallet-asset-tx-payment
* tips
* sc-consensus-babe
* sc-finality-grandpa
* sc-consensus-babe-rpc
* sc-cli
* make npos crates accept non-default account (#10420 )
* minimal changes to make npos pallets all work
* make this pesky reduce.rs a bit cleaner
* more work
* more work
* Tests build
* Fix imonline tests
* Formatting
* Fixes
* Fixes
* Fix bench
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Formatting
* Fixes
* Formatting
* Fixes
* Formatting
* Fixes
* Formatting
* Fixes
* Formatting
* Update client/keystore/src/local.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/finality-grandpa/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/keystore/src/local.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/keystore/src/local.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/staking/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/staking/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update primitives/runtime/src/traits.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Formatting
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: kianenigma <kian@parity.io >
2021-12-13 15:03:59 +01:00
Bastian Köcher
7b56ab15b4
Run cargo fmt on the whole code base ( #9394 )
...
* Run cargo fmt on the whole code base
* Second run
* Add CI check
* Fix compilation
* More unnecessary braces
* Handle weights
* Use --all
* Use correct attributes...
* Fix UI tests
* AHHHHHHHHH
* 🤦
* Docs
* Fix compilation
* 🤷
* Please stop
* 🤦 x 2
* More
* make rustfmt.toml consistent with polkadot
Co-authored-by: André Silva <andrerfosilva@gmail.com >
2021-07-21 14:32:32 +00:00
Seun Lanlege
2ae9d36758
sc-transcation-pool refactor ( #9228 )
...
* Use TransactionPool trait
* sc-transaction-pool-primitives
* sc-transaction-pool-api
* TP
* bye sc_transaction_graph
* fix line widths
* fix import errors
* fix import errors
* fix import errors 🤦🏾♂️
* fix import errors 🤦🏾♂️ 🤦🏾♂️ 🤦🏾♂️
* remove sp-keyring
2021-07-08 13:33:34 +00:00
Bastian Köcher
258c1a86f6
Transaction pool: Ensure that we prune transactions properly ( #8963 )
...
* Transaction pool: Ensure that we prune transactions properly
There was a bug in the transaction pool that we didn't pruned
transactions properly because we called `prune_known`, instead of `prune`.
This bug was introduced by:
https://github.com/paritytech/substrate/pull/4629
This is required to have stale extrinsics being removed properly, so
that they don't fill up the tx pool.
* Fix compilation
* Fix benches
* ...
2021-06-03 16:04:29 +02:00
Bastian Köcher
e3e651f72c
Happy new year ( #7814 )
...
* Happy new year
Updates the copyright years and fixes wrong license headers.
* Fix the template
* Split HEADER into HEADER-APACHE & HEADER-GPL
2021-01-04 09:03:13 +00: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
Bastian Köcher
493d5d8591
Fix tx-pool returning the same transaction multiple times ( #6535 )
...
* Fix tx-pool returning the same transaction multiple times
This fixes a bug that lead to returning the same transaction multiple
times when iterating the `ready` iterator. Internally the transaction
was kept in the `best` list and could be duplicated in that list be
re-inserting it again. This `best` list is using a `TransactionRef`
which internally uses a `insertion_id`. This `insertion_id` could lead
to the same transaction being inserted multiple times into the `best`
list.
* Update client/transaction-pool/src/testing/pool.rs
Co-authored-by: Nikolay Volf <nikvolf@gmail.com >
Co-authored-by: Nikolay Volf <nikvolf@gmail.com >
2020-06-30 11:02:46 +02:00
Bastian Köcher
d2846e2b9a
Make transaction pool prune transactions only of canonical blocks ( #6123 )
...
* Make tx pool aware of retracted fork blocks
* Make it compile
* Update client/transaction-pool/src/lib.rs
Co-authored-by: Nikolay Volf <nikvolf@gmail.com >
* Fix doc test
* Simplify the implementation
* Send tree route as arc to prevent heavy clones
* Switch to use `ExtrinsicHash` to make it more clear
* Fix benchmark
Co-authored-by: Nikolay Volf <nikvolf@gmail.com >
2020-06-05 23:12:00 +02:00
Benjamin Kampmann
be8c96adec
Relax substrate licensing scheme ( #5947 )
2020-05-15 13:21:56 +02:00
Tomasz Drwięga
04ccb179e9
Pass transaction source to validate_transaction ( #5366 )
...
* WiP
* Support source in the runtime API.
* Finish implementation in txpool.
* Fix warning.
* Fix tests.
* Apply suggestions from code review
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-Authored-By: Nikolay Volf <nikvolf@gmail.com >
* Extra changes.
* Fix test and benches.
* fix test
* Fix test & benches again.
* Fix tests.
* Update bumpalo
* Fix doc test.
* Fix doctest.
* Fix doctest.
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: Nikolay Volf <nikvolf@gmail.com >
2020-03-25 14:09:23 +01:00
Gavin Wood
f5dc69b404
Don't remove invalid transactions when skipping. ( #5121 )
...
* Don't remove invalid transactions when skipping.
* Use a special kind of extrinsic instead of arbitrary limit.
* Fix txpool tests.
* Attempt to create more blocks.
* Bump lock
Co-authored-by: Gavin Wood <github@gavwood.com >
Co-authored-by: Nikolay Volf <nikvolf@gmail.com >
2020-03-05 17:00:31 +01:00
Seun Lanlege
d3a3e288b6
Adds fork-awareness and finalization notifications to transaction pool watchers. ( #4740 )
...
* adds finalization support to sc-transaction-pool using MaintainedTransactionPool for finalization events
* adds TransactionStatus::Retracted, notify watchers of retracted blocks, finalized now finalizes, transactions for current finalized -> last finalized block
* adds last_finalized to ChainApi, use generic BlockT for ChainEvent
* fix tests
* Apply suggestions from code review
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com >
* tests
* fix tests, docs, lazily dedupe pruned hashes
* fix tests, Cargo.lock
* Apply suggestions from code review
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com >
* remove tree_route, last_finalized from ChainApi, add block hash to Finalization and Retracted events
* prune finality watchers
* fix tests
* remove HeaderBackend bound from FullChainApi
* code style nits, terminate stream in finality_timeout
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com >
2020-02-14 14:44:58 +01:00
Bastian Köcher
709a899f9d
Cleanup transaction pool deps ( #4782 )
...
* Cleanup transaction pool deps
* Fix it properly
* Fix doc test
2020-01-31 12:40:32 +01:00