Skip to content

Commit 27fa2d6

Browse files
Merge pull request #1451 from multiversx/development
Development
2 parents 1d757c4 + 887bd0b commit 27fa2d6

71 files changed

Lines changed: 7683 additions & 410 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Chain simulator e2e tests workflow
2+
3+
on:
4+
push:
5+
branches: [main, development]
6+
pull_request:
7+
branches: [main, development]
8+
9+
jobs:
10+
test-chainsimulator-e2e:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18.x]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
25+
- name: Build and start chain simulator
26+
run: npm run start-chain-simulator
27+
28+
- name: Wait for services to be ready
29+
run: |
30+
echo "Waiting for services to be healthy..."
31+
docker ps
32+
docker logs chainsimulator
33+
sleep 20 # Wait for 20 seconds to ensure services are up
34+
35+
- name: Print docker containers
36+
run: docker ps
37+
38+
- name: Start API Docker containers
39+
run: |
40+
cd .
41+
docker compose up -d
42+
43+
- name: Wait for API docker containers to start
44+
run: |
45+
sleep 20
46+
docker ps
47+
48+
- run: npm ci
49+
- run: npm run init
50+
51+
- name: Start API
52+
run: |
53+
npm run start:mainnet:e2e &
54+
sleep 10 # Wait a little more to ensure the API is fully up
55+
56+
- name: Prepare Test Data
57+
run: npm run prepare:test-data
58+
59+
- name: Run e2e tests
60+
run: npm run test:cs-e2e
61+
62+
- name: Stop API after tests
63+
run: |
64+
echo "Stopping the API..."
65+
kill $(lsof -t -i:3001)

.github/workflows/load-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
run: k6 run ./k6/script.js
5959

6060
- name: Upload result file for base branch
61-
uses: actions/upload-artifact@v3
61+
uses: actions/upload-artifact@v4
6262
with:
6363
name: base-results
6464
path: k6/output/summary.json
@@ -119,7 +119,7 @@ jobs:
119119
run: k6 run ./k6/script.js
120120

121121
- name: Upload result file for head branch
122-
uses: actions/upload-artifact@v3
122+
uses: actions/upload-artifact@v4
123123
with:
124124
name: head-results
125125
path: k6/output/summary.json
@@ -135,7 +135,7 @@ jobs:
135135
- uses: actions/checkout@v2
136136

137137
- name: Download all artifacts
138-
uses: actions/download-artifact@v3
138+
uses: actions/download-artifact@v4
139139
with:
140140
path: artifacts
141141

@@ -159,7 +159,7 @@ jobs:
159159
head: ${{ github.event.pull_request.head.sha }}
160160
161161
- name: Upload the report markdown
162-
uses: actions/upload-artifact@v3
162+
uses: actions/upload-artifact@v4
163163
if: github.event_name == 'pull_request'
164164
with:
165165
name: report-markdown

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ lerna-debug.log*
4141

4242
/src/plugins
4343

44-
.env
44+
.env
45+
46+
# CS Environment variables
47+
src/test/chain-simulator/config/.env

config/config.e2e.mainnet.yaml

Lines changed: 119 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,51 @@ network: 'mainnet'
22
metaChainShardId: 4294967295
33
api:
44
public: true
5+
publicPort: 3001
56
private: true
6-
graphql: true
7+
privatePort: 4001
8+
websocket: true
9+
cron:
10+
cacheWarmer: true
11+
fastWarm: false
12+
queueWorker: true
13+
elasticUpdater: false
14+
flags:
15+
useRequestCaching: true
16+
useKeepAliveAgent: true
17+
useTracing: false
18+
useRequestLogging: false
19+
useVmQueryTracing: false
20+
processNfts: true
21+
collectionPropertiesFromGateway: false
722
features:
23+
eventsNotifier:
24+
enabled: false
25+
port: 5674
26+
url: 'amqp://guest:guest@127.0.0.1:5672'
27+
exchange: 'all_events'
28+
queue: 'api-process-logs-and-events'
29+
guestCaching:
30+
enabled: false
31+
hitsThreshold: 100
32+
ttl: 12
33+
transactionPool:
34+
enabled: true
35+
transactionPoolWarmer:
36+
enabled: true
37+
cronExpression: '*/5 * * * * *'
38+
ttlInSeconds: 60
39+
updateCollectionExtraDetails:
40+
enabled: false
41+
updateAccountExtraDetails:
42+
enabled: false
43+
transfersLast24hUrl: 'https://tools.multiversx.com/growth-api/explorer/widgets/most-used/applications'
44+
marketplace:
45+
enabled: false
46+
serviceUrl: 'https://nfts-graph.multiversx.com/graphql'
47+
exchange:
48+
enabled: false
49+
serviceUrl: 'https://graph.xexchange.com/graphql'
850
dataApi:
951
enabled: false
1052
serviceUrl: 'https://data-api.multiversx.com'
@@ -13,35 +55,93 @@ features:
1355
maxExpirySeconds: 86400
1456
acceptedOrigins:
1557
- ''
58+
admins:
59+
- ''
60+
jwtSecret: ''
61+
stakingV4:
62+
enabled: false
63+
cronExpression: '*/5 * * * * *'
64+
activationEpoch: 1391
65+
nodeEpochsLeft:
66+
enabled: false
67+
transactionProcessor:
68+
enabled: false
69+
maxLookBehind: 1000
70+
transactionCompleted:
71+
enabled: false
72+
maxLookBehind: 1000
73+
logLevel: 'Error'
74+
transactionBatch:
75+
enabled: false
76+
maxLookBehind: 1000
1677
deepHistory:
1778
enabled: false
1879
url: ''
19-
cron:
20-
transactionProcessor: false
21-
transactionProcessorMaxLookBehind: 1000
22-
cacheWarmer: false
23-
flags:
24-
useRequestCaching: true
25-
useKeepAliveAgent: true
26-
useTracing: false
27-
collectionPropertiesFromGateway: false
80+
statusChecker:
81+
enabled: false
82+
thresholds:
83+
tokens: 1000
84+
nodes: 5000
85+
providers: 150
86+
tokenSupplyCount: 100
87+
tokenAssets: 100
88+
tokenAccounts: 1000
89+
tokenTransactions: 1000
90+
nodeValidators: 3260
91+
nftScamInfo:
92+
enabled: false
93+
processNfts:
94+
enabled: false
95+
nftQueueName: 'api-process-nfts'
96+
deadLetterQueueName: 'api-process-nfts-dlq'
97+
tps:
98+
enabled: false
99+
maxLookBehindNonces: 100
100+
nodesFetch:
101+
enabled: false
102+
serviceUrl: 'https://api.multiversx.com'
103+
tokensFetch:
104+
enabled: false
105+
serviceUrl: 'https://api.multiversx.com'
106+
providersFetch:
107+
enabled: false
108+
serviceUrl: 'https://api.multiversx.com'
109+
assetsFetch:
110+
enabled: false
111+
assetesUrl: 'https://tools.multiversx.com/assets-cdn'
112+
image:
113+
width: 600
114+
height: 600
115+
type: 'png'
116+
aws:
117+
s3KeyId: ''
118+
s3Secret: ''
119+
s3Bucket: 'media.elrond.com'
120+
s3Region: ''
28121
urls:
29-
self: 'https://api.multiversx.com'
122+
self: 'http://localhost:3001'
30123
elastic:
31-
- 'https://index.multiversx.com'
124+
- 'http://localhost:9200'
32125
gateway:
33-
- 'https://gateway.multiversx.com'
126+
- 'http://localhost:8085'
34127
verifier: 'https://play-api.multiversx.com'
35128
redis: '127.0.0.1'
36129
rabbitmq: 'amqp://127.0.0.1:5672'
37-
providers: 'https://internal-delegation-api.multiversx.com/providers'
130+
providers: 'https://delegation-api.multiversx.com/providers'
38131
delegation: 'https://delegation-api.multiversx.com'
39132
media: 'https://media.elrond.com'
40133
nftThumbnails: 'https://media.elrond.com/nfts/thumbnail'
134+
tmp: '/tmp'
135+
ipfs: 'https://ipfs.io/ipfs'
136+
socket: 'socket-api-fra.multiversx.com'
41137
maiarId: 'https://id-api.multiversx.com'
138+
indexer:
139+
type: 'elastic'
140+
maxPagination: 10000
42141
database:
43142
enabled: false
44143
url: 'mongodb://127.0.0.1:27017/api?authSource=admin'
144+
type: 'mysql'
45145
host: 'localhost'
46146
port: 3306
47147
username: 'root'
@@ -50,7 +150,8 @@ database:
50150
caching:
51151
cacheTtl: 6
52152
processTtl: 600
53-
poolLimit: 10
153+
poolLimit: 50
154+
cacheDuration: 3
54155
keepAliveTimeout:
55156
downstream: 61000
56157
upstream: 60000
@@ -69,14 +170,6 @@ inflation:
69170
- 1130177
70171
- 924690
71172
- 719203
72-
security:
73-
admins:
74-
jwtSecret:
75-
test:
76-
mockKeybases: false
77-
mockNodes: false
78-
mockTokens: false
79-
mockPath: './src/test/mocks/'
80-
transaction-action:
81-
mex:
82-
microServiceUrl: 'https://graph.xexchange.com/graphql'
173+
nftProcess:
174+
parallelism: 1
175+
maxRetries: 3

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"start:mainnet": "npm run copy-mainnet-config & nest start",
2929
"start:mainnet:watch": "npm run copy-mainnet-config & nest start --watch",
3030
"start:mainnet:debug": "npm run copy-mainnet-config & nest start --watch --debug",
31+
"start:mainnet:e2e": "npm run copy-e2e-mainnet-config & nest start",
32+
"start:mainnet:e2e:watch": "npm run copy-e2e-mainnet-config & nest start --watch",
33+
"start:mainnet:e2e:debug": "npm run copy-e2e-mainnet-config & nest start --watch --debug",
3134
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
3235
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
3336
"test": "npm run copy-mainnet-config & nest build & jest",
@@ -41,6 +44,7 @@
4144
"test:e2e:local": "npm run test:e2e:warm & npm run test:e2e",
4245
"test:api": "jest --config ./src/test/jest-api.json --runInBand --detectOpenHandles --forceExit",
4346
"test:graph": "jest --config ./src/test/jest-graph-spec.json --runInBand --detectOpenHandles --forceExit",
47+
"test:cs-e2e": "jest --config ./src/test/jest-chain-simulator.json --runInBand --detectOpenHandles --forceExit",
4448
"init": "run-script-os",
4549
"copy-mainnet-config": "run-script-os",
4650
"copy-testnet-config": "run-script-os",
@@ -73,7 +77,10 @@
7377
"copy-e2e-mainnet-config:nix": "cp ./config/config.e2e.mainnet.yaml ./config/config.yaml",
7478
"copy-e2e-mocked-mainnet-config:nix": "cp ./config/config.e2e-mocked.mainnet.yaml ./config/config.yaml",
7579
"copy-e2e-mainnet-config:windows": "copy .\\config\\config.e2e.mainnet.yaml .\\config\\config.yaml",
76-
"copy-e2e-mocked-mainnet-config:windows": "copy .\\config\\config.e2e-mocked.mainnet.yaml .\\config\\config.yaml"
80+
"copy-e2e-mocked-mainnet-config:windows": "copy .\\config\\config.e2e-mocked.mainnet.yaml .\\config\\config.yaml",
81+
"start-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" up -d --build",
82+
"stop-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" down",
83+
"prepare:test-data": "ts-node src/test/chain-simulator/utils/prepare-test-data.ts"
7784
},
7885
"dependencies": {
7986
"@aws-sdk/client-s3": "^3.54.0",
@@ -149,6 +156,7 @@
149156
"devDependencies": {
150157
"@automock/adapters.nestjs": "^2.1.0",
151158
"@automock/jest": "^2.1.0",
159+
"@jest/test-sequencer": "^29.7.0",
152160
"@nestjs/cli": "10.1.17",
153161
"@nestjs/schematics": "10.0.2",
154162
"@nestjs/testing": "10.2.4",
@@ -157,7 +165,7 @@
157165
"@types/crypto-js": "^4.0.2",
158166
"@types/express": "^4.17.13",
159167
"@types/fluent-ffmpeg": "^2.1.20",
160-
"@types/jest": "29.5.0",
168+
"@types/jest": "^29.5.0",
161169
"@types/js-yaml": "^4.0.5",
162170
"@types/json-diff": "^0.7.0",
163171
"@types/jsonwebtoken": "^8.5.8",
@@ -176,7 +184,7 @@
176184
"prettier": "^2.5.1",
177185
"run-script-os": "^1.1.6",
178186
"supertest": "^6.2.2",
179-
"ts-jest": "29.0.5",
187+
"ts-jest": "^29.0.5",
180188
"ts-loader": "9.4.2",
181189
"ts-node": "10.7.0",
182190
"tsconfig-paths": "^4.0.0",

src/common/graphql/graphql.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export class GraphQlService {
1616
const exchangeServiceUrl = this.apiConfigService.getExchangeServiceUrlMandatory();
1717
const graphqlClient = new GraphQLClient(exchangeServiceUrl, {
1818
fetch: this.createFetchWithTimeout(60_000),
19+
headers: {
20+
'origin': this.apiConfigService.getSelfUrl(),
21+
},
1922
});
2023

2124
try {

0 commit comments

Comments
 (0)