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

Delivery report for milestone one of the third grant of OpenBrush(6 milestone) #515

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions deliveries/openbrush_follow_up_2-milestone_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Milestone Delivery :mailbox:

**The [invoice form :pencil:](https://docs.google.com/forms/d/e/1FAIpQLSfmNYaoCgrxyhzgoKQ0ynQvnNRoTmgApz9NrMp-hd8mhIiO0A/viewform) has been filled out correctly for this milestone and the delivery is according to the official [milestone delivery guidelines](https://github.com/w3f/Grants-Program/blob/master/docs/milestone-deliverables-guidelines.md).**

* **Application Document:** https://github.com/w3f/Grants-Program/blob/master/applications/openbrush-follow-up-2.md
* **Milestone Number:** 1 milestone of the grant and 6 milestone of the OpenBrush
xgreenx marked this conversation as resolved.
Show resolved Hide resolved

**Context**

The milestone was related to upgradeable contracts on ink!.
To achieve that, we added host functions to `contract-pallet`, added support of
them to ink!, and implemented `Diamond` and `Proxy` patterns in OpenBrush.

We added support for upgradable contracts in the OpenBrush release [`v1.5.0`](https://github.com/Supercolony-net/openbrush-contracts/releases/tag/v1.5.0).
Each release, we improve implementation, add extensions, fix bugs, and finally,
it is fully ready in release [`v2.2.0`](https://github.com/Supercolony-net/openbrush-contracts/releases/tag/v2.2.0).

**Deliverables**

| Number | Deliverable | Link | Notes |
|--------|------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0b. | Documentation | [Documentation about upgradeable contracts](https://docs.openbrush.io/smart-contracts/upgradeable) | The documentation describes how storage works in upgradeable contracts and contains suggestions on not corrupting the storage. OpenBrush provides primitives to develop upgradeable contracts, and documentation also includes examples of how to use them. |
| 1. | Implement `delegate_call` in contract-pallet | [Implementation in substrate](https://github.com/paritytech/substrate/pull/10617), [fix of the bug](https://github.com/paritytech/substrate/pull/11771) | Implemented `seal_delegate_call` works in the same way as [delegatecall](https://docs.soliditylang.org/en/v0.8.10/introduction-to-smart-contracts.html#delegatecall-callcode-and-libraries) in ethereum. It allows the execution of the foreign code in the context of the current contract. |
| 2. | Implement `set_code_hash` in contract-pallet | [Implementation in substrate](https://github.com/paritytech/substrate/pull/10690) | Implemented `set_code_hash` allows replacing the code of the current contract with another code. It is a new approach to simplify the deployment of upgradable contracts that follow the `Proxy` pattern and reduce gas consumption. |
| 3. | Import `delegate_call` in ink! and update `Proxy` example | [Implementation in ink!](https://github.com/paritytech/ink/pull/1133) | To have a more consistent API with common `seal_call`, we did refactoring of `CallBuilder` and related stuff to support delegate and common calls in user-friendly form. |
| 4. | Implement `Diamond` Standard in OpenBrush with ink! | [Initial implementation](https://github.com/Supercolony-net/openbrush-contracts/pull/93), [Refactored](https://github.com/Supercolony-net/openbrush-contracts/pull/137) | Initially, we implemented the `Diamond` standard as in [EIP](https://eips.ethereum.org/EIPS/eip-2535). But after, we refactored it to take less size and simplified API. With release `v2.2.0` it uses new storage and is ready for upcoming storage refactoring in ink!. |
| 5. | Implement `Diamond` Standard on raw Rust without ink! | [Rust implementation](https://github.com/Supercolony-net/openbrush-contracts/pull/153) | We implemented the same contractor ink and on rust. The rust version still uses ink! primitives but without ink! code generation. It takes less space for ~1.2 kb. We plan to use it as a base for upcoming optimization to ink!. |
| 6. | Create an upgradable analog of each contract in OpenBrush | [New macro](https://github.com/Supercolony-net/openbrush-contracts/blob/d6e29f05fd462e4e027de1f2f9177d594a5a0f05/lang/macro/src/lib.rs#L447), [Refactoring with new macro](https://github.com/Supercolony-net/openbrush-contracts/pull/137) | We introduced a new `openbrush::upgradeable_storage` macro to OpenBrush. Macro allows making any data type upgradable(more about it in the documentation). We annotated all data types provided by OpenBrush with that macro. All storages are logic units now and are upgradeable by default in OpenBrush. |
| 7a. | Marketing - Write down article about OpenBrush | [Article](https://medium.com/supercolony/deep-dive-into-openbrush-dc04d5cc7825) | The article describes features of Open Brush with use cases - "Deep dive into OpenBrush" |
| 7b. | Marketing - Create 2 educational video for OpenBrush | [First Video](https://www.youtube.com/watch?v=rlROrqbYPeE) [Second Video](https://www.youtube.com/watch?v=eo_cY8lVNes) | The first video is general overview what is OpenBrush and it describes available features. The second describes of how to write upgradeable contracts and what is it. |

**Additional Information**

We want to highlight that the last milestone in the second grant(3rd milestone of
grant two and 5th milestone of the OpenBrush) is not delivered yet. It depends on
ink! team and review process takes a lot of time. We planned to deliver milestone
six after milestone five but already been two months paste since the start of the
grant, and we also have new ideas for new grant that we want to start in parallel.
So we did [big refactoring](https://github.com/Supercolony-net/openbrush-contracts/pull/137)
in OpenBrush and prepared the code for upcoming [change](https://github.com/paritytech/ink/issues/1134).
The documentation on how to write upgradeable contracts is agnostic to calculating storage keys.

Supercolony hopes that it is not a problem to deliver milestone six before milestone five=)