Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate APIs given common EncodeAsType/DecodeAsType for static/dynamic values #862

Merged
merged 7 commits into from
Mar 17, 2023

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented Mar 17, 2023

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 and DynamicTxPayload are now one struct, tx::Payload.
  • StaticStorageAddress and DynamicStorageAddress are now on struct, storage::Address.
  • StaticConstantAddress and DynamicConstantAddress 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.

@jsdw jsdw marked this pull request as draft March 17, 2023 09:35
@jsdw jsdw merged commit c377ff7 into jsdw-scale-encode-decode Mar 17, 2023
@jsdw jsdw deleted the jsdw-encode-decode-improvements branch March 17, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant