hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
310 stars 136 forks source link

Create PlatformVersion PBJ object #14773

Closed imalygin closed 2 months ago

imalygin commented 2 months ago

This is a follow-up for https://github.com/hashgraph/hedera-services/issues/13124

There is an interface SoftwareVersion which has three implementations: BasicSoftwareVersion, PlatformSoftwareVersion, and HederaSoftwareVersion. The difference between PlatformSoftwareVersion and HederaSoftwareVersion is that the latter also has an HAPI version. These classes are self-serializable, so we were able to work around the fact that they are serialized differently. Now, when we need to represent PlatformState as a protobuf object, they become incompatible. There is no straightforward way to convert HederaSoftwareVersion into a PBJ SemanticVersion, as HederaSoftwareVersion is represented with two objects of the SemanticVersion type.

The solution to this discrepancy: