Skip to content

Commit

Permalink
feat: switch tss lib (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrun5 authored Feb 23, 2023
1 parent 2d902ba commit 673792c
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 79 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,3 @@ jobs:

- name: Run linter
run: golangci-lint run --timeout=10m

vet-check:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.18.x"
- uses: actions/checkout@v2

- name: Run go vet
run: go vet ./...
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Unit tests
run: GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore go test -timeout 30m -coverpkg=$CVPKG -coverprofile=cover.out -p=1 $(go list ./... | grep -v 'cbcli\|e2e\|tss')
- name: TSS tests
run: GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore go test -timeout 30m -p 1 -coverpkg=$CVPKG -coverprofile=cover.out -p=1 $(go list ./... | grep 'tss')
run: make test
- name: Cover
run: echo "COVER=$(go tool cover -func cover.out | grep total | awk '{print substr($3, 1, length($3)-1)}')" >> $GITHUB_ENV
- name: Create comment
Expand Down
12 changes: 6 additions & 6 deletions chains/evm/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"math/big"
"time"

tssSigning "github.com/binance-chain/tss-lib/ecdsa/signing"
"github.com/binance-chain/tss-lib/common"

ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/libp2p/go-libp2p/core/host"
Expand Down Expand Up @@ -122,7 +122,7 @@ func (e *Executor) Execute(msgs []*message.Message) error {
select {
case sigResult := <-sigChn:
{
signatureData := sigResult.(*tssSigning.SignatureData)
signatureData := sigResult.(*common.SignatureData)
hash, err := e.executeProposal(proposals, signatureData)
if err != nil {
go e.comm.Broadcast(e.host.Peerstore().Peers(), []byte{}, comm.TssFailMsg, sessionID, nil)
Expand Down Expand Up @@ -160,11 +160,11 @@ func (e *Executor) Execute(msgs []*message.Message) error {
}
}

func (e *Executor) executeProposal(proposals []*proposal.Proposal, signatureData *tssSigning.SignatureData) (*ethCommon.Hash, error) {
func (e *Executor) executeProposal(proposals []*proposal.Proposal, signatureData *common.SignatureData) (*ethCommon.Hash, error) {
sig := []byte{}
sig = append(sig[:], ethCommon.LeftPadBytes(signatureData.Signature.R, 32)...)
sig = append(sig[:], ethCommon.LeftPadBytes(signatureData.Signature.S, 32)...)
sig = append(sig[:], signatureData.Signature.SignatureRecovery...)
sig = append(sig[:], ethCommon.LeftPadBytes(signatureData.R, 32)...)
sig = append(sig[:], ethCommon.LeftPadBytes(signatureData.S, 32)...)
sig = append(sig[:], signatureData.SignatureRecovery...)
sig[len(sig)-1] += 27 // Transform V from 0/1 to 27/28

var gasLimit uint64
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ require (
)

require (
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12 // indirect
github.com/agl/ed25519 v0.0.0-20200305024217-f36fc4b53d43 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20211129182920-9c4bbabe7acd // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
Expand All @@ -40,7 +43,7 @@ require (
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/base58 v1.0.3 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
Expand All @@ -60,14 +63,12 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/go-log v1.0.4 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
Expand Down Expand Up @@ -109,8 +110,8 @@ require (
github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/opencontainers/runtime-spec v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/otiai10/primes v0.0.0-20180210170552-f6d2a1ba97c4 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/otiai10/primes v0.0.0-20210501021515-f1b2be525a11 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pierrec/xxHash v0.1.5 // indirect
Expand Down Expand Up @@ -169,7 +170,5 @@ require (

replace (
github.com/agl/ed25519 => github.com/binance-chain/edwards25519 v0.0.0-20200305024217-f36fc4b53d43
github.com/binance-chain/tss-lib => github.com/ChainSafe/tss-lib v1.4.0
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4
google.golang.org/protobuf => google.golang.org/protobuf v1.28.1
github.com/binance-chain/tss-lib => github.com/timoftime/threshlib v0.0.0-20230223114305-ead1433f2707
)
Loading

0 comments on commit 673792c

Please sign in to comment.