Note: This is the default pull request template.
What is the current behavior? / What's the issue?
JS generated code is using universal struct reading, that is not leveraging symbol structs alignment
How have you changed the behavior?
struct generator is calling field.extensions.printer.load
.
In case of simple types, we could just handle it inside the printer, howevere in case of builtin fields (i.e. Amount) BuiltinPrinter does not have info about field itself, therefore wouldn't be able to access parent - aligned - struct
Only sensible way to do it was to pass down is_aligned
in calls to load()
What was NOT changed:
right now missing piece is handling of structs, so i.e. (from HashlockTransaction.deserialize)
const fee = Amount.deserializeAligned(view.buffer);
view.shiftRight(fee.size);
const deadline = Timestamp.deserializeAligned(view.buffer);
view.shiftRight(deadline.size);
const mosaic = UnresolvedMosaic.deserialize(view.buffer);
view.shiftRight(mosaic.size);
note that UnresolvedMosaic.deserialize
is called. otherwise it would require generating deserializeAligned on all structs, I'm not quite sure if that is wanted change, if so, should probably be done separately
How was this change tested?
- verified generated code
- catbuffer test vectors are passing
- additional unit tests added