Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Aug 23, 2024

Issue being fixed or feature implemented

V20 is activated on mainnet: time to bury it!

#6186

What was done?

Hard-fork v20 is buried and it requires to implement multiple fixes, simplifications, refactoring:

  • some tests for EHF moved from functional tests to unit tests
  • fixed crash in Credit Pool if DIP3 is not activated yet
  • added a requirement for v20 activation for CMNHFManager::GetSignalsStage
  • removed useless code from functional test feature_llmq_rotation
  • renamed variables "v20" to "mn_rr" in feature_llmq_evo.py so far as actually used fork is mn_rr

How Has This Been Tested?

Some unit and functional tests to succeed.

Done reindex (just in case):

src/qt/dash-qt -reindex  -assumevalid=0
src/qt/dash-qt -reindex  -assumevalid=0 -testnet

Breaking Changes

N/A

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 force-pushed the forks-speedup-p3 branch 3 times, most recently from f8a4893 to 318df9e Compare August 23, 2024 15:08
Comment on lines 51 to 53
if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "mnhf-before-v20");
}
Copy link
Member

Choose a reason for hiding this comment

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

dcab562: a devnet or something like that could have a mnhf tx get mined before v20 is active though right?

Copy link
Collaborator Author

@knst knst Aug 26, 2024

Choose a reason for hiding this comment

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

dcab562 it would not affect mainnet, testnet, indeed.

UPD: dropped

Comment on lines 53 to 58
if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetlocks-before-v20");
}
Copy link
Member

Choose a reason for hiding this comment

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

4afc853: I mean, this is kinda a breaking change no? Wouldn't affect mainnet but...

Copy link
Collaborator Author

@knst knst Aug 26, 2024

Choose a reason for hiding this comment

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

4afc853 it would not affect mainnet, testnet, indeed.

UPD: dropped

Comment on lines +119 to +123
if (!Params().IsValidMNActivation(mnhfTx.signal.versionBit, pindexPrev->GetMedianTimePast())) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-non-ehf");
}
Copy link
Member

Choose a reason for hiding this comment

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

6c69808: could probably be it's own distinct PR?

Copy link
Collaborator Author

@knst knst Aug 25, 2024

Choose a reason for hiding this comment

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

could not, because it's impossible (or very hard) to implement this functionality in functional tests within v20 buried.

signals.insert({versionBit, mined_height});
}

signals.insert({versionBit, mined_height});
Copy link
Member

Choose a reason for hiding this comment

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

3cd7a42: how's this duplicated?

Copy link
Collaborator Author

@knst knst Aug 25, 2024

Choose a reason for hiding this comment

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

see lines 222...225

This condition already checked for each signal in new_signals above and if it fails for any signal this function will return std::nullopt as a result

consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244
consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae
consensus.MinBIP9WarningHeight = 1899072 + 2016; // V19 activation height + miner confirmation window
consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777
Copy link
Member

Choose a reason for hiding this comment

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

what's the minimum set of commits needed in this PR to merge in 47def13?

Copy link
Collaborator Author

@knst knst Aug 25, 2024

Choose a reason for hiding this comment

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

two commits can be excluded from this PR as just useful follow-ups:

  • c15b3d9 (feat: activate v20 on the same block as v19)
  • 4ade970 (feat: speedup functional test feature_governance.py by generating less blocks)

and probably 3cd7a42

All others commits are required for 47def13

# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
self.extra_args = [[
'-dip3params=2000:2000',
'-dip3params=2000:2000', # Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
Copy link
Member

Choose a reason for hiding this comment

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

why not use testactivationheight?

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's out of scope this PR, I will do that in PR where I set DIP3 activation from block 1

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.

clang-diff format is not happy

@knst knst force-pushed the forks-speedup-p3 branch from 318df9e to 6e66cce Compare August 26, 2024 05:58
knst added 5 commits August 26, 2024 14:19
…locks during re-index

Relevant crash dump:

    Assertion failed: detected inconsistent lock order for 'cs_main' in node/blockstorage.cpp:778 (in thread 'main'), details in debug log.
    Posix Signal: Aborted
       0#: (0x62349D233974) stl_vector.h:115         - std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_impl_data::_M_copy_data(std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_impl_data const&)
       1#: (0x62349D233974) stl_vector.h:127         - std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_impl_data::_M_swap_data(std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_impl_data&)
       2#: (0x62349D233974) stl_vector.h:1959        - std::vector<unsigned long, std::allocator<unsigned long> >::_M_move_assign(std::vector<unsigned long, std::allocator<unsigned long> >&&, std::integral_constant<bool, true>)
       3#: (0x62349D233974) stl_vector.h:768         - std::vector<unsigned long, std::allocator<unsigned long> >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >&&)
       4#: (0x62349D233974) stacktraces.cpp:777      - HandlePosixSignal
       5#: (0x71E435442990) libc_sigaction.c         - ???
       6#: (0x71E435499A1B) pthread_kill.c:44        - __pthread_kill_implementation
       7#: (0x71E435499A1B) pthread_kill.c:78        - __pthread_kill_internal
       8#: (0x71E435499A1B) pthread_kill.c:89        - __GI___pthread_kill
       9#: (0x71E4354428E6) raise.c:27               - __GI_raise
      10#: (0x71E4354268B7) abort.c:81               - __GI_abort
      11#: (0x62349D239956) basic_string.h:390       - std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_check_length(unsigned long, unsigned long, char const*) const
      12#: (0x62349D239956) basic_string.h:1461      - std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)
      13#: (0x62349D239956) basic_string.h:1365      - std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+=(char const*)
      14#: (0x62349D239956) sync.cpp:114             - potential_deadlock_detected
      15#: (0x62349D2403DE) sync.cpp:188             - push_lock<std::recursive_mutex>
      16#: (0x62349D2403DE) sync.cpp:212             - void EnterCritical<std::recursive_mutex>(char const*, char const*, int, std::recursive_mutex*, bool)
      17#: (0x62349CAA8B72) unique_lock.h:150        - std::unique_lock<std::recursive_mutex>::try_lock()
      18#: (0x62349CAA8B72) sync.h:162               - UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::Enter(char const*, char const*, int)
      19#: (0x62349CAA8B72) sync.h:183               - UniqueLock<AnnotatedMixin<std::recursive_mutex>, std::unique_lock<std::recursive_mutex> >::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool)
      20#: (0x62349CE349CD) chain.h:225              - CBlockIndex::GetBlockPos() const
      21#: (0x62349CE349CD) blockstorage.cpp:778     - operator()
      22#: (0x62349CE349CD) blockstorage.cpp:778     - ReadBlockFromDisk(CBlock&, CBlockIndex const*, Consensus::Params const&)
      23#: (0x62349D102F82) mnhftx.cpp:284           - CMNHFManager::GetForBlock(CBlockIndex const*)
      24#: (0x62349D103E9B) mnhftx.cpp:58            - CMNHFManager::GetSignalsStage(CBlockIndex const*)
      25#: (0x62349D07F0E9) versionbits.cpp:222      - SignalHeight
      26#: (0x62349D07F90D) versionbits.cpp:37       - AbstractThresholdConditionChecker::GetStateFor(CBlockIndex const*, Consensus::Params const&, std::map<CBlockIndex const*, ThresholdState, std::less<CBlockIndex const*>, std::allocator<std::pair<CBlockIndex const* const, ThresholdState> > >&) const
      27#: (0x62349D080D93) sync.h:199               - UniqueLock<AnnotatedMixin<std::mutex>, std::unique_lock<std::mutex> >::~UniqueLock()
      28#: (0x62349D080D93) versionbits.cpp:260      - VersionBitsCache::State(CBlockIndex const*, Consensus::Params const&, Consensus::DeploymentPos)
      29#: (0x62349CC06C73) deterministicmns.cpp:227 - CDeterministicMNList::GetProjectedMNPayees(gsl::not_null<CBlockIndex const* const>, int) const
    Aborted (core dumped)
@knst knst force-pushed the forks-speedup-p3 branch from 6e66cce to 2381255 Compare August 26, 2024 07:28
@knst knst requested a review from PastaPastaPasta August 26, 2024 11:17
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.

generally LGMT; time for Udjin to review. I'll wanna reindex it, but I'll do that later

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.

reindexed with -assumevalid=0 on both mainnet and testnet, no issues

ACK 2381255

@UdjinM6 UdjinM6 added this to the 21.2 milestone Sep 6, 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 2381255

@PastaPastaPasta PastaPastaPasta merged commit 6d42651 into dashpay:develop Sep 10, 2024
@knst knst deleted the forks-speedup-p3 branch September 16, 2024 13:37
@UdjinM6 UdjinM6 removed this from the 21.2 milestone Oct 29, 2024
@UdjinM6 UdjinM6 added this to the 22 milestone Oct 29, 2024
PastaPastaPasta added a commit that referenced this pull request Dec 10, 2024
…y first block - 7/n

906c2d7 refactor: add annotation gsl::not_null for ConstructCreditPool (Konstantin Akimov)
f1905ca fix: intermittent missing of PoSe ban in feature_llmq_simplepose.py (Konstantin Akimov)
cf84dff fix: bump time for all nodes during mine_quorum in feature_llmq_rotation.py test (Konstantin Akimov)
efd4701 fix: intermittent error for feature_llmq_simplepose due to rotating quorums (Konstantin Akimov)
2bafadf feat: put DIP0024 activation to block 1 on RegTest (Konstantin Akimov)
632c4c4 feat: re-bury DIP0024 with new height when quorums actually appeared (Konstantin Akimov)
343c74b fix: intermittent error in feature_index_prune due to DKG influence (Konstantin Akimov)
de821b9 refactor: remove command line argument -bip147height, -dip8params (Konstantin Akimov)
d8ce0a7 docs: updated comment for DIP0003 activation on RegTest (Konstantin Akimov)
4dafec8 fix: add check that DIP0003 activated before retrieving CbTx for CreditPool (Konstantin Akimov)
26e9813 fix: assertion in Credit Pool validation during connecting blocks (Konstantin Akimov)

Pull request description:

  ## 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:
  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    utACK 906c2d7
  PastaPastaPasta:
    utACK 906c2d7

Tree-SHA512: fab8a9bc03bb7f220c19dd952a03f8fec0b6ef1362d7308eb77c90e0ba814a241bb2bf36beccf78bb285ede1b6d85ec52fa19b3729ac9b643b420d13fbb63b47
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