-
Notifications
You must be signed in to change notification settings - Fork 2.2k
token 2022: add alloc_and_serialize for fixed-len extensions #5672
token 2022: add alloc_and_serialize for fixed-len extensions #5672
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
878e601
to
a29209e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking very close! Just a few nits, but the core is good. Could you add a test for the new function?
Yep, I was mostly waiting to see if you were okay with changing this many bits of the TLV/extension module. Didn't want to make too many changes. Will definitely add some tests! |
7b557fe
to
318e54b
Compare
318e54b
to
0509e06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few last little things, then this is good to go! The tests look great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds the
alloc_and_serialize
function for fixed-length extensions to Token2022.Note: I decided to follow already pre-established patterns and rename the existing
alloc_and_serialize
function toalloc_and_serialize_variable_len_extension
. The existing pattern has been to add some form of*variable_len*
suffix on functions that deal with variable-length methods, and give the more concisely named functions to the fixed-length extensions.Regardless, this function allows reallocation of an account only if the extension does not exist yet and requires more uninitialized bytes to write it in.