Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation: Add support for Catalyst voting registration as specified in CIP-0015: cardano-foundation/CIPs#79 - a custom metadata to be included with Cardano transactions in order for the user to bind their staking key to a randomly generated voting key which would have the proportional weight in the Catalyst voting sidechain.
Changes:
__noinline_due_to_stack__
directive to prevent running out of stack space with inlined functions allocating non-trivial memoryaux_data_ctx
,body_ctx
andwitness_ctx
, to be able to reuse memory while serializing those three separate parts of the transaction, avoiding three concurrent hash contexts in case of the catalyst voting registration, otherwise Ledger was running out of memoryInstruction state size:
We originally faced issues with a prohibitively big instruction state size (~1100 bytes) due to three independent hash contexts, each taking up 256 bytes. By putting processing of metadata before the rest of the transaction we were able to save space by sharing memory with the tx body hash builder, saving ~256 bytes.
Testing: