Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint 1.11 #1303

Merged
merged 150 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
be52c1d
feature: added more test cases
YarikRevich Aug 15, 2023
d675c7a
fix: fixed existing test cases
YarikRevich Aug 24, 2023
07efc9f
fix: fixed bugs
YarikRevich Aug 25, 2023
8a82e5c
fix: fixed bugs
YarikRevich Aug 25, 2023
84787ff
fix: fixed bugs
YarikRevich Aug 25, 2023
14e845c
feature: added more test cases
YarikRevich Aug 25, 2023
8f71d48
feature: added more test cases
YarikRevich Aug 26, 2023
10c024d
fix: fixed bugs
YarikRevich Aug 26, 2023
0c5b2c8
fix: fixed bugs
YarikRevich Aug 26, 2023
e3c3b5b
fix: fixed bugs
YarikRevich Aug 26, 2023
5abf1a4
feature: added mocks
YarikRevich Aug 26, 2023
dc1a603
fix: fixed bugs
YarikRevich Aug 26, 2023
e9c9084
fix: fixed mocks
YarikRevich Aug 26, 2023
f54cd79
fix: fixed bugs
YarikRevich Aug 26, 2023
b4b0d6c
fix: fixed bugs
YarikRevich Aug 26, 2023
c2f314c
fix: fixed bugs
YarikRevich Aug 26, 2023
38cb120
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Aug 26, 2023
5b131ed
fix: fixed bugs
YarikRevich Aug 29, 2023
fcad306
Merge branch 'feature/zcnbridge-tests' of https://github.com/0chain/g…
YarikRevich Aug 29, 2023
f65eecf
fix: fixed bugs
YarikRevich Aug 29, 2023
852ccc5
fix: fixed bugs
YarikRevich Aug 29, 2023
2440669
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Aug 29, 2023
9886d26
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Aug 30, 2023
9a51ef3
fix: made components internal
YarikRevich Aug 30, 2023
bab761b
Merge branch 'feature/zcnbridge-tests' of https://github.com/0chain/g…
YarikRevich Aug 30, 2023
47cfad4
Add webstreaming to multiupload (#1190)
din-mukhammed Aug 28, 2023
0e1c494
fix dup upload consensus (#1195)
Hitenjain14 Aug 28, 2023
d533a8f
Fix multiupload completed callback (#1172)
din-mukhammed Aug 29, 2023
da1e646
Feat/update methods in WinSDK (#1198)
cnlangzi Aug 30, 2023
f18a038
delete dir in repair (#1196)
Hitenjain14 Aug 30, 2023
e12de4c
fix: fixed bugs
YarikRevich Aug 30, 2023
3cc6512
Merge branch 'feature/zcnbridge-tests' of https://github.com/0chain/g…
YarikRevich Aug 30, 2023
30178b0
fix: fixed bugs
YarikRevich Aug 30, 2023
74245ed
fix: fixed bugs
YarikRevich Aug 30, 2023
bcf10e0
Merge branch 'sprint-1.10' into feature/zcnbridge-tests
YarikRevich Sep 1, 2023
b3dd990
Merge branch 'sprint-1.11' into feature/zcnbridge-tests
YarikRevich Sep 3, 2023
8dd3c11
fix: fixed bugs
YarikRevich Sep 9, 2023
28d7bd5
Merge branch 'feature/zcnbridge-tests' of github.com:0chain/gosdk int…
YarikRevich Sep 9, 2023
c4c3528
Add NFT Config contract (#1212)
peterlimg Sep 9, 2023
d94e9f4
Silent the zcnbridge http request when --silent (#1207)
peterlimg Sep 9, 2023
dcde112
Merge github.com:0chain/gosdk into feature/zcnbridge-tests
YarikRevich Sep 9, 2023
c4193dd
Merge branch 'sprint-1.11' of github.com:0chain/gosdk into feature/zc…
YarikRevich Sep 9, 2023
c53c7c9
Merge pull request #1173 from 0chain/feature/zcnbridge-tests
Kishan-Dhakan Sep 9, 2023
075ca32
Change the return type of downloadBlocks to []byte in wasm (#1218)
boddumanohar Sep 11, 2023
d5d6721
change the order of exchanges to get the ZCN prices (#1216)
boddumanohar Sep 11, 2023
5fa2a66
Deprecate non multi-operation functions (#1214)
boddumanohar Sep 11, 2023
1c9f143
Updated self hosted macos runner (#1219)
shahnawaz-creator Sep 12, 2023
bd1c685
remove path header, fix ws tag (#1220)
din-mukhammed Sep 13, 2023
58e7ff5
Feature/ Challenge based on rounds (#1191)
Jayashsatolia403 Sep 15, 2023
adbbd82
expose send in wasm (#1225)
boddumanohar Sep 16, 2023
3f83c7b
fix rename dir err (#1226)
Hitenjain14 Sep 17, 2023
522e90c
Txnfee send (#1227)
boddumanohar Sep 20, 2023
0d64999
add rename dir (#1230)
Hitenjain14 Sep 24, 2023
b8df9ab
Async read (#1213)
Hitenjain14 Sep 24, 2023
684e1aa
Wasm for `move`, `rename`, `copy` (#1233)
boddumanohar Sep 24, 2023
0ffbf8a
Feat/streaming server in winsdk (#1228)
cnlangzi Sep 25, 2023
49e6b13
fix move when srcPath is same as destPath (#1239)
Hitenjain14 Sep 30, 2023
86d5d01
fix(upload):fixed invalid ffmpeg command in transcode feature (#1236)
cnlangzi Sep 30, 2023
a0aa9f7
Fix web streaming - wasm (#1237)
peterlimg Oct 2, 2023
160f7df
Add concurrency control (#1245)
Hitenjain14 Oct 5, 2023
d3fd0b0
Fix/stream tests (#1247)
cnlangzi Oct 6, 2023
5990f59
fix share consensus (#1246)
Hitenjain14 Oct 6, 2023
b8cad24
List optimization (#1240)
Hitenjain14 Oct 9, 2023
2f6b575
added sharders keep list (#1231)
dabasov Oct 9, 2023
3d9659e
chec alloc and prev alloc root (#1250)
Hitenjain14 Oct 10, 2023
4c07b1f
add check for chunkNumber (#1253)
Hitenjain14 Oct 11, 2023
fc0b346
split-key handler implemented in wasm sdk
Ash-KODES Oct 14, 2023
edf92cb
chnaging go version for cdn
Ash-KODES Oct 14, 2023
84f3793
bumped version
Ash-KODES Oct 14, 2023
778787a
minor refactoring
Ash-KODES Oct 15, 2023
32cdf30
bumping wasm_exec.js version
Ash-KODES Oct 15, 2023
4113b9a
Refactoring unnecessary structs
Ash-KODES Oct 16, 2023
0f61a49
create new conID (#1256)
Hitenjain14 Oct 16, 2023
acc4fcd
debugging consoles added
Ash-KODES Oct 17, 2023
0266a16
Merge branch 'sprint-1.11' into split-keys-handlers
dabasov Oct 17, 2023
0c75fad
fix statusbar update (#1257)
Hitenjain14 Oct 18, 2023
61af2ef
lint fixes
Ash-KODES Oct 18, 2023
5fb102a
lint ignore
Ash-KODES Oct 18, 2023
b73828c
nolint: unused added
Ash-KODES Oct 18, 2023
4f9b645
Merge pull request #1255 from 0chain/split-keys-handlers
Ash-KODES Oct 18, 2023
f58eb31
use httpdo for create connection (#1259)
Hitenjain14 Oct 20, 2023
937ae61
Add create dir in repair (#1262)
Hitenjain14 Oct 25, 2023
3ae631d
add desc for transaction data (#1263)
boddumanohar Oct 26, 2023
b15f973
Feature: provide audit zcnswap and refactor if needed (#1205)
YarikRevich Oct 26, 2023
e992911
Feat/exposed cli methods in winsdk (#1248)
cnlangzi Oct 27, 2023
39776e7
Fix/fail shardedr on bad code (#1264)
dabasov Oct 29, 2023
23d9799
Fix/roll logs (#1266)
dabasov Oct 29, 2023
f9e9aab
fix:download file/thumbnail by authticket in winsdk (#1265)
cnlangzi Oct 30, 2023
5a85b2b
feat(winsdk): added GetWalletBalance (#1267)
cnlangzi Oct 31, 2023
201b8bd
enabled gosdk update for sprint branches (#1268)
shahnawaz-creator Nov 1, 2023
a356c00
Revert "enabled gosdk update for sprint branches (#1268)" (#1269)
shahnawaz-creator Nov 1, 2023
d3c786a
fix in progress callback (#1270)
Hitenjain14 Nov 4, 2023
f7075dc
Cleanup update terms from update allocation (#1274)
Jayashsatolia403 Nov 7, 2023
7c85498
Improve download performance (#1271)
Hitenjain14 Nov 9, 2023
f3a75f7
feature: add reset nonce for bridge (#1279)
YarikRevich Nov 10, 2023
78290c5
Add registerAuthorizer to wasm (#1275)
peterlimg Nov 11, 2023
840f5ed
Hotfix/parse hostname error (#1241)
dabasov Nov 11, 2023
6ffe3b7
Adding RegisterAuthorizer method in wasmsdk (#1273)
Ash-KODES Nov 12, 2023
17a9355
upload optimization (#1281)
Hitenjain14 Nov 14, 2023
10b6a4a
added logging
dabasov Nov 15, 2023
fafce3c
added logging
dabasov Nov 15, 2023
895c7f0
hotfix
dabasov Nov 15, 2023
48cf793
hotfix
dabasov Nov 15, 2023
8446894
experiment
dabasov Nov 15, 2023
6834b05
experiment
dabasov Nov 15, 2023
65a0152
experiment
dabasov Nov 15, 2023
6b6578b
experiment
dabasov Nov 15, 2023
3a23f3f
experiment
dabasov Nov 15, 2023
68d4190
experiment
dabasov Nov 15, 2023
b6be0b5
experiment
dabasov Nov 15, 2023
6313cb8
experiment
dabasov Nov 15, 2023
9f65b2e
experiment
dabasov Nov 15, 2023
d4821f8
experiment
dabasov Nov 15, 2023
050270f
experiment
dabasov Nov 15, 2023
ceff40f
Sprint 1.11 revert (#1284)
dabasov Nov 16, 2023
717dfe3
rmv channel hasher (#1285)
Hitenjain14 Nov 16, 2023
69a53a3
Fix submit txn (#1287)
Jayashsatolia403 Nov 17, 2023
1dc0f7f
Feature: add BNT, USDC and EURC tokens for Swap (#1277)
YarikRevich Nov 19, 2023
6c5dafc
change hasher (#1288)
Hitenjain14 Nov 21, 2023
9d9f249
Import eth wallet with index (#1292)
peterlimg Nov 22, 2023
bf2d3ec
Feat/import-account-idx (#1294)
peterlimg Nov 23, 2023
434dd6a
Add account bip32 option (#1295)
peterlimg Nov 23, 2023
5a931d2
Fix allocation min lock (#1297)
Jayashsatolia403 Nov 24, 2023
c601526
create PRs to dependent repos when a PR is merged to sprint branches …
boddumanohar Nov 26, 2023
9a527cc
Removed padding from the CryptoJS Encrypt and Decrypt functions funct…
tanishq67 Nov 26, 2023
f3e6600
Fix allocation min lock
Jayashsatolia403 Nov 26, 2023
be14335
Merge pull request #1302 from 0chain/fix/min-lock
guruhubb Nov 26, 2023
9857209
change chunkNumber for wasm (#1304)
Hitenjain14 Nov 28, 2023
5737a99
Feature: implement fork per run strategy (#1299)
YarikRevich Nov 29, 2023
4b1b205
fix parse error (#1309)
Hitenjain14 Nov 30, 2023
ee87ed9
Fix memory usage (#1311)
Hitenjain14 Dec 2, 2023
218d3ed
Fix iso header (#1314)
Hitenjain14 Dec 3, 2023
4d5dc8f
Fix zboxcore min submit (#1315)
Jayashsatolia403 Dec 3, 2023
f45ed6b
Revert "Fix iso header (#1314)" (#1317)
Hitenjain14 Dec 4, 2023
f2d30c5
Add upload for empty file (#1316)
Hitenjain14 Dec 4, 2023
2a794a0
fix empty upload (#1320)
Hitenjain14 Dec 5, 2023
223ba2c
fix read auth ticket (#1319)
Hitenjain14 Dec 5, 2023
60d8a76
allocation validation for data parity shards (#1321)
boddumanohar Dec 6, 2023
c26e571
fix git action to raise PRs to update gosdk (#1313)
boddumanohar Dec 10, 2023
9b9b8e0
feature: added custom block number during Tenderly fork creation (#1323)
YarikRevich Dec 10, 2023
aa9db0a
Fix/retry tx on nonce error (#1322)
dabasov Dec 11, 2023
e3b28c1
Fix wm rollback (#1324)
Hitenjain14 Dec 12, 2023
d74e39c
Cleanup free storage update allocation (#1325)
Jayashsatolia403 Dec 13, 2023
310edbb
remove batch size (#1327)
Hitenjain14 Dec 13, 2023
61e65f2
fix retry op callback (#1329)
Hitenjain14 Dec 15, 2023
58e0df0
Revert "remove batch size (#1327)" (#1328)
Hitenjain14 Dec 15, 2023
bee24b7
Add `force` param for getAllocationBlobbers wasm (#1330)
peterlimg Dec 16, 2023
3d993d0
fix retry callback (#1331)
Hitenjain14 Dec 17, 2023
b7a1596
Fix fill panic (#1334)
Hitenjain14 Dec 18, 2023
03f9a47
Merge branch 'staging' into sprint-1.11
dabasov Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions .github/workflows/build-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ jobs:

echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"

elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"

# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
Expand Down Expand Up @@ -159,17 +159,17 @@ jobs:
run: |
tag=$(echo ${GITHUB_REF#refs/tags/})
echo ${tag}

if [[ "${{github.event_name}}" = "workflow_dispatch" ]]; then
echo "> 0Chain: trigger from workflow_dispatch"

echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"


elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"

# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
Expand Down Expand Up @@ -237,10 +237,10 @@ jobs:

echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"

elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"

# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
Expand All @@ -263,7 +263,6 @@ jobs:
path: |
zcncore-macos.tar.gz


build-windows:
name: Build-windows
runs-on: [self-hosted, arc-runner]
Expand Down Expand Up @@ -306,10 +305,10 @@ jobs:

echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"

elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"

# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
Expand All @@ -331,3 +330,29 @@ jobs:
name: zcn-windows
path: |
zcn-windows.zip

build-wasm:
name: Build-wasm
runs-on: [self-hosted, arc-runner]
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v2
with:
go-version: ^1.20

- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget

- name: Build
run: docker run --rm -v $PWD:/gosdk -w /gosdk golang:1.20 make wasm-build

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: zcn.wasm
path: zcn.wasm
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.18
go-version: ^1.20

- name: Checkout repository
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/system_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ jobs:
DEV8KC: ${{ secrets.DEV8KC }}
DEV9KC: ${{ secrets.DEV9KC }}
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
TENDERLY_SECRET: ${{ secrets.TENDERLY_SECRET }}
DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
GRAPHNODE_SC: ${{ secrets.GRAPHNODE_SC }}
GRAPHNODE_NETWORK: ${{ secrets.GRAPHNODE_NETWORK }}
GRAPHNODE_ETHEREUM_NODE_URL: https://rpc.tenderly.co/fork/${{ secrets.TENDERLY_FORK_ID }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}

98 changes: 95 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,90 @@ jobs:
echo "NETWORK_URL=$(echo dev-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $GITHUB_ENV

- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2.1.0
with:
version: '1.7'
force: 'false'

- name: "Create Tenderly fork"
run: |
echo "TENDERLY_CREATION_INFO=$(curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV

- name: "Parse Tenderly fork creation transaction result"
run: |
echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV
echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV

- name: "Retrieve Tenderly fork block number"
run: |
echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV

echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV

- name: "Transfer Bridge ownership in Tenderly fork"
run: |
echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"network_id": "1",
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
"transaction_index": null,
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
"to": "0x7700d773022b19622095118fadf46f7b9448be9b",
"gas": 8000000,
"gas_price": "0",
"value": "0",
"access_list": [],
"generate_access_list": true,
"save": true,
"source": "dashboard",
"block_header": null,
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
"skip_fork_head_update": false,
"alias": "",
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV

echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV

- name: "Transfer Authorizers ownership in Tenderly fork"
run: |
curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"network_id": "1",
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
"transaction_index": null,
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
"to": "0x481dab4407b9880de0a68dc62e6af611c4949e42",
"gas": 8000000,
"gas_price": "0",
"value": "0",
"access_list": [],
"generate_access_list": true,
"save": true,
"source": "dashboard",
"block_header": null,
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
"skip_fork_head_update": false,
"alias": "",
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate

- name: "Deploy 0Chain"
uses: 0chain/actions/deploy-0chain@master
with:
Expand All @@ -116,10 +200,10 @@ jobs:
teardown_condition: "TESTS_PASSED"
custom_go_sdk_version: ${{ env.CURRENT_BRANCH_HEAD }}
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }}
graphnode_sc: ${{ secrets.GRAPHNODE_SC }}
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }}
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ secrets.TENDERLY_FORK_ID }}
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}

- name: "Run System tests"
Expand All @@ -135,11 +219,19 @@ jobs:
retry_failures: true
run_frontend_tests: true
run_smoke_tests: ${{ github.ref != 'refs/heads/staging' && github.base_ref != 'staging' && github.ref != 'refs/heads/master' && github.base_ref != 'master' }}
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }}
DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}

- name: "Remove Tenderly fork"
if: always()
run: |
curl -X DELETE \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}

- name: "Set PR status as ${{ job.status }}"
if: ${{ (success() || failure()) && steps.findPr.outputs.number }}
uses: 0chain/actions/set-pr-status@master
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gosdk-build: gomod-download
go build -x -v -tags bn256 ./...

wasm-build: getrev
CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -o ./zcn.wasm ./wasmsdk
CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -buildvcs=false -o ./zcn.wasm ./wasmsdk

wasm-test: wasm-build
env -i $(shell go env) PATH="$(shell go env GOROOT)/misc/wasm:$(PATH)" CGO_ENABLED=0 GOOS=js GOARCH=wasm go test -v github.com/0chain/gosdk/wasmsdk/jsbridge/...
Expand Down
4 changes: 2 additions & 2 deletions core/conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

const (
// DefaultMinSubmit default value for min_submit
DefaultMinSubmit = 50
DefaultMinSubmit = 10
// DefaultMinConfirmation default value for min_confirmation
DefaultMinConfirmation = 50
DefaultMinConfirmation = 10
// DefaultMaxTxnQuery default value for max_txn_query
DefaultMaxTxnQuery = 5
// DefaultConfirmationChainLength default value for confirmation_chain_length
Expand Down
4 changes: 2 additions & 2 deletions core/conf/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestLoadConfig(t *testing.T) {
return mockDefaultReader()
},
run: func(r *require.Assertions, cfg Config) {
r.Equal(50, cfg.MinSubmit)
r.Equal(10, cfg.MinSubmit)
},
},
{
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestLoadConfig(t *testing.T) {
return mockDefaultReader()
},
run: func(r *require.Assertions, cfg Config) {
r.Equal(50, cfg.MinConfirmation)
r.Equal(10, cfg.MinConfirmation)
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions core/conf/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ func GetClientConfig() (*Config, error) {
// InitClientConfig set global client config
func InitClientConfig(c *Config) {
onceCfg.Do(func() {
sharderConsensous := c.SharderConsensous
if sharderConsensous < 1 {
sharderConsensous = DefaultSharderConsensous
}
cfg = c
cfg.SharderConsensous = sharderConsensous
})
}

Expand Down
18 changes: 18 additions & 0 deletions core/encryption/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/sha1"
"encoding/hex"

"github.com/minio/sha256-simd"
"golang.org/x/crypto/sha3"
)

Expand Down Expand Up @@ -35,6 +36,23 @@ func RawHash(data interface{}) []byte {
return hash.Sum(buf)
}

func ShaHash(data interface{}) []byte {
var databuf []byte
switch dataImpl := data.(type) {
case []byte:
databuf = dataImpl
case HashBytes:
databuf = dataImpl[:]
case string:
databuf = []byte(dataImpl)
default:
panic("unknown type")
}
hash := sha256.New()
_, _ = hash.Write(databuf)
return hash.Sum(nil)
}

/*FastHash - sha1 hash the given data and return the hash as hex string */
func FastHash(data interface{}) string {
return hex.EncodeToString(RawFastHash(data))
Expand Down
53 changes: 53 additions & 0 deletions core/node/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package node

import (
"sync"
)

var Cache *NonceCache
var once sync.Once

type NonceCache struct {
cache map[string]int64
guard sync.Mutex
sharders *NodeHolder
}

func InitCache(sharders *NodeHolder) {
Cache.sharders = sharders
}

func init() {
once.Do(func() {
Cache = &NonceCache{
cache: make(map[string]int64),
}
})
}

func (nc *NonceCache) GetNextNonce(clientId string) int64 {
nc.guard.Lock()
defer nc.guard.Unlock()
if _, ok := nc.cache[clientId]; !ok {
nonce, _, err := nc.sharders.GetNonceFromSharders(clientId)
if err != nil {
nonce = 0
}
nc.cache[clientId] = nonce
}

nc.cache[clientId] += 1
return nc.cache[clientId]
}

func (nc *NonceCache) Set(clientId string, nonce int64) {
nc.guard.Lock()
defer nc.guard.Unlock()
nc.cache[clientId] = nonce
}

func (nc *NonceCache) Evict(clientId string) {
nc.guard.Lock()
defer nc.guard.Unlock()
delete(nc.cache, clientId)
}
Loading
Loading