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

test: optimize feature asset locks test #6374

Conversation

PastaPastaPasta
Copy link
Member

@PastaPastaPasta PastaPastaPasta commented Oct 29, 2024

Issue being fixed or feature implemented

Minimize number of blocks needed to be mined in asset locks test

Based on CI test goes from about 270s -> 213s

What was done?

Reduce number of blocks needed by reducing hard fork activation points

How Has This Been Tested?

Ran test locally, built

Breaking Changes

Breaking for regtests, nothing else.

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@PastaPastaPasta PastaPastaPasta added this to the 22 milestone Oct 29, 2024
@@ -164,7 +164,7 @@ CCreditPool CCreditPoolManager::ConstructCreditPool(const CBlockIndex* const blo
}

const CBlockIndex* distant_block_index = block_index;
for (size_t i = 0; i < CCreditPoolManager::LimitBlocksToTrace; ++i) {
for (auto i = 0; i < Params().CreditPoolPeriodBlocks(); ++i) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

int here is just fine

Copy link
Member Author

Choose a reason for hiding this comment

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

better to auto imo

Copy link
Collaborator

Choose a reason for hiding this comment

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

better to auto imo

I'd disagree with your opinion.

There's so many cases, when auto is useful and increase code readability. Because it makes not only shorter to write but also easier to read. For example, iterators for containers, such as std::vector::const_iterator - If type of container is non-trivial even more useful. Also, if there's any lambda function involved, auto's are so useful to assign lambda or pass somewhere.

But in this particular case, Params().CreditPoolPeriodBlocks(); is not related to type of auto, is only thing is matter is a 0 from the initialization; you should read this code such as auto i = 0. So, this code compiles without warning, but not because you used auto, but because accidentally a type of Params().CreditPoolPeriodBlocks() is matched with `int.

In this particular case, auto makes code more difficult to read: why there's auto?

yes, it compiles. yes, it works as expected. but there's nothing "better"

Copy link
Member Author

@PastaPastaPasta PastaPastaPasta Oct 29, 2024

Choose a reason for hiding this comment

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

@@ -188,6 +189,8 @@ class CChainParams
int nMinSporkKeys;
uint16_t nDefaultPlatformP2PPort;
uint16_t nDefaultPlatformHTTPPort;
/// The number of blocks the credit pool tracks; 576 (one day) on mainnet, reduced on regtest
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe then apply 100 on all test nets? (Trstnet, devnet, regtest?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see a point to introduce breaking changes for devnet / testnet over this. Only real benefit is in CI situations imo

knst
knst previously approved these changes Oct 29, 2024
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

utACK 4cc3ee6

would you squash commit-2 and commit-3? The functional test feature_asset_Locks.py will fail if you run it with commit-2 but without commit-3, which violate atomic requirements for commits

@PastaPastaPasta PastaPastaPasta force-pushed the optimize-feature-asset-locks-test branch from a153390 to 2d05df0 Compare October 29, 2024 18:21
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

utACK 2d05df0

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 2d05df0

@PastaPastaPasta PastaPastaPasta merged commit 88a8e7a into dashpay:develop Oct 30, 2024
28 of 30 checks passed
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.

3 participants