Skip to content

Commit 8414b7c

Browse files
committed
Merge branch 'andrius/repo-cleanup' into 'main'
Repo cleanup See merge request flarenetwork/ftso/ftso-scaling!169
2 parents 865a8a9 + e6815ce commit 8414b7c

File tree

236 files changed

+1779
-184445
lines changed

Some content is hidden

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

236 files changed

+1779
-184445
lines changed

.env.example

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,23 @@ INDEXER_TOP_TIMEOUT=5
2020
# Feed Value Provider connection url
2121
VALUE_PROVIDER_BASE_URL="http://localhost:3101"
2222

23-
# Epoch settings
24-
ES_FIRST_VOTING_ROUND_START_TS=1704250616
25-
ES_VOTING_EPOCH_DURATION_SECONDS=20
26-
ES_FIRST_REWARD_EPOCH_START_VOTING_ROUND_ID=1000
27-
ES_REWARD_EPOCH_DURATION_IN_VOTING_EPOCHS=5
28-
INITIAL_REWARD_EPOCH_ID=0
29-
30-
# FTSO specific timings
31-
FTSO_REVEAL_DEADLINE_SECONDS=10
32-
33-
# Random benching window policy
34-
RANDOM_GENERATION_BENCHING_WINDOW=50
35-
36-
# Lib config addresses "local-test" | "from-env" | "coston" | "songbird" | "flare";
23+
# Specify network, determines protocol parameters and contract addresses: "local-test" | "from-env" | "coston" | "songbird" | "flare";
3724
NETWORK="local-test"
38-
# Definitions bellow only used when network is set to from-env
25+
26+
# Below parameters only needed when network is set to from-env
3927
FTSO_CA_FTSO_SYSTEMS_MANAGER_ADDRESS="0x000000000000000000000000000000000000dEaD"
4028
FTSO_CA_FTSO_REWARD_OFFERS_MANAGER_ADDRESS="0x000000000000000000000000000000000000dEaD"
4129
FTSO_CA_REWARD_MANAGER_ADDRESS="0x000000000000000000000000000000000000dEaD"
4230
FTSO_CA_SUBMISSION_ADDRESS="0x000000000000000000000000000000000000dEaD"
4331
FTSO_CA_RELAY_ADDRESS="0x000000000000000000000000000000000000dEaD"
4432
FTSO_CA_FLARE_SYSTEMS_CALCULATOR_ADDRESS="0x000000000000000000000000000000000000dEaD"
4533
FTSO_CA_VOTER_REGISTRY_ADDRESS="0x000000000000000000000000000000000000dEaD"
34+
35+
ES_FIRST_VOTING_ROUND_START_TS=1704250616
36+
ES_VOTING_EPOCH_DURATION_SECONDS=20
37+
ES_FIRST_REWARD_EPOCH_START_VOTING_ROUND_ID=1000
38+
ES_REWARD_EPOCH_DURATION_IN_VOTING_EPOCHS=5
39+
INITIAL_REWARD_EPOCH_ID=0
40+
41+
FTSO_REVEAL_DEADLINE_SECONDS=10
42+
RANDOM_GENERATION_BENCHING_WINDOW=50

.gitlab-ci.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,49 @@ workflow:
44
when: never
55
- when: always
66

7+
lint:
8+
stage: test
9+
image: node:22
10+
cache:
11+
- key:
12+
files:
13+
- yarn.lock
14+
paths:
15+
- node_modules
16+
- .yarn-cache
17+
policy: pull-push
18+
before_script:
19+
- yarn install --frozen-lockfile --cache-folder .yarn-cache
20+
script:
21+
- |
22+
set +e # don't stop on first failure
23+
yarn lint:check
24+
LINT_EXIT=$?
25+
yarn format:check
26+
FORMAT_EXIT=$?
27+
set -e
28+
29+
if [ "$LINT_EXIT" -ne 0 ] || [ "$FORMAT_EXIT" -ne 0 ]; then
30+
echo "lint:check exit=$LINT_EXIT, format:check exit=$FORMAT_EXIT"
31+
exit 1
32+
fi
33+
734
test-all:
835
stage: test
936
needs: []
1037
image: node:22
1138
cache:
12-
- key:
13-
files:
14-
- yarn.lock
15-
paths:
16-
- node_modules
17-
- .yarn-cache
18-
policy: pull-push
39+
- key:
40+
files:
41+
- yarn.lock
42+
paths:
43+
- node_modules
44+
- .yarn-cache
45+
policy: pull-push
1946
before_script:
20-
- yarn install --frozen-lockfile --cache-folder .yarn-cache
47+
- yarn install --frozen-lockfile --cache-folder .yarn-cache
2148
script:
22-
- yarn test:all
49+
- yarn test:all
2350

2451
# TODO: enable coverage reports
2552
# test-coverage:

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- ...
13+
14+
### Changed
15+
16+
- ...

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @adg-flare @alenabelium

CONTRIBUTING.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Contributing
2+
3+
This document describes the process of contributing to this project. It is
4+
intended for anyone considering opening an issue or pull request.
5+
6+
## AI Assistance
7+
8+
Any significant use of the AI assistance in the contribution MUST be disclosed in the pull request along with the extent of the use.
9+
10+
An example disclosure:
11+
12+
> This PR was written primarily by Claude Code.
13+
14+
Or a more detailed disclosure:
15+
16+
> I consulted ChatGPT for the following code snippets: ...
17+
18+
## Quick start
19+
20+
If you'd like to contribute, report a bug, suggest a feature or you've
21+
implemented a feature you should open an issue or pull request.
22+
23+
Any contribution to the project is expected to contain code that is formatted,
24+
linted and that the existing tests still pass. Adding unit tests for new code is
25+
also welcome.
26+
27+
## Dev environment
28+
29+
Prerequisites:
30+
31+
- Node.js, as specified in the `.nvmrc` file. We recommend using `nvm` to manage versions.
32+
- Yarn 1.22.x
33+
- Git
34+
35+
Install the dependencies:
36+
37+
```bash
38+
$ yarn install
39+
```
40+
41+
### Configuration
42+
43+
Copy `.env.example` to `.env` and fill the required configuration parameters.
44+
45+
46+
### Running the FTSO data provider client app
47+
48+
To start the app run:
49+
50+
```bash
51+
# development
52+
$ yarn run start
53+
54+
# watch mode
55+
$ yarn run start:dev
56+
```
57+
58+
### Testing
59+
60+
To run all tests or check code coverage, use the following commands:
61+
```bash
62+
yarn test:all
63+
yarn test:coverage
64+
```
65+
### Linting and formatting
66+
67+
We use ESLint and Prettier:
68+
- Check lint:
69+
70+
```bash
71+
yarn lint:check
72+
```
73+
74+
- Auto-fix lint issues:
75+
76+
```bash
77+
yarn lint:fix
78+
```
79+
80+
- Check formatting:
81+
82+
```bash
83+
yarn format:check
84+
```
85+
86+
- Auto-format:
87+
88+
```bash
89+
yarn format:fix
90+
```

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Flare Foundation
3+
Copyright (c) 2025 Flare Foundation
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
1+
<div align="center">
2+
<a href="https://flare.network/" target="blank">
3+
<img src="https://content.flare.network/Flare-2.svg" width="300" alt="Flare Logo" />
4+
</a>
5+
<br/>
6+
<a href="CONTRIBUTING.md">Contributing</a>
7+
·
8+
<a href="SECURITY.md">Security</a>
9+
·
10+
<a href="CHANGELOG.md">Changelog</a>
11+
</div>
12+
113
# FTSO Scaling
214

315
The repository contains services to support [FTSO Scaling protocol](./protocol/README.md) which include:
416
- [Data provider service](./apps/ftso-data-provider/src/README.md)
517
- [Reward calculator](./scripts/rewards/README.md)
618
- [Reward data analytics scripts](./scripts/analytics/README.md)
719

8-
The services are [Nest.js](https://nestjs.com/) applications which use logic that is implemented in [FTSO core library](./libs/ftso-core/)
9-
10-
# Reward calculation results
11-
12-
Reward calculation results are available [here](./rewards-data). See the documentation about [Reward calculator](./scripts/rewards/README.md) for details.
13-
14-
# Installation
15-
16-
## FTSO data provider
17-
18-
- Install Node.js (ideally 20.11.0 LTS).
19-
- Install, configure and run the [Flare System C-chain Indexer](https://gitlab.com/flarenetwork/flare-system-c-chain-indexer).
20-
- Install [Nest.js CLI](https://docs.nestjs.com/first-steps)
21-
- Clone the repo.
22-
- Build the project
23-
```bash
24-
yarn build
25-
```
26-
- Configure relevant [environment variables](../apps/ftso-reward-calculator/src/config/configuration.ts).
27-
- Run the code:
28-
```bash
29-
node dist/apps/ftso-data-provider/apps/ftso-data-provider/src/main.js
30-
```
20+
The services are [Nest.js](https://nestjs.com/) applications which use logic that is implemented in [FTSO core library](./libs/ftso-core/).
3121

3222
## FTSO Reward Calculator (experimental)
3323

RepoStructure.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

SECURITY.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Security policy
2+
3+
## Reporting a vulnerability
4+
5+
Please do not report a vulnerability using an issue or any other public channel.
6+
7+
If you have found a possible vulnerability, please send an email to
8+
`security at flare dot network`
9+
or through our Bug Bounty programs.
10+
11+
## Bug bounties
12+
13+
We sincerely appreciate and encourage reports of suspected security vulnerabilities.
14+
Please refer to our [Immunefi Bug Bounty Program](https://immunefi.com/bug-bounty/flarenetwork/information/) for scope, rules, and submission guidelines.
15+
16+
## Vulnerability disclosures
17+
18+
Critical vulnerabilities will be disclosed via GitHub's
19+
[security advisory](https://github.com/flare-foundation/ftso-scaling/security)
20+
system.
21+
22+
## Audits
23+
24+
Audit reports are published on Flare's [Developer Hub](https://dev.flare.network/support/audits/).
25+

apps/ftso-data-provider/src/auth/apikey.strategy.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ type verifiedCallback = (err: Error | null, user?: object, info?: object) => voi
1111
*/
1212
export class ApiKeyStrategy extends PassportStrategy(HeaderAPIKeyStrategy, "api-key-strategy") {
1313
constructor(private readonly authService: AuthService) {
14-
super(
15-
{ header: "X-API-KEY", prefix: "" },
16-
true,
17-
async (apiKey: string, verified: verifiedCallback, req: Request) => {
18-
if (this.authService.validateApiKey(apiKey)) {
19-
verified(null, {}, {});
20-
return req;
21-
} else {
22-
verified(new UnauthorizedException(), {}, {});
23-
}
14+
super({ header: "X-API-KEY", prefix: "" }, true, (apiKey: string, verified: verifiedCallback, req: Request) => {
15+
if (this.authService.validateApiKey(apiKey)) {
16+
verified(null, {}, {});
17+
return req;
18+
} else {
19+
verified(new UnauthorizedException(), {}, {});
2420
}
25-
);
21+
});
2622
}
2723
}

0 commit comments

Comments
 (0)