mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
* feat: add docs and CI workflow for publishing to onsonr.dev * (refactor): Move hway,motr executables to their own repos * feat: simplify devnet and testnet configurations * refactor: update import path for didcrypto package * docs(networks): Add README with project overview, architecture, and community links * refactor: Move network configurations to deploy directory * build: update golang version to 1.23 * refactor: move logger interface to appropriate package * refactor: Move devnet configuration to networks/devnet * chore: improve release process with date variable * (chore): Move Crypto Library * refactor: improve code structure and readability in DID module * feat: integrate Trunk CI checks * ci: optimize CI workflow by removing redundant build jobs --------- Co-authored-by: Darp Alakun <i@prad.nu>
49 lines
1.3 KiB
Go
Executable File
49 lines
1.3 KiB
Go
Executable File
//
|
|
// Copyright Coinbase, Inc. All Rights Reserved.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package gennaro
|
|
|
|
import (
|
|
"math/big"
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcd/btcec/v2"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/onsonr/sonr/crypto/core/curves"
|
|
"github.com/onsonr/sonr/crypto/internal"
|
|
)
|
|
|
|
var testGenerator, _ = curves.NewScalarBaseMult(btcec.S256(), big.NewInt(3333))
|
|
|
|
func TestNewParticipantWorks(t *testing.T) {
|
|
p, err := NewParticipant(1, 2, testGenerator, curves.NewK256Scalar(), 2)
|
|
require.NoError(t, err)
|
|
require.NotNil(t, p)
|
|
require.Equal(t, p.id, uint32(1))
|
|
require.Equal(t, p.round, 1)
|
|
require.Equal(t, p.curve, btcec.S256())
|
|
require.NotNil(t, p.pedersen)
|
|
require.NotNil(t, p.feldman)
|
|
require.Nil(t, p.pedersenResult)
|
|
require.NotNil(t, p.otherParticipantShares)
|
|
require.NotNil(t, p.scalar)
|
|
_, ok := p.otherParticipantShares[2]
|
|
require.True(t, ok)
|
|
}
|
|
|
|
func TestNewParticipantBadInputs(t *testing.T) {
|
|
_, err := NewParticipant(0, 0, nil, nil)
|
|
require.Error(t, err)
|
|
require.Equal(t, err, internal.ErrNilArguments)
|
|
_, err = NewParticipant(1, 2, nil, nil)
|
|
require.Error(t, err)
|
|
require.Equal(t, err, internal.ErrNilArguments)
|
|
_, err = NewParticipant(1, 2, testGenerator, nil)
|
|
require.Error(t, err)
|
|
require.Equal(t, err, internal.ErrNilArguments)
|
|
}
|