Skip to content

Commit 305af67

Browse files
authored
Merge pull request #569 from AmbireTech/config-file-limits
Configuration refactoring
2 parents 6a2475a + 0ee0600 commit 305af67

File tree

22 files changed

+286
-259
lines changed

22 files changed

+286
-259
lines changed

adapter/src/ethereum/ewt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl Token {
154154

155155
let payload = Payload::base64_decode(payload_encoded)?;
156156

157-
let decoded_signature = base64::decode_config(&signature_encoded, base64::URL_SAFE_NO_PAD)
157+
let decoded_signature = base64::decode_config(signature_encoded, base64::URL_SAFE_NO_PAD)
158158
.map_err(EwtVerifyError::SignatureDecoding)?;
159159

160160
// if it returns the same slice, then there was no suffix

docs/config/ganache.toml

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,3 @@
1-
# Maximum number of channels to return per request
2-
max_channels = 512
3-
4-
channels_find_limit = 200
5-
campaigns_find_limit = 200
6-
spendable_find_limit = 200
7-
wait_time = 500
8-
9-
msgs_find_limit = 10
10-
analytics_find_limit = 5000
11-
# in milliseconds
12-
analytics_maxtime = 20000
13-
14-
heartbeat_time = 30000
15-
health_threshold_promilles = 950
16-
health_unsignable_promilles = 750
17-
# 2 seconds
18-
# TODO: Check the POST /validator-message route performance, more than 1 second for timeout is a lot!
19-
propagation_timeout = 2000
20-
21-
fetch_timeout = 5000
22-
all_campaigns_timeout = 5000
23-
# for test_harness make it larger
24-
# Default: 5000
25-
channel_tick_timeout = 8000
26-
27-
ip_rate_limit = { type = 'ip', timeframe = 1200000 }
28-
291
creators_whitelist = [
302
# CREATOR
313
'0xaCBaDA2d5830d1875ae3D2de207A1363B316Df2F',
@@ -44,26 +16,55 @@ validators_whitelist = [
4416
# LEADER_2
4517
'0x6B83e7D6B72c098d48968441e0d05658dc17Adb9'
4618
]
19+
20+
[limits]
21+
channels_find = 200
22+
campaigns_find = 200
23+
spendable_find = 200
24+
msgs_find = 10
25+
analytics_find = 5000
26+
ip_rate_limit = { type = 'ip', timeframe = 1200000 }
27+
28+
[limits.units_for_slot]
29+
# The maximum number of campaigns a publisher can earn from
30+
# This will limit the returned Campaigns to the set number
31+
max_campaigns_earning_from = 25
32+
# 0.0001 (UnifiedNum) per 1000 impressions
33+
# 10 * (per) 1_000 / 10^8 = 0.0001
34+
# 0.00010000
35+
global_min_impression_price = '10000'
36+
37+
[sentry]
38+
# in milliseconds
39+
analytics_maxtime = 20000
4740
admins = [
4841
# LEADER
4942
'0x80690751969B234697e9059e04ed72195c3507fa'
5043
]
5144

52-
[platform]
45+
[sentry.platform]
5346
# This should be changed for tests and use the wiremock url
5447
url = "https://platform.adex.network"
5548
# 20 minutes in milliseconds
5649
keep_alive_interval = 1200000
5750

58-
[limits.units_for_slot]
59-
# The maximum number of campaigns a publisher can earn from
60-
# This will limit the returned Campaigns to the set number
61-
max_campaigns_earning_from = 25
51+
[worker]
52+
# Maximum number of channels to return per request
53+
max_channels = 512
54+
wait_time = 500
55+
heartbeat_time = 30000
56+
health_threshold_promilles = 950
57+
health_unsignable_promilles = 750
6258

63-
# 0.0001 (UnifiedNum) per 1000 impressions
64-
# 10 * (per) 1_000 / 10^8 = 0.0001
65-
# 0.00010000
66-
global_min_impression_price = '10000'
59+
[worker.timeouts]
60+
# 2 seconds
61+
# TODO: Check the POST /validator-message route performance, more than 1 second for timeout is a lot!
62+
propagation = 2000
63+
fetch = 5000
64+
all_campaigns = 5000
65+
# for test_harness make it larger
66+
# Default: 5000
67+
channel_tick = 8000
6768

6869
[chain."Ganache #1"]
6970
chain_id = 1

docs/config/prod.toml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
1-
# Maximum number of channels to return per request
2-
max_channels = 512
3-
4-
channels_find_limit = 512
5-
campaigns_find_limit = 512
6-
spendable_find_limit = 512
7-
wait_time = 40000
8-
9-
msgs_find_limit = 10
10-
analytics_find_limit = 5000
11-
# in milliseconds
12-
analytics_maxtime = 15000
13-
14-
heartbeat_time = 60000
15-
health_threshold_promilles = 970
16-
health_unsignable_promilles = 770
17-
propagation_timeout = 3000
18-
19-
fetch_timeout = 10000
20-
all_campaigns_timeout = 10000
21-
channel_tick_timeout = 10000
1+
creators_whitelist = []
2+
validators_whitelist = []
223

4+
[limits]
5+
channels_find = 512
6+
campaigns_find = 512
7+
spendable_find = 512
8+
msgs_find = 10
9+
analytics_find = 5000
2310
# 2h
2411
ip_rate_limit = { type = 'ip', timeframe = 7200000 }
2512

26-
creators_whitelist = []
27-
validators_whitelist = []
13+
[limits.units_for_slot]
14+
# The maximum number of campaigns a publisher can earn from
15+
# This will limit the returned Campaigns to the set number
16+
max_campaigns_earning_from = 25
17+
# 0.01 (UnifiedNum) per 1000 impressions
18+
# 1_000 * (per) 1_000 / 10^8 = 0.01
19+
global_min_impression_price = '1000000'
20+
21+
[sentry]
22+
# in milliseconds
23+
analytics_maxtime = 15000
2824
# Galya (for analytics)
2925
admins = ['0x5d6A3F1AD7b124ecDFDf4841D9bB246eD5fBF04c']
3026

31-
[platform]
27+
[sentry.platform]
3228
# This should be changed for tests and use the wiremock url
3329
url = "https://platform.adex.network"
3430
# 20 minutes in milliseconds
3531
keep_alive_interval = 1200000
3632

37-
[limits.units_for_slot]
38-
# The maximum number of campaigns a publisher can earn from
39-
# This will limit the returned Campaigns to the set number
40-
max_campaigns_earning_from = 25
33+
[worker]
34+
# Maximum number of channels to return per request
35+
max_channels = 512
36+
wait_time = 40000
37+
heartbeat_time = 60000
38+
health_threshold_promilles = 970
39+
health_unsignable_promilles = 770
4140

42-
# 0.01 (UnifiedNum) per 1000 impressions
43-
# 1_000 * (per) 1_000 / 10^8 = 0.01
44-
global_min_impression_price = '1000000'
41+
[worker.timeouts]
42+
propagation = 3000
43+
fetch = 10000
44+
all_campaigns = 10000
45+
channel_tick = 10000
4546

4647
[chain."Ethereum Mainnet"]
4748
chain_id = 1

primitives/examples/get_cfg_response.rs

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,6 @@ use serde_json::{from_value, json};
33

44
fn main() {
55
let json = json!({
6-
"max_channels": 512,
7-
"channels_find_limit": 200,
8-
"campaigns_find_limit": 200,
9-
"spendable_find_limit": 200,
10-
"wait_time": 500,
11-
"msgs_find_limit": 10,
12-
"analytics_find_limit": 5000,
13-
"analytics_maxtime": 20000,
14-
"heartbeat_time": 30000,
15-
"health_threshold_promilles": 950,
16-
"health_unsignable_promilles": 750,
17-
"propagation_timeout": 2000,
18-
"fetch_timeout": 5000,
19-
"all_campaigns_timeout": 5000,
20-
"channel_tick_timeout": 8000,
21-
"ip_rate_limit": {
22-
"type": "ip",
23-
"timeframe": 1200000
24-
},
256
"creators_whitelist": [
267
"0xaCBaDA2d5830d1875ae3D2de207A1363B316Df2F",
278
"0xDd589B43793934EF6Ad266067A0d1D4896b0dff0",
@@ -33,9 +14,6 @@ fn main() {
3314
"0xf3f583AEC5f7C030722Fe992A5688557e1B86ef7",
3415
"0x6B83e7D6B72c098d48968441e0d05658dc17Adb9"
3516
],
36-
"admins": [
37-
"0x80690751969B234697e9059e04ed72195c3507fa"
38-
],
3917
"chain": {
4018
"Ganache #1337": {
4119
"chain_id": 1337,
@@ -64,14 +42,42 @@ fn main() {
6442
}
6543
}
6644
},
67-
"platform": {
68-
"url": "https://platform.adex.network/",
69-
"keep_alive_interval": 1200000
70-
},
7145
"limits": {
7246
"units_for_slot": {
7347
"max_campaigns_earning_from": 25,
7448
"global_min_impression_price": "10000"
49+
},
50+
"channels_find": 200,
51+
"campaigns_find": 200,
52+
"spendable_find": 200,
53+
"msgs_find": 10,
54+
"analytics_find": 5000,
55+
"ip_rate_limit": {
56+
"type": "ip",
57+
"timeframe": 1200000
58+
}
59+
},
60+
"sentry": {
61+
"analytics_maxtime": 20000,
62+
"admins": [
63+
"0x80690751969B234697e9059e04ed72195c3507fa"
64+
],
65+
"platform": {
66+
"url": "https://platform.adex.network/",
67+
"keep_alive_interval": 1200000
68+
},
69+
},
70+
"worker": {
71+
"max_channels": 512,
72+
"wait_time": 500,
73+
"heartbeat_time": 30000,
74+
"health_threshold_promilles": 950,
75+
"health_unsignable_promilles": 750,
76+
"timeouts": {
77+
"propagation": 2000,
78+
"fetch": 5000,
79+
"all_campaigns": 5000,
80+
"channel_tick": 8000,
7581
}
7682
}
7783
});

0 commit comments

Comments
 (0)