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
This commit is contained in:
Jeffrey Paul 2025-06-20 08:55:42 -07:00
parent 4fe49ca8d0
commit 47afe117f4
2 changed files with 26 additions and 26 deletions

View File

@ -188,7 +188,7 @@ func TestDeterministicXPRVDerivation(t *testing.T) {
t.Logf("XPRV Index 1: %s", id3.String()) t.Logf("XPRV Index 1: %s", id3.String())
} }
func TestMnemonicVsXPRVConsistency(t *testing.T) { func TestMnemonicVsXPRVConsistency(_ *testing.T) {
// FIXME This test is missing! // FIXME This test is missing!
} }
@ -661,7 +661,7 @@ func TestConcurrentDerivation(t *testing.T) {
errors := make(chan error, testNumGoroutines*testNumIterations) errors := make(chan error, testNumGoroutines*testNumIterations)
for i := 0; i < testNumGoroutines; i++ { for i := 0; i < testNumGoroutines; i++ {
go func(goroutineID int) { go func() {
for j := 0; j < testNumIterations; j++ { for j := 0; j < testNumIterations; j++ {
if j < 0 || j > 1000000 { if j < 0 || j > 1000000 {
errors <- fmt.Errorf("index out of safe range") errors <- fmt.Errorf("index out of safe range")
@ -674,7 +674,7 @@ func TestConcurrentDerivation(t *testing.T) {
} }
results <- identity.String() results <- identity.String()
} }
}(i) }()
} }
// Collect results // Collect results

View File

@ -82,13 +82,13 @@ const (
) )
// logTestVector logs test information in a cleaner, more concise format // 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) t.Logf("=== TEST: %s ===", title)
} }
// TestDerivedKey is a helper function to test the derived key directly // TestDerivedKey is a helper function to test the derived key directly
func TestDerivedKey(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -132,7 +132,7 @@ func TestDerivedKey(t *testing.T) {
// TestCase1 tests the first test vector from the BIP85 specification // TestCase1 tests the first test vector from the BIP85 specification
func TestCase1(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -158,7 +158,7 @@ func TestCase1(t *testing.T) {
// TestCase2 tests the second test vector from the BIP85 specification // TestCase2 tests the second test vector from the BIP85 specification
func TestCase2(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -184,7 +184,7 @@ func TestCase2(t *testing.T) {
// TestBIP39_12EnglishWords tests the BIP39 12 English words test vector // TestBIP39_12EnglishWords tests the BIP39 12 English words test vector
func TestBIP39_12EnglishWords(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -228,7 +228,7 @@ func TestBIP39_12EnglishWords(t *testing.T) {
// TestBIP39_18EnglishWords tests the BIP39 18 English words test vector // TestBIP39_18EnglishWords tests the BIP39 18 English words test vector
func TestBIP39_18EnglishWords(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -272,7 +272,7 @@ func TestBIP39_18EnglishWords(t *testing.T) {
// TestBIP39_24EnglishWords tests the BIP39 24 English words test vector // TestBIP39_24EnglishWords tests the BIP39 24 English words test vector
func TestBIP39_24EnglishWords(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -316,7 +316,7 @@ func TestBIP39_24EnglishWords(t *testing.T) {
// TestHD_WIF tests the WIF test vector // TestHD_WIF tests the WIF test vector
func TestHD_WIF(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -356,7 +356,7 @@ func TestHD_WIF(t *testing.T) {
// TestXPRV tests the XPRV test vector // TestXPRV tests the XPRV test vector
func TestXPRV(t *testing.T) { func TestXPRV(t *testing.T) {
logTestVector(t, "XPRV", "Deriving an extended private key (XPRV)") logTestVector(t, "XPRV")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -382,7 +382,7 @@ func TestXPRV(t *testing.T) {
// TestDRNG_SHAKE256 tests the BIP85-DRNG-SHAKE256 test vector // TestDRNG_SHAKE256 tests the BIP85-DRNG-SHAKE256 test vector
func TestDRNG_SHAKE256(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -417,7 +417,7 @@ func TestDRNG_SHAKE256(t *testing.T) {
// TestPythonDRNGVectors tests the DRNG vectors from the Python implementation // TestPythonDRNGVectors tests the DRNG vectors from the Python implementation
func TestPythonDRNGVectors(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -492,7 +492,7 @@ func TestPythonDRNGVectors(t *testing.T) {
// TestDRNGDeterminism tests the deterministic behavior of the DRNG // TestDRNGDeterminism tests the deterministic behavior of the DRNG
func TestDRNGDeterminism(t *testing.T) { func TestDRNGDeterminism(t *testing.T) {
logTestVector(t, "DRNG Determinism", "Testing deterministic behavior of the DRNG") logTestVector(t, "DRNG Determinism")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -576,7 +576,7 @@ func TestDRNGDeterminism(t *testing.T) {
// TestDRNGLengths tests the DRNG with different lengths // TestDRNGLengths tests the DRNG with different lengths
func TestDRNGLengths(t *testing.T) { func TestDRNGLengths(t *testing.T) {
logTestVector(t, "DRNG Lengths", "Testing DRNG with different read lengths") logTestVector(t, "DRNG Lengths")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -609,7 +609,7 @@ func TestDRNGLengths(t *testing.T) {
// TestDRNGExceptions tests error handling in the DRNG // TestDRNGExceptions tests error handling in the DRNG
func TestDRNGExceptions(t *testing.T) { 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 // Test with entropy of the wrong size
testCases := []int{0, 1, 32, 63, 65, 128} 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 // TestDRNGDifferentSizes tests the DRNG with different buffer sizes
func TestDRNGDifferentSizes(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -703,7 +703,7 @@ func TestDRNGDifferentSizes(t *testing.T) {
// TestMasterKeyParsing tests parsing of different master key formats // TestMasterKeyParsing tests parsing of different master key formats
func TestMasterKeyParsing(t *testing.T) { 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 // Test valid master key
t.Logf("Testing valid master key") t.Logf("Testing valid master key")
@ -750,7 +750,7 @@ func TestMasterKeyParsing(t *testing.T) {
// TestDifferentPathFormats tests different path format expressions // TestDifferentPathFormats tests different path format expressions
func TestDifferentPathFormats(t *testing.T) { func TestDifferentPathFormats(t *testing.T) {
logTestVector(t, "Path Formats", "Testing different path format expressions") logTestVector(t, "Path Formats")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -794,7 +794,7 @@ func TestDifferentPathFormats(t *testing.T) {
// TestDirectBase85Encoding tests direct Base85 encoding with the test vector entropy // TestDirectBase85Encoding tests direct Base85 encoding with the test vector entropy
func TestDirectBase85Encoding(t *testing.T) { 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 // Parse the master key
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
@ -839,7 +839,7 @@ func TestDirectBase85Encoding(t *testing.T) {
// TestPWDBase64 tests the Base64 password test vector // TestPWDBase64 tests the Base64 password test vector
func TestPWDBase64(t *testing.T) { func TestPWDBase64(t *testing.T) {
logTestVector(t, "PWD Base64", "Deriving a Base64-encoded password") logTestVector(t, "PWD Base64")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -884,7 +884,7 @@ func TestPWDBase64(t *testing.T) {
// TestPWDBase85 tests the Base85 password test vector // TestPWDBase85 tests the Base85 password test vector
func TestPWDBase85(t *testing.T) { func TestPWDBase85(t *testing.T) {
logTestVector(t, "PWD Base85", "Deriving a Base85-encoded password") logTestVector(t, "PWD Base85")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -929,7 +929,7 @@ func TestPWDBase85(t *testing.T) {
// TestHexDerivation tests the HEX derivation test vector // TestHexDerivation tests the HEX derivation test vector
func TestHexDerivation(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -966,7 +966,7 @@ func TestHexDerivation(t *testing.T) {
// TestInvalidParameters tests error conditions for parameter validation // TestInvalidParameters tests error conditions for parameter validation
func TestInvalidParameters(t *testing.T) { func TestInvalidParameters(t *testing.T) {
logTestVector(t, "Invalid Parameters", "Testing error handling for invalid inputs") logTestVector(t, "Invalid Parameters")
masterKey, err := ParseMasterKey(testMasterKey) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {
@ -1044,7 +1044,7 @@ func TestInvalidParameters(t *testing.T) {
// TestAdditionalDeriveHex tests additional hex derivation scenarios // TestAdditionalDeriveHex tests additional hex derivation scenarios
func TestAdditionalDeriveHex(t *testing.T) { 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) masterKey, err := ParseMasterKey(testMasterKey)
if err != nil { if err != nil {