You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, contract's ScSpecEntry is an XDR stream (multiple XDR entries of the same type are appended together in a single byte buffer).
XDR parsers can either read whole buffer and parse it as a single entry of a given type (aka read_xdr_to_end in rs-xdr), or read buffer iteratively, where parser reads chunks of the buffer (for a given type) until buffer ends (aka read_xdr_iter).
In cli we can use stellar xdr decode. And different behaviors are specified using flag --input:
Note that when trying to pass --single, expected error will be returned (because whole buffer doesn't represent a single ScSpecEntry, but a batch of ScSpecEntry)
Technically, it is a valid stream of ScSpecEntry, but not a valid single ScSpecEntry.
Because Lab reads only single entry, most of contract spec XDRs can't be viewed using the lab (but still can be viewed using cli)
Internal slack discussion thread
What would you like to see?
Replace usage of read_xdr_to_end with read_xdr_iter (method's JS alternatives). This change is backward compatible, because single entry is the same as stream of 1 entry.
What alternatives are there?
Using cli
The text was updated successfully, but these errors were encountered:
What problem does your feature solve?
Currently, contract's
ScSpecEntry
is an XDR stream (multiple XDR entries of the same type are appended together in a single byte buffer).XDR parsers can either read whole buffer and parse it as a single entry of a given type (aka
read_xdr_to_end
in rs-xdr), or read buffer iteratively, where parser reads chunks of the buffer (for a given type) until buffer ends (akaread_xdr_iter
).In cli we can use
stellar xdr decode
. And different behaviors are specified using flag--input
:So we can decode XDR of a contract easily (reading full stream)
Note that when trying to pass
--single
, expected error will be returned (because whole buffer doesn't represent a singleScSpecEntry
, but a batch ofScSpecEntry
)The same behavior can be seen in lab for the same XDR:
Technically, it is a valid stream of
ScSpecEntry
, but not a valid singleScSpecEntry
.Because Lab reads only single entry, most of contract spec XDRs can't be viewed using the lab (but still can be viewed using cli)
Internal slack discussion thread
What would you like to see?
Replace usage of
read_xdr_to_end
withread_xdr_iter
(method's JS alternatives). This change is backward compatible, because single entry is the same as stream of 1 entry.What alternatives are there?
Using cli
The text was updated successfully, but these errors were encountered: