Skip to content

Commit a466add

Browse files
committed
evo: prohibit upgrading from LegacyBLS to ExtAddr support directly
As ExtAddr > BasicBLS > LegacyBLS, an upgrade to ExtAddr *assumes* the node is already *at least* at BasicBLS. We should not allow upgrades if this assumption is not met.
1 parent 25410e1 commit a466add

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/evo/deterministicmns.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,11 @@ bool CheckProUpServTx(CDeterministicMNManager& dmnman, const CTransaction& tx, g
14341434
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-version-downgrade");
14351435
}
14361436

1437+
// Nodes using the legacy scheme must first upgrade to the basic scheme before upgrading further
1438+
if (is_v23_active && dmn->pdmnState->nVersion == ProTxVersion::LegacyBLS && opt_ptx->nVersion > ProTxVersion::BasicBLS) {
1439+
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-version-upgrade");
1440+
}
1441+
14371442
// don't allow updating to addresses already used by other MNs
14381443
for (const NetInfoEntry& entry : opt_ptx->netInfo.GetEntries()) {
14391444
if (const auto& service_opt{entry.GetAddrPort()}; service_opt.has_value()) {
@@ -1503,6 +1508,11 @@ bool CheckProUpRegTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gs
15031508
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-version-downgrade");
15041509
}
15051510

1511+
// Nodes using the legacy scheme must first upgrade to the basic scheme before upgrading further
1512+
if (is_v23_active && dmn->pdmnState->nVersion == ProTxVersion::LegacyBLS && opt_ptx->nVersion > ProTxVersion::BasicBLS) {
1513+
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-version-upgrade");
1514+
}
1515+
15061516
// don't allow reuse of payee key for other keys (don't allow people to put the payee key onto an online server)
15071517
if (payoutDest == CTxDestination(PKHash(dmn->pdmnState->keyIDOwner)) || payoutDest == CTxDestination(PKHash(opt_ptx->keyIDVoting))) {
15081518
return state.Invalid(TxValidationResult::TX_BAD_SPECIAL, "bad-protx-payee-reuse");
@@ -1569,6 +1579,11 @@ bool CheckProUpRevTx(CDeterministicMNManager& dmnman, const CTransaction& tx, gs
15691579
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-version-downgrade");
15701580
}
15711581

1582+
// Nodes using the legacy scheme must first upgrade to the basic scheme before upgrading further
1583+
if (is_v23_active && dmn->pdmnState->nVersion == ProTxVersion::LegacyBLS && opt_ptx->nVersion > ProTxVersion::BasicBLS) {
1584+
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-version-upgrade");
1585+
}
1586+
15721587
if (!CheckInputsHash(tx, *opt_ptx, state)) {
15731588
// pass the state returned by the function above
15741589
return false;

0 commit comments

Comments
 (0)