Skip to content

Commit

Permalink
Add json and shell annotations for better readability (#1983)
Browse files Browse the repository at this point in the history
* Add json and shell annotations for better readability

* Add more

* All bash to shell

* Corrections

* The last one bash
  • Loading branch information
daria305 authored Jan 26, 2022
1 parent d87086c commit f0363db
Show file tree
Hide file tree
Showing 20 changed files with 265 additions and 212 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,19 @@ Please follow this guide: https://github.com/facebook/rocksdb/blob/master/INSTAL

When compiling GoShimmer, just run the build script:

```bash
```shell
./scripts/build.sh
```

If you also want to link the libraries statically (only on Linux) run this instead:
```bash

```shell
./scripts/build_goshimmer_rocksdb_builtin.sh
```

Finally, download the latest snapshot and make sure to place it in the root folder of GoShimmer:

```bash
```shell
wget -O snapshot.bin https://dbfiles-goshimmer.s3.eu-central-1.amazonaws.com/snapshots/nectar/snapshot-latest.bin
```

Expand Down
10 changes: 5 additions & 5 deletions documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The documentation is built using [Docusaurus 2](https://docusaurus.io/). The dep

## Installation

```console
```shell
npm i
npm run setup
```
Expand All @@ -18,15 +18,15 @@ This command checks out a local copy of the wiki and creates links to the conten

## Local Development

```console
```shell
npm start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Tear Down

```console
```shell
npm run clean
```

Expand All @@ -35,13 +35,13 @@ This command deletes the local wiki and local links.

## Including .md file

```console
```shell
{@import <file path>}
```

Example:

```console
```shell
{@import ../../../../bindings/wasm/docs/api-reference.md}
```

Expand Down
8 changes: 5 additions & 3 deletions documentation/docs/apis/client_lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ GoShimmer ships with a client Go library which communicates with the HTTP API. P
# Use the API

Simply `go get` the lib via:
```
```shell
go get github.com/iotaledger/goshimmer/client
```

Init the API by passing in the API URI of your GoShimmer node:
```

```go
goshimAPI := client.NewGoShimmerAPI("http://mynode:8080")
```

Optionally, define your own `http.Client` to use, in order for example to define custom timeouts:
```

```go
goshimAPI := client.NewGoShimmerAPI("http://mynode:8080", client.WithHTTPClient{Timeout: 30 * time.Second})
```

Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/apis/dRNG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ if err != nil {

### Response example

```shell
```json
{
"id": "messageID"
"id": "messageID"
}
```

Expand Down
42 changes: 21 additions & 21 deletions documentation/docs/apis/mana.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ if err != nil {
```

### Response examples
```shell
```json
{
"shortNodeID": "4AeXyZ26e4G",
"nodeID": "2GtxMQD94KvDH1SJPJV7icxofkyV1njuUZKtsqKmtux5",
"access": 26.5,
"accessTimestamp": 1614924295,
"consensus": 26.5,
"consensusTimestamp": 1614924295,
"consensusTimestamp": 1614924295
}
```

Expand Down Expand Up @@ -176,7 +176,7 @@ for _, m := range manas.Consensus {
```

### Response examples
```shell
```json
{
"access": [
{
Expand Down Expand Up @@ -250,14 +250,14 @@ fmt.Println("consensus mana percentile: ", mana.Consensus, "consensus mana updat
```

### Response examples
```shell
```json
{
"shortNodeID": "4AeXyZ26e4G",
"nodeID": "2GtxMQD94KvDH1SJPJV7icxofkyV1njuUZKtsqKmtux5",
"access": 75,
"accessTimestamp": 1614924295,
"consensus": 75,
"consensusTimestamp": 1614924295,
"consensusTimestamp": 1614924295
}
```

Expand Down Expand Up @@ -305,16 +305,16 @@ for _, m := accessMana.Online {
```

### Response examples
```shell
```json
{
"online": [
{
"rank": 1,
"shortNodeID": "4AeXyZ26e4G",
"nodeID": "2GtxMQD94KvDH1SJPJV7icxofkyV1njuUZKtsqKmtux5",
"mana": 75
}
],
{
"rank": 1,
"shortNodeID": "4AeXyZ26e4G",
"nodeID": "2GtxMQD94KvDH1SJPJV7icxofkyV1njuUZKtsqKmtux5",
"mana": 75
}
],
"timestamp": 1614924295
}
```
Expand Down Expand Up @@ -367,7 +367,7 @@ for _, m := accessMana.Online {
```

### Response examples
```shell
```json
{
"online": [
{
Expand Down Expand Up @@ -435,7 +435,7 @@ for _, m := accessMana.Nodes {
```

### Response examples
```shell
```json
{
"nodes": [
{
Expand Down Expand Up @@ -500,7 +500,7 @@ for _, m := consensusMana.Nodes {
```

### Response examples
```shell
```json
{
"nodes": [
{
Expand Down Expand Up @@ -564,10 +564,10 @@ fmt.Println("the timestamp of the output (decay duration)", res.Timestamp)
```

### Response examples
```shell
```json
{
"mana": 26.5,
"outputID": "4a5KkxVfsdFVbf1NBGeGTCjP8Ppsje4YFQg9bu5YGNMSJK1",
"outputID": "4a5KkxVfsdFVbf1NBGeGTCjP8Ppsje4YFQg9bu5YGNMSJK1",
"timestamp": 1614924295
}
```
Expand Down Expand Up @@ -618,7 +618,7 @@ for _, m := range res.Consensus {
```

### Response examples
```shell
```json
{
"consensus": [
{
Expand Down Expand Up @@ -707,7 +707,7 @@ for nodeID, e := range res.Logs {
```

### Response examples
```shell
```json
{
"logs": [
"2GtxMQD94KvDH1SJPJV7icxofkyV1njuUZKtsqKmtux5": {
Expand Down Expand Up @@ -808,7 +808,7 @@ for _, id := range res.Consensus.Allowed {
```

### Response examples
```shell
```json
{
"accessMana": {
"isFilterEnabled": false,
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/apis/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ curl --location 'http://localhost:8080/tools/diagnostic/messages'

#### Response examples
The response is written in a csv file.
```
```csv
ID,IssuerID,IssuerPublicKey,IssuanceTime,ArrivalTime,SolidTime,ScheduledTime,BookedTime,GradeOfFinality,GradeOfFinalityTime,StrongParents,WeakParents,DislikeParents,LikeParents,StrongApprovers,WeakApprovers,BranchID,Scheduled,Booked,Invalid,Rank,IsPastMarker,PastMarkers,PMHI,PMLI,FutureMarkers,FMHI,FMLI,PayloadType,TransactionID
...
Expand Down
5 changes: 3 additions & 2 deletions documentation/docs/apis/webAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ An implementation example is shown later for the POST method.
Two methods are currently used. First, with `GET` we register a new GET route for a handler function. The handler is accessed via the address `path`. The handler for a GET method can set the node to perform certain actions.
```go
webapi.Server().GET("path", HandlerFunc)
```
```
A command can be sent to the node software to the API, e.g. via command prompt:
```

```shell
curl "http://127.0.0.1:8080/path?command"
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For example, the config below contains example parameters for the PoW plugin.
The same arguments can be passed through command line arguments in the following way. Embedded objects' values are described using JSON dot-notation.
Additionally,the user can pass the path of the JSON config file through a command-line argument as well, as shown in an example below.

```bash
```shell
goshimmer \
--config=/tmp/config.json \
--pow.difficulty=2 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ It is problematic when incoming messages reference extremely old messages. If an

### Message timestamp vs transaction timestamp
Transactions contain a timestamp that is signed by the user when creating the transaction. It is thus different from the timestamp in the message which is created and signed by the node. We require
```
```go
transaction.timestamp+TW >= message.timestamp >= transaction.timestamp
```
where `TW` defines the maximum allowed difference between both timestamps, currently set to `10min`.
Expand All @@ -477,7 +477,8 @@ Reattachments of a transaction are possible during the time window `TW`. Specifi

### Age of UTXO
Inputs to a transaction (unspent outputs) inherit their spent time from the transaction timestamp. Similarly, unspent outputs inherit their creation time from the transaction timestamp as well. For a transaction to be considered valid we require
```

```go
transaction.timestamp >= inputs.timestamp
```
In other words, all inputs to a transaction need to have a smaller or equal timestamp than the transaction. In turn, all created unspent outputs will have a greater or equal timestamp than all inputs.
Expand Down
5 changes: 3 additions & 2 deletions documentation/docs/teamresources/local_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ golangci-lint is very flexible and customizable. Check the docs to see how confi

## Dealing With Errors
Most of the errors that golangci-lint reports are errors from formatting linters like `gofmt`, `goimports` and etc. You can easily auto-fix them with:
```
```shell
golangci-lint run --fix
```

Expand Down Expand Up @@ -54,7 +54,8 @@ Check this [article](https://docs.docker.com/develop/develop-images/build_enhanc

If you already enabled the buildkit engine in the configuration json file as described above and docker version is `18.09` or higher,
try to set the following env variables when building the docker image:
```

```shell
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker build -t iotaledger/goshimmer .
```

Expand Down
16 changes: 9 additions & 7 deletions documentation/docs/tooling/docker_private_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Reachable from the host system
<!-- Running the dashboard and analysis dashboard on the same container causes the dashboard to malfunction -->

It is therefore possible to send messages to the local network via the `peer_master`. Log messages of a specific containter can be followed via
```
```shell
docker logs --follow CONTAINERNAME
```

Expand All @@ -70,7 +70,8 @@ Docker Compose uses the `SNAPSHOT_FILE` environment variable to determine the lo
network, and gather their results in the `csv` folder.

Once the network is up and running, execute the script:
```

```shell
./get_approval_csv.sh
```
Example output:
Expand Down Expand Up @@ -104,7 +105,7 @@ In order to start the spammer, you need to send GET requests to a `/spammer` API

Example requests:

```bash
```shell
http://localhost:8080/spammer?cmd=start&rate=10&unit=mps

http://localhost:8080/spammer?cmd=start&rate=10&unit=mps&imif=uniform
Expand All @@ -131,7 +132,8 @@ Here is an example config that can be added:
To get an instance up and running on your machine make sure you have [Docker Compose](https://docs.docker.com/compose/install/) installed.

Then you just need to run this command:
```bash

```shell
docker-compose build
docker-compose --profile drng --profile grafana up -d
```
Expand All @@ -152,7 +154,7 @@ These services that are created by default with `docker-compose up -d`.

You can set the environment variable configuration inline as seen in this example.

```bash
```shell
GOSHIMMER_TAG=develop docker-compose up -d
```

Expand Down Expand Up @@ -214,7 +216,7 @@ In order to enable these containers you must set the `--profile grafana` flag wh

You can set the environment variable configuration inline as seen in this example.

```bash
```shell
docker-compose --profile grafana up -d
```

Expand Down Expand Up @@ -244,7 +246,7 @@ In order to enable these containers you must set the `--profile drng` flag when

You can set the environment variable configuration inline as seen in this example.

```bash
```shell
DRNG_REPLICAS=2 docker-compose --profile drng up -d
```

Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tooling/integration_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Prerequisites:
- Docker 17.12.0+
- Docker compose: file format 3.5

```
```shell
# Mac & Linux
cd tools/integration-tests
./runTests.sh
Expand Down
Loading

0 comments on commit f0363db

Please sign in to comment.