1.0.18 • Published 6 years ago

iexec-poco-v2 v1.0.18

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Build Status

Introduction to PoCo

PoCo Series #1 — About Trust and Agents Incentives

PoCo Series #2 — On the use of staking to prevent attacks

PoCo Series #3 — PoCo protocole update

PoCo UML

Actors :

  • (w) = an account with a wallet key pair
  • (s) = a smart contract created by (w)
  • (p) = application to start ( like java prog) on the responsability of (w) when used
  • (r) = a repository on the responsability of (w)

Actor : Marketplace Creator :

create IexecHub smart contract. IexecHub is composed of WorkerPoolHub,DatasetHub,AppHub,Marketplace Once IexecHub smart contract is created by Marketplace Creator, IexecHub and Marketplace can be used by the others actors scheduler, workers, iExecCloudUser :

blockchain interaction :

Actor : iExecCloudUser

  • iExecCloudUser = U(w)
  • U(s) = a WorkOrder smart contract owned by U(w)

Actor : Scheduler :

  • ScheduleProvider = S(w)
  • S(s) = a WorkerPool smart contract owned by S(w)
  • S(p) = iexec-scheduler = application that schedule a worker pool activity on the responsability of S(w). (works, tasks, datas for result in xtremweb)
  • S(r) = ResultRepository = provide the work result for U(w) on the responsability of S(w)

blockchain interaction :

Actor : Worker :

  • W(w) = RessourceProvider = RessourceProvider wallet
  • W(p) = iexec-worker = xtremweb worker application today

blockchain interaction :

Actor : App Provider

  • A(w) = AppProvider = app Provider wallet
  • A(s) = App = app smart contract created by A(w) with the app characteristics
  • A(r) = AppRepository = provide app reference on the responsability of A(w). . (apps, datas for apps in xtremweb, docker hub for docker app etc ... ) for W(p) usage

blockchain interaction :

Actor : Dataset Provider

  • D(w) = DatasetProvider = dataset Provider wallet
  • D(s) = Dataset = app smart contract created by D(w) with the dataset characteristics
  • D(r) = DatasetRepository = provide dataset reference on the responsability of D(w) for W(p) usage

Optional: usage not yet implemented in V2

Ask Nominal Use Case :

WorkOrderStatusEnum

ContributionStatusEnum

how to build

npm install
./node_modules/.bin/truffle compile

how to migrate

choice 1 :prepare ethereumjs simu

Install the latest testrpc

npm install -g ethereumjs-testrpc

start your testrpc with

testrpc

You must see somting like this atb the end of the log

Listening on localhost:8545

choice 2 : prepare Local geth node

Pull the the following docker image

docker pull iexechub/iexec-geth-local

start container

docker run -d --name iexec-geth-local --entrypoint=./startupGeth.sh -p 8545:8545 iexechub/iexec-geth-local

wait to see in logs the word : LOCAL_GETH_WELL_INITIALIZED :

docker logs -f iexec-geth-local

Your local geth network is ready, you can launch your truffle action

choice 1 or 2 then : it will deploy smart contracts according to the 2_deploy_contracts.js content.

./node_modules/.bin/truffle migrate

how to test

choice 1 or 2 then launch one test :

./node_modules/.bin/truffle test test/00_base.js

choice 1 or 2 then launch ALL tests :

./node_modules/.bin/truffle test

choice 1 or 2 then launch nominal workflow tests :

./node_modules/.bin/truffle test test/*

choice 1 or 2 then launch by contract/by fonctions tests :

./node_modules/.bin/truffle test test/"contract to test"/function to test"

how to launch solidity-coverage analyse

npm run coverage

or

./node_modules/.bin/solidity-coverage
coverage : 12/04/2018

180 passing (12m)
1 pending

-----------------------------|----------|----------|----------|----------|----------------|
File                         |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-----------------------------|----------|----------|----------|----------|----------------|
contracts/                  |      100 |    75.16 |      100 |      100 |                |
App.sol                    |      100 |       50 |      100 |      100 |                |
AppHub.sol                 |      100 |      100 |      100 |      100 |                |
Dataset.sol                |      100 |       50 |      100 |      100 |                |
DatasetHub.sol             |      100 |      100 |      100 |      100 |                |
IexecAPI.sol               |      100 |       50 |      100 |      100 |                |
IexecCallbackInterface.sol |      100 |      100 |      100 |      100 |                |
IexecHub.sol               |      100 |    70.54 |      100 |      100 |                |
IexecHubAccessor.sol       |      100 |       75 |      100 |      100 |                |
IexecHubInterface.sol      |      100 |      100 |      100 |      100 |                |
IexecLib.sol               |      100 |      100 |      100 |      100 |                |
Marketplace.sol            |      100 |    88.89 |      100 |      100 |                |
MarketplaceAccessor.sol    |      100 |       50 |      100 |      100 |                |
MarketplaceInterface.sol   |      100 |      100 |      100 |      100 |                |
OwnableOZ.sol              |      100 |       75 |      100 |      100 |                |
SafeMathOZ.sol             |      100 |       75 |      100 |      100 |                |
TestSha.sol                |      100 |      100 |      100 |      100 |                |
WorkOrder.sol              |      100 |       60 |      100 |      100 |                |
WorkerPool.sol             |      100 |    82.69 |      100 |      100 |                |
WorkerPoolHub.sol          |      100 |       75 |      100 |      100 |                |
-----------------------------|----------|----------|----------|----------|----------------|
All files                    |      100 |    75.16 |      100 |      100 |                |
-----------------------------|----------|----------|----------|----------|----------------|

Oyente analyse see here