Skip to content

Commit

Permalink
Updated links to the new gitbook. (#975)
Browse files Browse the repository at this point in the history
* Updated links to the new gitbook.
Also fixed some minor typos.

* Adjust README.md to be closer to master

* Revert typo
  • Loading branch information
Niederb authored Sep 7, 2022
1 parent 366fd1e commit e1f3f44
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 50 deletions.
63 changes: 17 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,36 @@ Integritee worker for Integritee [node](https://github.com/integritee-network/in
This is part of [Integritee](https://integritee.network)

## Build and Run
Please see our [Integritee Book](https://book.integritee.network/howto_worker.html) to learn how to build and run this.
Please see our [Integritee Book](https://docs.integritee.network/4-development/4.4-sdk) to learn how to build and run this.

To start multiple worker and a node with one simple command: Check out [this README](local-setup/README.md).

## Tests
### Environment
Unit tests within the enclave can't be run by `cargo test`. All unit and integration tests can be run by the worker binary

first, you should run ipfs daemon because it is needed for testing
```
ipfs daemon
```
second, you'll need a integritee-node running
```
./target/release/integritee-node --dev --execution native
```
then you should make sure that the sealed_state is empty (but exists)
```
worker/bin$ rm sealed_stf_state.bin
worker/bin$ touch sealed_stf_state.bin
```

### Execute tests
Run these with
```
integritee-service/bin$ ./integritee-service test --all
```

### End-to-end test with benchmarking

Including cleanup between runs:

run node
```
./target/release/integritee-node purge-chain --dev
./target/release/integritee-node --dev --ws-port 9979
```

run worker
## Docker
See [docker/README.md](docker/README.md).

```
export RUST_LOG=debug,substrate_api_client=warn,sp_io=warn,ws=warn,integritee_service=info,enclave_runtime=info,sp_io::misc=debug,runtime=debug,enclave_runtime::state=warn,ita_stf::sgx=info,light_client=warn,rustls=warn
./integritee-service --clean-reset -r 2002 -p 9979 -w 2001 run 2>&1 | tee worker.log
```
## Tests

wait until you see the worker synching a few blocks. then check MRENCLAVE and update bot-community.py constants accordingly
There are 3 types of tests:
- cargo tests
- enclave tests
- integration tests

### Cargo Tests
Run
```
./integritee-cli -p 9979 list-workers
cargo test
```

now bootstrap a new bot community
### Enclave Tests
Run

```
./bot-community.py init
./bot-community.py benchmark
make
./bin/integritee-service test --all
```

now you should see the community growing from 10 to hundreds, increasing with every ceremony
### Integration Tests
See [docker/README.md](docker/README.md)

## Direct calls scalability

Expand Down
8 changes: 4 additions & 4 deletions docs/trusted-rpc-interface.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Trusted Rpc Interface
This document contains information about the trusted worker json-rpc interface. The trusted worker server is a tls websocket directly running in the enclave.

The server expects an json-rpc call of the following format:
The server expects a json-rpc call of the following format:

`{"jsonrpc": "2.0", "method": "author_pendingExtrinsics", "params": ["5Ki5bf4dcY9eyrqBRe6Xbr5accvo42XZb86eXv5mkTJo"], "id": 1}`

Expand All @@ -10,12 +10,12 @@ The rpc method names of the worker are chosen such that they match the naming sc

### General
- `rpc_methods` (no params): List all available (though maybe unimplemented) rpc methods. Example: `{"jsonrpc": "2.0", "method": "rpc_methods","id": 1}`
- `author_getShieldingKey` (no params): Retrieves the public shielding key, which the client can use to encrypt it's messages before sending it to the worker.
- `author_getShieldingKey` (no params): Retrieves the public shielding key, which the client can use to encrypt its messages before sending it to the worker.
- `author_getMuRaUrl` (no params): Retrieves the mutual remote attestation url of the worker (Only needed by fellow validateers).
- `author_getUntrustedUrl` (no params): Retrieves the untrusted ws url of the worker (Only needed by fellow validateers).

### Sidechain related
A sidechain related call always enters our so called trusted operation pool. To provide as much privacy as possible, all calls are expected to be encrypted (with the shielding key that can be retrieved with `author_getShieldingKey`) and have the exact same structure, be it a getter or a call. This adds some complexity to the request structure but allows to expand calls and getters without having to change any networking and caching functionalities in our codebase (see the [Turtorial](https://book.integritee.network/howto_stf.html) on how to expand `Getters` and `Calls` according to the users need).
A sidechain related call always enters our so called trusted operation pool. To provide as much privacy as possible, all calls are expected to be encrypted (with the shielding key that can be retrieved with `author_getShieldingKey`) and have the exact same structure, be it a getter or a call. This adds some complexity to the request structure but allows to expand calls and getters without having to change any networking and caching functionalities in our codebase (see the [Tutorial](https://docs.integritee.network/4-development/4.4-sdk/4.4.4-custom-business-logic-stf) on how to expand `Getters` and `Calls` according to the users need).

#### Request
All rpc params are expected to be a [substrate codec](https://docs.substrate.io/v3/advanced/scale-codec/) encoded [Request](https://github.com/integritee-network/worker/blob/17e9776cbf09d0a1dd765546f27fc4d3c7bfefc4/core-primitives/types/src/lib.rs#L64-L68), with the parameters:
Expand All @@ -39,7 +39,7 @@ A [`TrustedCallSigned`](https://github.com/integritee-network/worker/blob/17e977
- the `TrustedCall` itself

The current implementation of the [`TrustedCall`](https://github.com/integritee-network/worker/blob/17e9776cbf09d0a1dd765546f27fc4d3c7bfefc4/app-libs/stf/src/lib.rs#L169-L176) supports the following calls:
- `balance_set_balance` set the balance of an account (signer, beneficary, free balance, reserved balance)
- `balance_set_balance` set the balance of an account (signer, beneficiary, free balance, reserved balance)
- `balance_transfer` transfer balance from first account to second account
- `balance_unshield` transfer balance from sidechain (incognito) account to parentchain (public) account.
- `balance_shield` transfer balance from parentchain (public) account to sidechain (incognito) account.
Expand Down

0 comments on commit e1f3f44

Please sign in to comment.