Skip to content

Commit

Permalink
Replaced curve instance elliptic.P256() with crypto.S256() (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashk767 authored Oct 13, 2023
1 parent 6aef029 commit 37e0b63
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 56 deletions.
4 changes: 2 additions & 2 deletions cmd/addStake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand All @@ -21,7 +21,7 @@ import (

func TestStakeCoins(t *testing.T) {

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

txnArgs := types.TransactionOptions{
Expand Down
4 changes: 2 additions & 2 deletions cmd/approve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package cmd
import (
"context"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
Types "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/mock"
"math/big"
"razor/core"
Expand All @@ -18,7 +18,7 @@ import (

func TestApprove(t *testing.T) {

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

type args struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/claimBounty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"io/fs"
"math/big"
"razor/cmd/mocks"
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestExecuteClaimBounty(t *testing.T) {
}

func TestClaimBounty(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

var config types.Configurations
Expand Down
4 changes: 2 additions & 2 deletions cmd/claimCommission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core/types"
"testing"
Expand All @@ -22,7 +22,7 @@ func TestClaimCommission(t *testing.T) {
var flagSet *pflag.FlagSet
var callOpts bind.CallOpts

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

type args struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
Types "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/mock"
"math/big"
Expand All @@ -27,7 +27,7 @@ func TestCommit(t *testing.T) {
seed []byte
epoch uint32
)
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

type args struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/confirm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/mock"
"math/big"
"razor/core"
Expand All @@ -20,7 +20,7 @@ import (
func TestClaimBlockReward(t *testing.T) {
var options types.TransactionOptions

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

type args struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/createCollection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand All @@ -20,7 +20,7 @@ import (

func TestCreateCollection(t *testing.T) {

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

var client *ethclient.Client
Expand Down
4 changes: 2 additions & 2 deletions cmd/createJob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand All @@ -23,7 +23,7 @@ func TestCreateJob(t *testing.T) {
var jobInput types.CreateJobInput
var config types.Configurations

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

type args struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/delegate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand All @@ -19,7 +19,7 @@ import (
)

func TestDelegate(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

var stakerId uint32 = 1
Expand Down
12 changes: 6 additions & 6 deletions cmd/dispute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/crypto"
"io/fs"
"math/big"
"razor/core/types"
Expand All @@ -22,7 +22,7 @@ import (
)

func TestDispute(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

var (
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestDispute(t *testing.T) {
}

func TestHandleDispute(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

var client *ethclient.Client
Expand Down Expand Up @@ -538,7 +538,7 @@ func TestHandleDispute(t *testing.T) {
}

func TestGiveSorted(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

nilDisputesMapping := types.DisputesStruct{
Expand Down Expand Up @@ -861,7 +861,7 @@ func TestCheckDisputeForIds(t *testing.T) {
blockIndex uint8
)

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

type args struct {
Expand Down Expand Up @@ -1142,7 +1142,7 @@ func BenchmarkGetCollectionIdPositionInBlock(b *testing.B) {
}

func BenchmarkHandleDispute(b *testing.B) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

var client *ethclient.Client
Expand Down
4 changes: 2 additions & 2 deletions cmd/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/spf13/pflag"
"github.com/stretchr/testify/mock"
"io/fs"
Expand All @@ -16,7 +16,7 @@ import (

func TestImportAccount(t *testing.T) {

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
var fileInfo fs.FileInfo

account := accounts.Account{Address: common.HexToAddress("0x000000000000000000000000000000000000dea1"),
Expand Down
6 changes: 3 additions & 3 deletions cmd/initiateWithdraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand All @@ -19,7 +19,7 @@ import (
)

func TestHandleUnstakeLock(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

var client *ethclient.Client
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestHandleUnstakeLock(t *testing.T) {
}

func TestWithdraw(t *testing.T) {
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

var client *ethclient.Client
Expand Down
4 changes: 2 additions & 2 deletions cmd/modifyCollectionStatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand Down Expand Up @@ -82,7 +82,7 @@ func TestCheckCurrentStatus(t *testing.T) {

func TestModifyAssetStatus(t *testing.T) {

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

var config types.Configurations
Expand Down
4 changes: 2 additions & 2 deletions cmd/propose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core/types"
"razor/pkg/bindings"
Expand All @@ -31,7 +31,7 @@ func TestPropose(t *testing.T) {
blockNumber *big.Int
)

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

salt := []byte{142, 170, 157, 83, 109, 43, 34, 152, 21, 154, 159, 12, 195, 119, 50, 186, 218, 57, 39, 173, 228, 135, 20, 100, 149, 27, 169, 158, 34, 113, 66, 64}
Expand Down
4 changes: 2 additions & 2 deletions cmd/resetUnstakeLock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand All @@ -20,7 +20,7 @@ import (

func TestExtendLock(t *testing.T) {

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(31337))

var extendLockInput types.ExtendLockInput
Expand Down
4 changes: 2 additions & 2 deletions cmd/reveal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/core"
"razor/core/types"
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestReveal(t *testing.T) {
var config types.Configurations
var epoch uint32

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

type args struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/setDelegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"errors"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"razor/cmd/mocks"
"razor/core"
Expand All @@ -31,7 +31,7 @@ func TestSetDelegation(t *testing.T) {
WaitTime: 1,
}

privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
privateKey, _ := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
txnOpts, _ := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1))

type args struct {
Expand Down
Loading

0 comments on commit 37e0b63

Please sign in to comment.