Skip to content

Conversation

@xdustinface
Copy link

No description provided.

@xdustinface xdustinface added this to the 17 milestone Jan 17, 2021
@xdustinface xdustinface marked this pull request as ready for review January 17, 2021 21:35
@xdustinface xdustinface force-pushed the pr-llmq-some-fixes branch 2 times, most recently from 186c12c to a47ccac Compare January 20, 2021 04:04
@xdustinface
Copy link
Author

@UdjinM6 See the last 5 commits, i changed/dropped some stuff. Quorums/Commitment caches are now unordered_lru_cache and scanQuorumsCache cache size is fixed by just calculating it based on the params.

@xdustinface xdustinface marked this pull request as ready for review January 20, 2021 05:07
@xdustinface
Copy link
Author

Okay so, i pushed some more commits to refactor ScanQuorums a bit because IMO it was really hard to read/understand its full logic before (and i hope i didn't break any of its logic haha). Also it seems like it didn't reuse existing cache if more than cache size was requested. So let's say we had 10 quorums in cache and you requested 11 it read all 11 from DB instead of 1 (0603e98)

This recent commits also changes the way the scanQuorumCache works from just one unordered_lru_cache to one unordered_lru_cache for each LLMQ type like with the normal quorums and commitments caches (
4f2a804). The rest should be obvious.

@UdjinM6
Copy link

UdjinM6 commented Jan 21, 2021

LGTM so far, waiting for the "inactive quorum" issue to be discussed (and fixed if needed).

@xdustinface
Copy link
Author

Okay so in the meeting today it turned out that the reason for querying old quorums is mainly to validate IS locks with verifyislock and chainlocks with quorum verify. But it appears that this only happens frequently during sync of platform because they store the the IS/CL in the platform blocks and they need to validate them on sync. When it's synced it can still happen but unlikely/not often and thats only if someone submits an asset lock older than our singing window to platform. I can't tell you much more details here so if you have more questions i guess @antouhou or @shumkov could leave you an answer.

Soo, from my understanding it wouldn't help a lot then here to have a bigger cache, right? We could maybe still just add a command line which allows to increase the cache sizes...not sure if it makes sense, but we could haha..

And i guess someone (i would but i don't know when :P) should in any case do some research and testing around all this to see how resource consuming fun like this is also given the fact that ivan said they are sometimes at the limit of the RPC queue during sync 🤔

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK, one nit

template <typename CacheType>
static void InitQuorumsCache(CacheType& cache)
{
for (auto& llmq : Params().GetConsensus().llmqs) {
Copy link
Member

Choose a reason for hiding this comment

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

Can llmq be const?

Copy link
Author

Choose a reason for hiding this comment

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

You could add it, but llmq is already const because GetConsensus() returns a const reference so llmqs is const and it would be kind of redundant.

@xdustinface xdustinface merged commit dc2473c into dashpay:develop Jan 25, 2021
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 11, 2022
* llmq: Detach dash-q-cachepop from caller

There should be no reason to keep this tread attached
to its parent, if so, let me know.

* llmq: Avoid nullptr access for pindexStart in ScanQuorums

* llmq: Add cacheKey in ProcessCommitment

* llmq: Erase minable commitments if they have been processed

* llmq: Add CLLMQUtils::InitQuorumsCache

* llmq: Use unordered_lru_cache for quorumsCache and rename it

* llmq: Use unordered_lru_cache for hasMinedCommitmentCache and rename it

* llmq: Drop redundant check

* llmq: Rename nMaxCount2 -> nScanCommitments

* llmq: Refactor storeCache -> fCacheExists

* llmq: Rename maxCount -> nCountRequested

* llmq: Rename result -> vecResultQuorums

* llmq: Return an empty vector if the are zero elements requested

* unordered_lru_cache: Add max_size()

* llmq: Partially reuse existing cache if more than max is requested

* llmq: std::map<LLMQType, unordered_lru_cache<...>> for scanQuoumsCache

* llmq: Drop params

* llmq: Only emplace to cache if there is something available
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