Consolidate APIs given common EncodeAsType/DecodeAsType for static/dynamic values #862
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.
This builds off #842, which in itself doesn't make any significant API changes, but starts relying on EncodeAsType and DecodeAsType, and applying thesein codegen.
Here, we now start consolidating some API's and making use of this; specifically:
StaticTxPayload
andDynamicTxPayload
are now one struct,tx::Payload
.StaticStorageAddress
andDynamicStorageAddress
are now on struct,storage::Address
.StaticConstantAddress
andDynamicConstantAddress
are now on struct,constant::Address
.For storage, we needed to tweak the API around obtaining bytes from a storage entry (to allow metadata to be used). We also were able to simplify the storage codegen (no more need for Hashers in the codegen; we will work out the hashing based on metadata at the point of calling).
Finally I did a little tidyup in the codegen around substitute types, and no longer generate a top level event type, instead pointing to the one that's provided. This paves the way to swap out the RuntimeCall type with a
tx::BoxedPayload
to make nested calls (batch, multisig, sudo etc) as ergonomic as top level ones, but actually doing that work has some implicaitions so I want to look into it separately.