Daohub-io / cap9

Capability-based security protocol for smart contracts
Apache License 2.0
22 stars 10 forks source link

Ewasm CLI - Development Workflow #190

Closed Latrasis closed 5 years ago

Latrasis commented 5 years ago

Based on #188, we need a basic deployment workflow via the CLI.

Compile a hello_world procedure

Assuming the project:

User should:

  1. Create a new cargo lib in project folder
  2. Set Correct Dependencies
  3. Compile to Wasm

Deploy a new Procedure

Assuming the project:

A cli command should:

  1. Receive the.wasm file
  2. Process the .wasm file
  3. Deploy / Create the procedure contract
  4. Return the procedure address

Register a new Procedure

Assuming the project:

A cli command should:

  1. Register the the procedure with given id and caplist

Call a new Procedure

Assuming the project:

A cli command should:

  1. Recieve an procedure id name
  2. Receive an abi function name
  3. Recieve an argument list in brackets
cap9 exec <group_id> <proc_id> <method> [param1, param2, ... ]
JakeOShannessy commented 5 years ago

Slight changes to the function execution command. The most significant is that the current example ACL model does not have a concept of "calling a procedure". The model of the ACL is that each user is forwarded to a procedure dedicated to their group which acts as a sandbox which defines everything they can do. There fore the <proc_id> and <group_id> parts are currently omitted.

Instead of exec we have call and query to reflect that there are two different modes of execution and we are likely to want to take advantage of both.

Also the parameters are not in brackets as it is not necessary for disambiguation and is simpler to parse.

Execution now looks like this:

cap9 call <method> <params...>

or

cap9 query <method> <params...>