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

feat: start DIP0024 from block 1 - fire up test chains by first block - 7/n #6325

Merged
merged 11 commits into from
Dec 10, 2024

Conversation

knst
Copy link
Collaborator

@knst knst commented Oct 10, 2024

Issue being fixed or feature implemented

This PR is 7th in the achieving ultimate goal to activate old forks from block 1.
It helps to run unit and functional tests faster; it helps for platform's dev-environment to start faster.

What was done?

Prior work: #6187, #6189, #6214, #6225, #6269, #6275

This PR:

  • simplify DIP0024 activation and activate it from block 1 at RegTest
  • removes command lines arguments: -bip147height, -dip8params
  • fixed intermittent errors in feature_index_prune.py and feature_llmq_simplepose.py
  • fix assertion crash on Regtest if using strange combination of -testactivationheight and -dip3params

How Has This Been Tested?

Run unit, functional tests.

Breaking Changes

[regtest only] -dip8params, -bip147height are removed.

Checklist:

  • 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

@knst knst added this to the 22 milestone Oct 10, 2024
@knst knst changed the title feat: bury mn_rr fork - fire up test chains by first block - 7/n feat: bury mn_rr fork - fire up test chains by first block - 7/n Oct 10, 2024
@knst knst force-pushed the forks-speedup-p6 branch from 6a16b30 to a320a6c Compare October 11, 2024 06:04
@knst knst changed the title feat: bury mn_rr fork - fire up test chains by first block - 7/n feat: bury DIP0024 fork - fire up test chains by first block - 7/n Oct 11, 2024
@knst knst changed the title feat: bury DIP0024 fork - fire up test chains by first block - 7/n feat: start DIP0024 from block 1, backport bitcoin#24527, bitcoin#23086 - fire up test chains by first block - 7/n Oct 11, 2024
@knst knst force-pushed the forks-speedup-p6 branch from a320a6c to 8073334 Compare October 17, 2024 08:35
@knst knst marked this pull request as draft October 17, 2024 16:08
@knst
Copy link
Collaborator Author

knst commented Oct 17, 2024

converted to draft because feature_llmq_simplepose.py is failing often on CI

Copy link

This pull request has conflicts, please rebase.

Copy link

This pull request has conflicts, please rebase.

Copy link

This pull request has conflicts, please rebase.

@PastaPastaPasta PastaPastaPasta modified the milestones: 22, 22.1 Nov 14, 2024
@knst knst force-pushed the forks-speedup-p6 branch 6 times, most recently from 61bf984 to cd2f39a Compare November 22, 2024 14:59
@knst knst marked this pull request as ready for review November 22, 2024 16:24
@knst
Copy link
Collaborator Author

knst commented Nov 22, 2024

converted to draft because feature_llmq_simplepose.py is failing often on CI

CI seems succeed now, please help to review it @UdjinM6 @PastaPastaPasta

I believe there's still some underlying issue remain in our llmq-code or in our test_framework, because every time something relevant changed, the functional test feature_llmq_simplepose.py becomes unstable:

Copy link

github-actions bot commented Dec 4, 2024

This pull request has conflicts, please rebase.

knst added 8 commits December 5, 2024 17:10
It can happen because now order of activation of hardforks v20, mn_rr, dip3
can be changed by using testactivationheight on Regtest and no more
guarantee about this assertions
bip147height is superseeded by -testactivationheight=bip147@height
dip8params is superseeded by -testactivationheight=dip0008@height
For current implementation it is not important when exactly fork happened
yet important to know when first rotating quorum formed
@knst
Copy link
Collaborator Author

knst commented Dec 6, 2024

I believe there's still some underlying issue remain in our llmq-code or in our test_framework, because every time something relevant changed, the functional test feature_llmq_simplepose.py becomes unstable:

ok, I fixed intermittent error in feature_llmq_simplepose.py. See 5ec071a

What a twist!!!

@UdjinM6
Copy link

UdjinM6 commented Dec 8, 2024

Looks good overall but 45bf353 and 5092207 change nothing for me, tried many times and 1-2 out of 8 jobs are failing with or without these commits. And it feels more like we are hiding the underlying issue rather than fixing it, would prefer them dropped. Also, backport commits should be in their own PR imo.

@knst knst force-pushed the forks-speedup-p6 branch from 5ec071a to f1905ca Compare December 9, 2024 06:52
@knst knst mentioned this pull request Dec 9, 2024
5 tasks
@knst
Copy link
Collaborator Author

knst commented Dec 9, 2024

dropped backports, dropped 45bf353 and 5092207 which seems not necessary anymore after 5ec071a

@UdjinM6 please re-review

UdjinM6
UdjinM6 previously approved these changes Dec 9, 2024
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 f1905ca

@@ -114,17 +114,20 @@ void CCreditPoolManager::AddToCache(const uint256& block_hash, int height, const

static std::optional<CBlock> GetBlockForCreditPool(const CBlockIndex* const block_index, const Consensus::Params& consensusParams)
{
// There's no CbTx before DIP0003 activation
if (!DeploymentActiveAt(*block_index, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003)) {
Copy link
Member

Choose a reason for hiding this comment

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

block_index can be null here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it seems unrelated because it was used in ReadBlockFromDisk before without extra checks:

bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus::Params& consensusParams)
{   
    const FlatFilePos block_pos{WITH_LOCK(cs_main, return pindex->GetBlockPos())};

Anyway, I added extra annotations just in case, see a new commit

const bool fDIP0024IsActive{optDIP0024IsActive.value_or(DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_DIP0024))};
const bool fHaveDIP0024Quorums{optHaveDIP0024Quorums.value_or(pindexPrev->nHeight >= consensusParams.DIP0024QuorumsHeight)};
const bool fDIP0024IsActive{
optIsDIP0024Active.value_or(DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_DIP0024))};
Copy link
Member

Choose a reason for hiding this comment

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

nit: we should rework this, currently this will always call DeploymentActiveAfter as it's a param. Should put in a lambda or something to avoid calling DeploymentActiveAfter if optIsDIP0024Active is set

Copy link
Collaborator Author

@knst knst Dec 10, 2024

Choose a reason for hiding this comment

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

we discussed it, this optIsDIP0024Active is used only for Unit test and it means that on production (mainnet, testnet, any devnet) it would be a case of OR in value_or for 100% calls. Not close to 100%, but indeed each one. So, this optimization won't give any extra benefits.

Also just a side note (not really important in this particular case) the function DeploymentActiveAfter for buried deployment (which is DIP0024) is simplified to one single if condition with height comparision, so, there's not much calculation is done anyway

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 906c2d7

pls update PR title

@knst knst changed the title feat: start DIP0024 from block 1, backport bitcoin#24527, bitcoin#23086 - fire up test chains by first block - 7/n feat: start DIP0024 from block 1 - fire up test chains by first block - 7/n Dec 10, 2024
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 906c2d7

@PastaPastaPasta PastaPastaPasta merged commit 977048f into dashpay:develop Dec 10, 2024
22 checks passed
@knst knst deleted the forks-speedup-p6 branch December 10, 2024 15:44
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