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

Update seal calls #1025

Merged
merged 27 commits into from
Sep 30, 2022
Merged

Update seal calls #1025

merged 27 commits into from
Sep 30, 2022

Conversation

xermicus
Copy link
Contributor

@xermicus xermicus commented Sep 26, 2022

This PR updates the seal_ calls to reflect newer versions. Some of them use seal1 and some storage APIs temporarily __unstable__now (will be changed as soon as they are released to some stable version).
Individual calls updated:

  • seal_random: Returns 4 more bytes (the block number) so the output buffer size had to be extend
  • seal_instantiate: Args changed
  • seal_terminate: Args changed
  • seal_call: Args (flags can be done later if needed)
  • seal_set_storage: Signature changed. key_len will be needed for transparent hashing, once we fix the metadata generation. The newly introduced return type (the length of the pre-existing value, if any) is ignore for now since in solidity we don't use that.
  • seal_clear_storage: Same as above.
  • seal_get_storage: Arguments changed

Additionally I decided to introduce a few macros to get rid of some awkward and repeating patterns and make it easier to reason about the emitted code.

@xermicus xermicus added the polkadot Concerns the Polkadot target label Sep 26, 2022
@xermicus xermicus marked this pull request as ready for review September 28, 2022 19:16
Signed-off-by: Cyrill Leutwiler <[email protected]>
Copy link
Contributor

@seanyoung seanyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like your macros, we should reuse them in emit more generally.

src/emit/substrate/mod.rs Outdated Show resolved Hide resolved
src/emit/substrate/mod.rs Outdated Show resolved Hide resolved
src/emit/substrate/mod.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
@xermicus
Copy link
Contributor Author

I really like your macros, we should reuse them in emit more generally.

Thanks! I considered this but it would be quite some work to change everything.I'd not be against it generally, but rather do it in a different PR (or as a sporadic effort when touching the code anyways, because it is easier to understand existing code after switching it to using these macros).

Signed-off-by: Cyrill Leutwiler <[email protected]>
src/emit/substrate/mod.rs Show resolved Hide resolved
src/emit/substrate/mod.rs Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
tests/substrate.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@LucasSte LucasSte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, fix the typo before merging.

src/emit/substrate/target.rs Outdated Show resolved Hide resolved
Co-authored-by: Lucas Steuernagel <[email protected]>
Signed-off-by: Cyrill Leutwiler <[email protected]>
@xermicus xermicus merged commit b2eb78c into hyperledger:main Sep 30, 2022
@xermicus xermicus added this to the `ink! v4` compatibility milestone Oct 5, 2022
xermicus added a commit to xermicus/solang that referenced this pull request Oct 7, 2022
Signed-off-by: Cyrill Leutwiler <[email protected]>
Co-authored-by: Lucas Steuernagel <[email protected]>
Signed-off-by: Cyrill Leutwiler <[email protected]>
@xermicus xermicus deleted the update-seal-calls branch May 15, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polkadot Concerns the Polkadot target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants