Skip to content

Finalize ink! 3.0 integration #493

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

Merged
merged 196 commits into from
Sep 29, 2020
Merged

Conversation

Robbepop
Copy link
Collaborator

@Robbepop Robbepop commented Sep 28, 2020

Finalization: ink! 3.0

This PR finalizes the implementation and integration of the new ink! 3.0.

ToDo List

  • miri fails for ink_core's bitstash unit tests. We should investigate why.
  • Rename ink_core::env::println to debug_println to make usage intent very clear.
  • Rework ink_core/env provided hashes
    • For every crypto hash provide two APIs:
      1. hash_bytes to hash some raw input bytes
      2. hash_encoded to hash some SCALE encodable entity of type T
    • For every crypto hash provide a type that provides simple access to the above 2 APIs.
    • Remove the ink_core/hash module and move all linkers to the above definitions.
  • Hide definitions in ink_lang using #[doc(hidden)] that are not user facing definitions but only required for the underlying code generation.
  • Experiment: Try including scale and scale-info into ink_lang so that contract writers can simply use that one instead of having to depend on those crates directly themselves.
    • Adjust cargo-contract new template for the changes.
  • Organizational
    • Move all ink! crates into crates directory.
    • Split ink_core into ink_env and ink_storage crate. Maybe rename ink_env to ink_runtime.
    • Rename ink_prelude to ink_memory, mirroring the planned ink_storage crate.
    • Rename ink_core/storage2 -> storage
    • Rename ink_metadata/layout2 -> layout
  • Make ink! event topics work, finally: Make ink! 2.0 event topics work #105
    • Find a way to generate event topic implementations in a way that they do not require heap allocations but instead make use of ink!'s static 16kB buffer. This might imply providing yet another high-level ink_core API specific to this purpose.
    • Use BLAKE2 cryptographic hash.
    • Avoid BLAKE2 hashing in case the SCALE encoded values fit into Env::Hash.
    • Encode topics[0] as the event's hashed signature if the ink! event is not anonymous.
    • Since Seal only supports up to MAX_EVENT_TOPICS but cannot distinguish between existing special-cased topics[0] or not we need to make sure that non-anonymous events can actually only have up to MAX_EVENT_TOPICS - 1 topics.
  • Update README.md
  • Write and convert all the acceptance tests for ink! 3.0.
  • Implement lint against __ink_ prefixed identifiers generically to be usable by all ink! language macros.
  • Port #[ink::test] proc. macro to newer ink_lang_ir and ink_lang_codegen crates.
  • Update all ink! crates to actually use version 3.0.0.
  • Make use of the new ink_lang_ir and ink_lang_codegen crates from ink_lang_macro. (Part 3)
  • Convert existing example smart contracts to ink! 3.0 syntax.
    • Flipper
    • Flipper (trait based)
    • Incrementer
    • ERC-20
    • ERC-721
    • Delegator
    • Multi-Signature
    • Domain Name Service (DNS)

Sorry, something went wrong.

Robbepop added 30 commits July 10, 2020 20:57
This new codegen is based on the (also) new ink! IR.
…ctors

Also this implementation avoids a lot of code duplication with the similar code generation for dispatch trait impl of ink! messages.

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
@Robbepop Robbepop marked this pull request as draft September 29, 2020 10:40

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
… impls

This works even in precense of type aliases.

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
@Robbepop Robbepop marked this pull request as ready for review September 29, 2020 12:34

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2020

Codecov Report

Merging #493 into master will increase coverage by 4.57%.
The diff coverage is 24.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
+ Coverage   62.42%   67.00%   +4.57%     
==========================================
  Files         145      148       +3     
  Lines        6805     6300     -505     
==========================================
- Hits         4248     4221      -27     
+ Misses       2557     2079     -478     
Impacted Files Coverage Δ
core/derive/src/storage_layout.rs 94.11% <ø> (ø)
core/src/storage2/alloc/allocator.rs 82.35% <ø> (ø)
core/src/storage2/alloc/boxed/storage.rs 100.00% <ø> (ø)
core/src/storage2/collections/bitstash/storage.rs 48.00% <ø> (ø)
core/src/storage2/collections/bitvec/storage.rs 50.00% <ø> (ø)
core/src/storage2/collections/hashmap/storage.rs 65.21% <ø> (-23.02%) ⬇️
core/src/storage2/collections/smallvec/storage.rs 100.00% <ø> (ø)
core/src/storage2/collections/stash/storage.rs 54.05% <ø> (-8.45%) ⬇️
core/src/storage2/collections/vec/storage.rs 68.75% <ø> (ø)
core/src/storage2/lazy/lazy_array.rs 96.26% <ø> (ø)
... and 66 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d7d855...b4789e5. Read the comment docs.

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM 🌮

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
Copy link
Collaborator

@cmichi cmichi left a comment

Choose a reason for hiding this comment

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

👏👏👏

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler

Verified

This commit was signed with the committer’s verified signature.
Robbepop Robin Freyler
@Robbepop Robbepop merged commit 529bd58 into master Sep 29, 2020
@Robbepop Robbepop deleted the robin-implement-trait-codegen-playground branch September 29, 2020 15:59
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

4 participants