Proposal for Ask! v0.4 (original Ask-lite v0.1, ink! in AssemblyScript)

6 Comments

Ask! v0.4 (original Ask-lite v0.1) Proposal

Ask! is a framework to write wasm smart contracts, written by assemblyscript, like ink!. But as far as I know, Patract Labs doesn't maintain it anymore.

So we contacted a former member of Patract Labs, who was one of the core developers of Ask!, to continue maintaining a redesigned version, called Ask-lite, which you can think of as a successor to Ask!.

In addition, we also contacted Astar, Phala and other teams who are interested in Ask!, and they are also very interested in Ask-lite. We plan to invite them to join and contribute to ask-lite after finishing the initial version of Ask-lite.

UPDATE: we contacted Patract Labs (the maintainer of the original Ask! repository) to transfer the Ask! repo to the ask-lang organization. And for less confusion, we will keep the name and icon of Ask!, so we will continue to develop Ask-lite v0.1 as Ask! v0.4 (a redesigned version).

Design

Architecture

  • Ask! components:
    1. Contract Framework
    2. Contract Preprocessor
    3. ask-cli (similar to the cargo-contract tool of ink!)

Compiling a wasm smart contract with Ask! actually goes through TWO compilation processes.

In the first compilation process, Ask! only checks the contract syntax, and then checks the specific type and semantics for the second time. The final assemblyscript code is generated by splicing strings, which results in very poor readability of the generated code, and error messages are difficult to locate the problem. Even some obviously wrong contract code can pass the compilation check and generate wasm.

Although Ask! provides ask-cli to partially solve the two compilation problem, it is not elegant.

  • Ask-lite (Ask! v0.4) components:
    1. Contract Framework
    2. Transform Framework

Ask-lite plans to use a more elegant way: manipulate the AST generated by the contract code through the asc toolchain to get final wasm code and metadata, without introducing additional tools (like ask-cli or cargo-contract) to help development of wasm contracts. In this way, the generated assemblyscript code has better readability, and the type checking and error messages have been greatly improved.

Codec

Ask! uses a forked version of as-scale-codec (the upstream doesn't seem to be maintained anymore, last commit was a year ago) for encoding/decoding, but Ask-lite uses as-serde-scale instead.

Compared with as-scale-codec, as-serde-scale has better codec performance, more complete implementation, easy to use, and is maintained by ourselves.

Contract framework

The contract framework will be developed on the basis of the new architecture, using new decorator syntax just like Ask!, but it will be closer to the ink! 3.0 style.

v0.1 Development plan (12 weeks)

  • Week 1~4 (3 developers)

    1. Redesign the architecture of Ask! and implement it.

    2. Track the latest code changes of pallet-contracts and ink! 3.0.

  • Week 5~7 (3 developers)

    1. Introduce a more general codec framework as-serde and a SCALE codec library as-serde-scale (based on as-serde), and adapt it to the contract framework.

    2. Redesign the interface of Ask! to be closer to ink! 3.0.

    3. Redesign the PackedLayout / SpreadLayout interface, referring to the storage abstraction of ink! 3.0.

    4. Redesign the Event syntax, and compatible with ink! 3.0.

    5. Integrate all designs using new decorator syntax closer to ink! 3.0.

  • Week 8~10 (3 developers)

    1. Provide suitable abstractions for crypto primitives.

    2. Improve env functions.

    3. Implement some common storage data structures, such as Array/Mapping, which is similar to ink! 3.0.

    4. Add a type analysis phase to the compile phase, which is used for the generation of metadata.json (compatible with ink! 3.0 metadata).

  • Week 11~12 (2 developers)

    1. Write some contract examples, such as flipper/ERC20.

    2. Write documentation.

Cost (34 developers * weeks)

I don't know how to evaluate the cost, so I just followed the cost of the previous Ask! proposals.

  • Total Cost: $105000
    • Operating activities: $6400 ( Rent and Devices: $200 per developer * week )
    • Employee payments: $98600 ($2900 per developer * week)
  • Monthly average: $20.01 / DOT 30 days EMA 2022-04-13
  • Treasury Proposal: 5247 DOT
Up
Comments
No comments here