-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Protocol 14 includes a new type called SponsorshipDescriptor
which is defined as an alias to an Optional AccountId
typedef AccountID* SponsorshipDescriptor;
The code generated by xdrgen produces an invalid output (see failure here stellar/go@3b2053c)
As a temporary workaround, I removed the marshaling/unmarshaling methods from SponsorshipDescriptor
which solves the problem and makes the type behave as expected, which is an optional field -- when reading from a raw XDR it will try to read the first 4 bytes to determine if it is void or not and then read the content.
This unblocks stellar/go#2864 and allows us to move forward with Protocol 14 support.
This seems like a bug on xdrgen when compiling to go (it does the right thing in JS), maybe for optional typedefs we don't need marshaling and unmarshalling since we can delegate to the struct being referenced.
I also put a simple demo here https://github.com/abuiles/xdr-test/blob/master/src/main.go which shows a similar XDR definition working fine.