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

Persist Environment types and values in metadata #1695

Closed
5 tasks done
cmichi opened this issue Mar 1, 2023 · 2 comments · Fixed by #1741
Closed
5 tasks done

Persist Environment types and values in metadata #1695

cmichi opened this issue Mar 1, 2023 · 2 comments · Fixed by #1741
Assignees
Labels
A-ink_env [ink_env] work item A-ink_metadata [ink_metadata] Work item OpenZeppelin

Comments

@cmichi
Copy link
Collaborator

cmichi commented Mar 1, 2023

In this section of our ARCHITECTURE.md we explain what the Environment trait in ink! is used for. The DefaultEnvironment which ink! uses is defined here.

Right now, we don't persist which Environment implementation the contract uses anywhere. This means someone can deploy a contract with types that are different from those a chain uses to that chain. In #1694 we will investigate the criticality of this issue. But whatever turns out there, we should have a feature that warns contract developers about this. It is a serious oversight.

ToDo

  • Persist the Environment types and MAX_EVENT_TOPICS value to the metadata. Will have to be a new field environment.
  • Make sure the schema and formal definition under metadata/ is up to date.
  • Create a follow-up PR to ink-docs to also update the documentation on metadata there.
  • Talk to @statictype about where to create a follow-up issue for the UI to validate that the chain's types match the environment denoted in the metadata. Either polkadot-js/api or both polkadot-js/apps and Contracts UI. I'm not sure where this validation should happen.
  • Create a follow-up issue for cargo-contract to validate that the chain's types match the environment denoted in the metadata.
@cmichi
Copy link
Collaborator Author

cmichi commented Apr 12, 2023

@SkymanOne
Copy link
Contributor

Closing as all tasks are completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_env [ink_env] work item A-ink_metadata [ink_metadata] Work item OpenZeppelin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants