Stack/serialization limit is weirdly enforced
object-Object opened this issue ยท 2 comments
I've mentioned this a few times in Discord, but I don't think an issue has been opened.
The stack/serialization/iota limit, which is used both when serializing iotas and after each frame evaluation in the CastingVM, is checked here:
HexIotaTypes.MAX_SERIALIZATION_TOTAL
is currently hardcoded to 1024. However, that's not the actual limit in practice, for two reasons:
isTooLargeToSerialize
starts counting at 1, because its initial purpose was to check the size of lists, and we include the list itself in the count. However, this still applies when checking the size of the entire stack, reducing the actual maximum legal stack size to 1023.- The
MAX_SERIALIZATION_TOTAL
andMAX_SERIALIZATION_DEPTH
checks use>=
, not>
, reducing the actual maximum legal stack size to 1022.
This also means that the largest possible list could only contain 1021 iotas.
I'm not sure if this counts as a bug really, but it seems weird.
I agree this is kind of weird. I'd like to revisit this and (like @walksanatora suggests) consider making this configurable