Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ docker-cluster-start-skipbuild: docker-cluster-stop build-docker-node
# Stop 4-node docker containers
docker-cluster-stop:
@cd docker && USERID=$(shell id -u) GROUPID=$(shell id -g) GOCACHE=$(shell go env GOCACHE) docker compose down
.PHONY: localnet-stop
.PHONY: localnet-stop ddd


# Implements test splitting and running. This is pulled directly from
Expand Down
4 changes: 2 additions & 2 deletions aclmapping/confidentialtransfers/mappings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ func cacheTxContext(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) {
}

func (suite *KeeperTestSuite) SetupAccountState(privateKey *ecdsa.PrivateKey, denom string, pendingBalanceCreditCounter uint16, initialAvailableBalance, initialPendingBalance, bankAmount uint64) (types.Account, error) {
aesKey, err := encryption.GetAESKey(*privateKey, denom)
aesKey, err := utils.GetAESKey(*privateKey, denom)
if err != nil {
return types.Account{}, err
}

teg := elgamal.NewTwistedElgamal()
keypair, err := teg.KeyGen(*privateKey, denom)
keypair, err := utils.GetElGamalKeyPair(*privateKey, denom)
if err != nil {
return types.Account{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/rs/cors v1.8.2
github.com/rs/zerolog v1.30.0
github.com/sei-protocol/goutils v0.0.2
github.com/sei-protocol/sei-cryptography v0.0.0-20241210180444-0707767a7b5c
github.com/sei-protocol/sei-cryptography v0.0.0-20241210192144-b20fa09be987
github.com/sei-protocol/sei-db v0.0.27-0.20240123064153-d6dfa112e760
github.com/sirkon/goproxy v1.4.8
github.com/spf13/cast v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1357,8 +1357,8 @@ github.com/sei-protocol/goutils v0.0.2 h1:Bfa7Sv+4CVLNM20QcpvGb81B8C5HkQC/kW1CQp
github.com/sei-protocol/goutils v0.0.2/go.mod h1:iYE2DuJfEnM+APPehr2gOUXfuLuPsVxorcDO+Tzq9q8=
github.com/sei-protocol/sei-cosmos v0.3.49 h1:BcTCBsVwi4w1+rYYINZmp4zC1QX3r6bo5Hr7wCopOAc=
github.com/sei-protocol/sei-cosmos v0.3.49/go.mod h1:XC417pB6NwxP/cQ2XTSZLzVnP8dMZ//4uCXS3SxFgoM=
github.com/sei-protocol/sei-cryptography v0.0.0-20241210180444-0707767a7b5c h1:D61M4HdCr8+ZcWlCKcIgMxWuP5WXpYJdr06GHP4jR8U=
github.com/sei-protocol/sei-cryptography v0.0.0-20241210180444-0707767a7b5c/go.mod h1:f/oIFwPFDt44P++D3F4htauoACnwkiHuDkb2h3oPoa4=
github.com/sei-protocol/sei-cryptography v0.0.0-20241210192144-b20fa09be987 h1:l2EcEUO2rThRIvqIlnJQvqSOwutSbuY01xf1gbgx4qM=
github.com/sei-protocol/sei-cryptography v0.0.0-20241210192144-b20fa09be987/go.mod h1:274GmYGRLVKlf/XcOx4SI2kmq1tJQYzlqboK9RNA9Q8=
github.com/sei-protocol/sei-db v0.0.46 h1:naXfSp1I3UgJJm/iSvXpdFzr9nofEOxp/EekcAVj7wY=
github.com/sei-protocol/sei-db v0.0.46/go.mod h1:m5g7p0QeAS3dNJHIl28zQpzOgxQmvYqPb7t4hwgIOCA=
github.com/sei-protocol/sei-iavl v0.2.0 h1:OisPjXiDT+oe+aeckzDEFgkZCYuUjHgs/PP8DPicN+I=
Expand Down
9 changes: 4 additions & 5 deletions loadtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
"syscall"
"time"

"github.com/ethereum/go-ethereum/crypto"
"github.com/sei-protocol/sei-cryptography/pkg/encryption/elgamal"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -37,6 +34,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"golang.org/x/sync/semaphore"
"golang.org/x/time/rate"
Expand All @@ -45,6 +43,8 @@ import (
"github.com/sei-protocol/sei-chain/utils/metrics"
cttypes "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"
tokenfactorytypes "github.com/sei-protocol/sei-chain/x/tokenfactory/types"

ctutils "github.com/sei-protocol/sei-chain/x/confidentialtransfers/utils"
)

var TestConfig EncodingConfig
Expand Down Expand Up @@ -579,8 +579,7 @@ func (c *LoadTestClient) generateMessage(key cryptotypes.PrivKey, msgType string
receiverPrivHex := hex.EncodeToString(receiverKey.Bytes())
receiverEcdsaKey, _ := crypto.HexToECDSA(receiverPrivHex)

teg := elgamal.NewTwistedElgamal()
receiverKeyPair, _ := teg.KeyGen(*receiverEcdsaKey, CtDefaultDenom)
receiverKeyPair, _ := ctutils.GetElGamalKeyPair(*receiverEcdsaKey, CtDefaultDenom)
senderAddress := sdk.AccAddress(key.PubKey().Address()).String()
receiverAddress := sdk.AccAddress(receiverKey.PubKey().Address()).String()
senderAccount := c.getCtAccount(senderAddress, CtDefaultDenom)
Expand Down
6 changes: 3 additions & 3 deletions x/confidentialtransfers/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx"
"github.com/gogo/protobuf/proto"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"
"github.com/sei-protocol/sei-cryptography/pkg/encryption"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/utils"
"github.com/sei-protocol/sei-cryptography/pkg/encryption/elgamal"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -109,13 +109,13 @@ func queryAccount(cmd *cobra.Command, args []string) error {
return err
}

aesKey, err := encryption.GetAESKey(*privateKey, denom)
aesKey, err := utils.GetAESKey(*privateKey, denom)
if err != nil {
return err
}

decryptor := elgamal.NewTwistedElgamal()
keyPair, err := decryptor.KeyGen(*privateKey, denom)
keyPair, err := utils.GetElGamalKeyPair(*privateKey, denom)
if err != nil {
return err
}
Expand Down
11 changes: 7 additions & 4 deletions x/confidentialtransfers/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ package keeper_test

import (
"crypto/ecdsa"
"crypto/rand"
"fmt"
"math/big"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/utils"
"github.com/sei-protocol/sei-cryptography/pkg/encryption"
"github.com/sei-protocol/sei-cryptography/pkg/encryption/elgamal"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand All @@ -25,8 +28,8 @@ func (suite *KeeperTestSuite) TestDefaultGenesisState() {
}

func (suite *KeeperTestSuite) TestGenesisExportImportState() {
pk1, _ := encryption.GenerateKey()
pk2, _ := encryption.GenerateKey()
pk1, _ := ecdsa.GenerateKey(secp256k1.S256(), rand.Reader)
pk2, _ := ecdsa.GenerateKey(secp256k1.S256(), rand.Reader)
addr1 := sdk.AccAddress("addr1")
addr2 := sdk.AccAddress("addr2")
testDenom1 := fmt.Sprintf("factory/%s/TEST1", addr1.String())
Expand Down Expand Up @@ -58,9 +61,9 @@ func (suite *KeeperTestSuite) TestGenesisExportImportState() {

func generateCtAccount(pk *ecdsa.PrivateKey, testDenom string, balance *big.Int) types.CtAccount {
eg := elgamal.NewTwistedElgamal()
keyPair, _ := eg.KeyGen(*pk, testDenom)
keyPair, _ := utils.GetElGamalKeyPair(*pk, testDenom)

aesPK1, _ := encryption.GetAESKey(*pk, testDenom)
aesPK1, _ := utils.GetAESKey(*pk, testDenom)

amountLo := big.NewInt(100)
amountHi := big.NewInt(0)
Expand Down
10 changes: 6 additions & 4 deletions x/confidentialtransfers/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package keeper_test

import (
"crypto/ecdsa"
"crypto/rand"
"fmt"
"math/big"

"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"
"github.com/sei-protocol/sei-cryptography/pkg/encryption"
)

func (suite *KeeperTestSuite) TestAccountQuery() {
Expand All @@ -16,7 +18,7 @@ func (suite *KeeperTestSuite) TestAccountQuery() {
testDenom := fmt.Sprintf("factory/%s/TEST", addr.String())
nonExistingDenom := fmt.Sprintf("factory/%s/NONEXISTING", addr.String())

pk1, _ := encryption.GenerateKey()
pk1, _ := ecdsa.GenerateKey(secp256k1.S256(), rand.Reader)
ctAccount := generateCtAccount(pk1, testDenom, big.NewInt(1000))
account, _ := ctAccount.FromProto()

Expand Down Expand Up @@ -92,8 +94,8 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() {
testDenom1 := fmt.Sprintf("factory/%s/FIRST", addr.String())
testDenom2 := fmt.Sprintf("factory/%s/SECOND", addr.String())

pk1, _ := encryption.GenerateKey()
pk2, _ := encryption.GenerateKey()
pk1, _ := ecdsa.GenerateKey(secp256k1.S256(), rand.Reader)
pk2, _ := ecdsa.GenerateKey(secp256k1.S256(), rand.Reader)
ctAccount1 := generateCtAccount(pk1, testDenom1, big.NewInt(1000))
ctAccount2 := generateCtAccount(pk2, testDenom2, big.NewInt(2000))
account1, _ := ctAccount1.FromProto()
Expand Down
5 changes: 3 additions & 2 deletions x/confidentialtransfers/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/sei-protocol/sei-chain/app/apptesting"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/keeper"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"
"github.com/sei-protocol/sei-chain/x/confidentialtransfers/utils"
"github.com/sei-protocol/sei-cryptography/pkg/encryption"
"github.com/sei-protocol/sei-cryptography/pkg/encryption/elgamal"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -69,13 +70,13 @@ func (suite *KeeperTestSuite) SetupAccount() {
}

func (suite *KeeperTestSuite) SetupAccountState(privateKey *ecdsa.PrivateKey, denom string, pendingBalanceCreditCounter uint16, initialAvailableBalance, initialPendingBalance, bankAmount *big.Int) (types.Account, error) {
aesKey, err := encryption.GetAESKey(*privateKey, denom)
aesKey, err := utils.GetAESKey(*privateKey, denom)
if err != nil {
return types.Account{}, err
}

teg := elgamal.NewTwistedElgamal()
keypair, err := teg.KeyGen(*privateKey, denom)
keypair, err := utils.GetElGamalKeyPair(*privateKey, denom)
if err != nil {
return types.Account{}, err
}
Expand Down
36 changes: 18 additions & 18 deletions x/confidentialtransfers/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (suite *KeeperTestSuite) TestMsgServer_InitializeAccountModifyPubkey() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
otherKeyPair, _ := teg.KeyGen(*otherPk, DefaultTestDenom)
otherKeyPair, _ := utils.GetElGamalKeyPair(*otherPk, DefaultTestDenom)
initializeStruct.Pubkey = &otherKeyPair.PublicKey

req := types.NewMsgInitializeAccountProto(initializeStruct)
Expand Down Expand Up @@ -131,7 +131,7 @@ func (suite *KeeperTestSuite) TestMsgServer_InitializeAccountModifyBalances() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
keyPair, _ := teg.KeyGen(*testPk, DefaultTestDenom)
keyPair, _ := utils.GetElGamalKeyPair(*testPk, DefaultTestDenom)
nonZeroCiphertext, _, _ := teg.Encrypt(keyPair.PublicKey, big.NewInt(100000))

// Generate a 'ZeroBalanceProof' on the non-zero balance
Expand Down Expand Up @@ -328,7 +328,7 @@ func (suite *KeeperTestSuite) TestMsgServer_DepositBasic() {
suite.Require().Equal(initialState.PendingBalanceCreditCounter+1, account.PendingBalanceCreditCounter, "PendingBalanceCreditCounter should have increased by 1")

// Check that pending balances were increased by the deposit amount
keyPair, _ := teg.KeyGen(*testPk, DefaultTestDenom)
keyPair, _ := utils.GetElGamalKeyPair(*testPk, DefaultTestDenom)
oldPendingBalancePlaintext, _, _, _ := initialState.GetPendingBalancePlaintext(teg, keyPair)

newPendingBalancePlaintext, _, _, _ := account.GetPendingBalancePlaintext(teg, keyPair)
Expand Down Expand Up @@ -561,7 +561,7 @@ func (suite *KeeperTestSuite) TestMsgServer_WithdrawHappyPath() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
keyPair, _ := teg.KeyGen(*testPk, DefaultTestDenom)
keyPair, _ := utils.GetElGamalKeyPair(*testPk, DefaultTestDenom)
oldBalanceDecrypted, _ := teg.DecryptLargeNumber(keyPair.PrivateKey, initialState.AvailableBalance, elgamal.MaxBits32)
newBalanceDecrypted, _ := teg.DecryptLargeNumber(keyPair.PrivateKey, account.AvailableBalance, elgamal.MaxBits32)
newTotal := new(big.Int).Sub(oldBalanceDecrypted, withdrawAmount)
Expand Down Expand Up @@ -651,7 +651,7 @@ func (suite *KeeperTestSuite) TestMsgServer_WithdrawInvalidAmount() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
keys, _ := teg.KeyGen(*testPk, DefaultTestDenom)
keys, _ := utils.GetElGamalKeyPair(*testPk, DefaultTestDenom)
newBalanceNegative := new(big.Int).Sub(initialAvailableBalance, withdrawStruct.Amount)

// NOTE: This should be encrypting a negative number, but this cannot be done using the teg library.
Expand Down Expand Up @@ -716,7 +716,7 @@ func (suite *KeeperTestSuite) TestMsgServer_ModifiedDecryptableBalance() {
withdrawStruct, _ := types.NewWithdraw(*testPk, initialState.AvailableBalance, DefaultTestDenom, testAddr.String(), initialState.DecryptableAvailableBalance, withdrawAmount)

// Modify the decryptable balance
aesKey, _ := encryption.GetAESKey(*testPk, DefaultTestDenom)
aesKey, _ := utils.GetAESKey(*testPk, DefaultTestDenom)
fraudulentDecryptableBalance, _ := encryption.EncryptAESGCM(big.NewInt(10000000000), aesKey)
withdrawStruct.DecryptableBalance = fraudulentDecryptableBalance

Expand All @@ -743,7 +743,7 @@ func (suite *KeeperTestSuite) TestMsgServer_ModifiedDecryptableBalance() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
keyPair, _ := teg.KeyGen(*testPk, DefaultTestDenom)
keyPair, _ := utils.GetElGamalKeyPair(*testPk, DefaultTestDenom)
actualBalance, err := teg.DecryptLargeNumber(keyPair.PrivateKey, accountState.AvailableBalance, elgamal.MaxBits32)
suite.Require().NoError(err, "Should be able to decrypt actual balance since the encrypted value is small")

Expand Down Expand Up @@ -889,7 +889,7 @@ func (suite *KeeperTestSuite) TestMsgServer_CloseAccountHasPendingBalance() {
suite.Require().NoError(err, "Should have no error applying pending balance")

account, _ := suite.App.ConfidentialTransfersKeeper.GetAccount(suite.Ctx, testAddr.String(), DefaultTestDenom)
aeskey, _ := encryption.GetAESKey(*testPk, DefaultTestDenom)
aeskey, _ := utils.GetAESKey(*testPk, DefaultTestDenom)
availableBalanceAmount, err := encryption.DecryptAESGCM(account.DecryptableAvailableBalance, aeskey)
suite.Require().NoError(err, "Should be able to decrypt available balance")

Expand Down Expand Up @@ -1016,15 +1016,15 @@ func (suite *KeeperTestSuite) TestMsgServer_ApplyPendingBalance() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
keyPair, _ := teg.KeyGen(*testPk, DefaultTestDenom)
keyPair, _ := utils.GetElGamalKeyPair(*testPk, DefaultTestDenom)

expectedNewBalance := new(big.Int).Add(initialPendingBalance, initialAvailableBalance)

// Check that the balances were correctly added to the available balance.
actualAvailableBalance, _ := teg.DecryptLargeNumber(keyPair.PrivateKey, account.AvailableBalance, elgamal.MaxBits32)
suite.Require().Equal(expectedNewBalance, actualAvailableBalance, "Available balance should match")

aesKey, _ := encryption.GetAESKey(*testPk, DefaultTestDenom)
aesKey, _ := utils.GetAESKey(*testPk, DefaultTestDenom)
actualDecryptableAvailableBalance, _ := encryption.DecryptAESGCM(account.DecryptableAvailableBalance, aesKey)
suite.Require().Equal(expectedNewBalance, actualDecryptableAvailableBalance, "Decryptable available balance should match")

Expand Down Expand Up @@ -1214,9 +1214,9 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferHappyPath() {
if teg == nil {
teg = elgamal.NewTwistedElgamal()
}
senderKeypair, _ := teg.KeyGen(*senderPk, DefaultTestDenom)
senderKeypair, _ := utils.GetElGamalKeyPair(*senderPk, DefaultTestDenom)

recipientKeypair, _ := teg.KeyGen(*recipientPk, DefaultTestDenom)
recipientKeypair, _ := utils.GetElGamalKeyPair(*recipientPk, DefaultTestDenom)

transferAmount := uint64(500)

Expand Down Expand Up @@ -1257,7 +1257,7 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferHappyPath() {
suite.Require().Equal(new(big.Int).Sub(senderOldBalanceDecrypted, transferAmountBigInt), senderNewBalanceDecrypted, "AvailableBalance of sender should be decreased")

// Verify that the DecryptableAvailableBalances were updated as well and that they match the available balances.
senderAesKey, _ := encryption.GetAESKey(*senderPk, DefaultTestDenom)
senderAesKey, _ := utils.GetAESKey(*senderPk, DefaultTestDenom)
senderOldDecryptableBalanceDecrypted, _ := encryption.DecryptAESGCM(initialSenderState.DecryptableAvailableBalance, senderAesKey)
senderNewDecryptableBalanceDecrypted, _ := encryption.DecryptAESGCM(senderAccountState.DecryptableAvailableBalance, senderAesKey)
suite.Require().Equal(new(big.Int).Sub(senderOldDecryptableBalanceDecrypted, transferAmountBigInt), senderNewDecryptableBalanceDecrypted)
Expand Down Expand Up @@ -1333,7 +1333,7 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferInsufficientBalance() {
// Initialize the recipient account
recipientAccountState, _ := suite.SetupAccountState(recipientPk, DefaultTestDenom, 10, big.NewInt(2000), big.NewInt(3000), big.NewInt(1000))

senderAesKey, _ := encryption.GetAESKey(*senderPk, DefaultTestDenom)
senderAesKey, _ := utils.GetAESKey(*senderPk, DefaultTestDenom)

initialBalance, _ := encryption.DecryptAESGCM(initialSenderState.DecryptableAvailableBalance, senderAesKey)

Expand Down Expand Up @@ -1431,7 +1431,7 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferWrongRecipient() {
initialRecipientState, _ := suite.SetupAccountState(recipientPk, DefaultTestDenom, 10, big.NewInt(2000), big.NewInt(3000), big.NewInt(1000))
suite.SetupAccountState(otherPk, DefaultTestDenom, 10, big.NewInt(2000), big.NewInt(3000), big.NewInt(1000))

senderAesKey, _ := encryption.GetAESKey(*senderPk, DefaultTestDenom)
senderAesKey, _ := utils.GetAESKey(*senderPk, DefaultTestDenom)

initialBalance, _ := encryption.DecryptAESGCM(initialSenderState.DecryptableAvailableBalance, senderAesKey)

Expand Down Expand Up @@ -1476,7 +1476,7 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferDifferentAmounts() {
initialSenderState, _ := suite.SetupAccountState(senderPk, DefaultTestDenom, 10, big.NewInt(2000), big.NewInt(3000), big.NewInt(1000))
initialRecipientState, _ := suite.SetupAccountState(recipientPk, DefaultTestDenom, 10, big.NewInt(2000), big.NewInt(3000), big.NewInt(1000))

senderAesKey, _ := encryption.GetAESKey(*senderPk, DefaultTestDenom)
senderAesKey, _ := utils.GetAESKey(*senderPk, DefaultTestDenom)

initialBalance, _ := encryption.DecryptAESGCM(initialSenderState.DecryptableAvailableBalance, senderAesKey)

Expand All @@ -1503,7 +1503,7 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferDifferentAmounts() {
transferHiBigInt := new(big.Int).SetUint64(uint64(transferHiBits))

// Encrypt the transfer amounts for the recipient
recipientKeyPair, _ := teg.KeyGen(*recipientPk, DefaultTestDenom)
recipientKeyPair, _ := utils.GetElGamalKeyPair(*recipientPk, DefaultTestDenom)

encryptedTransferLoBits, loBitsRandomness, _ := teg.Encrypt(recipientKeyPair.PublicKey, transferLoBigInt)

Expand Down Expand Up @@ -1537,7 +1537,7 @@ func (suite *KeeperTestSuite) TestMsgServer_TransferDifferentAmounts() {

hiBitsScalar, _ := curves.ED25519().Scalar.SetBigInt(transferHiBigInt)

senderKeyPair, _ := teg.KeyGen(*senderPk, DefaultTestDenom)
senderKeyPair, _ := utils.GetElGamalKeyPair(*senderPk, DefaultTestDenom)

ciphertextEqualityLoProof, err := zkproofs.NewCiphertextCiphertextEqualityProof(senderKeyPair, &recipientKeyPair.PublicKey, transferStruct.SenderTransferAmountLo, &loBitsRandomness, &loBitsScalar)
suite.Require().NoError(err, "Should have no error generating lo bits equality proof despite mismatch in transfer amounts")
Expand Down
8 changes: 4 additions & 4 deletions x/confidentialtransfers/types/apply_pending_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
currentAvailableBalance,
currentPendingBalanceLo,
currentPendingBalanceHi *elgamal.Ciphertext) (*ApplyPendingBalance, error) {
aesKey, err := encryption.GetAESKey(privKey, denom)
aesKey, err := utils.GetAESKey(privKey, denom)

Check warning on line 31 in x/confidentialtransfers/types/apply_pending_balance.go

View check run for this annotation

Codecov / codecov/patch

x/confidentialtransfers/types/apply_pending_balance.go#L31

Added line #L31 was not covered by tests
if err != nil {
return nil, err
}
Expand All @@ -40,7 +40,7 @@
}

teg := elgamal.NewTwistedElgamal()
keyPair, err := teg.KeyGen(privKey, denom)
keyPair, err := utils.GetElGamalKeyPair(privKey, denom)

Check warning on line 43 in x/confidentialtransfers/types/apply_pending_balance.go

View check run for this annotation

Codecov / codecov/patch

x/confidentialtransfers/types/apply_pending_balance.go#L43

Added line #L43 was not covered by tests
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -84,12 +84,12 @@
}

availableBalanceString := NotDecrypted
keyPair, err := decryptor.KeyGen(privKey, r.Denom)
keyPair, err := utils.GetElGamalKeyPair(privKey, r.Denom)

Check warning on line 87 in x/confidentialtransfers/types/apply_pending_balance.go

View check run for this annotation

Codecov / codecov/patch

x/confidentialtransfers/types/apply_pending_balance.go#L87

Added line #L87 was not covered by tests
if err != nil {
return &ApplyPendingBalanceDecrypted{}, err
}

aesKey, err := encryption.GetAESKey(privKey, r.Denom)
aesKey, err := utils.GetAESKey(privKey, r.Denom)

Check warning on line 92 in x/confidentialtransfers/types/apply_pending_balance.go

View check run for this annotation

Codecov / codecov/patch

x/confidentialtransfers/types/apply_pending_balance.go#L92

Added line #L92 was not covered by tests
if err != nil {
return &ApplyPendingBalanceDecrypted{}, err
}
Expand Down
Loading
Loading