Closed abitmore closed 2 years ago
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
This is actually a protocol change. If not coordinated properly, it may cause the chain to fork.
Since it's not on mainnet yet, it only affects testnet. Will add hard fork protection code for testnet only.
Actually the change is a soft fork. Won't add hard fork protection.
If the type of a member variable is Optional, setting a non-standard default value will cause serialization / deserialization problems.
Follow-up of https://github.com/bitshares/bitshares-core/pull/2469.
To reproduce:
Or (broadcast a signed transaction without explicit
"new_fee_rate":null
in the JSON)Actually, if broadcast the transaction to an API node with explicit
"new_fee_rate":null
in the JSON, the API node will accept the transaction, but the transaction will get rejected when being propagated to other nodes. If the API node is a block producer and the transaction is included in a block, the block will be rejected by other nodes because it can not pass Merkle tree validation.The underlying issue is in FC. When unpacking (deserializing) an optional object, if the target variable is valid already, it will not get emptied / reset / overwritten. Related code: https://github.com/bitshares/bitshares-fc/blob/c72d5d31cc239a1a381cb3543402c9e2f4cc3f7f/include/fc/io/raw.hpp#L266-L273
Not sure if it's worth fixing. Usually we don't pass in a valid optional object when unpacking, although this time we did it.