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

Improvements of chain extension implementation #649

Merged
merged 3 commits into from
Feb 23, 2022
Merged

Conversation

kvinwang
Copy link
Collaborator

This PR add a attribute_macro chain_extension as a drop-in replacement of ink_lang::chain_extension.
The macro generates some extra codes:

  • A trait PinkExtBackend for the runtime to implement.
  • Const variables for the function ids.
  • A call dispatcher

With this improvement, the runtime now implements the extension functions more type-safe.

Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

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

Are we going to put the context of the current contract to a global variable?

@kvinwang
Copy link
Collaborator Author

Are we going to put the context of the current contract to a global variable?

No. It might be impossible because the current contract can be changed without notifying the pink runtime.

Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

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

Finally understood how it works, haha

@kvinwang kvinwang merged commit 7d407cb into master Feb 23, 2022
@kvinwang kvinwang deleted the ext-improve branch February 23, 2022 13:05
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.

None yet

2 participants