Closed bytemaster closed 10 years ago
We need a strategy for dealing with 32-bit / 64-bit targets. Here are the options:
sizeof
. When the output of the script differs on different platforms, we have a problem.FC_REFLECT
. Those macros are too hairy and poorly documented for me to really tell if FC_REFLECT
is the right tool for this.gccxml
. Not viable, support for C++11 appears to be poor.clang
. We might want to check out https://github.com/sk-havok/clang-extract, normally I'd recommend gccxml
but it doesn't support C++11.I will also propose Option 5, which is to use a well-supported serialization library such as Capn Proto. This has multiple advantages, such as bindings for other languages, backwards compatibility baked in, better documentation, etc.
The downside is it will require slightly more work to make our types serializable than just an FC_REFLECT macro, but I personally feel that is a small price to pay.
For what it's worth, this issue has nothing to do with compatibility between 32-bit and 64-bit serialization. In commit 4dd9c7f8fe64a9d57278ef42194a440248505645, a new field was added to a field in the database but there was no upgrade mechanism for this particular database. When a user started the new version of their client for the first time, it tried to read the old database and couldn't deserialize the newly-added field. This was "fixed" by telling the user to delete their ~/.BitShares directory whenever they upgraded, which used to be common practice.
If it happens in the future when the "delete everything" approach isn't acceptable, fc reflect has a versioning mechanism used in Keyhotee (I'm not sure if it's used in bitshares_toolkit yet) that works well.
@emfrias Can you provide a link to an example of the versioning mechanism being used? A quick search didn't lead me to anything.
Here's part of it here (contains docs for usage in comments): https://github.com/BitShares/bitshares_toolkit/blob/develop/libraries/db/include/bts/db/upgrade_leveldb.hpp
Based on @emfrias comment, I think the OP issue is resolved. +5% for @nathanhourt's Option 5, filing a new ticket.
Cap'n Proto is still in beta and has not been security audited. Maybe one of us could audit it. But I'm thinking we have plenty of more urgent tasks, so I'm thinking Option 4.
For the record, fc is still in alpha and has not been audited either.
https://bitsharestalk.org/index.php?topic=5523.msg75207#msg75207