Skip to content

Persist Environment types and values in metadata #1695

@cmichi

Description

@cmichi

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions