Skip to content

Commit 6d918a9

Browse files
committed
Merge ETCM-311 into branch
2 parents 42c3609 + 4d2bd58 commit 6d918a9

File tree

68 files changed

+8699
-7482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+8699
-7482
lines changed

.buildkite/pipeline.nix

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{ cfg, pkgs, ... }:
22

33
with cfg.steps.commands;
4-
54
let
65
commonAttrs = {
76
retry.automatic = true;
87
agents.queue = "project42";
98
};
109
in
11-
1210
{
1311
steps.commands = {
1412
nixExpr = commonAttrs // {
@@ -97,6 +95,19 @@ in
9795
];
9896
};
9997

98+
annotate-test-reports = commonAttrs // {
99+
dependsOn = [ test-unit ];
100+
label = "annotate test reports";
101+
command = "junit-annotate";
102+
allowDependencyFailure = true;
103+
plugins = [{
104+
"junit-annotate#1.9.0" = {
105+
artifacts = "target/test-reports/*.xml";
106+
report-slowest = 50;
107+
};
108+
}];
109+
};
110+
100111
test-evm = commonAttrs // {
101112
dependsOn = [ compile ];
102113
label = "EVM tests";

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ metals.sbt
2424
# Nix
2525
result
2626
.nix/
27+
28+
# sonarScan
29+
.scannerwork/

README.md

Lines changed: 92 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Unit Test Code Coverage Status - TBD
1414

1515
### Docs - FIXME: Update docs!
1616

17-
For more details on configuration and functionality check out our [wiki](http://mantis.readthedocs.io) (also at [wiki](https://github.com/input-output-hk/mantis/wiki))
17+
For more details on configuration and functionality check out our [website](https://docs.mantisclient.io/first-steps/getting-started) and [documentation](https://docs.mantisclient.io/first-steps/getting-started)
1818

1919
### Download the client
2020

2121
The latest release can be downloaded from [here](https://github.com/input-output-hk/mantis/releases)
2222

2323
### Command line version
2424

25-
You can use generic launcher with appropriate parameter to connect with pre-configured network, it can be found in `bin` directory.
25+
In the `bin` directory, you can find the generic launcher. To connect to a pre-configured network just pass the network name as a parameter.
2626

2727
Example:
2828
- `./bin/mantis-launcher etc` - for joining Ethereum Classic network
@@ -55,7 +55,7 @@ Possible networks: `etc`, `eth`, `mordor`, `testnet-internal`
5555
./bin/mantis cli encrypt-key --passphrase=pass 00b11c32957057651d56cd83085ef3b259319057e0e887bd0fdaee657e6f75d0
5656
```
5757

58-
Command output uses the same format as keystore so it could be used ex. to setup private faucet
58+
The command output uses the same format as the keystore so it could be used ex. to setup private faucet
5959

6060
ex.
6161
```
@@ -135,20 +135,20 @@ git commit -m "Update nix-sbt sha"
135135

136136
#### Locally build & run monitoring client
137137

138-
Setup a dashboard using Prometheus and Grafana, popular choice of monitoring stack.
139-
Before that you need enable the metrics in the file “metrics.conf”, setting mantis.metrics.enabled=true.
138+
A docker-compose setup using Prometheus and Grafana, and a preconfigured dashboard, is available.
139+
As a precondition you need to have docker and sbt installed.
140+
Before running the script, you need to enable metrics by editing the file `metrics.conf` and setting `mantis.metrics.enabled=true`
140141

141-
You can start Docker Compose initializing Prometheus and Grafana with a preconfigured dashboard.
142-
For build the monitoring, you need to run the following script: `./docker/monitoring/build.sh`
143-
This script prepares a docker image of mantis. And as a precondition you need to have installed docker-compose and sbt.
142+
To build the monitoring, run the following script at `./docker/mantis/build.sh`.
143+
This script builds a docker image of mantis using the local sources and starts the docker-compose.
144144

145-
We can see the dashboard called "Mantis" at URL: http://localhost:3000 using user and password: admin and admin
145+
Grafana will be available at http://localhost:3000 (using user and password: admin and admin) with a dashboard called `Mantis`.
146146

147147

148148
### TLS setup
149149

150150
Both the JSON RPC (on the node and faucet) can be additionally protected using TLS.
151-
On the development environment it's already properly configured with a development certificate.
151+
The development environment it already properly configured with a development certificate.
152152

153153
#### Generating a new certificate
154154

@@ -159,7 +159,9 @@ If a new certificate is required, create a new keystore with a certificate by ru
159159
1. Configure the certificate and password file to be used at `mantis.network.rpc.http.certificate` key on the `application.conf` file:
160160

161161
keystore-path: path to the keystore storing the certificates (if generated through our script they are by default located in "./tls/mantisCA.p12")
162+
162163
keystore-type: type of certificate keystore being used (if generated through our script use "pkcs12")
164+
163165
password-file: path to the file with the password used for accessing the certificate keystore (if generated through our script they are by default located in "./tls/password")
164166
2. Enable TLS in specific config:
165167
- For JSON RPC: `mantis.network.rpc.http.mode=https`
@@ -168,18 +170,90 @@ If a new certificate is required, create a new keystore with a certificate by ru
168170

169171
1. Configure the certificate and password file to be used at `mantis.network.rpc.http.certificate` key on the `faucet.conf` file:
170172

171-
keystore-path: path to the keystore storing the certificates (if generated through our script they are by default located in "./tls/mantisCA.p12")
172-
keystore-type: type of certificate keystore being used (if generated through our script use "pkcs12")
173-
password-file: path to the file with the password used for accessing the certificate keystore (if generated through our script they are by default located in "./tls/password")
173+
keystore-path: path to the keystore storing the certificates (if generated through our script they are by default located in "./tls/mantisCA.p12")
174+
175+
keystore-type: type of certificate keystore being used (if generated through our script use "pkcs12")
176+
177+
password-file: path to the file with the password used for accessing the certificate keystore (if generated through our script they are by default located in "./tls/password")
174178
2. Enable TLS in specific config:
175-
- For JSON RPC: `mantis.network.rpc.http.mode=https`
176-
3. Configure the certificate used from RpcClient to connect with the node. Necessary if the node uses http secure.
179+
- For JSON RPC: `mantis.network.rpc.http.mode=https`
180+
3. Configure the certificate used from RpcClient to connect with the node. Necessary if the node uses http secure.
177181
This certificate and password file to be used at `faucet.rpc-client.certificate` key on the `faucet.conf` file:
178182

179-
keystore-path: path to the keystore storing the certificates
180-
keystore-type: type of certificate keystore being used (if generated through our script use "pkcs12")
181-
password-file: path to the file with the password used for accessing the certificate keystore
183+
keystore-path: path to the keystore storing the certificates
184+
keystore-type: type of certificate keystore being used (if generated through our script use "pkcs12")
185+
password-file: path to the file with the password used for accessing the certificate keystore
186+
187+
### Faucet setup and testing
188+
1. First start a client node using the docker-compose, by running the script found at `./docker/mantis/build.sh`
189+
Modify the script before running it by adding the `volumes` and `command` sections to mantis configuration:
190+
```
191+
mantis:
192+
image: mantis:latest
193+
ports:
194+
- 8546:8546
195+
- 13798:13798
196+
- 9095:9095
197+
networks:
198+
- mantis-net
199+
volumes:
200+
- $HOME/.mantis:/home/demiourgos728/.mantis/
201+
command: -Dconfig.file=./conf/sagano.conf
202+
```
203+
204+
2. Create a wallet address. Run the following curl command, replacing `<password>` by a password of your choice:
205+
```
206+
curl --request POST \
207+
--url http://127.0.0.1:8546/ \
208+
--header 'Cache-Control: no-cache' \
209+
--header 'Content-Type: application/json' \
210+
--data '{
211+
"jsonrpc": "2.0",
212+
"method": "personal_newAccount",
213+
"params": ["<password>"],
214+
"id": 1
215+
}'
216+
```
217+
218+
You will receive a response like this:
219+
```
220+
{"jsonrpc":"2.0","result":"<address>","id":1}
221+
```
222+
223+
3. Modify `src/universal/conf/faucet.conf` file, config your account address created in the previous step. with the password choosen by you:
224+
```
225+
wallet-address = "<address>"
226+
wallet-password = "<password>"
227+
```
228+
229+
4. Now check the `keystore` folder in `~/.mantis/testnet-internal-nomad/keystore`.
230+
Inside you will find a key generate with the curl request sent in step `2.`. Copy that file to `~/.mantis-faucet/keystore/`:
231+
```
232+
cp UTC--<date>--<key> ~/.mantis-faucet/keystore/
233+
```
234+
235+
5. Start the faucet in command line:
236+
```
237+
sbt -Dconfig.file=src/universal/conf/faucet.conf "run faucet"
238+
```
239+
240+
6. Run the following curl command to send tokens from your faucet to a wallet address:
241+
```
242+
curl --request POST \
243+
--url http://127.0.0.1:8099/ \
244+
--header 'Content-Type: application/json' \
245+
--data '{
246+
"jsonrpc": "2.0",
247+
"method": "faucet_sendFunds",
248+
"params": ["<address>"],
249+
"id": 1
250+
}'
251+
```
252+
253+
Happy transfer!
182254

255+
Note: In order for the transfer transaction be persisted, a faucet needs sufficient founds in its account and in this test
256+
case a new faucet, without ETC tokens, is being created.
183257

184258
### Feedback
185259

build.sbt

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,26 @@ lazy val node = {
111111
Seq(
112112
Dependencies.akka,
113113
Dependencies.akkaHttp,
114-
Dependencies.json4s,
115-
Dependencies.circe,
114+
Dependencies.apacheCommons,
116115
Dependencies.boopickle,
117-
Dependencies.rocksDb,
118-
Dependencies.enumeratum,
119-
Dependencies.testing,
120116
Dependencies.cats,
121-
Dependencies.monix,
122-
Dependencies.network,
117+
Dependencies.circe,
118+
Dependencies.cli,
123119
Dependencies.crypto,
124-
Dependencies.scopt,
120+
Dependencies.dependencies,
121+
Dependencies.enumeratum,
122+
Dependencies.guava,
123+
Dependencies.json4s,
124+
Dependencies.kamon,
125125
Dependencies.logging,
126-
Dependencies.apacheCommons,
127126
Dependencies.micrometer,
128-
Dependencies.kamon,
127+
Dependencies.monix,
128+
Dependencies.network,
129129
Dependencies.prometheus,
130-
Dependencies.cli,
131-
Dependencies.dependencies
130+
Dependencies.rocksDb,
131+
Dependencies.scaffeine,
132+
Dependencies.scopt,
133+
Dependencies.testing
132134
).flatten ++ malletDeps
133135
}
134136

@@ -253,3 +255,6 @@ addCommandAlias(
253255
|;it:test
254256
|""".stripMargin
255257
)
258+
259+
scapegoatVersion in ThisBuild := "1.4.7"
260+
scapegoatReports := Seq("xml")

ci-like/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM nixos/nix
2+
3+
RUN apk --update add git less openssh && \
4+
rm -rf /var/lib/apt/lists/* && \
5+
rm /var/cache/apk/*
6+
7+
RUN nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
8+
RUN nix-channel --update
9+
10+
RUN nix-build -A pythonFull '<nixpkgs>'
11+

ci-like/nix.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sandbox = false
2+
experimental-features = nix-command flakes ca-references
3+
substituters = https://hydra.iohk.io https://cache.nixos.org https://mantis-ops.cachix.org
4+
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= mantis-ops.cachix.org-1:SornDcX8/9rFrpTjU+mAAb26sF8mUpnxgXNjmKGcglQ=

0 commit comments

Comments
 (0)