Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockId removal: tx-pool refactor #1678

Merged
merged 14 commits into from
Sep 27, 2023
Merged

BlockId removal: tx-pool refactor #1678

merged 14 commits into from
Sep 27, 2023

Conversation

michalkucharczyk
Copy link
Contributor

@michalkucharczyk michalkucharczyk commented Sep 22, 2023

It changes following APIs:

  • trait ChainApi
    -- validate_transaction

  • trait TransactionPool
    --submit_at
    --submit_one
    --submit_and_watch

and some implementation details, in particular:

  • impl Pool
    --submit_at
    --resubmit_at
    --submit_one
    --submit_and_watch
    --prune_known
    --prune
    --prune_tags
    --resolve_block_number
    --verify
    --verify_one

  • revalidation queue

All tests are also adjusted.

This PR is part of BlockId::Number refactoring analysis (#53)
Some ground work towards: (#1202)

It changes following APIs:
- trait ChainApi
-- `validate_transaction`

- trait `TransactionPool`
--`submit_at`
--`submit_one`
--`submit_and_watch`

and some implementation details, in particular:
- impl `Pool`
--`submit_at`
--`resubmit_at`
--`submit_one`
--`submit_and_watch`
--`prune_known`
--`prune`
--`prune_tags`
--`resolve_block_number`
--`verify`
--`verify_one`A

- revalidation queue

All tests are also adjusted.
@michalkucharczyk michalkucharczyk requested a review from a team September 22, 2023 14:41
@michalkucharczyk michalkucharczyk added the T0-node This PR/Issue is related to the topic “node”. label Sep 22, 2023
@michalkucharczyk
Copy link
Contributor Author

bot fmt

@command-bot
Copy link

command-bot bot commented Sep 22, 2023

@michalkucharczyk https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3775436 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 7-2e3d2e38-25bd-41ef-aaf2-580ea4e2b3f7 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Sep 22, 2023

@michalkucharczyk Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3775436 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3775436/artifacts/download.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work 👍

sc_transaction_pool_api::error::Error::InvalidBlockId(format!("{:?}", at)).into(),
)
})
.expect("hash to number should work");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh wait!

Move this above the let validation_results. Print a debug message and return. Should not really happen. Just one thing to check, is it fine to drop batch or are the tx still in the pool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this shall never happen. hash to block number shall always work - I can add debug and return.

Just one thing to check, is it fine to drop batch or are the tx still in the pool?

Did not get it, could you give me more details on that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the batch, that is passed in to this function, is dropped without it being processed and "re-added".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transactions will stay in validated_pool, so they can be resubmitted in the next batch.
Skipping re-validation sounds reasonable, otherwise the transactions could be invalidated (if the block is not available).

Done in 7c002a4.

I also added test for this case:

// revalidation shall be skipped for unknown block:
block_on(queue.revalidate_later(unknown_block, uxt_hashes));
// no revalidation shall be done
assert_eq!(api.validation_requests().len(), 4);
// number of ready shall not change
assert_eq!(pool.validated_pool().status().ready, 2);

@michalkucharczyk michalkucharczyk requested review from bkchr and a team September 26, 2023 09:12
@michalkucharczyk michalkucharczyk requested a review from a team September 26, 2023 12:01
Copy link
Contributor

@skunert skunert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good!

substrate/client/basic-authorship/src/basic_authorship.rs Outdated Show resolved Hide resolved
substrate/client/transaction-pool/src/revalidation.rs Outdated Show resolved Hide resolved
substrate/utils/frame/rpc/system/src/lib.rs Outdated Show resolved Hide resolved
@michalkucharczyk michalkucharczyk merged commit ab3a3bc into master Sep 27, 2023
6 checks passed
@michalkucharczyk michalkucharczyk deleted the mku-blockid-txpool branch September 27, 2023 09:58
ordian added a commit that referenced this pull request Sep 27, 2023
* master: (61 commits)
  OpenGov in Westend and Rococo (#1177)
  Associated type Hasher for `QueryPreimage`, `StorePreimage` and `Bounded` (#1720)
  Migrate polkadot-primitives to v6 (#1543)
  genesis-builder: implemented for all runtimes (#1492)
  `BlockId` removal: `tx-pool` refactor (#1678)
  Bump directories from 4.0.1 to 5.0.1 (#1656)
  Allow debug_assertions in short-benchmarks CI job (#1711)
  chainHead/storage: Fix storage iteration using the query key (#1665)
  Implement more useful traits in `Slot` type (#1595)
  Make downloads in parallel and give more time to complete (#1699)
  Bump actions/checkout from 4.0.0 to 4.1.0 (#1688)
  contracts: Fix incorrect storage alias in mirgration (#1687)
  Fix documentation about justification and `finalized == true` requirement (#1607)
  tweak pallet macro (genesis_config etc) to cater for RA users as well. (#1689)
  Uncoupling pallet-xcm from frame-system's RuntimeCall (#1684)
  Bump aes-gcm from 0.10.2 to 0.10.3 (#1681)
  docs / Update PR template to reflect monorepo (#1674)
  update contributing guide and ui-tests scripts (#1668)
  pallet epm: add `TrimmingStatus` to the mined solution (#1659)
  Update HRMP pallet benchmarking to use benchmarks v2 (#1676)
  ...
ordian added a commit that referenced this pull request Oct 10, 2023
* tsv-disabling-node-side: (69 commits)
  runtime-api: cleanup after v7 stabilization (#1729)
  Move requests-responses and polling from `ChainSync` to `SyncingEngine` (#1650)
  Add custom error message for `StorageNoopGuard` (#1727)
  Clarify docs
  cargo fmt
  add a CAVEAT comment
  implement disabled_validators correctly
  remove unnecessary hash string (#1722)
  OpenGov in Westend and Rococo (#1177)
  Associated type Hasher for `QueryPreimage`, `StorePreimage` and `Bounded` (#1720)
  Migrate polkadot-primitives to v6 (#1543)
  genesis-builder: implemented for all runtimes (#1492)
  `BlockId` removal: `tx-pool` refactor (#1678)
  Bump directories from 4.0.1 to 5.0.1 (#1656)
  Allow debug_assertions in short-benchmarks CI job (#1711)
  chainHead/storage: Fix storage iteration using the query key (#1665)
  Implement more useful traits in `Slot` type (#1595)
  Make downloads in parallel and give more time to complete (#1699)
  Bump actions/checkout from 4.0.0 to 4.1.0 (#1688)
  contracts: Fix incorrect storage alias in mirgration (#1687)
  ...
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
It changes following APIs:
- trait `ChainApi`
-- `validate_transaction`

- trait `TransactionPool` 
--`submit_at`
--`submit_one`
--`submit_and_watch`

and some implementation details, in particular:
- impl `Pool` 
--`submit_at`
--`resubmit_at`
--`submit_one`
--`submit_and_watch`
--`prune_known`
--`prune`
--`prune_tags`
--`resolve_block_number`
--`verify`
--`verify_one`

- revalidation queue

All tests are also adjusted.

---------

Co-authored-by: command-bot <>
Co-authored-by: Bastian Köcher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T0-node This PR/Issue is related to the topic “node”.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants