-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Currently, we have a number of customizations for the cereal XDR->JSON conversion. Unfortunately, these customizations don't match SEP-0051. We also currently don't implement the corresponding JSON->XDR cereal overrides. Additionally note that we don't always do a great job of keeping XDRCereal.h up-to-date (e.g., not updating to handle ContractID). Also, some of our overrides have data loss, e.g.,
SCAddress addr;
addr.type(SC_ADDRESS_TYPE_CLAIMABLE_BALANCE);
addr.claimableBalanceId().v0().fill(0xff);
{
cereal::JSONOutputArchive ar(std::cout);
xdr::archive(ar, addr);
}
std::cout << "\n";
addr.type(SC_ADDRESS_TYPE_LIQUIDITY_POOL);
addr.liquidityPoolId().fill(0xff);
{
cereal::JSONOutputArchive ar(std::cout);
xdr::archive(ar, addr);
}
/*
{
"value0": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
{
"value0": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
*/While we could either add these missing overrides, change to match SEP-0051, and fix the broken ones, it seems like it would be easier to just use rs-stellar-xdr, instead. I believe none of the JSON serialization should happen on a critical path, so the (likely) performance degradation for serialization of C++ XDR -> Rust -> JSON should be acceptable.