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.
abuiles/go@5c48fa9
This unblocks https://github.com/stellar/go/pull/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.
Protocol 14 includes a new type called
SponsorshipDescriptorwhich is defined as an alias to an OptionalAccountIdThe 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
SponsorshipDescriptorwhich 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.abuiles/go@5c48fa9
This unblocks https://github.com/stellar/go/pull/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.