You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-18Lines changed: 45 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,11 @@ Components:
8
8
9
9
* Domain crate
10
10
* Sentry - check the list of [opened issues](https://github.com/AdExNetwork/adex-validator-stack-rust/issues?q=is:open is:issue project:AdExNetwork/adex-validator-stack-rust/1)
11
-
* Validator worker - TODO
11
+
* Validator worker - The validator worker(`Leader` or `Follower`) that validates/proposes new states.
12
+
* memory-repository - Generic helper crate for creating InMemory repositories for testing.
13
+
* adapter - Adapter trait for `sign`, `verify` and `validate_channel` with Dummy implementation for testing.
14
+
15
+
**Note:** Please refer to the README.md of the component for a more detailed overview of it.
12
16
13
17
## Domain
14
18
Contains all the Domain `Aggregates`, `Entities`, `Value Objects`, interfaces (traits) and `Domain Error`.
@@ -18,23 +22,19 @@ All the structs have defined (de)serialization. The also have incorporated domai
18
22
`TargetingTag.score` (the `Score` struct) should be with a value between `0` and `100`.
19
23
This means that once we have a `Score` object, we are guaranteed to have a valid object everywhere.
20
24
21
-
The `Repository` traits are meant for retrieving the underlying object types, this includes implementations with
22
-
Databases (like `Postgres` for `Sentry`), API calls (for the `Validator` to fetch the objects from `Sentry`),
23
-
memory (for testing) and etc.
24
-
25
-
## Sentry: API
26
-
27
-
#### Do not require authentication, can be cached:
28
-
29
-
The API documentation can be found on the [adex-validator](https://github.com/AdExNetwork/adex-validator/blob/master/docs/api.md).
30
-
Currently implemented endpoints:
25
+
The `Repository` traits are meant to help you create the correct abstractions in the underlying application,
26
+
as every application has different requirements for the way and things it will fetch.
31
27
32
-
- POST `/channel` - creates a new channel
33
-
- GET `/channel/list` - get a list of all channels
28
+
## Sentry & Validator worker
34
29
35
-
## Validator worker
36
-
37
-
TODO
30
+
Split into 3 layer - Domain, Infrastructure & Application.
31
+
- Domain - the domain objects/structs that are defining the business rules and constraints.
32
+
- Infrastructure - specific implementations of e.g. Repositories, Logging and etc.
33
+
like `Memory__Repository`, `Api__Repository` and so on.
34
+
- Application - all the application specific logic, which means services, structs and etc. that use the Domain and it's
35
+
traits to achieve the task at hand. For example: In sentry we have the `resource`s, there we define the
36
+
`channel_create`. Which handles the request, validates it and uses the `ChannelRepository` trait to
37
+
`add` the new Channel and returns the appropriate Response. It is not however limited to Request -> Response.
38
38
39
39
## Testing setup
40
40
@@ -57,10 +57,37 @@ We've setup `rust-toolchain` but you can manually override it as well with `rust
57
57
58
58
`DATABASE_URL=postgresql://postgres:docker@localhost:5432/sentry cargo run --bin sentry`
59
59
60
+
### Run Validator Worker
61
+
62
+
`cargo run --bin validator`
63
+
64
+
For the available options:
65
+
66
+
`cargo run --bin validator -- --help`
67
+
60
68
#### Environment variables:
61
69
70
+
**NOTE: Currently we use `.env` file to define values for those environment variables.
71
+
We need to see if we want configuration files per binary instead.**
72
+
73
+
##### Sentry:
62
74
-`DATABASE_URL` - The url of the Postgres database used for production.
75
+
-`SENTRY_CHANNEL_LIST_LIMIT` - the limit per page for listing channels from the `/channel/list` request.
76
+
77
+
##### Validator:
78
+
-`VALIDATOR_TICKS_WAIT_TIME` - The time for a whole cycle(tick) of the validator worker to get & loop channels,
79
+
validate and send statuses and etc.
80
+
-`VALIDATOR_SENTRY_URL` - The url of the Sentry API that should be used
81
+
-`VALIDATOR_VALIDATION_TICK_TIMEOUT` - The maximum time for validation of a single channel as a `Leader` or `Follower`
82
+
83
+
## Development environment
84
+
85
+
We use [cargo-make](https://github.com/sagiegurari/cargo-make) for running the checks and build project locally
86
+
as well as on CI. For a complete list of out-of-the-box commands you can check
For more information on the possible options on the binary please run:
4
+
5
+
`cargo run --bin validator -- --help`
6
+
7
+
The default mode is running the validator in infinite tick mode, basically constantly waiting and never finishing.
8
+
9
+
It is possible to run it in single tick mode with the `-s` option
10
+
11
+
Currently you can run the Validator worker only with DummyAdapter as we do not have any other implementations.
12
+
13
+
The DummyAdapter requires you to specify the Identity that will be used for the adapter in the form of a string.
14
+
You can still pass `-s` for single tick mode.
15
+
16
+
For tracking issue on the options and the configuration of the validator refer to issue [#68](https://github.com/AdExNetwork/adex-validator-stack-rust/issues/68)
0 commit comments