From 9592b02f7c372ed96cb070ca8176acb71d7a6eec Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Mon, 11 Mar 2024 15:59:16 -0400 Subject: [PATCH] fix: lint --- crypto/keyring/keyring_ledger_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crypto/keyring/keyring_ledger_test.go b/crypto/keyring/keyring_ledger_test.go index 44914a99e828..244e877f1747 100644 --- a/crypto/keyring/keyring_ledger_test.go +++ b/crypto/keyring/keyring_ledger_test.go @@ -16,7 +16,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/ledger" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" ) @@ -142,7 +141,7 @@ func TestAltKeyring_SaveLedgerKey(t *testing.T) { func TestSignWithLedger(t *testing.T) { // Create two distinct Ledger records: recordA and recordB. // RecordA is added to the Ledger but recordB is not added. - pathA := hd.NewFundraiserParams(0, sdk.CoinType, 0) + pathA := hd.NewFundraiserParams(0, types.CoinType, 0) privA, _, err := ledger.NewPrivKeySecp256k1(*pathA, "cosmos") require.NoError(t, err) recordA, err := NewLedgerRecord("ledgerA", privA.PubKey(), pathA) @@ -150,7 +149,7 @@ func TestSignWithLedger(t *testing.T) { pubA, err := recordA.GetPubKey() require.NoError(t, err) - pathB := hd.NewFundraiserParams(0, sdk.CoinType, 1) + pathB := hd.NewFundraiserParams(0, types.CoinType, 1) // privB won't be added to the Ledger because it doesn't use ledger.NewPrivKeySecp256k1 privB := secp256k1.GenPrivKey() recordB, err := NewLedgerRecord("ledgerB", privB.PubKey(), pathB) @@ -161,7 +160,7 @@ func TestSignWithLedger(t *testing.T) { require.NotEqual(t, pubA, pubB) type testCase struct { name string - record Record + record *Record msg []byte wantSig []byte wantPub cryptotypes.PubKey @@ -171,7 +170,7 @@ func TestSignWithLedger(t *testing.T) { testCases := []testCase{ { name: "ordinary ledger tx", - record: *recordA, + record: recordA, msg: []byte("msg"), wantSig: []byte{0xfb, 0x93, 0x1b, 0xb9, 0x75, 0x25, 0xe7, 0x99, 0x64, 0xc2, 0x78, 0xf7, 0x94, 0x9a, 0x63, 0x83, 0xe2, 0x59, 0x76, 0x48, 0x1d, 0x2, 0xbc, 0xc2, 0x83, 0x21, 0x24, 0x4b, 0x95, 0x99, 0x25, 0x8b, 0x30, 0x38, 0x6, 0x61, 0x79, 0x9a, 0x9e, 0x8, 0x98, 0xfd, 0x34, 0xc6, 0x7e, 0x47, 0x4d, 0x5f, 0xe, 0xf3, 0xc3, 0xe7, 0xdd, 0xe3, 0x89, 0x80, 0xda, 0x8b, 0x48, 0x15, 0x34, 0xce, 0xdf, 0x1c}, wantPub: pubA, @@ -179,7 +178,7 @@ func TestSignWithLedger(t *testing.T) { }, { name: "want error when the public key the user attempted to sign with doesn't match the public key on the ledger", - record: *recordB, + record: recordB, msg: []byte("msg"), wantSig: []byte(nil), wantPub: nil, @@ -190,7 +189,7 @@ func TestSignWithLedger(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - sig, pub, err := SignWithLedger(&tc.record, tc.msg, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) + sig, pub, err := SignWithLedger(tc.record, tc.msg, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) assert.Equal(t, tc.wantSig, sig) assert.Equal(t, tc.wantPub, pub) if tc.wantErr {