Skip to content

Commit 3b9cfae

Browse files
committed
v4.0.0
0 parents  commit 3b9cfae

204 files changed

Lines changed: 31481 additions & 0 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.

.github/workflows/gofmt.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Go-fmt
2+
on: push
3+
jobs:
4+
gofmt:
5+
name: Run Gofmt
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: Harden the runner (Audit all outbound calls)
10+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
11+
with:
12+
egress-policy: audit
13+
14+
- uses: actions/checkout@v5
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: 'stable'
18+
19+
- uses: Jerome1337/gofmt-action@d5eabd189843f1d568286a54578159978b7c0fb1 # v1.0.5

.github/workflows/govulncheck.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Go Vulnerability Check
2+
on:
3+
schedule:
4+
- cron: '0 0 * * 0' # Runs every Sunday at 12:00 AM (UTC)
5+
push:
6+
branches:
7+
- master
8+
- release/*
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
govulncheck:
15+
name: Run govulncheck
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Harden the runner (Audit all outbound calls)
19+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
20+
with:
21+
egress-policy: audit
22+
23+
- uses: actions/checkout@v5
24+
- uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
25+

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Go Test
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release/*
7+
pull_request:
8+
branches:
9+
- master
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test:
16+
name: Run Tests
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Harden the runner (Audit all outbound calls)
21+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
22+
with:
23+
egress-policy: audit
24+
25+
- uses: actions/checkout@v5
26+
- uses: actions/setup-go@v5
27+
with:
28+
go-version: 'stable'
29+
30+
- name: Run Tests
31+
run: make test_ci

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
build
2+
vendor
3+
benchdata
4+
.DS_Store
5+
6+
# Binaries for programs and plugins
7+
*.exe
8+
*.exe~
9+
*.dll
10+
*.so
11+
*.dylib
12+
13+
# Test binary, build with `go test -c`
14+
*.test
15+
16+
# Output of the go coverage tool, specifically when used with LiteIDE
17+
*.out
18+
19+
# IDE
20+
.idea/*
21+
!.idea/copyright/
22+
!.idea/codeStyles/
23+
*.swp
24+
.vscode/*.json
25+
26+
# Test fixtures
27+
test/*fixtures/*.json

.gitlab-ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
image: golang:latest
2+
3+
variables:
4+
# Please edit to your GitLab project
5+
REPO_NAME: gitlab.com/thorchaintss/tss-lib
6+
7+
# The problem is that to be able to use go get, one needs to put
8+
# the repository in the $GOPATH. So for example if your gitlab domain
9+
# is gitlab.com, and that your repository is namespace/project, and
10+
# the default GOPATH being /go, then you'd need to have your
11+
# repository in /go/src/gitlab.com/namespace/project
12+
# Thus, making a symbolic link corrects this.
13+
before_script:
14+
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
15+
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
16+
- cd $GOPATH/src/$REPO_NAME
17+
18+
stages:
19+
- test
20+
21+
22+
unit_tests:
23+
stage: test
24+
coverage: '/total:\s+\(statements\)\s+(\d+.\d+\%)/'
25+
script:
26+
- go test -timeout 60m -race -v -coverprofile=coverage.out ./...
27+
- go tool cover -func=coverage.out
28+
29+

.idea/codeStyles/Project.xml

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

.idea/codeStyles/codeStyleConfig.xml

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

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Io FinNet Group, Inc.
4+
Copyright (c) 2021 Swingby
5+
Copyright (c) 2019 Binance
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

Makefile

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
MODULE = github.com/iofinnet/tss-lib/v3
2+
PACKAGES = $(shell go list ./... | grep -v '/vendor/')
3+
UT_TIMEOUT = -timeout 60m
4+
UT_COVER = -covermode=atomic -cover
5+
UT_PACKAGES_LEVEL_0 = $(shell go list ./... | grep -v '/vendor/' | grep 'keygen' )
6+
UT_PACKAGES_LEVEL_1 = $(shell go list ./... | grep -v '/vendor/' | grep -v 'keygen' )
7+
8+
all: protob test
9+
10+
########################################
11+
### Protocol Buffers
12+
13+
protob:
14+
@echo "--> Building Protocol Buffers using buf"
15+
@go tool buf generate
16+
17+
########################################
18+
### Format
19+
20+
fmt:
21+
@go fmt ./...
22+
23+
lint:
24+
@golangci-lint run
25+
26+
build: protob
27+
go fmt ./...
28+
29+
########################################
30+
### Testing
31+
32+
test_unit_level0:
33+
@echo "--> Running Unit Tests - Level 0"
34+
@echo "!!! WARNING: This will take a long time :|"
35+
@echo "!!! WARNING: This will delete fixtures"
36+
go clean -testcache
37+
rm -f ./test/_ecdsa_fixtures/*json
38+
rm -f ./test/_schnorr_fixtures/*json
39+
go test -failfast ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_0)
40+
41+
42+
test_unit: test_unit_level0
43+
@echo "--> Running Unit Tests - Level 1"
44+
@echo "!!! WARNING: This will take a long time :|"
45+
go test -failfast ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_1)
46+
47+
test_unit_race_level0:
48+
@echo "--> Running Unit Tests (with Race Detection) - Level 0"
49+
@echo "!!! WARNING: This will take a long time :|"
50+
@echo "!!! WARNING: This will delete fixtures"
51+
go clean -testcache
52+
rm -f ./test/_ecdsa_fixtures/*json
53+
rm -f ./test/_schnorr_fixtures/*json
54+
go test -failfast -race ${UT_TIMEOUT} $(UT_PACKAGES_LEVEL_0)
55+
56+
test_unit_race: test_unit_race_level0
57+
@echo "--> Running Unit Tests (with Race Detection) - Level 1"
58+
@echo "!!! WARNING: This will take a long time :|"
59+
go test -failfast -race ${UT_TIMEOUT} ${UT_COVER} $(UT_PACKAGES_LEVEL_1)
60+
61+
test_unit_race_ci: test_unit_race_level0
62+
@echo "--> Running Unit Tests (with Race Detection) - Level 1"
63+
@echo "!!! WARNING: This will take a long time :|"
64+
go test -failfast -race ${UT_TIMEOUT} $(UT_PACKAGES_LEVEL_1)
65+
66+
test:
67+
make test_unit_race
68+
69+
test_ci:
70+
make test_unit_race_ci
71+
72+
########################################
73+
### Pre Commit
74+
75+
pre_commit: build test
76+
77+
########################################
78+
79+
# To avoid unintended conflicts with file names, always add to .PHONY
80+
# # unless there is a reason not to.
81+
# # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
82+
.PHONY: protob build test test_ci test_unit test_unit_race

SECURITY.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Security Policy
2+
3+
## Reporting a Bug or Vulnerability
4+
5+
For non-security problems please open an issue in this GitHub repository.
6+
7+
If you find any security issues please send a report confidentially to security@binance.com.
8+
9+
Please include notes about the impact of the issue and a walkthrough on how it can be exploited.
10+
11+
For severe security issues that completely breach the safety of the scheme or leak the secret shares we would be happy to reward you with a bounty based on the security impact and severity. Please include a link to this notice in your email.

0 commit comments

Comments
 (0)