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

refactor(mempool)!: optimisations,excess sig index,fix weight calc #3691

Merged

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Jan 10, 2022

Description

  • fix weighting calculation for metadata (integer division bug: (∑v_i) / d != v_1 / d + v_2/d +.... v_n/d unless all vs are multiples of d due to integer rounding)
  • updated fee estimation in wallet
  • add excess signature index in mempool (required for compact block propagation)
  • account for multiple kernels in transactions in mempool
  • many smaller mempool optimisations (clones, etc)
  • remove blocking thread pool usage for mempool
  • remove unused mempool event stream (fills up and never empties, consuming some memory)
  • clean up some legacy code (from when base node contained the wallet and miner)
  • updated tests

Because the block weight calculation changed, this is a breaking change only affecting full/near full blocks

Motivation and Context

A bug in the way metadata weights are calculated meant that a set of transactions can have a different total weight from a block containing those same transactions. After a correctly weighted full block is returned from get block template, the block validator could incorrectly reject a block once mined as exceeding maximum weight.

Create a many to many index between transactions and kernels in the mempool.

How Has This Been Tested?

Unit: Existing tests updated
Manual: Producing 3 blocks worth of transactions, mining and checking the block is accepted and the transactions removed from the mempool

@sdbondi sdbondi force-pushed the core-mempool-optimisations branch from 8cbfec3 to 6aa7cf4 Compare January 10, 2022 14:31
@sdbondi sdbondi changed the title refactor!(mempool): optimisations,excess sig index,fix weight calc refactor(mempool)!: optimisations,excess sig index,fix weight calc Jan 10, 2022
@sdbondi sdbondi force-pushed the core-mempool-optimisations branch from 6aa7cf4 to 62c9dd7 Compare January 10, 2022 14:51
@sdbondi sdbondi marked this pull request as draft January 10, 2022 16:04
@sdbondi sdbondi force-pushed the core-mempool-optimisations branch from 62c9dd7 to 6710053 Compare January 11, 2022 05:12
@sdbondi sdbondi force-pushed the core-mempool-optimisations branch from 6710053 to babf00b Compare January 11, 2022 05:13
@sdbondi sdbondi marked this pull request as ready for review January 11, 2022 05:13
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

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

LGTM
There is just some code that's been commented out that's been left in.

base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
base_layer/core/src/mempool/service/service.rs Outdated Show resolved Hide resolved
* development:
  feat: covenants implementation (tari-project#3656)
  ci: add tor script to binaries bundle (tari-project#3689)
Copy link
Collaborator

@stringhandler stringhandler left a comment

Choose a reason for hiding this comment

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

looking good.

@aviator-app aviator-app bot merged commit 75ad348 into tari-project:development Jan 12, 2022
sdbondi added a commit to sdbondi/tari that referenced this pull request Jan 12, 2022
* development:
  fix(comms): improve simultaneous connection handling (tari-project#3697)
  refactor(mempool)!: optimisations,excess sig index,fix weight calc (tari-project#3691)
sdbondi added a commit to sdbondi/tari that referenced this pull request Jan 12, 2022
* development:
  fix(comms): improve simultaneous connection handling (tari-project#3697)
  refactor(mempool)!: optimisations,excess sig index,fix weight calc (tari-project#3691)
@sdbondi sdbondi deleted the core-mempool-optimisations branch January 17, 2022 06:24
@sdbondi sdbondi restored the core-mempool-optimisations branch February 3, 2022 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants