feat: min protocol version check for SML serialisation (#5302)

## Issue being fixed or feature implemented
This was reported/requested by @HashEngineering:
> Older versions of our App won't sync due to if (obj.nVersion ==
BASIC_BLS_VERSION) . Older versions don't know what version a SML Entry
is. As such, they will never read the type field. On the android client
this causes an offset problem when reading the mnlistdiff and it will
throw an exception that bans the peer that supplied it. Soon enough, no
peers will be left to connect to because they will all give the android
client bad data.

## What was done?
With this PR, SML will serialise the new v19 fields (`nType`,
`platformHTTPPort`, `platformNodeID`) if the client's version is at
least equal to `70227`.
Note: Serialisation for hashing skips the above rule.

Also, functional test mininode protocol version is set to `70227`.

## How Has This Been Tested?


## Breaking Changes


## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone
This commit is contained in:
Odysseas Gabrielides 2023-04-09 08:12:39 +03:00 committed by pasta
parent fe1d7e083a
commit 1fd442f229
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 4 additions and 1 deletions

View File

@ -73,6 +73,9 @@ public:
obj.keyIDVoting,
obj.isValid
);
if ((s.GetType() & SER_NETWORK) && s.GetVersion() < DMN_TYPE_PROTO_VERSION) {
return;
}
if (obj.nVersion == BASIC_BLS_VERSION) {
READWRITE(obj.nType);
if (obj.nType == MnType::HighPerformance) {

View File

@ -32,7 +32,7 @@ from test_framework.util import hex_str_to_bytes, assert_equal
import dash_hash
MIN_VERSION_SUPPORTED = 60001
MY_VERSION = 70225 # BLS_SCHEME_PROTO_VERSION
MY_VERSION = 70227 # DMN_TYPE_PROTO_VERSION
MY_SUBVERSION = b"/python-mininode-tester:0.0.3%s/"
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)