Skip to content

Commit fdde95b

Browse files
dabasovJayashsatolia403Hitenjain14Kishan-Dhakanlpoli
authored
Sprint 1.11 (#1279)
* Debug (#1232) * Revert "Debug (#1232)" (#1240) This reverts commit 49a5c9e. * Fix phase locking (#1230) (#1241) * add logs for 2 phase lock * add update log * add root in log * add update log * use update lock * add log in update repo * use save * use exec * log rows affected * use no key update * use repo update * cleanup * add defer * add defer * increase timeout by 5 mins * Case 3 and case 4 (#1198) * Send WM commit status to conductor * Rename file * Modify log type * Add state for stopping blobber from committing WM * Send file meta root to rpc server * Export function to use it in conductor client * Modify field type * Add code to get file meta root * Modify file meta root retrieval * Add field * Apply rename for conductor test based on conductor state * Add comment * Log error --------- Co-authored-by: Ebrahim Gomaa <[email protected]> * Feature/ Challenge based on rounds (#1226) * Fix * Updated gosdk * Fix * Fix * Fix * Logging * Debug * Fix * Fix * Debug * Debug * Debug * Fix unit tests * Logigng * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Fix * Fix * Updated gosdk * Fix * Fix * log config too * Fix phase locking (#1230) * add logs for 2 phase lock * add update log * add root in log * add update log * use update lock * add log in update repo * use save * use exec * log rows affected * use no key update * use repo update * cleanup * add defer * add defer * Fix * Added logging * Debug * Debug * Added reference to logs * Fix * Fix * Updated gosdk * Use slice instead of ll * Validator last 5 transactions * Fix * Fix * Updated gosdk * Resolved comments * Updated gosdk --------- Co-authored-by: Hitenjain14 <[email protected]> * Increase limit on number of open challenges per fetching (#1249) * Fix * Updated gosdk * Fix * Fix * Fix * Logging * Debug * Fix * Fix * Debug * Debug * Debug * Fix unit tests * Logigng * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Fix * Fix * Updated gosdk * Fix * Fix * log config too * Fix phase locking (#1230) * add logs for 2 phase lock * add update log * add root in log * add update log * use update lock * add log in update repo * use save * use exec * log rows affected * use no key update * use repo update * cleanup * add defer * add defer * Fix * Added logging * Debug * Debug * Added reference to logs * Fix * Fix * Updated gosdk * Use slice instead of ll * Validator last 5 transactions * Fix * Fix * Updated gosdk * Resolved comments * Updated gosdk * Fix * Increase time limit * Increase time limit * Fix * Fix * Fix * Fix * Debug * Debug * Debug * Fix * Fix * Fix * Cleanup logging --------- Co-authored-by: Hitenjain14 <[email protected]> * Refactor commit (#1239) * add szwg to commit * lock for query * aggregate queries * check len * rmv debug * only update file ref * move update fields to ref * fix numBlock download stats * rmv log * rmv commented collector code * Error on renaming dir (#1250) * throw err when renaming dir * fix unit test * Fix replace blobber (#1251) * Async processing (#1225) * fix pre download * rmv hash * add async processing * use range * fix unit test * fix delete change * add logs * fix unit test * fix delete cmd * save file ref * add conn timing logs * set default to 32MB * fix timing log * add inner lock * fix test * add ctx to cancel go routine * parallel write to file * fix connection * revert storage changes * empty commit * Fix phase locking (#1230) * add logs for 2 phase lock * add update log * add root in log * add update log * use update lock * add log in update repo * use save * use exec * log rows affected * use no key update * use repo update * cleanup * add defer * add defer * rmv allocObj from connObj * Download block limit (#1254) * add limit as 500 to numBlocks * add daily and req limit * fix test * fix test * Fix download stats (#1256) * fix download stats * fix typo * Fix empty alloc cleanup (#1252) * Fix replace blobber * Fix empty alloc cleanup * Debug Rounds fetch (#1255) * Fix * Updated gosdk * Fix * Fix * Fix * Logging * Debug * Fix * Fix * Debug * Debug * Debug * Fix unit tests * Logigng * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Updated gosdk * Fix * Fix * Updated gosdk * Fix * Fix * log config too * Fix phase locking (#1230) * add logs for 2 phase lock * add update log * add root in log * add update log * use update lock * add log in update repo * use save * use exec * log rows affected * use no key update * use repo update * cleanup * add defer * add defer * Fix * Added logging * Debug * Debug * Added reference to logs * Fix * Fix * Updated gosdk * Use slice instead of ll * Validator last 5 transactions * Fix * Fix * Updated gosdk * Resolved comments * Updated gosdk * Fix * Increase time limit * Increase time limit * Fix * Fix * Fix * Fix * Debug * Debug * Debug * Fix * Fix * Fix * Cleanup logging * Fix * Debug * Fix --------- Co-authored-by: Hitenjain14 <[email protected]> * remove prefix (#1257) * remove .gpg file if already exist * introduce flock to apt commands * check on docker context existance and install git * change buildx to action * refine buildx build name based on runner name * create docker context based on runner name * increase blobber and validator job timeout * Refine docker buildx creation and usage * Create Unique buildx per job per runner * remove qemu and upgrade go action version to v4 * changed runners labels build-&-publish-docker-image.yml * added server cleanup along with blobber build * ADD disk cleanup for conductor test * fix cleanup script * fix cleanup script * added sudo to perform cleanup * bypassing cleanup failure * bypassing cleanup failure for validators * Fix Save change (#1263) * add and update change * fix empty allocation id in change * add rename dir * Fix move change when srcPath is same as destPath (#1270) * fix move change when dest is same as src * add fileID for new ref * fix unit test * Fix challenge timing issue (#1277) * Fix challenge timing issue * Fix challenge timing issue * Fix challenge timing issue * bypass cleanup if it is already running (#1280) * Revert "Fix challenge timing issue (#1277)" (#1283) * Limit Max File Size on blobber (#1274) * Added update in config * 5TB config * Reverted max_file_size config on blobber and fetching from 0chain * Fix * Fix * Fix * Fix * Fix * Fix unit tests --------- Co-authored-by: dabasov <[email protected]> * add l2 caching for alloc (#1258) * add l2 caching for alloc * rmv return from commit repo * use update * fix update * add log * rmv update object * add log for allocation * move lock to middleware * fix save alloc update * empty commit * fix blobber size update * fix unit test * cleanup * rmv commit in initMap * fix unit test * fix renamefile mock db * add commit method to enhancedDB --------- Co-authored-by: Yury <[email protected]> * add list query param (#1273) * Optimize GetRefs, correct and add indexes on ref table (#1284) * Correct index on ref table, add path index for get refs optimization * Fix gorm tags on ref table * Fix typo * fix goose migration tags * add pg_trgm extension * sharder keep list (#1266) * changed get round * updated version * Fix/finalize (#1285) * Debug finalize * Debug finalize * Debug finalize * Debug finalize * Debug finalize * Fix finalize * Debug * Fix * FIX * Fixed * Fixed * fix list file (#1288) * Cleanup worker for challenge tables (#1278) * add cleanup worker for challenge tables * move cleanupGap to config --------- Co-authored-by: Yury <[email protected]> * add err check and increase wait time (#1289) * Client stats and blacklist (#1286) * add client stats and blacklist * add client stats check * fix goose migration * fix migration * fix typo --------- Co-authored-by: Yury <[email protected]> * Fix nested rename dir (#1295) * add log for rootRef * add objTreePath * fix rename nested dir * use save (#1297) * fix retry redeem wm check (#1299) * Use rename in place of copy buffer (#1298) * use rename than copy buffer * fix storage tests * fix update latest wm (#1301) * Fix blobber stats (#1305) * fix blobber stats * add stats worker * rmv listAlloc * build stats on start * Feat/remove native sc calls (#1306) * removed native MakeSCRestAPICall * removed native MakeSCRestAPICall --------- Co-authored-by: Jayash Satolia <[email protected]> * WM cleanup (#1296) * add cleanup worker for wm * add hdd tablespace * add log for hdd path * update default hdd path * update owner * add init db script * we are already creating with tablespace in initdb.sh * update initdb script.sh * update sql for write_markers_archive table --------- Co-authored-by: Manohar Reddy <[email protected]> Co-authored-by: Yury <[email protected]> * Fix/max file size updateWorker and added config for storagesc update interval (#1308) * Added worker for max file size * Added config for update worker * Debug * Added logs for update worker * Added fix for worker timings = * Debug * Debug * Debug * Debug * Debug * Removed logging * Removed logging * Refactor = * Refactor * fix tablespace permission issue in conductor test b0docker-compose.yml * Fix/cond tablespace (#1309) * updated docker-compose wrt conductor test tablspace * updated docker-compose wrt conductor test tablspace * updated docker-compose wrt conductor test tablspace * updated blobber env * update gosdk version to latest of sprint-1.11 (#1310) * fix blobber stats (#1314) * race condition fix (#1316) * Node recovery conductor tests (#1259) * notify on validator tickert generatd * fix race condition * Added changes for fail upload commit (#1318) * Feat/download verify ct (#1317) * notify on validator tickert generatd * fix race condition * miss up download for CT * debug logs * Improve download performance (#1315) * improve download file * write data * rmv content length * fix unit test * add new db snapshot migration (#1312) Co-authored-by: Yury <[email protected]> * fix commit error (#1320) * update gosdk (#1319) Co-authored-by: Yaroslav Svitlytskyi <[email protected]> * fix where statement (#1321) * Fix/loop break (#1322) * updated gosdk * add mutex * updated gosdk * merged changes * merged changes --------- Co-authored-by: Hitenjain14 <[email protected]> * Fix blobber stats panic (#1324) * Fix blobber stats panic * Fix * Fix * fix break in switch (#1326) * change hasher to blake3 (#1325) * change hasher to blake3 * add blake hash * fix lint * fix lint for hash write * update gosdk * Fix challenge worker (#1327) * revert changes * fix challenge worker * fix lint * add goto for accept case --------- Co-authored-by: Yury <[email protected]> * Config watcher (#1329) * add watch config * add on config change * Remove min lock demand from blobber (#1332) * fix alloc lock (#1334) * Feature: implement fork per run strategy (#1335) * feature: added fork creation * feature: improved Tenderly fork creation flow * Merge pull request #1336 * rmv wm lock table * fix unit tests * rmv write_locks table * rmv gorm tag * empty commit * Fix mem usage (#1337) * updated gosdk to blobber * change hasher to sha2 256 * fix unit test * changed runner for lint tests.yml --------- Co-authored-by: shahnawaz-creator <[email protected]> Co-authored-by: shahnawaz-creator <[email protected]> * fix rb for failed marker (#1342) * Fix lwm (#1338) * add wm log * fix log * fix update allocation * fix log * lru of value * fix alloc update * Fix auth ticket (#1341) * fix read auth ticket * fix unit test * convert to base64 * Fix expiration column name (#1343) * Fix expiration column name * Fix size param * merged changes * Revert "merged changes" This reverts commit 39f717a. * feature: added custom block number during Tenderly fork creation (#1345) * fix update alloc (#1347) * extended field for mimetype * add aws secrets for blobbers (#1349) * add aws secrets for blobbers * add validator secrets * typo * update logs --------- Co-authored-by: sanchit <sanchit4242.com> * Fix root hash (#1346) * add root logs * check alloc root * fix lint * rmv wm cleanup * fix lint * fix encrypted key point (#1350) * fix encrypted key point * check root ref precommit * update min-submit to 20% (#1348) * update gosdk to v1.11.0 (#1351) * fix wm retries (#1352) --------- Co-authored-by: Jayash Satolia <[email protected]> Co-authored-by: Hitenjain14 <[email protected]> Co-authored-by: Kishan Dhakan <[email protected]> Co-authored-by: Kishan Dhakan <[email protected]> Co-authored-by: Laxmi Prasad Oli <[email protected]> Co-authored-by: Ebrahim Gomaa <[email protected]> Co-authored-by: Amr Amin <[email protected]> Co-authored-by: shahnawaz-creator <[email protected]> Co-authored-by: shahnawaz-creator <[email protected]> Co-authored-by: tapishsinha-rs <[email protected]> Co-authored-by: Dinmukhammed Kambarov <[email protected]> Co-authored-by: Manohar Reddy <[email protected]> Co-authored-by: Yaroslav Svitlytskyi <[email protected]> Co-authored-by: Hitenjain14 <[email protected]> Co-authored-by: Sanchit Sharma <[email protected]>
1 parent d0bc790 commit fdde95b

File tree

118 files changed

+3090
-1409
lines changed

Some content is hidden

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

118 files changed

+3090
-1409
lines changed

.github/workflows/build-&-publish-docker-image.yml

Lines changed: 97 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- name: Cleanup before restarting conductor tests.
2828
run: |
29-
echo 'y' | docker system prune -a
29+
echo 'y' | docker system prune -a || true
3030
cd /tmp
3131
sudo rm -rf ./*
3232
@@ -99,7 +99,7 @@ jobs:
9999
steps:
100100
- name: Cleanup before restarting conductor tests.
101101
run: |
102-
echo 'y' | docker system prune -a
102+
echo 'y' | docker system prune -a || true
103103
cd /tmp
104104
sudo rm -rf ./*
105105
@@ -204,6 +204,90 @@ jobs:
204204
echo "NETWORK_URL=$(echo dev-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV
205205
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $GITHUB_ENV
206206
207+
- name: 'Setup jq'
208+
uses: dcarbone/[email protected]
209+
with:
210+
version: '1.7'
211+
force: 'false'
212+
213+
- name: "Create Tenderly fork"
214+
run: |
215+
echo "TENDERLY_CREATION_INFO=$(curl -X POST \
216+
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
217+
-H "Content-Type: application/json" \
218+
-d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \
219+
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV
220+
221+
- name: "Parse Tenderly fork creation transaction result"
222+
run: |
223+
echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV
224+
echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV
225+
226+
- name: "Retrieve Tenderly fork block number"
227+
run: |
228+
echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \
229+
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
230+
-H "Content-Type: application/json" \
231+
https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV
232+
233+
echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV
234+
235+
- name: "Transfer Bridge ownership in Tenderly fork"
236+
run: |
237+
echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \
238+
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
239+
-H "Content-Type: application/json" \
240+
-d '{
241+
"network_id": "1",
242+
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
243+
"transaction_index": null,
244+
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
245+
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
246+
"to": "0x7700d773022b19622095118fadf46f7b9448be9b",
247+
"gas": 8000000,
248+
"gas_price": "0",
249+
"value": "0",
250+
"access_list": [],
251+
"generate_access_list": true,
252+
"save": true,
253+
"source": "dashboard",
254+
"block_header": null,
255+
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
256+
"skip_fork_head_update": false,
257+
"alias": "",
258+
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
259+
}' \
260+
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV
261+
262+
echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV
263+
264+
- name: "Transfer Authorizers ownership in Tenderly fork"
265+
run: |
266+
curl -X POST \
267+
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
268+
-H "Content-Type: application/json" \
269+
-d '{
270+
"network_id": "1",
271+
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
272+
"transaction_index": null,
273+
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
274+
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
275+
"to": "0x481dab4407b9880de0a68dc62e6af611c4949e42",
276+
"gas": 8000000,
277+
"gas_price": "0",
278+
"value": "0",
279+
"access_list": [],
280+
"generate_access_list": true,
281+
"save": true,
282+
"source": "dashboard",
283+
"block_header": null,
284+
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
285+
"skip_fork_head_update": false,
286+
"alias": "",
287+
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
288+
}' \
289+
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate
290+
207291
- name: "Deploy 0Chain"
208292
uses: 0chain/actions/deploy-0chain@master
209293
with:
@@ -213,13 +297,12 @@ jobs:
213297
blobber_image: ${{ env.TAG }}-${{ env.SHORT_SHA }}
214298
validator_image: ${{ env.TAG }}-${{ env.SHORT_SHA }}
215299
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
216-
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
300+
TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }}
217301
graphnode_sc: ${{ secrets.GRAPHNODE_SC }}
218302
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }}
219-
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ secrets.TENDERLY_FORK_ID }}
303+
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }}
220304
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
221305

222-
223306
- name: "Run System tests"
224307
uses: 0chain/actions/run-system-tests@master
225308
with:
@@ -231,11 +314,19 @@ jobs:
231314
run_flaky_tests: false
232315
retry_failures: true
233316
run_smoke_tests: ${{ github.ref != 'refs/heads/staging' && github.base_ref != 'staging' && github.ref != 'refs/heads/master' && github.base_ref != 'master' }}
234-
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
317+
TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }}
235318
DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
236319
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
237320
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
238321

322+
- name: "Remove Tenderly fork"
323+
if: always()
324+
run: |
325+
curl -X DELETE \
326+
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
327+
-H "Content-Type: application/json" \
328+
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}
329+
239330
- name: "Set PR status as ${{ job.status }}"
240331
if: ${{ (success() || failure()) && steps.findPr.outputs.number }}
241332
uses: 0chain/actions/set-pr-status@master

.github/workflows/system_tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ jobs:
4646
DEV8KC: ${{ secrets.DEV8KC }}
4747
DEV9KC: ${{ secrets.DEV9KC }}
4848
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
49-
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
49+
TENDERLY_SECRET: ${{ secrets.TENDERLY_SECRET }}
5050
GRAPHNODE_NETWORK: ${{ secrets.GRAPHNODE_NETWORK }}
51-
GRAPHNODE_ETHEREUM_NODE_URL: https://rpc.tenderly.co/fork/${{ secrets.TENDERLY_FORK_ID }}
5251
DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
5352
GRAPHNODE_SC: ${{ secrets.GRAPHNODE_SC }}
5453
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
linter:
1414
name: Lints
15-
runs-on: [self-hosted,arc-runner]
15+
runs-on: [self-hosted,blobber-runner]
1616
steps:
1717
- name: Setup go
1818
uses: actions/setup-go@v3

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ Sample Response:
166166
terms:
167167
read_price: 26.874 mZCN / GB
168168
write_price: 26.874 mZCN / GB / time_unit
169-
min_lock_demand: 0.1
170169
cct: 2m0s
171170
max_offer_duration: 744h0m0s
172171
- id: 7a90e6790bcd3d78422d7a230390edc102870fe58c15472073922024985b1c7d
@@ -176,7 +175,6 @@ Sample Response:
176175
terms:
177176
read_price: 10.000 mZCN / GB
178177
write_price: 100.000 mZCN / GB / time_unit
179-
min_lock_demand: 0.1
180178
cct: 2m0s
181179
max_offer_duration: 744h0m0s
182180
- id: f65af5d64000c7cd2883f4910eb69086f9d6e6635c744e62afcfab58b938ee25
@@ -186,7 +184,6 @@ Sample Response:
186184
terms:
187185
read_price: 10.000 mZCN / GB
188186
write_price: 100.000 mZCN / GB / time_unit
189-
min_lock_demand: 0.1
190187
cct: 2m0s
191188
max_offer_duration: 744h0m0s
192189
- id: f8dc4aaf3bb32ae0f4ed575dd6931a42b75e546e07cb37a6e1c6aaf1225891c5
@@ -196,7 +193,6 @@ Sample Response:
196193
terms:
197194
read_price: 26.874 mZCN / GB
198195
write_price: 26.865 mZCN / GB / time_unit
199-
min_lock_demand: 0.1
200196
cct: 2m0s
201197
max_offer_duration: 744h0m0s
202198
```

code/go/0chain.net/blobber/config.go

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package main
33
import (
44
"context"
55
"fmt"
6-
"log"
7-
"time"
86

97
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/config"
108
"github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore"
@@ -29,76 +27,8 @@ func setupConfig(configDir string, deploymentMode int) {
2927
if config.Configuration.MountPoint == "" {
3028
panic("Please specify mount point in flag or config file")
3129
}
32-
config.Configuration.AllocDirLevel = viper.GetIntSlice("storage.alloc_dir_level")
33-
config.Configuration.FileDirLevel = viper.GetIntSlice("storage.file_dir_level")
34-
config.Configuration.DeploymentMode = byte(deploymentMode)
35-
config.Configuration.ChainID = viper.GetString("server_chain.id")
36-
config.Configuration.SignatureScheme = viper.GetString("server_chain.signature_scheme")
37-
38-
config.Configuration.OpenConnectionWorkerFreq = viper.GetInt64("openconnection_cleaner.frequency")
39-
config.Configuration.OpenConnectionWorkerTolerance = viper.GetInt64("openconnection_cleaner.tolerance")
40-
41-
config.Configuration.WMRedeemFreq = viper.GetInt64("writemarker_redeem.frequency")
42-
config.Configuration.WMRedeemNumWorkers = viper.GetInt("writemarker_redeem.num_workers")
43-
44-
config.Configuration.RMRedeemFreq = viper.GetInt64("readmarker_redeem.frequency")
45-
config.Configuration.RMRedeemNumWorkers = viper.GetInt("readmarker_redeem.num_workers")
46-
47-
config.Configuration.HealthCheckWorkerFreq = viper.GetDuration("healthcheck.frequency")
48-
49-
config.Configuration.ChallengeResolveFreq = viper.GetInt64("challenge_response.frequency")
50-
config.Configuration.ChallengeResolveNumWorkers = viper.GetInt("challenge_response.num_workers")
51-
config.Configuration.ChallengeMaxRetires = viper.GetInt("challenge_response.max_retries")
52-
53-
config.Configuration.AutomaticUpdate = viper.GetBool("disk_update.automatic_update")
54-
blobberUpdateIntrv := viper.GetDuration("disk_update.blobber_update_interval")
55-
if blobberUpdateIntrv <= 0 {
56-
blobberUpdateIntrv = 5 * time.Minute
57-
}
58-
config.Configuration.BlobberUpdateInterval = blobberUpdateIntrv
59-
60-
config.Configuration.PGUserName = viper.GetString("pg.user")
61-
config.Configuration.PGPassword = viper.GetString("pg.password")
62-
config.Configuration.DBHost = viper.GetString("db.host")
63-
config.Configuration.DBName = viper.GetString("db.name")
64-
config.Configuration.DBPort = viper.GetString("db.port")
65-
config.Configuration.DBUserName = viper.GetString("db.user")
66-
config.Configuration.DBPassword = viper.GetString("db.password")
67-
config.Configuration.DBTablesToKeep = viper.GetStringSlice("db.keep_tables")
68-
69-
config.Configuration.PriceInUSD = viper.GetBool("price_in_usd")
70-
71-
config.Configuration.WriteMarkerLockTimeout = viper.GetDuration("write_marker_lock_timeout")
72-
73-
config.Configuration.UpdateAllocationsInterval =
74-
viper.GetDuration("update_allocations_interval")
75-
76-
config.Configuration.MaxAllocationDirFiles =
77-
viper.GetInt("max_dirs_files")
78-
if config.Configuration.MaxAllocationDirFiles < 50000 {
79-
config.Configuration.MaxAllocationDirFiles = 50000
80-
}
81-
82-
config.Configuration.DelegateWallet = viper.GetString("delegate_wallet")
83-
if w := config.Configuration.DelegateWallet; len(w) != 64 {
84-
log.Fatal("invalid delegate wallet:", w)
85-
}
86-
87-
config.Configuration.MinSubmit = viper.GetInt("min_submit")
88-
if config.Configuration.MinSubmit < 1 {
89-
config.Configuration.MinSubmit = 50
90-
} else if config.Configuration.MinSubmit > 100 {
91-
config.Configuration.MinSubmit = 100
92-
}
93-
config.Configuration.MinConfirmation = viper.GetInt("min_confirmation")
94-
if config.Configuration.MinConfirmation < 1 {
95-
config.Configuration.MinConfirmation = 50
96-
} else if config.Configuration.MinConfirmation > 100 {
97-
config.Configuration.MinConfirmation = 100
98-
}
99-
10030
transaction.MinConfirmation = config.Configuration.MinConfirmation
101-
31+
config.ReadConfig(deploymentMode)
10232
fmt.Print(" [OK]\n")
10333
}
10434

code/go/0chain.net/blobber/datastore.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func setupDatabase() error {
3434

3535
time.Sleep(1 * time.Second)
3636
}
37-
3837
if err := migrateDatabase(pgDB); err != nil {
3938
return fmt.Errorf("error while migrating schema: %v", err)
4039
}
@@ -49,7 +48,7 @@ func migrateDatabase(db *gorm.DB) error {
4948
if err != nil {
5049
return err
5150
}
52-
51+
5352
goose.Migrate(sqlDB)
5453
return nil
5554
}

code/go/0chain.net/blobber/http.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func startHttpServer() {
2626
}
2727

2828
r := mux.NewRouter()
29-
initHandlers(r)
29+
initHandlers(r, config.Development())
3030

3131
var wg sync.WaitGroup
3232

@@ -36,7 +36,7 @@ func startHttpServer() {
3636
// start https server
3737
go startServer(&wg, r, mode, httpsPort, true)
3838

39-
logging.Logger.Info("Ready to listen to the requests")
39+
logging.Logger.Info("Ready to listen to the requests with development mode: " + mode)
4040
fmt.Print("> start http server [OK]\n")
4141

4242
wg.Wait()
@@ -104,12 +104,12 @@ func startServer(wg *sync.WaitGroup, r *mux.Router, mode string, port int, isTls
104104
}
105105
}
106106

107-
func initHandlers(r *mux.Router) {
107+
func initHandlers(r *mux.Router, devMode bool) {
108108
handler.StartTime = time.Now().UTC()
109109
r.HandleFunc("/", handler.HomepageHandler)
110110
handler.SetupHandlers(r)
111111
handler.SetupSwagger()
112-
common.SetAdminCredentials()
112+
common.SetAdminCredentials(devMode)
113113
}
114114

115115
func initProfHandlers(mux *http.ServeMux) {

code/go/0chain.net/blobber/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ func main() {
4848
panic(err)
4949
}
5050

51-
err := setCCTFromChain()
52-
if err != nil {
51+
if err := setStorageScConfigFromChain(); err != nil {
52+
logging.Logger.Error("Error setStorageScConfigFromChain" + err.Error())
5353
panic(err)
5454
}
5555

0 commit comments

Comments
 (0)