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!: masternode node hard-fork activation DIP-0023 #5469

Merged
merged 21 commits into from
Oct 6, 2023
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
612faa8
feat: imlemented new hard-fork mechanism that uses MN Activation Height
knst Aug 3, 2023
c8d84a8
fix: MnEHF transaction should be accepted to mempool bypass fee limits
knst Aug 3, 2023
33ab318
feat: add CMNHFManager and logic to make hard-forks accordingly recei…
knst Aug 3, 2023
b85a497
feat: new functional test for feature MnEHF
knst Aug 3, 2023
2c4597d
feat: improve functional tests for MnEHF to check block reconsideration
knst Aug 8, 2023
4e03666
Update src/chainparams.cpp
knst Aug 17, 2023
bb8d06a
fix: conflict resolve due to new fuzz test (versionbits) and -Wno-reo…
knst Sep 4, 2023
628ce18
feat: let unknown deployments to be mined in blocks
knst Sep 4, 2023
0878e18
fix: check MnEHF earlier
knst Sep 6, 2023
ef14b53
feat: add functional test for unknown and invalid version bits of EHF…
knst Sep 6, 2023
5bcbcc8
docs: documented UpdateMNActivationParam
knst Sep 6, 2023
df4c366
fix: logs in chainparams moved out from if(fJustCheck)
knst Sep 11, 2023
5d9085f
Update src/chainparams.cpp
knst Sep 11, 2023
7b18bc8
fix: EHF takes care not only about nTimeOut but about nStartTime also
knst Sep 20, 2023
3973f2b
feat: update functional tests for Mn EHF - to use same bit more than …
knst Sep 20, 2023
92be5e0
fix: now EHF transactions expires after nExpiryEHF blocks
knst Sep 21, 2023
13f28a0
fix: mark invalid EHF tx in mempool
knst Sep 23, 2023
5e31bd5
refactor: multiple fixes, cleanups, improvements and refactorings
knst Sep 23, 2023
d83dbd2
fix: fix previous commit with fixes
knst Sep 24, 2023
4b046bb
use deployment nStartTime as a signal expiration mark, adjust tests
UdjinM6 Sep 26, 2023
f7705cd
fix: scan quorums instead just using verified sigs
knst Sep 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/evo/mnhftx.cpp
Original file line number Diff line number Diff line change
@@ -53,24 +53,21 @@ CMNHFManager::Signals CMNHFManager::GetSignalsStage(const CBlockIndex* const pin
return signals;
}

bool MNHFTx::Verify(const CBlockIndex* const pQuorumIndex, const uint256& msgHash, TxValidationState& state) const
bool MNHFTx::Verify(const uint256& quorumHash, const uint256& msgHash, TxValidationState& state) const
{
if (versionBit >= VERSIONBITS_NUM_BITS) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-nbit-out-of-bounds");
}

Consensus::LLMQType llmqType = Params().GetConsensus().llmqTypeMnhf;
const auto& llmq_params_opt = llmq::GetLLMQParams(llmqType);
if (!llmq_params_opt.has_value()) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-quorum-type");
}
int signOffset{llmq_params_opt->dkgInterval};
const Consensus::LLMQType& llmqType = Params().GetConsensus().llmqTypeMnhf;
const auto quorum = llmq::quorumManager->GetQuorum(llmqType, quorumHash);

const uint256 requestId = ::SerializeHash(std::make_pair(MNEHF_REQUESTID_PREFIX, int64_t{versionBit}));

if (!llmq::CSigningManager::VerifyRecoveredSig(llmqType, *llmq::quorumManager, pQuorumIndex->nHeight + signOffset, requestId, msgHash, sig)) {
const uint256 signHash = llmq::utils::BuildSignHash(llmqType, quorum->qc->quorumHash, requestId, msgHash);
if (!sig.VerifyInsecure(quorum->qc->quorumPublicKey, signHash)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-invalid");
}

return true;
}

@@ -107,7 +104,7 @@ bool CheckMNHFTx(const CTransaction& tx, const CBlockIndex* pindexPrev, TxValida
uint256 msgHash = tx_copy.GetHash();


if (!mnhfTx.signal.Verify(pindexQuorum, msgHash, state)) {
if (!mnhfTx.signal.Verify(mnhfTx.signal.quorumHash, msgHash, state)) {
// set up inside Verify
return false;
}
6 changes: 3 additions & 3 deletions src/evo/mnhftx.h
Original file line number Diff line number Diff line change
@@ -28,11 +28,11 @@ class MNHFTx
{
public:
uint8_t versionBit{0};
uint256 quorumHash;
CBLSSignature sig;
uint256 quorumHash{0};
CBLSSignature sig{};

MNHFTx() = default;
bool Verify(const CBlockIndex* const pQuorumIndex, const uint256& msgHash, TxValidationState& state) const;
bool Verify(const uint256& quorumHash, const uint256& msgHash, TxValidationState& state) const;

SERIALIZE_METHODS(MNHFTx, obj)
{