From 47afe117f4a0763d1449efe62a3b78b537934514 Mon Sep 17 00:00:00 2001 From: sneak Date: Fri, 20 Jun 2025 08:55:42 -0700 Subject: [PATCH] Fix unused parameter errors in agehd and bip85 tests - Remove unused goroutineID parameter from agehd concurrent test - Remove unused description parameter from bip85 logTestVector function - Update all call sites to match new signatures --- pkg/agehd/agehd_test.go | 6 +++--- pkg/bip85/bip85_test.go | 46 ++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pkg/agehd/agehd_test.go b/pkg/agehd/agehd_test.go index 531abbb..45d4019 100644 --- a/pkg/agehd/agehd_test.go +++ b/pkg/agehd/agehd_test.go @@ -188,7 +188,7 @@ func TestDeterministicXPRVDerivation(t *testing.T) { t.Logf("XPRV Index 1: %s", id3.String()) } -func TestMnemonicVsXPRVConsistency(t *testing.T) { +func TestMnemonicVsXPRVConsistency(_ *testing.T) { // FIXME This test is missing! } @@ -661,7 +661,7 @@ func TestConcurrentDerivation(t *testing.T) { errors := make(chan error, testNumGoroutines*testNumIterations) for i := 0; i < testNumGoroutines; i++ { - go func(goroutineID int) { + go func() { for j := 0; j < testNumIterations; j++ { if j < 0 || j > 1000000 { errors <- fmt.Errorf("index out of safe range") @@ -674,7 +674,7 @@ func TestConcurrentDerivation(t *testing.T) { } results <- identity.String() } - }(i) + }() } // Collect results diff --git a/pkg/bip85/bip85_test.go b/pkg/bip85/bip85_test.go index 92446ba..6ac8c3f 100644 --- a/pkg/bip85/bip85_test.go +++ b/pkg/bip85/bip85_test.go @@ -82,13 +82,13 @@ const ( ) // logTestVector logs test information in a cleaner, more concise format -func logTestVector(t *testing.T, title, description string) { +func logTestVector(t *testing.T, title string) { t.Logf("=== TEST: %s ===", title) } // TestDerivedKey is a helper function to test the derived key directly func TestDerivedKey(t *testing.T) { - logTestVector(t, "Derived Child Keys", "Testing direct key derivation for BIP85 paths") + logTestVector(t, "Derived Child Keys") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -132,7 +132,7 @@ func TestDerivedKey(t *testing.T) { // TestCase1 tests the first test vector from the BIP85 specification func TestCase1(t *testing.T) { - logTestVector(t, "Test Case 1", "Basic entropy derivation with path m/83696968'/0'/0'") + logTestVector(t, "Test Case 1") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -158,7 +158,7 @@ func TestCase1(t *testing.T) { // TestCase2 tests the second test vector from the BIP85 specification func TestCase2(t *testing.T) { - logTestVector(t, "Test Case 2", "Basic entropy derivation with path m/83696968'/0'/1'") + logTestVector(t, "Test Case 2") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -184,7 +184,7 @@ func TestCase2(t *testing.T) { // TestBIP39_12EnglishWords tests the BIP39 12 English words test vector func TestBIP39_12EnglishWords(t *testing.T) { - logTestVector(t, "BIP39 12 English Words", "Deriving a 12-word English BIP39 mnemonic") + logTestVector(t, "BIP39 12 English Words") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -228,7 +228,7 @@ func TestBIP39_12EnglishWords(t *testing.T) { // TestBIP39_18EnglishWords tests the BIP39 18 English words test vector func TestBIP39_18EnglishWords(t *testing.T) { - logTestVector(t, "BIP39 18 English Words", "Deriving an 18-word English BIP39 mnemonic") + logTestVector(t, "BIP39 18 English Words") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -272,7 +272,7 @@ func TestBIP39_18EnglishWords(t *testing.T) { // TestBIP39_24EnglishWords tests the BIP39 24 English words test vector func TestBIP39_24EnglishWords(t *testing.T) { - logTestVector(t, "BIP39 24 English Words", "Deriving a 24-word English BIP39 mnemonic") + logTestVector(t, "BIP39 24 English Words") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -316,7 +316,7 @@ func TestBIP39_24EnglishWords(t *testing.T) { // TestHD_WIF tests the WIF test vector func TestHD_WIF(t *testing.T) { - logTestVector(t, "HD-Seed WIF", "Deriving a WIF-encoded private key for Bitcoin Core hdseed") + logTestVector(t, "HD-Seed WIF") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -356,7 +356,7 @@ func TestHD_WIF(t *testing.T) { // TestXPRV tests the XPRV test vector func TestXPRV(t *testing.T) { - logTestVector(t, "XPRV", "Deriving an extended private key (XPRV)") + logTestVector(t, "XPRV") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -382,7 +382,7 @@ func TestXPRV(t *testing.T) { // TestDRNG_SHAKE256 tests the BIP85-DRNG-SHAKE256 test vector func TestDRNG_SHAKE256(t *testing.T) { - logTestVector(t, "DRNG-SHAKE256", "Testing the deterministic random number generator with SHAKE256") + logTestVector(t, "DRNG-SHAKE256") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -417,7 +417,7 @@ func TestDRNG_SHAKE256(t *testing.T) { // TestPythonDRNGVectors tests the DRNG vectors from the Python implementation func TestPythonDRNGVectors(t *testing.T) { - logTestVector(t, "Python DRNG Vectors", "Testing specific DRNG vectors from the Python implementation") + logTestVector(t, "Python DRNG Vectors") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -492,7 +492,7 @@ func TestPythonDRNGVectors(t *testing.T) { // TestDRNGDeterminism tests the deterministic behavior of the DRNG func TestDRNGDeterminism(t *testing.T) { - logTestVector(t, "DRNG Determinism", "Testing deterministic behavior of the DRNG") + logTestVector(t, "DRNG Determinism") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -576,7 +576,7 @@ func TestDRNGDeterminism(t *testing.T) { // TestDRNGLengths tests the DRNG with different lengths func TestDRNGLengths(t *testing.T) { - logTestVector(t, "DRNG Lengths", "Testing DRNG with different read lengths") + logTestVector(t, "DRNG Lengths") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -609,7 +609,7 @@ func TestDRNGLengths(t *testing.T) { // TestDRNGExceptions tests error handling in the DRNG func TestDRNGExceptions(t *testing.T) { - logTestVector(t, "DRNG Exceptions", "Testing error handling in the DRNG") + logTestVector(t, "DRNG Exceptions") // Test with entropy of the wrong size testCases := []int{0, 1, 32, 63, 65, 128} @@ -641,7 +641,7 @@ func TestDRNGExceptions(t *testing.T) { // TestDRNGDifferentSizes tests the DRNG with different buffer sizes func TestDRNGDifferentSizes(t *testing.T) { - logTestVector(t, "DRNG Different Sizes", "Testing the DRNG with different buffer sizes") + logTestVector(t, "DRNG Different Sizes") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -703,7 +703,7 @@ func TestDRNGDifferentSizes(t *testing.T) { // TestMasterKeyParsing tests parsing of different master key formats func TestMasterKeyParsing(t *testing.T) { - logTestVector(t, "Master Key Parsing", "Testing parsing of master keys in different formats") + logTestVector(t, "Master Key Parsing") // Test valid master key t.Logf("Testing valid master key") @@ -750,7 +750,7 @@ func TestMasterKeyParsing(t *testing.T) { // TestDifferentPathFormats tests different path format expressions func TestDifferentPathFormats(t *testing.T) { - logTestVector(t, "Path Formats", "Testing different path format expressions") + logTestVector(t, "Path Formats") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -794,7 +794,7 @@ func TestDifferentPathFormats(t *testing.T) { // TestDirectBase85Encoding tests direct Base85 encoding with the test vector entropy func TestDirectBase85Encoding(t *testing.T) { - logTestVector(t, "Direct Base85 Encoding", "Testing Base85 encoding with BIP85 test vector") + logTestVector(t, "Direct Base85 Encoding") // Parse the master key masterKey, err := ParseMasterKey(testMasterKey) @@ -839,7 +839,7 @@ func TestDirectBase85Encoding(t *testing.T) { // TestPWDBase64 tests the Base64 password test vector func TestPWDBase64(t *testing.T) { - logTestVector(t, "PWD Base64", "Deriving a Base64-encoded password") + logTestVector(t, "PWD Base64") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -884,7 +884,7 @@ func TestPWDBase64(t *testing.T) { // TestPWDBase85 tests the Base85 password test vector func TestPWDBase85(t *testing.T) { - logTestVector(t, "PWD Base85", "Deriving a Base85-encoded password") + logTestVector(t, "PWD Base85") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -929,7 +929,7 @@ func TestPWDBase85(t *testing.T) { // TestHexDerivation tests the HEX derivation test vector func TestHexDerivation(t *testing.T) { - logTestVector(t, "HEX Derivation", "Testing HEX data derivation with BIP85 test vector") + logTestVector(t, "HEX Derivation") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -966,7 +966,7 @@ func TestHexDerivation(t *testing.T) { // TestInvalidParameters tests error conditions for parameter validation func TestInvalidParameters(t *testing.T) { - logTestVector(t, "Invalid Parameters", "Testing error handling for invalid inputs") + logTestVector(t, "Invalid Parameters") masterKey, err := ParseMasterKey(testMasterKey) if err != nil { @@ -1044,7 +1044,7 @@ func TestInvalidParameters(t *testing.T) { // TestAdditionalDeriveHex tests additional hex derivation scenarios func TestAdditionalDeriveHex(t *testing.T) { - logTestVector(t, "Additional Hex Derivation", "Testing hex data derivation with various lengths") + logTestVector(t, "Additional Hex Derivation") masterKey, err := ParseMasterKey(testMasterKey) if err != nil {