diff --git a/backend/ethereum/wallet/hd/wallet_test.go b/backend/ethereum/wallet/hd/wallet_test.go index 3c63a9ed7..5ad8c9413 100644 --- a/backend/ethereum/wallet/hd/wallet_test.go +++ b/backend/ethereum/wallet/hd/wallet_test.go @@ -86,7 +86,7 @@ func TestUnlock(t *testing.T) { _, err := hdWallet.Unlock(ethwallet.AsWalletAddr(missingAddr)) assert.Error(t, err, "should error on unlocking missing address") - acc, err := hdWallet.Unlock(setup.Address) + acc, err := hdWallet.Unlock(setup.AddressInWallet) assert.NoError(t, err, "should not error on unlocking valid address") assert.NotNil(t, acc, "account should be non nil when error is nil") } @@ -99,7 +99,7 @@ func TestContains(t *testing.T) { missingAddr := common.BytesToAddress(setup.AddressEncoded) assert.False(t, hdWallet.Contains(missingAddr), "should not contain address of the missing account") - assert.True(t, hdWallet.Contains(ethwallet.AsEthAddr(setup.Address)), "should contain valid account") + assert.True(t, hdWallet.Contains(ethwallet.AsEthAddr(setup.AddressInWallet)), "should contain valid account") } // nolint:interfacer // rand.Rand is preferred over io.Reader here. @@ -125,10 +125,10 @@ func newSetup(t require.TestingT, prng *rand.Rand) (*test.Setup, accounts.Wallet require.NoError(t, err, "invalid sample address") return &test.Setup{ - Wallet: hdWallet, - Address: acc.Address(), - Backend: new(ethwallet.Backend), - AddressEncoded: sampleBytes, - DataToSign: dataToSign, + Wallet: hdWallet, + AddressInWallet: acc.Address(), + Backend: new(ethwallet.Backend), + AddressEncoded: sampleBytes, + DataToSign: dataToSign, }, rawHDWallet, hdWallet } diff --git a/backend/ethereum/wallet/keystore/wallet_test.go b/backend/ethereum/wallet/keystore/wallet_test.go index 603a166a8..66d71f3a4 100644 --- a/backend/ethereum/wallet/keystore/wallet_test.go +++ b/backend/ethereum/wallet/keystore/wallet_test.go @@ -90,11 +90,11 @@ func newSetup(t require.TestingT) *test.Setup { require.NoError(t, err, "decoding valid address should not fail") return &test.Setup{ - Wallet: w, - Address: acc.Address(), - Backend: new(ethwallet.Backend), - AddressEncoded: validAddrBytes, - DataToSign: dataToSign, + Wallet: w, + AddressInWallet: acc.Address(), + Backend: new(ethwallet.Backend), + AddressEncoded: validAddrBytes, + DataToSign: dataToSign, } } diff --git a/backend/ethereum/wallet/simple/wallet_test.go b/backend/ethereum/wallet/simple/wallet_test.go index b3ad95ab7..dd51e29f7 100644 --- a/backend/ethereum/wallet/simple/wallet_test.go +++ b/backend/ethereum/wallet/simple/wallet_test.go @@ -58,7 +58,7 @@ func TestUnlock(t *testing.T) { _, err := simpleWallet.Unlock(ethwallet.AsWalletAddr(missingAddr)) assert.Error(t, err, "should error on unlocking missing address") - acc, err := simpleWallet.Unlock(setup.Address) + acc, err := simpleWallet.Unlock(setup.AddressInWallet) assert.NoError(t, err, "should not error on unlocking missing address") assert.NotNil(t, acc, "account should be non nil when error is nil") } @@ -69,7 +69,7 @@ func TestWallet_Contains(t *testing.T) { missingAddr := common.BytesToAddress(setup.AddressEncoded) assert.False(t, simpleWallet.Contains(missingAddr)) - assert.True(t, simpleWallet.Contains(ethwallet.AsEthAddr(setup.Address))) + assert.True(t, simpleWallet.Contains(ethwallet.AsEthAddr(setup.AddressInWallet))) } func TestSignatures(t *testing.T) { @@ -106,10 +106,10 @@ func newSetup(t require.TestingT, prng *rand.Rand) (*test.Setup, *simple.Wallet) require.NoError(t, err, "invalid sample address") return &test.Setup{ - Wallet: simpleWallet, - Address: acc.Address(), - Backend: new(ethwallet.Backend), - AddressEncoded: validAddrBytes, - DataToSign: dataToSign, + Wallet: simpleWallet, + AddressInWallet: acc.Address(), + Backend: new(ethwallet.Backend), + AddressEncoded: validAddrBytes, + DataToSign: dataToSign, }, simpleWallet } diff --git a/backend/sim/wallet/wallet_internal_test.go b/backend/sim/wallet/wallet_internal_test.go index 35d77bc52..3a4a346b0 100644 --- a/backend/sim/wallet/wallet_internal_test.go +++ b/backend/sim/wallet/wallet_internal_test.go @@ -100,10 +100,10 @@ func newWalletSetup(rng *rand.Rand) *test.Setup { } return &test.Setup{ - Backend: new(Backend), - Wallet: w, - Address: acc.Address(), - AddressEncoded: accountB.Address().Bytes(), - DataToSign: data, + Backend: new(Backend), + Wallet: w, + AddressInWallet: acc.Address(), + AddressEncoded: accountB.Address().Bytes(), + DataToSign: data, } } diff --git a/wallet/test/wallet.go b/wallet/test/wallet.go index abd7d5046..82d7f33af 100644 --- a/wallet/test/wallet.go +++ b/wallet/test/wallet.go @@ -32,18 +32,18 @@ type UnlockedAccount func() (wallet.Account, error) // Setup provides all objects needed for the generic tests. type Setup struct { - Backend wallet.Backend // backend implementation - Wallet wallet.Wallet // the wallet instance used for testing - Address wallet.Address // an address of an account in the test wallet - DataToSign []byte // some data to sign - AddressEncoded []byte // a valid nonzero address not in the wallet + Backend wallet.Backend // backend implementation + Wallet wallet.Wallet // the wallet instance used for testing + AddressInWallet wallet.Address // an address of an account in the test wallet + DataToSign []byte // some data to sign + AddressEncoded []byte // a valid nonzero address not in the wallet } // TestAccountWithWalletAndBackend tests an account implementation together with // a corresponding wallet and backend implementation. // This function should be called by every implementation of the wallet interface. func TestAccountWithWalletAndBackend(t *testing.T, s *Setup) { - acc, err := s.Wallet.Unlock(s.Address) + acc, err := s.Wallet.Unlock(s.AddressInWallet) assert.NoError(t, err) // Check unlocked account sig, err := acc.SignData(s.DataToSign) @@ -102,7 +102,7 @@ func TestAccountWithWalletAndBackend(t *testing.T, s *Setup) { // GenericSignatureSizeTest tests that the size of the signatures produced by // Account.Sign(…) does not vary between executions (tested with 2048 samples). func GenericSignatureSizeTest(t *testing.T, s *Setup) { - acc, err := s.Wallet.Unlock(s.Address) + acc, err := s.Wallet.Unlock(s.AddressInWallet) require.NoError(t, err) // get a signature sign, err := acc.SignData(s.DataToSign) diff --git a/wallet/test/walletbench.go b/wallet/test/walletbench.go index 5b828a1f9..9e9d01eab 100644 --- a/wallet/test/walletbench.go +++ b/wallet/test/walletbench.go @@ -28,7 +28,7 @@ func GenericAccountBenchmark(b *testing.B, s *Setup) { } func benchAccountSign(b *testing.B, s *Setup) { - perunAcc, err := s.Wallet.Unlock(s.Address) + perunAcc, err := s.Wallet.Unlock(s.AddressInWallet) require.Nil(b, err) for n := 0; n < b.N; n++ { @@ -50,7 +50,7 @@ func GenericBackendBenchmark(b *testing.B, s *Setup) { func benchBackendVerifySig(b *testing.B, s *Setup) { // We dont want to measure the SignDataWithPW here, just need it for the verification b.StopTimer() - perunAcc, err := s.Wallet.Unlock(s.Address) + perunAcc, err := s.Wallet.Unlock(s.AddressInWallet) require.Nil(b, err) signature, err := perunAcc.SignData(s.DataToSign) require.Nil(b, err)